From 72696040dfac41512c672f71f2b3712656641a7f Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sat, 7 Apr 2018 02:34:55 +0700 Subject: GSUP: implement TCAP-like session management Unlike TCAP/MAP, GSUP is just a transport layer without the dialogue/context. This prevents us from having session based communication, required e.g. for USSD. But we can emulate TCAP dialogue by adding additional IEs, which would allow to relate each message to a particular session. This change introduces the following IEs: - OSMO_GSUP_SESSION_ID_IE, - OSMO_GSUP_SESSION_STATE_IE, which optionally can be used to indicate that the message is related to a session with given ID, and to manage session state, i.e. initiate, continue, and finish. Change-Id: I1cee271fed0284a134ffed103c0d4bebbcfde2a8 Related: OS#1597 --- tests/gsup/gsup_test.c | 13 ++++++++++++- tests/gsup/gsup_test.err | 5 +++++ tests/gsup/gsup_test.ok | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'tests/gsup') diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c index acc7274f..6ead7d28 100644 --- a/tests/gsup/gsup_test.c +++ b/tests/gsup/gsup_test.c @@ -171,6 +171,15 @@ static void test_gsup_messages_dec_enc(void) 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, }; + static const uint8_t dummy_session_ies[] = { + 0x2b, /* Dummy value, we only interested in IE coding */ + TEST_IMSI_IE, + + /* Session ID and state */ + 0x30, 0x04, 0xde, 0xad, 0xbe, 0xef, + 0x31, 0x01, 0x01, + }; + static const struct test { char *name; const uint8_t *data; @@ -204,6 +213,8 @@ static void test_gsup_messages_dec_enc(void) send_auth_info_res_umts, sizeof(send_auth_info_res_umts)}, {"Send Authentication Info Request with AUTS and RAND (UMTS)", send_auth_info_req_auts, sizeof(send_auth_info_req_auts)}, + {"Dummy message with session IEs", + dummy_session_ies, sizeof(dummy_session_ies)}, }; printf("Test GSUP message decoding/encoding\n"); @@ -267,7 +278,7 @@ static void test_gsup_messages_dec_enc(void) osmo_hexdump(t->data + j, ie_end - j)); OSMO_ASSERT(j <= ie_end - 2); - OSMO_ASSERT(t->data[j+0] <= OSMO_GSUP_CN_DOMAIN_IE); + OSMO_ASSERT(t->data[j+0] <= OSMO_GSUP_SESSION_STATE_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 05c64fe4..5c010e6c 100644 --- a/tests/gsup/gsup_test.err +++ b/tests/gsup/gsup_test.err @@ -40,6 +40,9 @@ generated message: 08 01 08 21 43 65 87 09 21 43 f5 26 0e 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 original message: 08 01 08 21 43 65 87 09 21 43 f5 26 0e 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 20 10 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 IMSI: 123456789012345 + generated message: 2b 01 08 21 43 65 87 09 21 43 f5 30 04 de ad be ef 31 01 01 + original message: 2b 01 08 21 43 65 87 09 21 43 f5 30 04 de ad be ef 31 01 01 + 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 @@ -54,6 +57,7 @@ message 11: tested 13 truncations, 12 parse failures message 12: tested 211 truncations, 209 parse failures message 13: tested 45 truncations, 43 parse failures + message 14: tested 20 truncations, 18 parse failures DLGSUP Stopping DLGSUP logging message 0: tested 2816 modifications, 510 parse failures message 1: tested 3584 modifications, 768 parse failures @@ -69,3 +73,4 @@ DLGSUP Stopping DLGSUP logging message 11: tested 3328 modifications, 767 parse failures message 12: tested 54016 modifications, 4622 parse failures message 13: tested 11520 modifications, 1026 parse failures + message 14: tested 5120 modifications, 1026 parse failures diff --git a/tests/gsup/gsup_test.ok b/tests/gsup/gsup_test.ok index 49a85ba6..1f599025 100644 --- a/tests/gsup/gsup_test.ok +++ b/tests/gsup/gsup_test.ok @@ -27,4 +27,6 @@ Test GSUP message decoding/encoding Send Authentication Info Result with IK, CK, AUTN and RES (UMTS) OK Testing Send Authentication Info Request with AUTS and RAND (UMTS) Send Authentication Info Request with AUTS and RAND (UMTS) OK + Testing Dummy message with session IEs + Dummy message with session IEs OK Done. -- cgit v1.2.3