Change in osmo-mgw[master]: osmux: Make conn_osmux_{allocate,release}_local_cid() APIs static
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29646 ) Change subject: osmux: Make conn_osmux_{allocate,release}_local_cid() APIs static ...................................................................... osmux: Make conn_osmux_{allocate,release}_local_cid() APIs static They are used internally in the mgcp_osmux.c file. Change-Id: If7c83f98a94818090173a8be9d3bff9818b2ead1 --- M include/osmocom/mgcp/osmux.h M src/libosmo-mgcp/mgcp_osmux.c 2 files changed, 29 insertions(+), 31 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/46/29646/1 diff --git a/include/osmocom/mgcp/osmux.h b/include/osmocom/mgcp/osmux.h index c5f6871..be5ee6a 100644 --- a/include/osmocom/mgcp/osmux.h +++ b/include/osmocom/mgcp/osmux.h @@ -12,8 +12,6 @@ int osmux_init_conn(struct mgcp_conn_rtp *conn); int conn_osmux_enable(struct mgcp_conn_rtp *conn); void conn_osmux_disable(struct mgcp_conn_rtp *conn); -int conn_osmux_allocate_local_cid(struct mgcp_conn_rtp *conn); -void conn_osmux_release_local_cid(struct mgcp_conn_rtp *conn); int osmux_xfrm_to_osmux(char *buf, int buf_len, struct mgcp_conn_rtp *conn); int osmux_send_dummy(struct mgcp_conn_rtp *conn); diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c index cd45a87..3351650 100644 --- a/src/libosmo-mgcp/mgcp_osmux.c +++ b/src/libosmo-mgcp/mgcp_osmux.c @@ -485,6 +485,35 @@ return 0; } +/*! relase OSXMUX cid, that had been allocated to this connection. + * \param[in] conn connection with OSMUX cid to release */ +static void conn_osmux_release_local_cid(struct mgcp_conn_rtp *conn) +{ + if (conn->osmux.local_cid_allocated) + osmux_cid_pool_put(conn->osmux.local_cid); + conn->osmux.local_cid = 0; + conn->osmux.local_cid_allocated = false; +} + +/*! allocate local OSMUX cid to connection. + * \param[in] conn connection for which we allocate the local OSMUX cid + * \returns Allocated OSMUX cid, -1 on error (no free CIDs avail). + */ +static int conn_osmux_allocate_local_cid(struct mgcp_conn_rtp *conn) +{ + OSMO_ASSERT(conn->osmux.local_cid_allocated == false); + int osmux_cid = osmux_cid_pool_get_next(); + if (osmux_cid == -1) { + LOGPCONN(conn->conn, DOSMUX, LOGL_INFO, + "no available local Osmux CID to allocate!\n"); + return -1; + } + + conn->osmux.local_cid = (uint8_t) osmux_cid; + conn->osmux.local_cid_allocated = true; + return osmux_cid; +} + /*! Initialize Osmux bits of a conn. * \param[in] conn Osmux connection to initialize * \returns 0 on success, negative on ERROR */ @@ -589,35 +618,6 @@ conn->osmux.ctrg = NULL; } -/*! relase OSXMUX cid, that had been allocated to this connection. - * \param[in] conn connection with OSMUX cid to release */ -void conn_osmux_release_local_cid(struct mgcp_conn_rtp *conn) -{ - if (conn->osmux.local_cid_allocated) - osmux_cid_pool_put(conn->osmux.local_cid); - conn->osmux.local_cid = 0; - conn->osmux.local_cid_allocated = false; -} - -/*! allocate local OSMUX cid to connection. - * \param[in] conn connection for which we allocate the local OSMUX cid - * \returns Allocated OSMUX cid, -1 on error (no free CIDs avail). - */ -int conn_osmux_allocate_local_cid(struct mgcp_conn_rtp *conn) -{ - OSMO_ASSERT(conn->osmux.local_cid_allocated == false); - int osmux_cid = osmux_cid_pool_get_next(); - if (osmux_cid == -1) { - LOGPCONN(conn->conn, DOSMUX, LOGL_INFO, - "no available local Osmux CID to allocate!\n"); - return -1; - } - - conn->osmux.local_cid = (uint8_t) osmux_cid; - conn->osmux.local_cid_allocated = true; - return osmux_cid; -} - /*! send RTP dummy packet to OSMUX connection port. * \param[in] conn associated RTP connection * \returns bytes sent, -1 on error */ -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29646 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: If7c83f98a94818090173a8be9d3bff9818b2ead1 Gerrit-Change-Number: 29646 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin@sysmocom.de> Gerrit-MessageType: newchange
participants (1)
-
pespin