summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-12-26 18:13:38 +0100
committerHarald Welte <laforge@osmocom.org>2019-09-28 14:34:07 +0200
commit1b729ce106f474e29e7bbd57c01c3472e75a8b25 (patch)
tree9d5116c2ab5d98e484e0e10d9229917e69934a71 /src
parent2e286a5429fd90c02c217c94591c690b40a93888 (diff)
gsup: add OSMO_GSUP_SUPPORTED_RAT_TYPES_IE and OSMO_GSUP_CURRENT_RAT_TYPE_IE
OSMO_GSUP_SUPPORTED_RAT_TYPES_IE corresponds to the Supported RAT Types Indicator from 3GPP TS 29.002. See 8.1.2 MAP_UPDATE_LOCATION service, which indicates the capabilities of the MSC/VLR to the HLR. So far, have room for eight RAT types in the gsup_msg. That is an arbitrary random choice without any rationale. OSMO_GSUP_CURRENT_RAT_TYPE_IE is useful to communicate the currently used RAN / RAT type of the current subscriber during Location Updating Request. Change-Id: I93850710ab55a605bf61b95063a69682a2899bb1
Diffstat (limited to 'src')
-rw-r--r--src/gsm/gsup.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index 2e6690ee..2f9d85d8 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -297,6 +297,7 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len,
struct osmo_gsup_message *gsup_msg)
{
int rc;
+ int i;
uint8_t tag;
/* the shift/match functions expect non-const pointers, but we'll
* either copy the data or cast pointers back to const before returning
@@ -459,6 +460,21 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len,
gsup_msg->cn_domain = *value;
break;
+ case OSMO_GSUP_SUPPORTED_RAT_TYPES_IE:
+ if (value_len > ARRAY_SIZE(gsup_msg->supported_rat_types)) {
+ LOGP(DLGSUP, LOGL_ERROR, "nr of supported RAT types %zu > %zu\n",
+ value_len, ARRAY_SIZE(gsup_msg->supported_rat_types));
+ return -GMM_CAUSE_COND_IE_ERR;
+ }
+ for (i = 0; i < value_len; i++)
+ gsup_msg->supported_rat_types[i] = value[i];
+ gsup_msg->supported_rat_types_len = value_len;
+ break;
+
+ case OSMO_GSUP_CURRENT_RAT_TYPE_IE:
+ gsup_msg->current_rat_type = *value;
+ break;
+
case OSMO_GSUP_CHARG_CHAR_IE:
gsup_msg->pdp_charg_enc = value;
gsup_msg->pdp_charg_enc_len = value_len;
@@ -856,6 +872,25 @@ int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
if ((u8 = gsup_msg->cause_sm))
msgb_tlv_put(msg, OSMO_GSUP_CAUSE_SM_IE, sizeof(u8), &u8);
+ if (gsup_msg->supported_rat_types_len) {
+ int i;
+ uint8_t *len = msgb_tl_put(msg, OSMO_GSUP_SUPPORTED_RAT_TYPES_IE);
+ *len = gsup_msg->supported_rat_types_len;
+ for (i = 0; i < gsup_msg->supported_rat_types_len; i++) {
+ if (!gsup_msg->supported_rat_types[i] ||
+ gsup_msg->supported_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->supported_rat_types[i]), i);
+ return -EINVAL;
+ }
+ msgb_v_put(msg, gsup_msg->supported_rat_types[i]);
+ }
+ }
+ if (gsup_msg->current_rat_type != OSMO_RAT_UNKNOWN) {
+ u8 = gsup_msg->current_rat_type;
+ msgb_tlv_put(msg, OSMO_GSUP_CURRENT_RAT_TYPE_IE, sizeof(u8), &u8);
+ }
+
return 0;
}