From 10db2817e5ce76eebd61dd6b607a6dfad57fa417 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Fri, 14 Dec 2018 16:14:34 +0100 Subject: 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 --- src/gsm/gsup.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src') 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; } -- cgit v1.2.3