From c2628317cc3482262c80b93cbfb2cbe960772558 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Tue, 25 Sep 2018 23:03:13 +0700 Subject: GSUP/SMS: introduce MO-/MT-FORWARD-SM messages According to 3GPP TS 29.002, there are two services: - MAP-MO-FORWARD-SHORT-MESSAGE (see 12.2), - MAP-MT-FORWARD-SHORT-MESSAGE (see 12.9), which are used to forward MO/MT short messages. This change replicates both services as GSUP messages: - OSMO_GSUP_MSGT_MO_FORWARD_SM_*, - OSMO_GSUP_MSGT_MT_FORWARD_SM_*. Please note, that only the 'must-have' IEs are introduced by this change, in particular the following: - OSMO_GSUP_SM_RP_MR_IE (see note below), - OSMO_GSUP_SM_RP_DA_IE (see 7.6.8.1), - OSMO_GSUP_SM_RP_OA_IE (see 7.6.8.2), - OSMO_GSUP_SM_RP_UI_IE (see 7.6.8.4), - OSMO_GSUP_SM_RP_MMS_IE (see 7.6.8.7), - OSMO_GSUP_SM_RP_CAUSE_IE (see GSM TS 04.11, 8.2.5.4), where both SM_RP_DA and SM_RP_OA IEs basically contain a single nested TV of the following format: - T: identity type (see 'osmo_gsup_sms_sm_rp_oda_t'), - V: encoded identity itself (optional). According to GSM TS 04.11, every single message on the SM-RL has an unique message reference (see 8.2.3), that is used to link an RP-ACK or RP-ERROR message to the associated (preceding) RP-DATA or RP-SMMA message transfer attempt. In case of TCAP/MAP, this message reference is being mapped to the Invoke ID. But since GSUP has no 'Invoke ID' IE, and it is not required for other applications (other than SMS), this change introduces a special 'SM_RP_MR' IE that doesn't exist in MAP. Change-Id: Ibe325c64ae2d6c626b232533bb4cbc65fc2b5d71 Related Change-Id: (docs) Ie0150756c33c1352bc4eb49421824542c711175c Related Change-Id: (TTCN) Ibf49474a81235096c032ea21f217170f523bd94e Related: OS#3587 --- tests/gsup/gsup_test.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++- tests/gsup/gsup_test.err | 44 +++++++++++++++++++++-------- tests/gsup/gsup_test.ok | 8 ++++++ 3 files changed, 112 insertions(+), 13 deletions(-) (limited to 'tests') diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c index 9712d77b..09368933 100644 --- a/tests/gsup/gsup_test.c +++ b/tests/gsup/gsup_test.c @@ -217,6 +217,69 @@ static void test_gsup_messages_dec_enc(void) 0x02, 0x01, 0x47, }; + static const uint8_t send_mo_forward_sm_req[] = { + 0x24, /* OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST */ + TEST_IMSI_IE, + + /* SM related IEs */ + 0x40, 0x01, /* SM-RP-MR (Message Reference) */ + 0xfa, + 0x41, 0x08, /* SM-RP-DA (Destination Address) */ + 0x03, /* SMSC address */ + 0x91, 0x52, 0x75, 0x47, 0x99, 0x09, 0x82, + 0x42, 0x01, /* SM-RP-OA (Originating Address) */ + 0xff, /* Special case: noSM-RP-OA */ + 0x43, 0x04, /* SM-RP-UI (TPDU) */ + 0xde, 0xad, 0xbe, 0xef, + }; + + static const uint8_t send_mt_forward_sm_req[] = { + 0x28, /* OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST */ + TEST_IMSI_IE, + + /* SM related IEs */ + 0x40, 0x01, /* SM-RP-MR (Message Reference) */ + 0xfa, + 0x41, 0x09, /* SM-RP-DA (Destination Address) */ + 0x01, /* IMSI */ + 0x21, 0x43, 0x65, 0x87, 0x09, 0x21, 0x43, 0xf5, + 0x42, 0x08, /* SM-RP-OA (Originating Address) */ + 0x03, /* SMSC address */ + 0x91, 0x52, 0x75, 0x47, 0x99, 0x09, 0x82, + 0x43, 0x04, /* SM-RP-UI (TPDU) */ + 0xde, 0xad, 0xbe, 0xef, + 0x45, 0x01, /* SM-RP-MMS (More Messages to Send) */ + 0x01, + }; + + static const uint8_t send_mo_mt_forward_sm_err[] = { + 0x25, /* OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR */ + TEST_IMSI_IE, + + /* Session related IEs */ + 0x30, 0x04, /* Session ID */ + 0xde, 0xad, 0xbe, 0xef, + 0x31, 0x01, /* Session state (END) */ + 0x03, + + /* SM related IEs */ + 0x40, 0x01, /* SM-RP-MR (Message Reference) */ + 0xfa, + 0x44, 0x01, /* SM-RP-Cause value */ + 0xaf, + }; + + static const uint8_t send_mo_mt_forward_sm_rsp[] = { + 0x2a, /* OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT */ + TEST_IMSI_IE, + + /* SM related IEs */ + 0x40, 0x01, /* SM-RP-MR (Message Reference) */ + 0xfa, + 0x43, 0x04, /* SM-RP-UI (TPDU) */ + 0xde, 0xad, 0xbe, 0xef, + }; + static const struct test { char *name; const uint8_t *data; @@ -256,6 +319,14 @@ static void test_gsup_messages_dec_enc(void) send_ussd_req, sizeof(send_ussd_req)}, {"SS/USSD processUnstructuredSS-Request / ReturnResult", send_ussd_res, sizeof(send_ussd_res)}, + {"MO-ForwardSM (MSC -> SMSC) Request", + send_mo_forward_sm_req, sizeof(send_mo_forward_sm_req)}, + {"MT-ForwardSM (MSC -> SMSC) Request", + send_mt_forward_sm_req, sizeof(send_mt_forward_sm_req)}, + {"MO-/MT-ForwardSM Response", + send_mo_mt_forward_sm_rsp, sizeof(send_mo_mt_forward_sm_rsp)}, + {"MO-/MT-ForwardSM Error", + send_mo_mt_forward_sm_err, sizeof(send_mo_mt_forward_sm_err)}, }; printf("Test GSUP message decoding/encoding\n"); @@ -323,7 +394,7 @@ static void test_gsup_messages_dec_enc(void) * FIXME: share the maximal IE value somehow * in order to avoid manual updating of this */ - OSMO_ASSERT(t->data[j+0] <= OSMO_GSUP_SS_INFO_IE); + OSMO_ASSERT(t->data[j+0] <= OSMO_GSUP_SM_RP_MMS_IE); OSMO_ASSERT(t->data[j+1] <= ie_end - j - 2); ie_end = j; diff --git a/tests/gsup/gsup_test.err b/tests/gsup/gsup_test.err index ac71ac24..4a1357c4 100644 --- a/tests/gsup/gsup_test.err +++ b/tests/gsup/gsup_test.err @@ -49,6 +49,18 @@ generated message: 22 01 08 21 43 65 87 09 21 43 f5 30 04 de ad be ef 31 01 03 35 08 a3 06 02 01 01 02 01 47 original message: 22 01 08 21 43 65 87 09 21 43 f5 30 04 de ad be ef 31 01 03 35 08 a3 06 02 01 01 02 01 47 IMSI: 123456789012345 + generated message: 24 01 08 21 43 65 87 09 21 43 f5 40 01 fa 41 08 03 91 52 75 47 99 09 82 42 01 ff 43 04 de ad be ef + original message: 24 01 08 21 43 65 87 09 21 43 f5 40 01 fa 41 08 03 91 52 75 47 99 09 82 42 01 ff 43 04 de ad be ef + IMSI: 123456789012345 + generated message: 28 01 08 21 43 65 87 09 21 43 f5 40 01 fa 41 09 01 21 43 65 87 09 21 43 f5 42 08 03 91 52 75 47 99 09 82 43 04 de ad be ef 45 01 01 + original message: 28 01 08 21 43 65 87 09 21 43 f5 40 01 fa 41 09 01 21 43 65 87 09 21 43 f5 42 08 03 91 52 75 47 99 09 82 43 04 de ad be ef 45 01 01 + IMSI: 123456789012345 + generated message: 2a 01 08 21 43 65 87 09 21 43 f5 40 01 fa 43 04 de ad be ef + original message: 2a 01 08 21 43 65 87 09 21 43 f5 40 01 fa 43 04 de ad be ef + IMSI: 123456789012345 + generated message: 25 01 08 21 43 65 87 09 21 43 f5 30 04 de ad be ef 31 01 03 40 01 fa 44 01 af + original message: 25 01 08 21 43 65 87 09 21 43 f5 30 04 de ad be ef 31 01 03 40 01 fa 44 01 af + IMSI: 123456789012345 message 0: tested 11 truncations, 11 parse failures message 1: tested 14 truncations, 13 parse failures message 2: tested 83 truncations, 81 parse failures @@ -66,21 +78,29 @@ message 14: tested 20 truncations, 18 parse failures message 15: tested 42 truncations, 39 parse failures message 16: tested 30 truncations, 27 parse failures + message 17: tested 33 truncations, 29 parse failures + message 18: tested 44 truncations, 39 parse failures + message 19: tested 20 truncations, 18 parse failures + message 20: tested 26 truncations, 22 parse failures DLGSUP Stopping DLGSUP logging message 0: tested 2816 modifications, 510 parse failures - message 1: tested 3584 modifications, 768 parse failures - message 2: tested 21248 modifications, 2571 parse failures + message 1: tested 3584 modifications, 770 parse failures + message 2: tested 21248 modifications, 2575 parse failures message 3: tested 2816 modifications, 510 parse failures - message 4: tested 3584 modifications, 768 parse failures - message 5: tested 20736 modifications, 4010 parse failures - message 6: tested 3584 modifications, 769 parse failures - message 7: tested 3584 modifications, 768 parse failures + message 4: tested 3584 modifications, 770 parse failures + message 5: tested 20736 modifications, 4022 parse failures + message 6: tested 3584 modifications, 771 parse failures + message 7: tested 3584 modifications, 770 parse failures message 8: tested 2816 modifications, 510 parse failures message 9: tested 2816 modifications, 510 parse failures - message 10: tested 3584 modifications, 768 parse failures - message 11: tested 3328 modifications, 767 parse failures - message 12: tested 54016 modifications, 4622 parse failures + message 10: tested 3584 modifications, 770 parse failures + message 11: tested 3328 modifications, 769 parse failures + message 12: tested 54016 modifications, 4626 parse failures message 13: tested 11520 modifications, 1026 parse failures - message 14: tested 5120 modifications, 1026 parse failures - message 15: tested 10752 modifications, 1256 parse failures - message 16: tested 7680 modifications, 1265 parse failures + message 14: tested 5120 modifications, 1030 parse failures + message 15: tested 10752 modifications, 1262 parse failures + message 16: tested 7680 modifications, 1271 parse failures + message 17: tested 8448 modifications, 2053 parse failures + message 18: tested 11264 modifications, 2307 parse failures + message 19: tested 5120 modifications, 1031 parse failures + message 20: tested 6656 modifications, 1546 parse failures diff --git a/tests/gsup/gsup_test.ok b/tests/gsup/gsup_test.ok index d63dd2d6..7a9455db 100644 --- a/tests/gsup/gsup_test.ok +++ b/tests/gsup/gsup_test.ok @@ -33,4 +33,12 @@ Test GSUP message decoding/encoding SS/USSD processUnstructuredSS-Request / Invoke OK Testing SS/USSD processUnstructuredSS-Request / ReturnResult SS/USSD processUnstructuredSS-Request / ReturnResult OK + Testing MO-ForwardSM (MSC -> SMSC) Request + MO-ForwardSM (MSC -> SMSC) Request OK + Testing MT-ForwardSM (MSC -> SMSC) Request + MT-ForwardSM (MSC -> SMSC) Request OK + Testing MO-/MT-ForwardSM Response + MO-/MT-ForwardSM Response OK + Testing MO-/MT-ForwardSM Error + MO-/MT-ForwardSM Error OK Done. -- cgit v1.2.3