[4/9] gsup: Extract the QoS field
diff mbox

Message ID 1429825244-61253-4-git-send-email-holger@freyther.de
State Changes Requested
Headers show

Commit Message

Holger Freyther April 23, 2015, 9:40 p.m. UTC
From: Holger Hans Peter Freyther <holger@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(-)

Patch
diff mbox

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