[PATCH] osmo-bsc[master]: osmo-bsc: Move user plane/voice related bits into sub-structure

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Dec 19 17:13:42 UTC 2017


osmo-bsc: Move user plane/voice related bits into sub-structure

This clarifies which members of the struct are for what.

Change-Id: I618822e6f2d48adce25f9df5c25acbce7c858412
---
M include/osmocom/bsc/osmo_bsc.h
M src/osmo-bsc/osmo_bsc_api.c
M src/osmo-bsc/osmo_bsc_audio.c
M src/osmo-bsc/osmo_bsc_bssap.c
M src/osmo-bsc/osmo_bsc_ctrl.c
M src/osmo-bsc/osmo_bsc_mgcp.c
M src/osmo-bsc/osmo_bsc_sigtran.c
7 files changed, 43 insertions(+), 44 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/06/5506/2

diff --git a/include/osmocom/bsc/osmo_bsc.h b/include/osmocom/bsc/osmo_bsc.h
index 131007b..485c836 100644
--- a/include/osmocom/bsc/osmo_bsc.h
+++ b/include/osmocom/bsc/osmo_bsc.h
@@ -26,23 +26,23 @@
 	int ciphering_handled;
 
 	/* for audio handling */
-	uint16_t cic;
-	uint32_t rtp_ip;
-	int rtp_port;
+	struct {
+		uint16_t cic;
+		uint32_t rtp_ip;
+		int rtp_port;
+		/* RTP address of the remote end (assigned by MSC through assignment request) */
+		struct sockaddr_storage aoip_rtp_addr_remote;
 
-	/* RTP address of the remote end (assigned by MSC through assignment
-	 * request) */
-	struct sockaddr_storage aoip_rtp_addr_remote;
+		/* Local RTP address (reported back to the MSC by us with the
+		 * assignment complete message) */
+		struct sockaddr_storage aoip_rtp_addr_local;
 
-	/* Local RTP address (reported back to the MSC by us with the
-	 * assignment complete message) */
-	struct sockaddr_storage aoip_rtp_addr_local;
-
-	/* storage to keep states of the MGCP connection handler, the
-	 * handler is created when an assignment request is received
-	 * and is terminated when the assignment complete message is
-	 * sent */
-	struct mgcp_ctx *mgcp_ctx;
+		/* storage to keep states of the MGCP connection handler, the
+		* handler is created when an assignment request is received
+		* and is terminated when the assignment complete message is
+		* sent */
+		struct mgcp_ctx *mgcp_ctx;
+	} user_plane;
 
 	/* for advanced ping/pong */
 	int send_ping;
diff --git a/src/osmo-bsc/osmo_bsc_api.c b/src/osmo-bsc/osmo_bsc_api.c
index 152b818..a2a8630 100644
--- a/src/osmo-bsc/osmo_bsc_api.c
+++ b/src/osmo-bsc/osmo_bsc_api.c
@@ -435,7 +435,7 @@
 	struct msgb *resp;
 	return_when_not_connected(conn);
 
-	if (is_ipaccess_bts(conn->bts) && conn->sccp_con->rtp_ip) {
+	if (is_ipaccess_bts(conn->bts) && conn->sccp_con->user_plane.rtp_ip) {
 		/* NOTE: In a network that makes use of an IPA base station
 		 * and AoIP, we have to wait until the BTS reports its RTP
 		 * IP/Port combination back to BSC via RSL. Unfortunately, the
diff --git a/src/osmo-bsc/osmo_bsc_audio.c b/src/osmo-bsc/osmo_bsc_audio.c
index 0c11b85..82367f0 100644
--- a/src/osmo-bsc/osmo_bsc_audio.c
+++ b/src/osmo-bsc/osmo_bsc_audio.c
@@ -57,17 +57,17 @@
 
 		/* we can ask it to connect now */
 		LOGP(DMSC, LOGL_DEBUG, "Connecting BTS to port: %d conn: %d\n",
-		     con->sccp_con->rtp_port, lchan->abis_ip.conn_id);
+		     con->sccp_con->user_plane.rtp_port, lchan->abis_ip.conn_id);
 
 		/* If AoIP is in use, the rtp_ip, which has been communicated
 		 * via the A interface as connect_ip */
-		if(con->sccp_con->rtp_ip)
-			rtp_ip = con->sccp_con->rtp_ip;
+		if(con->sccp_con->user_plane.rtp_ip)
+			rtp_ip = con->sccp_con->user_plane.rtp_ip;
 		else
 			rtp_ip = ntohl(INADDR_ANY);
 
 		rc = rsl_ipacc_mdcx(lchan, rtp_ip,
-				    con->sccp_con->rtp_port,
+				    con->sccp_con->user_plane.rtp_port,
 				    lchan->abis_ip.rtp_payload2);
 		if (rc < 0) {
 			LOGP(DMSC, LOGL_ERROR, "Failed to send MDCX: %d\n", rc);
@@ -84,13 +84,13 @@
 			 * inform the logic that controls the MGW about the new
 			 * connection info */
 			LOGP(DMSC, LOGL_INFO,"RTP connection handover initiated...\n");
-			mgcp_handover(con->sccp_con->mgcp_ctx, con->ho_lchan);
-		} else if (is_ipaccess_bts(con->bts) && con->sccp_con->rtp_ip) {
+			mgcp_handover(con->sccp_con->user_plane.mgcp_ctx, con->ho_lchan);
+		} else if (is_ipaccess_bts(con->bts) && con->sccp_con->user_plane.rtp_ip) {
 			/* NOTE: This is only relevant on AoIP networks with
 			 * IPA based base stations. See also osmo_bsc_api.c,
 			 * function bsc_assign_compl() */
 			LOGP(DMSC, LOGL_INFO, "Tx MSC ASSIGN COMPL (POSTPONED)\n");
-			mgcp_ass_complete(con->sccp_con->mgcp_ctx, lchan);
+			mgcp_ass_complete(con->sccp_con->user_plane.mgcp_ctx, lchan);
 		}
 		break;
 	}
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index aea3994..6f2d0f4 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -361,13 +361,13 @@
 		return -1;
 	}
 
