From 21262335907f2aa621742e87d596e4278b0f3d86 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 1 Nov 2010 20:53:31 +0100 Subject: mgcp: Rename transcoder_end to trans_net Packets arriving for trans_net will be send out to the networking. We will introduce a trans_bts in a second. --- openbsc/include/openbsc/mgcp_internal.h | 3 ++- openbsc/src/mgcp/mgcp_network.c | 26 +++++++++++++------------- openbsc/src/mgcp/mgcp_protocol.c | 14 +++++++------- openbsc/src/mgcp/mgcp_vty.c | 4 ++-- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/openbsc/include/openbsc/mgcp_internal.h b/openbsc/include/openbsc/mgcp_internal.h index 473ee31c0..68c8235d8 100644 --- a/openbsc/include/openbsc/mgcp_internal.h +++ b/openbsc/include/openbsc/mgcp_internal.h @@ -98,7 +98,8 @@ struct mgcp_endpoint { /* port status for bts/net */ struct mgcp_rtp_end bts_end; struct mgcp_rtp_end net_end; - struct mgcp_rtp_end transcoder_end; + + struct mgcp_rtp_end trans_net; int is_transcoded; /* sequence bits */ diff --git a/openbsc/src/mgcp/mgcp_network.c b/openbsc/src/mgcp/mgcp_network.c index 6c6c33646..f78e42abb 100644 --- a/openbsc/src/mgcp/mgcp_network.c +++ b/openbsc/src/mgcp/mgcp_network.c @@ -176,7 +176,7 @@ static int send_transcoder(struct mgcp_endpoint *endp, int is_rtp, struct mgcp_config *cfg = endp->cfg; struct sockaddr_in addr; - if (endp->transcoder_end.rtp_port == 0) { + if (endp->trans_net.rtp_port == 0) { LOGP(DMGCP, LOGL_ERROR, "Transcoder port not known on 0x%x\n", ENDPOINT_NUMBER(endp)); return -1; @@ -404,7 +404,7 @@ static int rtp_data_transcoder(struct bsc_fd *fd, unsigned int what) if (rc <= 0) return -1; - proto = fd == &endp->transcoder_end.rtp ? PROTO_RTP : PROTO_RTCP; + proto = fd == &endp->trans_net.rtp ? PROTO_RTP : PROTO_RTCP; if (memcmp(&addr.sin_addr, &cfg->transcoder_in, sizeof(addr.sin_addr)) != 0) { LOGP(DMGCP, LOGL_ERROR, @@ -413,8 +413,8 @@ static int rtp_data_transcoder(struct bsc_fd *fd, unsigned int what) return -1; } - if (endp->transcoder_end.rtp_port != addr.sin_port && - endp->transcoder_end.rtcp_port != addr.sin_port) { + if (endp->trans_net.rtp_port != addr.sin_port && + endp->trans_net.rtcp_port != addr.sin_port) { LOGP(DMGCP, LOGL_ERROR, "Data from wrong transcoder source port %d on 0x%x\n", ntohs(addr.sin_port), ENDPOINT_NUMBER(endp)); @@ -428,7 +428,7 @@ static int rtp_data_transcoder(struct bsc_fd *fd, unsigned int what) return 0; } - endp->transcoder_end.packets += 1; + endp->trans_net.packets += 1; return send_to(endp, DEST_NETWORK, proto == PROTO_RTP, &addr, &buf[0], rc); } @@ -545,18 +545,18 @@ int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port) int mgcp_bind_transcoder_rtp_port(struct mgcp_endpoint *endp, int rtp_port) { - if (endp->transcoder_end.rtp.fd != -1 || endp->transcoder_end.rtcp.fd != -1) { + if (endp->trans_net.rtp.fd != -1 || endp->trans_net.rtcp.fd != -1) { LOGP(DMGCP, LOGL_ERROR, "Previous net-port was still bound on %d\n", ENDPOINT_NUMBER(endp)); - mgcp_free_rtp_port(&endp->transcoder_end); + mgcp_free_rtp_port(&endp->trans_net); } - endp->transcoder_end.local_port = rtp_port; - endp->transcoder_end.rtp.cb = rtp_data_transcoder; - endp->transcoder_end.rtp.data = endp; - endp->transcoder_end.rtcp.data = endp; - endp->transcoder_end.rtcp.cb = rtp_data_transcoder; - return bind_rtp(endp->cfg, &endp->transcoder_end, ENDPOINT_NUMBER(endp)); + endp->trans_net.local_port = rtp_port; + endp->trans_net.rtp.cb = rtp_data_transcoder; + endp->trans_net.rtp.data = endp; + endp->trans_net.rtcp.data = endp; + endp->trans_net.rtcp.cb = rtp_data_transcoder; + return bind_rtp(endp->cfg, &endp->trans_net, ENDPOINT_NUMBER(endp)); } int mgcp_free_rtp_port(struct mgcp_rtp_end *end) diff --git a/openbsc/src/mgcp/mgcp_protocol.c b/openbsc/src/mgcp/mgcp_protocol.c index 4e7ebf8bb..435ceeee2 100644 --- a/openbsc/src/mgcp/mgcp_protocol.c +++ b/openbsc/src/mgcp/mgcp_protocol.c @@ -422,7 +422,7 @@ static int allocate_ports(struct mgcp_endpoint *endp) } if (endp->cfg->transcoder_ip) { - if (allocate_port(endp, &endp->transcoder_end, + if (allocate_port(endp, &endp->trans_net, &endp->cfg->transcoder_ports, mgcp_bind_transcoder_rtp_port) != 0) { mgcp_rtp_end_reset(&endp->net_end); @@ -828,7 +828,7 @@ int mgcp_endpoints_allocate(struct mgcp_config *cfg) cfg->endpoints[i].cfg = cfg; mgcp_rtp_end_init(&cfg->endpoints[i].net_end); mgcp_rtp_end_init(&cfg->endpoints[i].bts_end); - mgcp_rtp_end_init(&cfg->endpoints[i].transcoder_end); + mgcp_rtp_end_init(&cfg->endpoints[i].trans_net); } return 0; @@ -852,7 +852,7 @@ void mgcp_free_endp(struct mgcp_endpoint *endp) mgcp_rtp_end_reset(&endp->bts_end); mgcp_rtp_end_reset(&endp->net_end); - mgcp_rtp_end_reset(&endp->transcoder_end); + mgcp_rtp_end_reset(&endp->trans_net); endp->is_transcoded = 0; memset(&endp->net_state, 0, sizeof(endp->net_state)); @@ -938,12 +938,12 @@ static void create_transcoder(struct mgcp_endpoint *endp) send_msg(endp, in_endp, endp->bts_end.local_port, "CRCX", "recvonly"); send_msg(endp, in_endp, endp->bts_end.local_port, "MDCX", "recvonly"); - send_msg(endp, out_endp, endp->transcoder_end.local_port, "CRCX", "sendrecv"); - send_msg(endp, out_endp, endp->transcoder_end.local_port, "MDCX", "sendrecv"); + send_msg(endp, out_endp, endp->trans_net.local_port, "CRCX", "sendrecv"); + send_msg(endp, out_endp, endp->trans_net.local_port, "MDCX", "sendrecv"); port = rtp_calculate_port(out_endp, endp->cfg->transcoder_remote_base); - endp->transcoder_end.rtp_port = htons(port); - endp->transcoder_end.rtcp_port = htons(port + 1); + endp->trans_net.rtp_port = htons(port); + endp->trans_net.rtcp_port = htons(port + 1); } static void delete_transcoder(struct mgcp_endpoint *endp) diff --git a/openbsc/src/mgcp/mgcp_vty.c b/openbsc/src/mgcp/mgcp_vty.c index d284abff9..f1738824d 100644 --- a/openbsc/src/mgcp/mgcp_vty.c +++ b/openbsc/src/mgcp/mgcp_vty.c @@ -106,7 +106,7 @@ DEFUN(show_mcgp, show_mgcp_cmd, "show mgcp", inet_ntoa(endp->bts_end.addr), endp->bts_end.packets, endp->bts_state.lost_no, endp->net_end.packets, endp->net_state.lost_no, - endp->transcoder_end.packets, + endp->trans_net.packets, VTY_NEWLINE); } @@ -529,7 +529,7 @@ int mgcp_parse_config(const char *config_file, struct mgcp_config *cfg) LOGP(DMGCP, LOGL_FATAL, "Failed to bind: %d\n", rtp_port); return -1; } - endp->transcoder_end.local_alloc = PORT_ALLOC_STATIC; + endp->trans_net.local_alloc = PORT_ALLOC_STATIC; } } -- cgit v1.2.3