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.
This commit is contained in:
Holger Hans Peter Freyther 2015-05-17 19:56:38 +02:00
parent 1711a3d1ef
commit f0bfe388b3
3 changed files with 13 additions and 0 deletions

View File

@ -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,

View File

@ -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);

View File

@ -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,