This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Vadim Yanitskiy gerrit-no-reply at lists.osmocom.orgHello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/7600 to look at the new patch set (#2). GSUP: add USSD encoding / decoding support In order to be able to transfer USSD messages via GSUP, this change introduces the new message types OSMO_GSUP_MSGT_USSD_*, and a few new information elements: - OSMO_GSUP_USSD_SID_IE, - OSMO_GSUP_USSD_PAYLOAD_IE. The 'osmo_gsup_message' structure was extended with a few new fields, which carry the L3 bytes of USSD payload, its length, and unique USSD session ID. Change-Id: Ie17a78043a35fffbdd59e80fd2b2da39cce5e532 Related: OS#1597 --- M include/osmocom/gsm/gsup.h M src/gsm/gsup.c M tests/gsup/gsup_test.c M tests/gsup/gsup_test.err M tests/gsup/gsup_test.ok 5 files changed, 105 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/00/7600/2 diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h index 1a8a3b2..7b7e0ef 100644 --- a/include/osmocom/gsm/gsup.h +++ b/include/osmocom/gsm/gsup.h @@ -81,6 +81,9 @@ OSMO_GSUP_AUTS_IE = 0x26, OSMO_GSUP_RES_IE = 0x27, OSMO_GSUP_CN_DOMAIN_IE = 0x28, + /* USSD support */ + OSMO_GSUP_USSD_SID_IE = 0x29, + OSMO_GSUP_USSD_PAYLOAD_IE = 0x30, }; /*! GSUP message type */ @@ -110,6 +113,10 @@ OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST = 0b00011100, OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR = 0b00011101, OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT = 0b00011110, + + OSMO_GSUP_MSGT_USSD_REQUEST = 0b00100000, + OSMO_GSUP_MSGT_USSD_ERROR = 0b00100001, + OSMO_GSUP_MSGT_USSD_RESULT = 0b00100010, }; #define OSMO_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b00000011) == 0b00) @@ -175,6 +182,9 @@ enum osmo_gsup_cn_domain cn_domain; const uint8_t *pdp_charg_enc; size_t pdp_charg_enc_len; + const uint8_t *ussd_payload; + size_t ussd_payload_len; + uint32_t ussd_sid; }; int osmo_gsup_decode(const uint8_t *data, size_t data_len, diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index b6ac56d..d43af9b 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -29,6 +29,7 @@ #include <osmocom/gsm/gsup.h> #include <stdint.h> +#include <arpa/inet.h> /*! \addtogroup gsup * @{ @@ -62,6 +63,10 @@ OSMO_VALUE_STRING(OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST), OSMO_VALUE_STRING(OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR), OSMO_VALUE_STRING(OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT), + + OSMO_VALUE_STRING(OSMO_GSUP_MSGT_USSD_REQUEST), + OSMO_VALUE_STRING(OSMO_GSUP_MSGT_USSD_ERROR), + OSMO_VALUE_STRING(OSMO_GSUP_MSGT_USSD_RESULT), { 0, NULL } }; @@ -261,6 +266,7 @@ /* specific parts */ while (data_len > 0) { + uint32_t *ussd_sid; enum osmo_gsup_iei iei; struct osmo_gsup_pdp_info pdp_info; struct osmo_auth_vector auth_info; @@ -385,6 +391,16 @@ gsup_msg->pdp_charg_enc_len = value_len; break; + case OSMO_GSUP_USSD_SID_IE: + ussd_sid = (uint32_t *) value; + gsup_msg->ussd_sid = ntohl(*ussd_sid); + break; + + case OSMO_GSUP_USSD_PAYLOAD_IE: + gsup_msg->ussd_payload = value; + gsup_msg->ussd_payload_len = value_len; + break; + default: LOGP(DLGSUP, LOGL_NOTICE, "GSUP IE type %d unknown\n", iei); @@ -483,6 +499,7 @@ int idx; uint8_t bcd_buf[GSM48_MI_SIZE] = {0}; size_t bcd_len; + uint32_t ussd_sid; /* generic part */ if(!gsup_msg->message_type) @@ -564,6 +581,17 @@ gsup_msg->pdp_charg_enc_len, gsup_msg->pdp_charg_enc); } + if (gsup_msg->ussd_sid) { + ussd_sid = htonl(gsup_msg->ussd_sid); + msgb_tlv_put(msg, OSMO_GSUP_USSD_SID_IE, + sizeof(gsup_msg->ussd_sid), (uint8_t *) &ussd_sid); + } + + if (gsup_msg->ussd_payload) { + msgb_tlv_put(msg, OSMO_GSUP_USSD_PAYLOAD_IE, + gsup_msg->ussd_payload_len, gsup_msg->ussd_payload); + } + return 0; } diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c index b55f1d9..437b07f 100644 --- a/tests/gsup/gsup_test.c +++ b/tests/gsup/gsup_test.c @@ -171,6 +171,56 @@ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, }; + static const uint8_t send_ussd_req[] = { + 0x20, + TEST_IMSI_IE, + /* USSD_SID_IE */ + 0x29, 0x04, 0xde, 0xad, 0xbe, 0xef, + /* USSD_PAYLOAD_IE */ + 0x30, 0x19, + /** + * Protocol Discriminator: Non call related SS messages + * Message Type: Register (0x3b), SQN: 1 + */ + 0x0b, 0x7b, 0x1c, 0x15, 0xa1, 0x13, 0x02, 0x01, + 0x05, 0x02, 0x01, 0x3b, + /** + * Coding: GSM 7 bit default alphabet + * Language: Language unspecified (15) + */ + 0x30, 0x0b, 0x04, 0x01, 0x0f, + /** + * USSD String: *#100# + */ + 0x04, 0x06, 0xaa, 0x51, 0x0c, 0x06, 0x1b, 0x01, + }; + + static const uint8_t send_ussd_res[] = { + 0x22, + TEST_IMSI_IE, + /* USSD_SID_IE */ + 0x29, 0x04, 0xde, 0xad, 0xbe, 0xef, + /* USSD_PAYLOAD_IE */ + 0x30, 0x2b, + /** + * Protocol Discriminator: Non call related SS messages + * Message Type: Release Complete (0x2a), SQN: 0 + */ + 0x8b, 0x2a, 0x1c, 0x27, 0xa2, 0x25, 0x02, 0x01, + 0x05, 0x30, 0x20, 0x02, 0x01, 0x3b, + /** + * Coding: GSM 7 bit default alphabet + * Language: Language unspecified (15) + */ + 0x30, 0x1b, 0x04, 0x01, 0x0f, + /** + * USSD String: Your extension is 01393 + */ + 0x04, 0x16, 0xd9, 0x77, 0x5d, 0x0e, 0x2a, 0xe3, + 0xe9, 0x65, 0xf7, 0x3c, 0xfd, 0x76, 0x83, 0xd2, + 0x73, 0x10, 0x2c, 0x36, 0xcb, 0xcd, 0x1a, 0x0d, + }; + static const struct test { char *name; const uint8_t *data; @@ -204,6 +254,8 @@ 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)}, + {"USSD Request", send_ussd_req, sizeof(send_ussd_req)}, + {"USSD Result", send_ussd_res, sizeof(send_ussd_res)}, }; printf("Test GSUP message decoding/encoding\n"); @@ -267,7 +319,7 @@ 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_USSD_PAYLOAD_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 05c64fe..eb4ca0d 100644 --- a/tests/gsup/gsup_test.err +++ b/tests/gsup/gsup_test.err @@ -40,6 +40,12 @@ 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: 20 01 08 21 43 65 87 09 21 43 f5 29 04 de ad be ef 30 19 0b 7b 1c 15 a1 13 02 01 05 02 01 3b 30 0b 04 01 0f 04 06 aa 51 0c 06 1b 01 + original message: 20 01 08 21 43 65 87 09 21 43 f5 29 04 de ad be ef 30 19 0b 7b 1c 15 a1 13 02 01 05 02 01 3b 30 0b 04 01 0f 04 06 aa 51 0c 06 1b 01 + IMSI: 123456789012345 + generated message: 22 01 08 21 43 65 87 09 21 43 f5 29 04 de ad be ef 30 2b 8b 2a 1c 27 a2 25 02 01 05 30 20 02 01 3b 30 1b 04 01 0f 04 16 d9 77 5d 0e 2a e3 e9 65 f7 3c fd 76 83 d2 73 10 2c 36 cb cd 1a 0d + original message: 22 01 08 21 43 65 87 09 21 43 f5 29 04 de ad be ef 30 2b 8b 2a 1c 27 a2 25 02 01 05 30 20 02 01 3b 30 1b 04 01 0f 04 16 d9 77 5d 0e 2a e3 e9 65 f7 3c fd 76 83 d2 73 10 2c 36 cb cd 1a 0d + 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 +60,8 @@ 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 44 truncations, 42 parse failures + message 15: tested 62 truncations, 60 parse failures DLGSUP Stopping DLGSUP logging message 0: tested 2816 modifications, 510 parse failures message 1: tested 3584 modifications, 768 parse failures @@ -69,3 +77,5 @@ 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 11264 modifications, 1007 parse failures + message 15: tested 15872 modifications, 1006 parse failures diff --git a/tests/gsup/gsup_test.ok b/tests/gsup/gsup_test.ok index 49a85ba..5c45ab0 100644 --- a/tests/gsup/gsup_test.ok +++ b/tests/gsup/gsup_test.ok @@ -27,4 +27,8 @@ 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 USSD Request + USSD Request OK + Testing USSD Result + USSD Result OK Done. -- To view, visit https://gerrit.osmocom.org/7600 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ie17a78043a35fffbdd59e80fd2b2da39cce5e532 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com> Gerrit-Reviewer: Alexander Chemeris <Alexander.Chemeris at gmail.com> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>