summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2018-12-14 16:14:34 +0100
committerOliver Smith <osmith@sysmocom.de>2018-12-21 13:13:30 +0100
commit10db2817e5ce76eebd61dd6b607a6dfad57fa417 (patch)
tree5425929afda0ed0330d9e20670a5686fbc4b0b12 /src
parent19742408cf3d83bb67e4b8c2fc3b0cbbee7bee59 (diff)
GSUP: add CHECK-IMEI message
Implement necessary messages for Procedure Check_IMEI_VLR (TS 23.018 Chapter 7.1.2.9). This lets the VLR ask the EIR to check if an IMEI is valid. In the Osmocom stack, we don't have an EIR and this request will be handled by the HLR. We will be able to store the IMEI in the HLR as side-effect (OS#2541). This is roughly based on TS 29.002 8.7.1 MAP_CHECK_IMEI service, but only implements the bare minimum required IEs (imei and imei_result). Related: OS#3733 Change-Id: I085819df0ea7f3bfeb0cabebb5fd1942a23c6155
Diffstat (limited to 'src')
-rw-r--r--src/gsm/gsup.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index 3b31d03c..3d2a8e2e 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -79,6 +79,10 @@ const struct value_string osmo_gsup_message_type_names[] = {
OSMO_VALUE_STRING(OSMO_GSUP_MSGT_READY_FOR_SM_ERROR),
OSMO_VALUE_STRING(OSMO_GSUP_MSGT_READY_FOR_SM_RESULT),
+ OSMO_VALUE_STRING(OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST),
+ OSMO_VALUE_STRING(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR),
+ OSMO_VALUE_STRING(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT),
+
{ 0, NULL }
};
@@ -116,6 +120,8 @@ int osmo_gsup_get_err_msg_type(enum osmo_gsup_message_type type_in)
return OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR;
case OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST:
return OSMO_GSUP_MSGT_READY_FOR_SM_ERROR;
+ case OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST:
+ return OSMO_GSUP_MSGT_CHECK_IMEI_ERROR;
default:
return -1;
}
@@ -487,6 +493,15 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len,
gsup_msg->sm_alert_rsn = *value;
break;
+ case OSMO_GSUP_IMEI_IE:
+ gsup_msg->imei_enc = value;
+ gsup_msg->imei_enc_len = value_len;
+ break;
+
+ case OSMO_GSUP_IMEI_RESULT_IE:
+ gsup_msg->imei_result = osmo_decode_big_endian(value, value_len) + 1;
+ break;
+
default:
LOGP(DLGSUP, LOGL_NOTICE,
"GSUP IE type %d unknown\n", iei);
@@ -720,6 +735,14 @@ int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
sizeof(u8), &u8);
}
+ if (gsup_msg->imei_enc)
+ msgb_tlv_put(msg, OSMO_GSUP_IMEI_IE, gsup_msg->imei_enc_len, gsup_msg->imei_enc);
+
+ if ((u8 = gsup_msg->imei_result)) {
+ u8 -= 1;
+ msgb_tlv_put(msg, OSMO_GSUP_IMEI_RESULT_IE, sizeof(u8), &u8);
+ }
+
return 0;
}