From 49c1a7156c7e0ced1709aee4a3d3438db60bae41 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 23 Apr 2015 09:13:01 -0400 Subject: gsup: Extract the QoS field Add roundtrip test for the new QoS IE. It will be consumed in later commits. --- 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 a2d3cc798..123e1fc05 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_CONTEXT_ID_IE = 0x10, GPRS_GSUP_PDP_TYPE_IE = 0x11, GPRS_GSUP_ACCESS_POINT_NAME_IE = 0x12, + GPRS_GSUP_PDP_QOS_IE = 0x13, 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 56f78fd12..cb14fa114 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); @@ -333,6 +338,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 a7c240183..bbd1d8ab3 100644 --- a/openbsc/tests/gprs/gprs_test.c +++ b/openbsc/tests/gprs/gprs_test.c @@ -446,10 +446,11 @@ static void test_gsup_messages_dec_enc(void) 0x08, 0x07, /* MSISDN of the subscriber */ 0x91, 0x94, 0x61, 0x46, 0x32, 0x24, 0x43, 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', + 0x13, 0x01, 0x02, 0x05, 0x11, 0x10, 0x01, 0x02, 0x11, 0x02, 0xf1, 0x21, /* IPv4 */ -- cgit v1.2.3