jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/33547 )
Change subject: ASCI: Replace "priv" pointer of connection instance ......................................................................
ASCI: Replace "priv" pointer of connection instance
The pointer is preplaced by "send" pointer and "send_next" pointer. The "send" pointer points to the connection the received data is forwarded to for transmission. This is what the "priv" pointer was used for. The "send_next" pointer can be used to send RTP to multiple connections that are in a conference. This will be used by later patch. (see Chg-Id: Ic99a55ab5a3a6170e940403fadd52697e99f2f3a)
Change-Id: Icefacf0f91ae068e4f0cd65244d92735045b7c26 --- M include/osmocom/mgcp/mgcp_conn.h M src/libosmo-mgcp/mgcp_iuup.c M src/libosmo-mgcp/mgcp_network.c 3 files changed, 29 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/47/33547/1
diff --git a/include/osmocom/mgcp/mgcp_conn.h b/include/osmocom/mgcp/mgcp_conn.h index 7ac40ab..eaf4663 100644 --- a/include/osmocom/mgcp/mgcp_conn.h +++ b/include/osmocom/mgcp/mgcp_conn.h @@ -137,8 +137,11 @@ struct mgcp_conn_rtp rtp; } u;
- /*! pointer to optional private data */ - void *priv; + /*! pointer to (optional) destination of received payload */ + struct mgcp_conn *send; + + /*! pointer to (optional) next destination of payload */ + struct mgcp_conn *send_next; };
/* RTP connection related counters */ diff --git a/src/libosmo-mgcp/mgcp_iuup.c b/src/libosmo-mgcp/mgcp_iuup.c index 6ad62c8..36a8cae 100644 --- a/src/libosmo-mgcp/mgcp_iuup.c +++ b/src/libosmo-mgcp/mgcp_iuup.c @@ -51,11 +51,11 @@ * the connection to cache the destination connection pointer. */
struct mgcp_conn *conn_dst; - if (!conn->priv) { + if (!conn->send) { conn_dst = mgcp_find_dst_conn(conn); - conn->priv = conn_dst; + conn->send = conn_dst; } else { - conn_dst = (struct mgcp_conn *)conn->priv; + conn_dst = conn->send; } return conn_dst; } diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c index 33cd8af..8850670 100644 --- a/src/libosmo-mgcp/mgcp_network.c +++ b/src/libosmo-mgcp/mgcp_network.c @@ -1330,11 +1330,11 @@ * Since list iterations are quite costly, we will figure out the * destination only once and use the optional private data pointer of * the connection to cache the destination connection pointer. */ - if (!conn->priv) { + if (!conn->send) { conn_dst = mgcp_find_dst_conn(conn); - conn->priv = conn_dst; + conn->send = conn_dst; } else { - conn_dst = (struct mgcp_conn *)conn->priv; + conn_dst = conn->send; }
/* There is no destination conn, stop here */ @@ -1406,8 +1406,8 @@ * connections present when one connection is removed from the * endpoint. */ llist_for_each_entry(conn_cleanup, &endp->conns, entry) { - if (conn_cleanup->priv == conn) - conn_cleanup->priv = NULL; + if (conn_cleanup->send == conn) + conn_cleanup->send = NULL; } }