mirror of https://gerrit.osmocom.org/libosmocore
gsup: add OSMO_GSUP_RAT_TYPES_IE
Corresponds to the Supported RAT Types Indicator from 3GPP TS 29.002. See 8.1.2 MAP_UPDATE_LOCATION service. This is useful to communicate the RAN / RAT type of the current subscriber during Location Updating Request. The use case we have in mind for VLR <-> HLR would require only a single RAT type, but 29.002 specifies a list of supported RAT types. Hence implement this as a list. So far, have room for eight RAT types in the gsup_msg. That is an arbitrary random choice without any rationale. Change-Id: I93850710ab55a605bf61b95063a69682a2899bb1
This commit is contained in:
parent
0e48cd67e1
commit
fb4e75de41
|
@ -45,6 +45,7 @@
|
||||||
#include <osmocom/gsm/protocol/gsm_03_40.h>
|
#include <osmocom/gsm/protocol/gsm_03_40.h>
|
||||||
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
||||||
#include <osmocom/gsm/protocol/gsm_08_08.h>
|
#include <osmocom/gsm/protocol/gsm_08_08.h>
|
||||||
|
#include <osmocom/gsm/gsm_utils.h>
|
||||||
#include <osmocom/crypt/auth.h>
|
#include <osmocom/crypt/auth.h>
|
||||||
|
|
||||||
#define OSMO_GSUP_PORT 4222
|
#define OSMO_GSUP_PORT 4222
|
||||||
|
@ -86,6 +87,7 @@ enum osmo_gsup_iei {
|
||||||
OSMO_GSUP_AUTS_IE = 0x26,
|
OSMO_GSUP_AUTS_IE = 0x26,
|
||||||
OSMO_GSUP_RES_IE = 0x27,
|
OSMO_GSUP_RES_IE = 0x27,
|
||||||
OSMO_GSUP_CN_DOMAIN_IE = 0x28,
|
OSMO_GSUP_CN_DOMAIN_IE = 0x28,
|
||||||
|
OSMO_GSUP_RAT_TYPES_IE = 0x29,
|
||||||
|
|
||||||
OSMO_GSUP_SESSION_ID_IE = 0x30,
|
OSMO_GSUP_SESSION_ID_IE = 0x30,
|
||||||
OSMO_GSUP_SESSION_STATE_IE = 0x31,
|
OSMO_GSUP_SESSION_STATE_IE = 0x31,
|
||||||
|
@ -373,6 +375,9 @@ struct osmo_gsup_message {
|
||||||
|
|
||||||
/*! Session Management cause as of 3GPP TS 24.008 10.5.6.6 / Table 10.5.157. */
|
/*! Session Management cause as of 3GPP TS 24.008 10.5.6.6 / Table 10.5.157. */
|
||||||
enum gsm48_gsm_cause cause_sm;
|
enum gsm48_gsm_cause cause_sm;
|
||||||
|
|
||||||
|
enum osmo_rat_type rat_types[8];
|
||||||
|
size_t rat_types_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
int osmo_gsup_decode(const uint8_t *data, size_t data_len,
|
int osmo_gsup_decode(const uint8_t *data, size_t data_len,
|
||||||
|
|
|
@ -297,6 +297,7 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len,
|
||||||
struct osmo_gsup_message *gsup_msg)
|
struct osmo_gsup_message *gsup_msg)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
int i;
|
||||||
uint8_t tag;
|
uint8_t tag;
|
||||||
/* the shift/match functions expect non-const pointers, but we'll
|
/* the shift/match functions expect non-const pointers, but we'll
|
||||||
* either copy the data or cast pointers back to const before returning
|
* either copy the data or cast pointers back to const before returning
|
||||||
|
@ -459,6 +460,16 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len,
|
||||||
gsup_msg->cn_domain = *value;
|
gsup_msg->cn_domain = *value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OSMO_GSUP_RAT_TYPES_IE:
|
||||||
|
if (value_len > ARRAY_SIZE(gsup_msg->rat_types)) {
|
||||||
|
LOGP(DLGSUP, LOGL_ERROR, "nr of RAT types %zu > %zu\n", value_len, ARRAY_SIZE(gsup_msg->rat_types));
|
||||||
|
return -GMM_CAUSE_COND_IE_ERR;
|
||||||
|
}
|
||||||
|
for (i = 0; i < value_len; i++)
|
||||||
|
gsup_msg->rat_types[i] = value[i];
|
||||||
|
gsup_msg->rat_types_len = value_len;
|
||||||
|
break;
|
||||||
|
|
||||||
case OSMO_GSUP_CHARG_CHAR_IE:
|
case OSMO_GSUP_CHARG_CHAR_IE:
|
||||||
gsup_msg->pdp_charg_enc = value;
|
gsup_msg->pdp_charg_enc = value;
|
||||||
gsup_msg->pdp_charg_enc_len = value_len;
|
gsup_msg->pdp_charg_enc_len = value_len;
|
||||||
|
@ -856,6 +867,20 @@ int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
|
||||||
if ((u8 = gsup_msg->cause_sm))
|
if ((u8 = gsup_msg->cause_sm))
|
||||||
msgb_tlv_put(msg, OSMO_GSUP_CAUSE_SM_IE, sizeof(u8), &u8);
|
msgb_tlv_put(msg, OSMO_GSUP_CAUSE_SM_IE, sizeof(u8), &u8);
|
||||||
|
|
||||||
|
if (gsup_msg->rat_types_len) {
|
||||||
|
int i;
|
||||||
|
uint8_t *len = msgb_tl_put(msg, OSMO_GSUP_RAT_TYPES_IE);
|
||||||
|
*len = gsup_msg->rat_types_len;
|
||||||
|
for (i = 0; i < gsup_msg->rat_types_len; i++) {
|
||||||
|
if (!gsup_msg->rat_types[i] || gsup_msg->rat_types[i] >= OSMO_RAT_COUNT) {
|
||||||
|
LOGP(DLGSUP, LOGL_ERROR, "Failed to encode RAT type %s (nr %d)\n",
|
||||||
|
osmo_rat_type_name(gsup_msg->rat_types[i]), i);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
msgb_v_put(msg, gsup_msg->rat_types[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,27 +157,27 @@
|
||||||
DLGSUP Stopping DLGSUP logging
|
DLGSUP Stopping DLGSUP logging
|
||||||
message 0: tested 3584 modifications, 771 parse failures
|
message 0: tested 3584 modifications, 771 parse failures
|
||||||
message 1: tested 3584 modifications, 770 parse failures
|
message 1: tested 3584 modifications, 770 parse failures
|
||||||
message 2: tested 21248 modifications, 2575 parse failures
|
message 2: tested 21248 modifications, 2577 parse failures
|
||||||
message 3: tested 2816 modifications, 510 parse failures
|
message 3: tested 2816 modifications, 510 parse failures
|
||||||
message 4: tested 3584 modifications, 770 parse failures
|
message 4: tested 3584 modifications, 770 parse failures
|
||||||
message 5: tested 20736 modifications, 4023 parse failures
|
message 5: tested 20736 modifications, 4025 parse failures
|
||||||
message 6: tested 3584 modifications, 771 parse failures
|
message 6: tested 3584 modifications, 771 parse failures
|
||||||
message 7: tested 3584 modifications, 770 parse failures
|
message 7: tested 3584 modifications, 770 parse failures
|
||||||
message 8: tested 2816 modifications, 510 parse failures
|
message 8: tested 2816 modifications, 510 parse failures
|
||||||
message 9: tested 2816 modifications, 510 parse failures
|
message 9: tested 2816 modifications, 510 parse failures
|
||||||
message 10: tested 3584 modifications, 770 parse failures
|
message 10: tested 3584 modifications, 770 parse failures
|
||||||
message 11: tested 3328 modifications, 770 parse failures
|
message 11: tested 3328 modifications, 770 parse failures
|
||||||
message 12: tested 54016 modifications, 4626 parse failures
|
message 12: tested 54016 modifications, 4628 parse failures
|
||||||
message 13: tested 11520 modifications, 1026 parse failures
|
message 13: tested 11520 modifications, 1028 parse failures
|
||||||
message 14: tested 5120 modifications, 1030 parse failures
|
message 14: tested 5120 modifications, 1030 parse failures
|
||||||
message 15: tested 10752 modifications, 1262 parse failures
|
message 15: tested 10752 modifications, 1263 parse failures
|
||||||
message 16: tested 7680 modifications, 1271 parse failures
|
message 16: tested 7680 modifications, 1271 parse failures
|
||||||
message 17: tested 8448 modifications, 2053 parse failures
|
message 17: tested 8448 modifications, 2053 parse failures
|
||||||
message 18: tested 11264 modifications, 2307 parse failures
|
message 18: tested 11264 modifications, 2308 parse failures
|
||||||
message 19: tested 5120 modifications, 1031 parse failures
|
message 19: tested 5120 modifications, 1031 parse failures
|
||||||
message 20: tested 4352 modifications, 1030 parse failures
|
message 20: tested 4352 modifications, 1030 parse failures
|
||||||
message 21: tested 3584 modifications, 771 parse failures
|
message 21: tested 3584 modifications, 771 parse failures
|
||||||
message 22: tested 5632 modifications, 771 parse failures
|
message 22: tested 5632 modifications, 772 parse failures
|
||||||
message 23: tested 3584 modifications, 770 parse failures
|
message 23: tested 3584 modifications, 770 parse failures
|
||||||
message 24: tested 3584 modifications, 771 parse failures
|
message 24: tested 3584 modifications, 771 parse failures
|
||||||
message 25: tested 11264 modifications, 2058 parse failures
|
message 25: tested 11264 modifications, 2058 parse failures
|
||||||
|
|
Loading…
Reference in New Issue