From patchwork Thu Apr 23 21:40:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Holger Freyther X-Patchwork-Id: 464062 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (tmp.osmocom.org [144.76.43.76]) by ozlabs.org (Postfix) with ESMTP id DCF4E14012C for ; Fri, 24 Apr 2015 07:50:39 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id F04B81C00; Thu, 23 Apr 2015 21:50:37 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from gandharva.secretlabs.de (gandharva.secretlabs.de [5.9.72.18]) by lists.osmocom.org (Postfix) with ESMTP id A6FC71BC0 for ; Thu, 23 Apr 2015 21:50:36 +0000 (UTC) Received: from Holgers-MacBook-Air.local.com (162-253-137-5.dedicated.allstream.net [162.253.137.5]) by gandharva.secretlabs.de (Postfix) with ESMTPSA id EEF2124F87 for ; Thu, 23 Apr 2015 21:41:00 +0000 (UTC) From: Holger Freyther To: openbsc@lists.osmocom.org Subject: [PATCH 3/9] gsup: Extract the new MSISDN string Date: Thu, 23 Apr 2015 17:40:38 -0400 Message-Id: <1429825244-61253-3-git-send-email-holger@freyther.de> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1429825244-61253-1-git-send-email-holger@freyther.de> References: <1429825244-61253-1-git-send-email-holger@freyther.de> X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Development of the OpenBSC GSM base station controller List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" From: Holger Hans Peter Freyther --- openbsc/include/openbsc/gprs_gsup_messages.h | 4 ++++ openbsc/src/gprs/gprs_gsup_messages.c | 10 ++++++++++ openbsc/tests/gprs/gprs_test.c | 2 ++ 3 files changed, 16 insertions(+) diff --git a/openbsc/include/openbsc/gprs_gsup_messages.h b/openbsc/include/openbsc/gprs_gsup_messages.h index 9857b97..937733f 100644 --- a/openbsc/include/openbsc/gprs_gsup_messages.h +++ b/openbsc/include/openbsc/gprs_gsup_messages.h @@ -29,6 +29,7 @@ #define GPRS_GSUP_MAX_NUM_PDP_INFO 10 /* GSM 09.02 limits this to 50 */ #define GPRS_GSUP_MAX_NUM_AUTH_INFO 5 +#define GPRS_GSUP_MAX_MSISDN_LEN 9 #define GPRS_GSUP_PDP_TYPE_SIZE 2 @@ -43,6 +44,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_MSISDN_IE = 0x13, GPRS_GSUP_RAND_IE = 0x20, GPRS_GSUP_SRES_IE = 0x21, GPRS_GSUP_KC_IE = 0x22 @@ -102,6 +104,8 @@ struct gprs_gsup_message { size_t num_auth_tuples; struct gprs_gsup_pdp_info pdp_infos[GPRS_GSUP_MAX_NUM_PDP_INFO]; size_t num_pdp_infos; + const uint8_t *msisdn_enc; + size_t msisdn_enc_len; }; int gprs_gsup_decode(const uint8_t *data, size_t data_len, diff --git a/openbsc/src/gprs/gprs_gsup_messages.c b/openbsc/src/gprs/gprs_gsup_messages.c index 9d9b6be..be8e823 100644 --- a/openbsc/src/gprs/gprs_gsup_messages.c +++ b/openbsc/src/gprs/gprs_gsup_messages.c @@ -2,6 +2,7 @@ /* * (C) 2014 by Sysmocom s.f.m.c. GmbH + * (C) 2015 by Holger Hans Peter Freyther * All Rights Reserved * * Author: Jacob Erlbeck @@ -291,6 +292,10 @@ int gprs_gsup_decode(const uint8_t *const_data, size_t data_len, gsup_msg->auth_tuples[gsup_msg->num_auth_tuples++] = auth_info; break; + case GPRS_GSUP_MSISDN_IE: + gsup_msg->msisdn_enc = value; + gsup_msg->msisdn_enc_len = value_len; + break; default: LOGP(DGPRS, LOGL_NOTICE, "GSUP IE type %d unknown\n", iei); @@ -415,4 +420,9 @@ void gprs_gsup_encode(struct msgb *msg, const struct gprs_gsup_message *gsup_msg encode_auth_info(msg, GPRS_GSUP_AUTH_TUPLE_IE, auth_info); } + + if (gsup_msg->msisdn_enc) + msgb_tlv_put(msg, GPRS_GSUP_MSISDN_IE, + gsup_msg->msisdn_enc_len, gsup_msg->msisdn_enc); + } diff --git a/openbsc/tests/gprs/gprs_test.c b/openbsc/tests/gprs/gprs_test.c index 0ae06e7..555d657 100644 --- a/openbsc/tests/gprs/gprs_test.c +++ b/openbsc/tests/gprs/gprs_test.c @@ -452,6 +452,8 @@ static void test_gsup_messages_dec_enc(void) 0x10, 0x01, 0x02, 0x11, 0x02, 0xf1, 0x21, /* IPv4 */ 0x12, 0x08, 0x03, 'f', 'o', 'o', 0x03, 'a', 'p', 'n', + 0x13, 0x07, /* MSISDN of the subscriber */ + 0x91, 0x94, 0x61, 0x46, 0x32, 0x24, 0x43, }; static const uint8_t location_cancellation_req[] = {