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
diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c
index 079a703..f194573 100644
--- a/tests/gsup/gsup_test.c
+++ b/tests/gsup/gsup_test.c
@@ -289,6 +289,33 @@
 			0x02, /* Memory Available (SMMA) */
 	};
 
+	static const uint8_t send_check_imei_req[] = {
+		0x30, /* OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST */
+		TEST_IMSI_IE,
+
+		/* imei */
+		0x50, 0x09,
+			0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
+	};
+
+	static const uint8_t send_check_imei_err[] = {
+		0x31, /* OSMO_GSUP_MSGT_CHECK_IMEI_ERROR */
+		TEST_IMSI_IE,
+
+		/* cause */
+		0x02, 0x01,
+			0x60, /* GMM_CAUSE_INV_MAND_INFO */
+	};
+
+	static const uint8_t send_check_imei_res[] = {
+		0x32, /* OSMO_GSUP_MSGT_CHECK_IMEI_RESULT */
+		TEST_IMSI_IE,
+
+		/* imei_result */
+		0x51, 0x01,
+			0x00, /* OSMO_GSUP_IMEI_RESULT_ACK */
+	};
+
 	static const struct test {
 		char *name;
 		const uint8_t *data;
@@ -338,6 +365,12 @@
 			send_mo_mt_forward_sm_err, sizeof(send_mo_mt_forward_sm_err)},
 		{"ReadyForSM (MSC -> SMSC) Indication",
 			send_ready_for_sm_ind, sizeof(send_ready_for_sm_ind)},
+		{"Check IMEI Request",
+			send_check_imei_req, sizeof(send_check_imei_req)},
+		{"Check IMEI Error",
+			send_check_imei_err, sizeof(send_check_imei_err)},
+		{"Check IMEI Result",
+			send_check_imei_res, sizeof(send_check_imei_res)},
 	};
 
 	printf("Test GSUP message decoding/encoding\n");