aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-05-17 19:56:38 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-05-24 12:32:23 +0800
commit0bb5674cde008af942a0bfaefc9855b09117df34 (patch)
treed4abd72357b0bdd314bb75b2ec8bcc835bc7cab8
parente54a24d4e6b7e77dff72fdf2ee153a9220a94f35 (diff)
gsup: Decode/Encode the hlr-Number in the GSUP message
Implement it similar to the msisdn_enc/msisdn_enc_len and extend the testcase to include it as well.
-rw-r--r--openbsc/include/openbsc/gprs_gsup_messages.h3
-rw-r--r--openbsc/src/gprs/gprs_gsup_messages.c8
-rw-r--r--openbsc/tests/gprs/gprs_test.c2
3 files changed, 13 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/gprs_gsup_messages.h b/openbsc/include/openbsc/gprs_gsup_messages.h
index 123e1fc05..8cbc809f7 100644
--- a/openbsc/include/openbsc/gprs_gsup_messages.h
+++ b/openbsc/include/openbsc/gprs_gsup_messages.h
@@ -42,6 +42,7 @@ enum gprs_gsup_iei {
GPRS_GSUP_CANCEL_TYPE_IE = 0x06,
GPRS_GSUP_FREEZE_PTMSI_IE = 0x07,
GPRS_GSUP_MSISDN_IE = 0x08,
+ GPRS_GSUP_HLR_NUMBER_IE = 0x09,
GPRS_GSUP_PDP_CONTEXT_ID_IE = 0x10,
GPRS_GSUP_PDP_TYPE_IE = 0x11,
GPRS_GSUP_ACCESS_POINT_NAME_IE = 0x12,
@@ -109,6 +110,8 @@ struct gprs_gsup_message {
size_t num_pdp_infos;
const uint8_t *msisdn_enc;
size_t msisdn_enc_len;
+ const uint8_t *hlr_enc;
+ size_t hlr_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 cb14fa114..bdcff5f69 100644
--- a/openbsc/src/gprs/gprs_gsup_messages.c
+++ b/openbsc/src/gprs/gprs_gsup_messages.c
@@ -303,6 +303,11 @@ int gprs_gsup_decode(const uint8_t *const_data, size_t data_len,
gsup_msg->msisdn_enc_len = value_len;
break;
+ case GPRS_GSUP_HLR_NUMBER_IE:
+ gsup_msg->hlr_enc = value;
+ gsup_msg->hlr_enc_len = value_len;
+ break;
+
default:
LOGP(DGPRS, LOGL_NOTICE,
"GSUP IE type %d unknown\n", iei);
@@ -394,6 +399,9 @@ void gprs_gsup_encode(struct msgb *msg, const struct gprs_gsup_message *gsup_msg
if (gsup_msg->msisdn_enc)
msgb_tlv_put(msg, GPRS_GSUP_MSISDN_IE,
gsup_msg->msisdn_enc_len, gsup_msg->msisdn_enc);
+ if (gsup_msg->hlr_enc)
+ msgb_tlv_put(msg, GPRS_GSUP_HLR_NUMBER_IE,
+ gsup_msg->hlr_enc_len, gsup_msg->hlr_enc);
if ((u8 = gsup_msg->cause))
msgb_tlv_put(msg, GPRS_GSUP_CAUSE_IE, sizeof(u8), &u8);
diff --git a/openbsc/tests/gprs/gprs_test.c b/openbsc/tests/gprs/gprs_test.c
index bbd1d8ab3..c78b98ab5 100644
--- a/openbsc/tests/gprs/gprs_test.c
+++ b/openbsc/tests/gprs/gprs_test.c
@@ -445,6 +445,8 @@ static void test_gsup_messages_dec_enc(void)
TEST_IMSI_IE,
0x08, 0x07, /* MSISDN of the subscriber */
0x91, 0x94, 0x61, 0x46, 0x32, 0x24, 0x43,
+ 0x09, 0x07, /* HLR-Number of the subscriber */
+ 0x91, 0x83, 0x52, 0x38, 0x48, 0x83, 0x93,
0x04, 0x00, /* PDP info complete */
0x05, 0x15,
0x10, 0x01, 0x01,