mirror of https://gerrit.osmocom.org/libosmocore
gsup: Add encoding/decoding for the pdp charging characteristics
These fields can be in the ISD and the PDP Context inofmration. Store pointers to this IE in both cases. It needs to be used by the SGSN when opening a PDP context. Change-Id: Iedc7c02adcf77ca5c9545119e19c968dfbbb3e6b
This commit is contained in:
parent
639c408ec1
commit
eb55c0d4da
|
@ -51,6 +51,7 @@ enum osmo_gsup_iei {
|
|||
OSMO_GSUP_PDP_TYPE_IE = 0x11,
|
||||
OSMO_GSUP_ACCESS_POINT_NAME_IE = 0x12,
|
||||
OSMO_GSUP_PDP_QOS_IE = 0x13,
|
||||
OSMO_GSUP_CHARG_CHAR_IE = 0x14,
|
||||
OSMO_GSUP_RAND_IE = 0x20,
|
||||
OSMO_GSUP_SRES_IE = 0x21,
|
||||
OSMO_GSUP_KC_IE = 0x22,
|
||||
|
@ -127,6 +128,11 @@ struct osmo_gsup_pdp_info {
|
|||
const uint8_t *qos_enc;
|
||||
/*! length (in octets) of qos_enc */
|
||||
size_t qos_enc_len;
|
||||
/*! PDP Charging Characteristics, still in encoded form. Can be NULL if no
|
||||
* PDP Charging Characteristics */
|
||||
const uint8_t *pdp_charg_enc;
|
||||
/*! length (in octets) of pdp_charg_enc */
|
||||
size_t pdp_charg_enc_len;
|
||||
};
|
||||
|
||||
/*! parsed/decoded GSUP protocol message */
|
||||
|
@ -148,6 +154,8 @@ struct osmo_gsup_message {
|
|||
const uint8_t *auts;
|
||||
const uint8_t *rand;
|
||||
enum osmo_gsup_cn_domain cn_domain;
|
||||
const uint8_t *pdp_charg_enc;
|
||||
size_t pdp_charg_enc_len;
|
||||
};
|
||||
|
||||
int osmo_gsup_decode(const uint8_t *data, size_t data_len,
|
||||
|
|
|
@ -103,6 +103,11 @@ static int decode_pdp_info(uint8_t *data, size_t data_len,
|
|||
pdp_info->qos_enc_len = value_len;
|
||||
break;
|
||||
|
||||
case OSMO_GSUP_CHARG_CHAR_IE:
|
||||
pdp_info->pdp_charg_enc = value;
|
||||
pdp_info->pdp_charg_enc_len = value_len;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOGP(DLGSUP, LOGL_ERROR,
|
||||
"GSUP IE type %d not expected in PDP info\n", iei);
|
||||
|
@ -375,6 +380,11 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len,
|
|||
gsup_msg->cn_domain = *value;
|
||||
break;
|
||||
|
||||
case OSMO_GSUP_CHARG_CHAR_IE:
|
||||
gsup_msg->pdp_charg_enc = value;
|
||||
gsup_msg->pdp_charg_enc_len = value_len;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOGP(DLGSUP, LOGL_NOTICE,
|
||||
"GSUP IE type %d unknown\n", iei);
|
||||
|
@ -415,6 +425,11 @@ static void encode_pdp_info(struct msgb *msg, enum osmo_gsup_iei iei,
|
|||
pdp_info->qos_enc_len, pdp_info->qos_enc);
|
||||
}
|
||||
|
||||
if (pdp_info->pdp_charg_enc) {
|
||||
msgb_tlv_put(msg, OSMO_GSUP_CHARG_CHAR_IE,
|
||||
pdp_info->pdp_charg_enc_len, pdp_info->pdp_charg_enc);
|
||||
}
|
||||
|
||||
/* Update length field */
|
||||
*len_field = msgb_length(msg) - old_len;
|
||||
}
|
||||
|
@ -540,6 +555,11 @@ void osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg
|
|||
uint8_t dn = gsup_msg->cn_domain;
|
||||
msgb_tlv_put(msg, OSMO_GSUP_CN_DOMAIN_IE, 1, &dn);
|
||||
}
|
||||
|
||||
if (gsup_msg->pdp_charg_enc) {
|
||||
msgb_tlv_put(msg, OSMO_GSUP_CHARG_CHAR_IE,
|
||||
gsup_msg->pdp_charg_enc_len, gsup_msg->pdp_charg_enc);
|
||||
}
|
||||
}
|
||||
|
||||
/*! @} */
|
||||
|
|
|
@ -69,15 +69,18 @@ static void test_gsup_messages_dec_enc(void)
|
|||
0x09, 0x07, /* HLR-Number of the subscriber */
|
||||
0x91, 0x83, 0x52, 0x38, 0x48, 0x83, 0x93,
|
||||
0x04, 0x00, /* PDP info complete */
|
||||
0x05, 0x15,
|
||||
0x05, 0x19,
|
||||
0x10, 0x01, 0x01,
|
||||
0x11, 0x02, 0xf1, 0x21, /* IPv4 */
|
||||
0x12, 0x09, 0x04, 't', 'e', 's', 't', 0x03, 'a', 'p', 'n',
|
||||
0x13, 0x01, 0x02,
|
||||
0x14, 0x02, 0xFF, 0x23,
|
||||
0x05, 0x11,
|
||||
0x10, 0x01, 0x02,
|
||||
0x11, 0x02, 0xf1, 0x21, /* IPv4 */
|
||||
0x12, 0x08, 0x03, 'f', 'o', 'o', 0x03, 'a', 'p', 'n',
|
||||
0x14, 0x02,
|
||||
0xAE, 0xFF
|
||||
};
|
||||
|
||||
static const uint8_t location_cancellation_req[] = {
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
generated message: 05 01 08 21 43 65 87 09 21 43 f5 02 01 07
|
||||
original message: 05 01 08 21 43 65 87 09 21 43 f5 02 01 07
|
||||
IMSI: 123456789012345
|
||||
generated message: 06 01 08 21 43 65 87 09 21 43 f5 08 07 91 94 61 46 32 24 43 09 07 91 83 52 38 48 83 93 04 00 05 15 10 01 01 11 02 f1 21 12 09 04 74 65 73 74 03 61 70 6e 13 01 02 05 11 10 01 02 11 02 f1 21 12 08 03 66 6f 6f 03 61 70 6e
|
||||
original message: 06 01 08 21 43 65 87 09 21 43 f5 08 07 91 94 61 46 32 24 43 09 07 91 83 52 38 48 83 93 04 00 05 15 10 01 01 11 02 f1 21 12 09 04 74 65 73 74 03 61 70 6e 13 01 02 05 11 10 01 02 11 02 f1 21 12 08 03 66 6f 6f 03 61 70 6e
|
||||
generated message: 06 01 08 21 43 65 87 09 21 43 f5 08 07 91 94 61 46 32 24 43 09 07 91 83 52 38 48 83 93 04 00 05 19 10 01 01 11 02 f1 21 12 09 04 74 65 73 74 03 61 70 6e 13 01 02 14 02 ff 23 05 11 10 01 02 11 02 f1 21 12 08 03 66 6f 6f 03 61 70 6e 14 02 ae ff
|
||||
original message: 06 01 08 21 43 65 87 09 21 43 f5 08 07 91 94 61 46 32 24 43 09 07 91 83 52 38 48 83 93 04 00 05 19 10 01 01 11 02 f1 21 12 09 04 74 65 73 74 03 61 70 6e 13 01 02 14 02 ff 23 05 11 10 01 02 11 02 f1 21 12 08 03 66 6f 6f 03 61 70 6e 14 02 ae ff
|
||||
IMSI: 123456789012345
|
||||
generated message: 1c 01 08 21 43 65 87 09 21 43 f5 06 01 00
|
||||
original message: 1c 01 08 21 43 65 87 09 21 43 f5 06 01 00
|
||||
|
@ -45,7 +45,7 @@
|
|||
message 2: tested 83 truncations, 81 parse failures
|
||||
message 3: tested 11 truncations, 11 parse failures
|
||||
message 4: tested 14 truncations, 13 parse failures
|
||||
message 5: tested 73 truncations, 68 parse failures
|
||||
message 5: tested 81 truncations, 75 parse failures
|
||||
message 6: tested 14 truncations, 13 parse failures
|
||||
message 7: tested 14 truncations, 13 parse failures
|
||||
message 8: tested 11 truncations, 11 parse failures
|
||||
|
@ -60,7 +60,7 @@ DLGSUP Stopping DLGSUP logging
|
|||
message 2: tested 21248 modifications, 2571 parse failures
|
||||
message 3: tested 2816 modifications, 510 parse failures
|
||||
message 4: tested 3584 modifications, 768 parse failures
|
||||
message 5: tested 18688 modifications, 3505 parse failures
|
||||
message 5: tested 20736 modifications, 4010 parse failures
|
||||
message 6: tested 3584 modifications, 769 parse failures
|
||||
message 7: tested 3584 modifications, 768 parse failures
|
||||
message 8: tested 2816 modifications, 510 parse failures
|
||||
|
|
Loading…
Reference in New Issue