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
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index 3d2a8e2..29cf488 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -282,6 +282,7 @@
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
@@ -442,6 +443,16 @@
gsup_msg->cn_domain = *value;
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:
gsup_msg->pdp_charg_enc = value;
gsup_msg->pdp_charg_enc_len = value_len;
@@ -676,6 +687,20 @@
msgb_tlv_put(msg, OSMO_GSUP_CN_DOMAIN_IE, 1, &dn);
}
+ 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]);
+ }
+ }
+
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);