[PATCH 4/9] gsup: Extract the QoS field

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/OpenBSC@lists.osmocom.org/.

Holger Freyther holger at freyther.de
Thu Apr 23 21:40:39 UTC 2015


From: Holger Hans Peter Freyther <holger at moiji-mobile.com>

---
 openbsc/include/openbsc/gprs_gsup_messages.h |  3 +++
 openbsc/src/gprs/gprs_gsup_messages.c        | 10 ++++++++++
 openbsc/tests/gprs/gprs_test.c               |  3 ++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/openbsc/include/openbsc/gprs_gsup_messages.h b/openbsc/include/openbsc/gprs_gsup_messages.h
index 937733f..701070a 100644
--- a/openbsc/include/openbsc/gprs_gsup_messages.h
+++ b/openbsc/include/openbsc/gprs_gsup_messages.h
@@ -45,6 +45,7 @@ enum gprs_gsup_iei {
 	GPRS_GSUP_PDP_TYPE_IE			= 0x11,
 	GPRS_GSUP_ACCESS_POINT_NAME_IE		= 0x12,
 	GPRS_GSUP_MSISDN_IE			= 0x13,
+	GPRS_GSUP_PDP_QOS_IE			= 0x14,
 	GPRS_GSUP_RAND_IE			= 0x20,
 	GPRS_GSUP_SRES_IE			= 0x21,
 	GPRS_GSUP_KC_IE				= 0x22
@@ -91,6 +92,8 @@ struct gprs_gsup_pdp_info {
 	uint16_t			pdp_type;
 	const uint8_t			*apn_enc;
 	size_t				apn_enc_len;
+	const uint8_t			*qos_enc;
+	size_t				qos_enc_len;
 };
 
 struct gprs_gsup_message {
diff --git a/openbsc/src/gprs/gprs_gsup_messages.c b/openbsc/src/gprs/gprs_gsup_messages.c
index be8e823..a4b0617 100644
--- a/openbsc/src/gprs/gprs_gsup_messages.c
+++ b/openbsc/src/gprs/gprs_gsup_messages.c
@@ -94,6 +94,11 @@ static int decode_pdp_info(uint8_t *data, size_t data_len,
 			pdp_info->apn_enc_len = value_len;
 			break;
 
+		case GPRS_GSUP_PDP_QOS_IE:
+			pdp_info->qos_enc = value;
+			pdp_info->qos_enc_len = value_len;
+			break;
+
 		default:
 			LOGP(DGPRS, LOGL_ERROR,
 			     "GSUP IE type %d not expected in PDP info\n", iei);
@@ -331,6 +336,11 @@ static void encode_pdp_info(struct msgb *msg, enum gprs_gsup_iei iei,
 			     pdp_info->apn_enc_len, pdp_info->apn_enc);
 	}
 
+	if (pdp_info->qos_enc) {
+		msgb_tlv_put(msg, GPRS_GSUP_PDP_QOS_IE,
+				pdp_info->qos_enc_len, pdp_info->qos_enc);
+	}
+
 	/* Update length field */
 	*len_field = msgb_length(msg) - old_len;
 }
diff --git a/openbsc/tests/gprs/gprs_test.c b/openbsc/tests/gprs/gprs_test.c
index 555d657..ffe0220 100644
--- a/openbsc/tests/gprs/gprs_test.c
+++ b/openbsc/tests/gprs/gprs_test.c
@@ -444,10 +444,11 @@ static void test_gsup_messages_dec_enc(void)
 		0x06,
 		TEST_IMSI_IE,
 		0x04, 0x00, /* PDP info complete */
-		0x05, 0x12,
+		0x05, 0x15,
 			0x10, 0x01, 0x01,
 			0x11, 0x02, 0xf1, 0x21, /* IPv4 */
 			0x12, 0x09, 0x04, 't', 'e', 's', 't', 0x03, 'a', 'p', 'n',
+			0x14, 0x01, 0x02,
 		0x05, 0x11,
 			0x10, 0x01, 0x02,
 			0x11, 0x02, 0xf1, 0x21, /* IPv4 */
-- 
2.3.5




More information about the OpenBSC mailing list