Change in libosmocore[master]: add gsm0808_create_handover_request_ack2 to add AoIP RTP addr

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Mar 15 02:08:34 UTC 2019


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/13259


Change subject: add gsm0808_create_handover_request_ack2 to add AoIP RTP addr
......................................................................

add gsm0808_create_handover_request_ack2 to add AoIP RTP addr

Change-Id: Ia71542ea37d4fd2c9fb9b40357db7aeb111ec576
---
M include/osmocom/gsm/gsm0808.h
M src/gsm/gsm0808.c
M src/gsm/libosmogsm.map
3 files changed, 54 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/59/13259/1

diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index a1345c3..b31a698 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -143,6 +143,26 @@
 };
 struct msgb *gsm0808_create_handover_required(const struct gsm0808_handover_required *params);
 
+struct gsm0808_create_handover_request_ack {
+	const uint8_t *l3_info;
+	uint8_t l3_info_len;
+
+	bool chosen_channel_present;
+	uint8_t chosen_channel;
+
+	/*! For A5/N set chosen_encr_alg = N+1, e.g. chosen_encr_alg = 1 means A5/0 (no encryption), 2 means A5/1, 4
+	 * means A5/3. Set chosen_encr_alg = 0 to omit the Chosen Encryption Algorithm IE. */
+	uint8_t chosen_encr_alg;
+
+	/* chosen_speech_version == 0 omits the IE */
+	uint8_t chosen_speech_version;
+
+	struct sockaddr_storage aoip_transport_layer;
+
+	/* more items are defined in the spec and may be added later */
+	bool more_items; /*!< always set this to false */
+};
+struct msgb *gsm0808_create_handover_request_ack2(const struct gsm0808_create_handover_request_ack *params);
 struct msgb *gsm0808_create_handover_request_ack(const uint8_t *l3_info, uint8_t l3_info_len,
 						 uint8_t chosen_channel, uint8_t chosen_encr_alg,
 						 uint8_t chosen_speech_version);
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 4873076..ad51b5f 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -860,9 +860,7 @@
 /*! Create BSSMAP HANDOVER REQUEST ACKNOWLEDGE message, 3GPP TS 48.008 3.2.1.10.
  * Sent from the MT BSC back to the MSC when it has allocated an lchan to handover to.
  * l3_info is the RR Handover Command that the MO BSC sends to the MS to move over. */
-struct msgb *gsm0808_create_handover_request_ack(const uint8_t *l3_info, uint8_t l3_info_len,
-						 uint8_t chosen_channel, uint8_t chosen_encr_alg,
-						 uint8_t chosen_speech_version)
+struct msgb *gsm0808_create_handover_request_ack2(const struct gsm0808_create_handover_request_ack *params)
 {
 	struct msgb *msg;
 
@@ -873,13 +871,22 @@
 	/* Message Type, 3.2.2.1 */
 	msgb_v_put(msg, BSS_MAP_MSG_HANDOVER_RQST_ACKNOWLEDGE);
 
-	/* Layer 3 Information, 3.2.2.24 */
-	msgb_tlv_put(msg, GSM0808_IE_LAYER_3_INFORMATION, l3_info_len, l3_info);
+	/* Layer 3 Information, 3.2.2.24 -- it is actually mandatory, but rather compose a nonstandard message than
+	 * segfault or return NULL without a log message. */
+	if (params->l3_info && params->l3_info_len)
+		msgb_tlv_put(msg, GSM0808_IE_LAYER_3_INFORMATION, params->l3_info_len, params->l3_info);
 
-	msgb_tv_put(msg, GSM0808_IE_CHOSEN_CHANNEL, chosen_channel);
-	msgb_tv_put(msg, GSM0808_IE_CHOSEN_ENCR_ALG, chosen_encr_alg);
-	if (chosen_speech_version != 0)
-		msgb_tv_put(msg, GSM0808_IE_SPEECH_VERSION, chosen_speech_version);
+	if (params->chosen_channel_present)
+		msgb_tv_put(msg, GSM0808_IE_CHOSEN_CHANNEL, params->chosen_channel);
+	if (params->chosen_encr_alg)
+		msgb_tv_put(msg, GSM0808_IE_CHOSEN_ENCR_ALG, params->chosen_encr_alg);
+
+	if (params->chosen_speech_version != 0)
+		msgb_tv_put(msg, GSM0808_IE_SPEECH_VERSION, params->chosen_speech_version);
+
+	if (params->aoip_transport_layer.ss_family == AF_INET
+	    || params->aoip_transport_layer.ss_family == AF_INET6)
+		gsm0808_enc_aoip_trasp_addr(msg, &params->aoip_transport_layer);
 
 	/* prepend header with final length */
 	msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg));
@@ -887,6 +894,23 @@
 	return msg;
 }
 
+/*! Same as gsm0808_create_handover_request_ack2() but with less parameters.
+ * In particular, this lacks the AoIP Transport Layer address. */
+struct msgb *gsm0808_create_handover_request_ack(const uint8_t *l3_info, uint8_t l3_info_len,
+						 uint8_t chosen_channel, uint8_t chosen_encr_alg,
+						 uint8_t chosen_speech_version)
+{
+	struct gsm0808_create_handover_request_ack params = {
+		.l3_info = l3_info,
+		.l3_info_len = l3_info_len,
+		.chosen_channel = chosen_channel,
+		.chosen_encr_alg = chosen_encr_alg,
+		.chosen_speech_version = chosen_speech_version,
+	};
+
+	return gsm0808_create_handover_request_ack2(&params);
+}
+
 /*! Create BSSMAP HANDOVER DETECT message, 3GPP TS 48.008 3.2.1.40.
  * Sent from the MT BSC back to the MSC when the MS has sent a handover RACH request and the MT BSC has
  * received the Handover Detect message. */
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 3fadc5a..12ca1fa 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -183,6 +183,7 @@
 gsm0808_create_sapi_reject;
 gsm0808_create_handover_required;
 gsm0808_create_handover_request_ack;
+gsm0808_create_handover_request_ack2;
 gsm0808_create_handover_detect;
 gsm0808_create_handover_complete;
 gsm0808_create_handover_failure;

-- 
To view, visit https://gerrit.osmocom.org/13259
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia71542ea37d4fd2c9fb9b40357db7aeb111ec576
Gerrit-Change-Number: 13259
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190315/8e3f7925/attachment.htm>


More information about the gerrit-log mailing list