-	if (conn->mgcp_ctx) {
+	if (conn->user_plane.mgcp_ctx) {
 		/* NOTE: This is the AoIP case, osmo-bsc has to negotiate with
 		 * the MGCP-GW. For this an mgcp_ctx should be created that
 		 * contains the FSM and some system data. When the connection
 		 * is removed from the MGCP-GW, then osmo_bsc_sigtran_send()
 		 * calls osmo_bsc_sigtran_send(). */
-	        mgcp_clear_complete(conn->mgcp_ctx, resp);
+	        mgcp_clear_complete(conn->user_plane.mgcp_ctx, resp);
 	} else {
 		/* NOTE: This is the SCCP-Lite case, since we do not handle
 		 * the MGCP-GW switching ourselves, we may skip everything
@@ -535,11 +535,9 @@
 	/* Detect if a CIC code is present, if so, we use the classic ip.access
 	 * method to calculate the RTP port */
 	if (TLVP_PRESENT(&tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE)) {
-		conn->cic =
-		    osmo_load16be(TLVP_VAL
-				  (&tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE));
-		timeslot = conn->cic & 0x1f;
-		multiplex = (conn->cic & ~0x1f) >> 5;
+		conn->user_plane.cic = osmo_load16be(TLVP_VAL(&tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE));
+		timeslot = conn->user_plane.cic & 0x1f;
+		multiplex = (conn->user_plane.cic & ~0x1f) >> 5;
 	} else if (TLVP_PRESENT(&tp, GSM0808_IE_AOIP_TRASP_ADDR)) {
 		/* Decode AoIP transport address element */
 		data = TLVP_VAL(&tp, GSM0808_IE_AOIP_TRASP_ADDR);
@@ -621,15 +619,16 @@
 		 * reasons, functional wise it would not matter when exactly
 		 * the network side RTP connection is made, as long it is made
 		 * before we return with the assignment complete message. */
-		memcpy(&conn->aoip_rtp_addr_remote, &rtp_addr, sizeof(rtp_addr));
+		memcpy(&conn->user_plane.aoip_rtp_addr_remote, &rtp_addr, sizeof(rtp_addr));
 
 		/* Create an assignment request using the MGCP fsm. This FSM
 		 * is directly started when its created (now) and will also
 		 * take care about the further processing (creating RTP
 		 * endpoints, calling gsm0808_assign_req(), responding to
 		 * the assignment request etc... */
-		conn->mgcp_ctx = mgcp_assignm_req(msc->network, msc->network->mgw.client, conn, chan_mode, full_rate);
-		if (!conn->mgcp_ctx) {
+		conn->user_plane.mgcp_ctx = mgcp_assignm_req(msc->network, msc->network->mgw.client,
+								conn, chan_mode, full_rate);
+		if (!conn->user_plane.mgcp_ctx) {
 			LOGP(DMSC, LOGL_ERROR, "MGCP GW failure, rejecting assignment... (id=%i)\n", conn->conn_id);
 			goto reject;
 		}
@@ -641,8 +640,8 @@
 		 * (the MSC does that for us). We set conn->rtp_ip to 0 and check
 		 * on this later. By this we know that we have to behave accordingly
 		 * to sccp-lite. */
-		conn->rtp_port = mgcp_timeslot_to_port(multiplex, timeslot, msc->rtp_base);
-		conn->rtp_ip = 0;
+		conn->user_plane.rtp_port = mgcp_timeslot_to_port(multiplex, timeslot, msc->rtp_base);
+		conn->user_plane.rtp_ip = 0;
 		return gsm0808_assign_req(conn->conn, chan_mode, full_rate);
 	}
 
@@ -849,7 +848,7 @@
 					lchan->abis_ip.ass_compl.chosen_channel,
 					lchan->abis_ip.ass_compl.encr_alg_id,
 					lchan->abis_ip.ass_compl.speech_mode,
-					&conn->sccp_con->aoip_rtp_addr_local,
+					&conn->sccp_con->user_plane.aoip_rtp_addr_local,
 					&sc,
 					NULL);
 
diff --git a/src/osmo-bsc/osmo_bsc_ctrl.c b/src/osmo-bsc/osmo_bsc_ctrl.c
index 6330892..8c9dfe7 100644
--- a/src/osmo-bsc/osmo_bsc_ctrl.c
+++ b/src/osmo-bsc/osmo_bsc_ctrl.c
@@ -552,7 +552,7 @@
 		if (!conn->sccp_con)
 			continue;
 
-		if (conn->sccp_con->cic != cic)
+		if (conn->sccp_con->user_plane.cic != cic)
 			continue;
 
 		/*
diff --git a/src/osmo-bsc/osmo_bsc_mgcp.c b/src/osmo-bsc/osmo_bsc_mgcp.c
index f5efa95..ebd13d6 100644
--- a/src/osmo-bsc/osmo_bsc_mgcp.c
+++ b/src/osmo-bsc/osmo_bsc_mgcp.c
@@ -231,8 +231,8 @@
 	/* Set the connection details in the conn struct. The code that
 	 * controls the BTS via RSL will take these values and signal them
 	 * to the BTS via RSL/IPACC */
-	conn->rtp_port = r->audio_port;
-	conn->rtp_ip = osmo_ntohl(inet_addr(r->audio_ip));
+	conn->user_plane.rtp_port = r->audio_port;
+	conn->user_plane.rtp_ip = osmo_ntohl(inet_addr(r->audio_ip));
 
 	/* Notify the FSM that we got the response. */
 	osmo_fsm_inst_dispatch(mgcp_ctx->fsm, EV_CRCX_BTS_RESP, mgcp_ctx);
@@ -428,7 +428,7 @@
 	 * identifier. However, the MGW does not support IPv6 yet. This is
 	 * why we stop here in case some MSC tries to signal IPv6 AoIP
 	 * transport identifiers */
-	if (conn->aoip_rtp_addr_remote.ss_family != AF_INET) {
+	if (conn->user_plane.aoip_rtp_addr_remote.ss_family != AF_INET) {
 		LOGPFSML(fi, LOGL_ERROR,
 			 "CRCX/NET: endpoint:%x MSC uses unsupported address format in AoIP transport identifier -- aborting...\n",
 			 rtp_endpoint);
@@ -436,7 +436,7 @@
 		return;
 	}
 
-	sin = (struct sockaddr_in *)&conn->aoip_rtp_addr_remote;
+	sin = (struct sockaddr_in *)&conn->user_plane.aoip_rtp_addr_remote;
 	addr = inet_ntoa(sin->sin_addr);
 	port = osmo_ntohs(sin->sin_port);
 	LOGPFSML(fi, LOGL_DEBUG, "CRCX/NET: MSC expects RTP input on address %s:%u\n", addr, port);
@@ -512,7 +512,7 @@
 		 r->audio_ip, r->audio_port);
 
 	/* Store address */
-	sin = (struct sockaddr_in *)&conn->aoip_rtp_addr_local;
+	sin = (struct sockaddr_in *)&conn->user_plane.aoip_rtp_addr_local;
 	sin->sin_family = AF_INET;
 	sin->sin_addr.s_addr = inet_addr(r->audio_ip);
 	sin->sin_port = osmo_ntohs(r->audio_port);
diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c
index 7669b67..67f8703 100644
--- a/src/osmo-bsc/osmo_bsc_sigtran.c
+++ b/src/osmo-bsc/osmo_bsc_sigtran.c
@@ -385,8 +385,8 @@
 	}
 
 	/* Remove mgcp context if existant */
-	if (conn->mgcp_ctx)
-		mgcp_free_ctx(conn->mgcp_ctx);
+	if (conn->user_plane.mgcp_ctx)
+		mgcp_free_ctx(conn->user_plane.mgcp_ctx);
 
 	llist_del(&conn->entry);
 	talloc_free(conn);

-- 
To view, visit https://gerrit.osmocom.org/5506
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I618822e6f2d48adce25f9df5c25acbce7c858412
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list