mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-11-02 13:03:33 +00:00
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.
This commit is contained in:
@@ -98,7 +98,8 @@ struct mgcp_endpoint {
|
|||||||
/* port status for bts/net */
|
/* port status for bts/net */
|
||||||
struct mgcp_rtp_end bts_end;
|
struct mgcp_rtp_end bts_end;
|
||||||
struct mgcp_rtp_end net_end;
|
struct mgcp_rtp_end net_end;
|
||||||
struct mgcp_rtp_end transcoder_end;
|
|
||||||
|
struct mgcp_rtp_end trans_net;
|
||||||
int is_transcoded;
|
int is_transcoded;
|
||||||
|
|
||||||
/* sequence bits */
|
/* sequence bits */
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ static int send_transcoder(struct mgcp_endpoint *endp, int is_rtp,
|
|||||||
struct mgcp_config *cfg = endp->cfg;
|
struct mgcp_config *cfg = endp->cfg;
|
||||||
struct sockaddr_in addr;
|
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",
|
LOGP(DMGCP, LOGL_ERROR, "Transcoder port not known on 0x%x\n",
|
||||||
ENDPOINT_NUMBER(endp));
|
ENDPOINT_NUMBER(endp));
|
||||||
return -1;
|
return -1;
|
||||||
@@ -404,7 +404,7 @@ static int rtp_data_transcoder(struct bsc_fd *fd, unsigned int what)
|
|||||||
if (rc <= 0)
|
if (rc <= 0)
|
||||||
return -1;
|
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) {
|
if (memcmp(&addr.sin_addr, &cfg->transcoder_in, sizeof(addr.sin_addr)) != 0) {
|
||||||
LOGP(DMGCP, LOGL_ERROR,
|
LOGP(DMGCP, LOGL_ERROR,
|
||||||
@@ -413,8 +413,8 @@ static int rtp_data_transcoder(struct bsc_fd *fd, unsigned int what)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endp->transcoder_end.rtp_port != addr.sin_port &&
|
if (endp->trans_net.rtp_port != addr.sin_port &&
|
||||||
endp->transcoder_end.rtcp_port != addr.sin_port) {
|
endp->trans_net.rtcp_port != addr.sin_port) {
|
||||||
LOGP(DMGCP, LOGL_ERROR,
|
LOGP(DMGCP, LOGL_ERROR,
|
||||||
"Data from wrong transcoder source port %d on 0x%x\n",
|
"Data from wrong transcoder source port %d on 0x%x\n",
|
||||||
ntohs(addr.sin_port), ENDPOINT_NUMBER(endp));
|
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;
|
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);
|
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)
|
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",
|
LOGP(DMGCP, LOGL_ERROR, "Previous net-port was still bound on %d\n",
|
||||||
ENDPOINT_NUMBER(endp));
|
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->trans_net.local_port = rtp_port;
|
||||||
endp->transcoder_end.rtp.cb = rtp_data_transcoder;
|
endp->trans_net.rtp.cb = rtp_data_transcoder;
|
||||||
endp->transcoder_end.rtp.data = endp;
|
endp->trans_net.rtp.data = endp;
|
||||||
endp->transcoder_end.rtcp.data = endp;
|
endp->trans_net.rtcp.data = endp;
|
||||||
endp->transcoder_end.rtcp.cb = rtp_data_transcoder;
|
endp->trans_net.rtcp.cb = rtp_data_transcoder;
|
||||||
return bind_rtp(endp->cfg, &endp->transcoder_end, ENDPOINT_NUMBER(endp));
|
return bind_rtp(endp->cfg, &endp->trans_net, ENDPOINT_NUMBER(endp));
|
||||||
}
|
}
|
||||||
|
|
||||||
int mgcp_free_rtp_port(struct mgcp_rtp_end *end)
|
int mgcp_free_rtp_port(struct mgcp_rtp_end *end)
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ static int allocate_ports(struct mgcp_endpoint *endp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (endp->cfg->transcoder_ip) {
|
if (endp->cfg->transcoder_ip) {
|
||||||
if (allocate_port(endp, &endp->transcoder_end,
|
if (allocate_port(endp, &endp->trans_net,
|
||||||
&endp->cfg->transcoder_ports,
|
&endp->cfg->transcoder_ports,
|
||||||
mgcp_bind_transcoder_rtp_port) != 0) {
|
mgcp_bind_transcoder_rtp_port) != 0) {
|
||||||
mgcp_rtp_end_reset(&endp->net_end);
|
mgcp_rtp_end_reset(&endp->net_end);
|
||||||
@@ -828,7 +828,7 @@ int mgcp_endpoints_allocate(struct mgcp_config *cfg)
|
|||||||
cfg->endpoints[i].cfg = cfg;
|
cfg->endpoints[i].cfg = cfg;
|
||||||
mgcp_rtp_end_init(&cfg->endpoints[i].net_end);
|
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].bts_end);
|
||||||
mgcp_rtp_end_init(&cfg->endpoints[i].transcoder_end);
|
mgcp_rtp_end_init(&cfg->endpoints[i].trans_net);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
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->bts_end);
|
||||||
mgcp_rtp_end_reset(&endp->net_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;
|
endp->is_transcoded = 0;
|
||||||
|
|
||||||
memset(&endp->net_state, 0, sizeof(endp->net_state));
|
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, "CRCX", "recvonly");
|
||||||
send_msg(endp, in_endp, endp->bts_end.local_port, "MDCX", "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->trans_net.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, "MDCX", "sendrecv");
|
||||||
|
|
||||||
port = rtp_calculate_port(out_endp, endp->cfg->transcoder_remote_base);
|
port = rtp_calculate_port(out_endp, endp->cfg->transcoder_remote_base);
|
||||||
endp->transcoder_end.rtp_port = htons(port);
|
endp->trans_net.rtp_port = htons(port);
|
||||||
endp->transcoder_end.rtcp_port = htons(port + 1);
|
endp->trans_net.rtcp_port = htons(port + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void delete_transcoder(struct mgcp_endpoint *endp)
|
static void delete_transcoder(struct mgcp_endpoint *endp)
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ DEFUN(show_mcgp, show_mgcp_cmd, "show mgcp",
|
|||||||
inet_ntoa(endp->bts_end.addr),
|
inet_ntoa(endp->bts_end.addr),
|
||||||
endp->bts_end.packets, endp->bts_state.lost_no,
|
endp->bts_end.packets, endp->bts_state.lost_no,
|
||||||
endp->net_end.packets, endp->net_state.lost_no,
|
endp->net_end.packets, endp->net_state.lost_no,
|
||||||
endp->transcoder_end.packets,
|
endp->trans_net.packets,
|
||||||
VTY_NEWLINE);
|
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);
|
LOGP(DMGCP, LOGL_FATAL, "Failed to bind: %d\n", rtp_port);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
endp->transcoder_end.local_alloc = PORT_ALLOC_STATIC;
|
endp->trans_net.local_alloc = PORT_ALLOC_STATIC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user