pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39212?usp=email )
Change subject: Rename mgcp_free_rtp_port() to mgcp_rtp_end_free_port() ......................................................................
Rename mgcp_free_rtp_port() to mgcp_rtp_end_free_port()
While at it, moving the only clearly existing API for the same object to the same place to have them together (mgcp_rtp_end_remote_addr_available()).
Change-Id: Ifabd1cf69273a6d22feb65c08de590d083987d09 --- M include/osmocom/mgcp/mgcp_network.h M src/libosmo-mgcp/mgcp_conn.c M src/libosmo-mgcp/mgcp_network.c M src/libosmo-mgcp/mgcp_protocol.c 4 files changed, 14 insertions(+), 10 deletions(-)
Approvals: Jenkins Builder: Verified daniel: Looks good to me, approved laforge: Looks good to me, but someone else must approve
diff --git a/include/osmocom/mgcp/mgcp_network.h b/include/osmocom/mgcp/mgcp_network.h index 453fbe9..db3dce7 100644 --- a/include/osmocom/mgcp/mgcp_network.h +++ b/include/osmocom/mgcp/mgcp_network.h @@ -132,6 +132,7 @@ };
bool mgcp_rtp_end_remote_addr_available(const struct mgcp_rtp_end *rtp_end); +void mgcp_rtp_end_free_port(struct mgcp_rtp_end *end);
struct mgcp_rtp_tap { /* is this tap active (1) or not (0) */ @@ -152,7 +153,6 @@ void mgcp_cleanup_e1_bridge_cb(struct mgcp_endpoint *endp, struct mgcp_conn *conn); int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port, struct mgcp_conn_rtp *conn); -void mgcp_free_rtp_port(struct mgcp_rtp_end *end); void mgcp_patch_and_count(const struct mgcp_endpoint *endp, struct mgcp_rtp_state *state, struct mgcp_rtp_end *rtp_end, diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c index b4d971e..e7ff30b 100644 --- a/src/libosmo-mgcp/mgcp_conn.c +++ b/src/libosmo-mgcp/mgcp_conn.c @@ -137,7 +137,7 @@ conn_osmux_disable(conn_rtp); if (mgcp_conn_rtp_is_iuup(conn_rtp)) mgcp_conn_iuup_cleanup(conn_rtp); - mgcp_free_rtp_port(&conn_rtp->end); + mgcp_rtp_end_free_port(&conn_rtp->end); rate_ctr_group_free(conn_rtp->ctrg); mgcp_codec_reset_all(conn_rtp); } diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c index f0111cd..9a993a7 100644 --- a/src/libosmo-mgcp/mgcp_network.c +++ b/src/libosmo-mgcp/mgcp_network.c @@ -85,12 +85,6 @@
static int rx_rtp(struct msgb *msg);
-bool mgcp_rtp_end_remote_addr_available(const struct mgcp_rtp_end *rtp_end) -{ - return (osmo_sockaddr_port(&rtp_end->addr.u.sa) != 0) && - (osmo_sockaddr_is_any(&rtp_end->addr) == 0); -} - /*! Determine the local rtp bind IP-address. * \param[out] addr caller provided memory to store the resulting IP-Address. * \param[in] endp mgcp endpoint, that holds a copy of the VTY parameters. @@ -1726,9 +1720,19 @@ return bind_rtp(endp->trunk->cfg, conn->end.local_addr, end, endp); }
+/*********************** + * mgcp_rtp_end + **********************/ + +bool mgcp_rtp_end_remote_addr_available(const struct mgcp_rtp_end *rtp_end) +{ + return (osmo_sockaddr_port(&rtp_end->addr.u.sa) != 0) && + (osmo_sockaddr_is_any(&rtp_end->addr) == 0); +} + /*! free allocated RTP and RTCP ports. * \param[in] end RTP end */ -void mgcp_free_rtp_port(struct mgcp_rtp_end *end) +void mgcp_rtp_end_free_port(struct mgcp_rtp_end *end) { if (end->rtp) { osmo_iofd_free(end->rtp); diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c index 98a0062..eef9d5f 100644 --- a/src/libosmo-mgcp/mgcp_protocol.c +++ b/src/libosmo-mgcp/mgcp_protocol.c @@ -1331,7 +1331,7 @@ } if (strcmp(new_local_addr, conn_rtp->end.local_addr)) { osmo_strlcpy(conn_rtp->end.local_addr, new_local_addr, sizeof(conn_rtp->end.local_addr)); - mgcp_free_rtp_port(&conn_rtp->end); + mgcp_rtp_end_free_port(&conn_rtp->end); if (allocate_port(endp, conn_rtp) != 0) { rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_FAIL_BIND_PORT)); goto error3;