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/3374 to look at the new patch set (#3). gsm0480: modify USSD structures to support external handling This change renames the 'ss_request' struct to 'gsm0480_ss_request', and adds the following new fields: - message_type - GSM 04.80 Chapter 2.2 - component_type - GSM 04.80 Chapter 3.6.2 - error_code - GSM 04.80 Chapter 3.6.6 - problem_code - GSM 04.80 Chapter 3.6.7 - ussd_text_language - ussd_text_len in order to pave the way for the further patches to allow communicating un-parsed SS/USSD to an external application, and avoid parsing the whole SS/USSD request every time. As this brokes the API/ABI, the code compiled against the old version of the library will no longer work due to the missing symbol. Change-Id: I5f8972b86cd4dcb54b643a24b5794a87c8758073 --- M TODO-RELEASE M include/osmocom/gsm/gsm0480.h M src/gsm/gsm0480.c M tests/ussd/ussd_test.c 4 files changed, 54 insertions(+), 26 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/74/3374/3 diff --git a/TODO-RELEASE b/TODO-RELEASE index a5def79..da0e82a 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -9,3 +9,4 @@ #library what description / commit summary line core msgb_queue_free() add inline func to msgb.h coding gsm0503_rach_ext-encode() add func to gsm0503_coding.h +gsm GSM 04.80 API + ABI facilitate external USSD interface diff --git a/include/osmocom/gsm/gsm0480.h b/include/osmocom/gsm/gsm0480.h index 672ffe5..781d8d7 100644 --- a/include/osmocom/gsm/gsm0480.h +++ b/include/osmocom/gsm/gsm0480.h @@ -20,16 +20,36 @@ int gsm0480_decode_ussd_request(const struct gsm48_hdr *hdr, uint16_t len, struct ussd_request *request) OSMO_DEPRECATED("Use gsm0480_decode_ss_request() instead"); -struct ss_request { - uint8_t opcode; - uint8_t ss_code; - uint8_t ussd_text[MAX_LEN_USSD_STRING + 1]; +struct gsm0480_ss_request { + /*! L3 transaction ID */ uint8_t transaction_id; + /*! Message type 2.2 */ + uint8_t message_type; + + /*! Component type 3.6.2 */ + uint8_t component_type; + /*! Invoke id 3.6.3 */ uint8_t invoke_id; + + union { + /*! Operational code 3.6.4 */ + uint8_t opcode; + /*! Error code 3.6.6 */ + uint8_t error_code; + /*! Problem code 3.6.7 */ + uint8_t problem_code; + }; + + uint8_t ussd_text_len; + uint8_t ussd_text_language; + uint8_t ussd_text[MAX_LEN_USSD_STRING + 1]; + + /*! Parameters of a Interrogate/Activate/DeactivateSS Request */ + uint8_t ss_code; }; int gsm0480_decode_ss_request(const struct gsm48_hdr *hdr, uint16_t len, - struct ss_request *request); + struct gsm0480_ss_request *request); struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text); struct msgb *gsm0480_create_unstructuredSS_Notify(int alertPattern, const char *text); diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c index 71470e5..9cfe336 100644 --- a/src/gsm/gsm0480.c +++ b/src/gsm/gsm0480.c @@ -195,24 +195,24 @@ /* Forward declarations */ static int parse_ss(const struct gsm48_hdr *hdr, - uint16_t len, struct ss_request *req); + uint16_t len, struct gsm0480_ss_request *req); static int parse_ss_info_elements(const uint8_t *ussd_ie, uint16_t len, - struct ss_request *req); + struct gsm0480_ss_request *req); static int parse_facility_ie(const uint8_t *facility_ie, uint16_t length, - struct ss_request *req); + struct gsm0480_ss_request *req); static int parse_ss_invoke(const uint8_t *invoke_data, uint16_t length, - struct ss_request *req); + struct gsm0480_ss_request *req); static int parse_process_uss_req(const uint8_t *uss_req_data, uint16_t length, - struct ss_request *req); + struct gsm0480_ss_request *req); static int parse_ss_for_bs_req(const uint8_t *ss_req_data, uint16_t length, - struct ss_request *req); + struct gsm0480_ss_request *req); /* Decode a mobile-originated USSD-request message */ int gsm0480_decode_ussd_request(const struct gsm48_hdr *hdr, uint16_t len, struct ussd_request *req) { - struct ss_request ss; + struct gsm0480_ss_request ss; int rc = 0; memset(&ss, 0, sizeof(ss)); @@ -228,7 +228,7 @@ ss.transaction_id = req->transaction_id; rc = parse_ss(hdr, len, &ss); - /* convert from ss_request to legacy ussd_request */ + /* convert from gsm0480_ss_request to legacy ussd_request */ req->transaction_id = ss.transaction_id; req->invoke_id = ss.invoke_id; if (ss.ussd_text[0] == 0xFF) @@ -247,7 +247,7 @@ /* Decode a mobile-originated SS request message */ int gsm0480_decode_ss_request(const struct gsm48_hdr *hdr, uint16_t len, - struct ss_request *req) + struct gsm0480_ss_request *req) { int rc = 0; @@ -267,11 +267,13 @@ return rc; } -static int parse_ss(const struct gsm48_hdr *hdr, uint16_t len, struct ss_request *req) +static int parse_ss(const struct gsm48_hdr *hdr, uint16_t len, + struct gsm0480_ss_request *req) { int rc = 1; uint8_t msg_type = hdr->msg_type & 0x3F; /* message-type - section 3.4 */ + req->message_type = msg_type; switch (msg_type) { case GSM0480_MTYPE_RELEASE_COMPLETE: LOGP(0, LOGL_DEBUG, "SS Release Complete\n"); @@ -293,7 +295,7 @@ } static int parse_ss_info_elements(const uint8_t *ss_ie, uint16_t len, - struct ss_request *req) + struct gsm0480_ss_request *req) { int rc = -1; /* Information Element Identifier - table 3.2 & GSM 04.08 section 10.5 */ @@ -326,7 +328,7 @@ } static int parse_facility_ie(const uint8_t *facility_ie, uint16_t length, - struct ss_request *req) + struct gsm0480_ss_request *req) { int rc = 1; uint8_t offset = 0; @@ -341,6 +343,8 @@ LOGP(0, LOGL_ERROR, "Component does not fit.\n"); return 0; } + + req->component_type = component_type; switch (component_type) { case GSM0480_CTYPE_INVOKE: @@ -368,7 +372,7 @@ /* Parse an Invoke component - see table 3.3 */ static int parse_ss_invoke(const uint8_t *invoke_data, uint16_t length, - struct ss_request *req) + struct gsm0480_ss_request *req) { int rc = 1; uint8_t offset; @@ -430,7 +434,7 @@ /* Parse the parameters of a Process UnstructuredSS Request */ static int parse_process_uss_req(const uint8_t *uss_req_data, uint16_t length, - struct ss_request *req) + struct gsm0480_ss_request *req) { int rc = 0; int num_chars; @@ -451,9 +455,12 @@ /* Prevent a mobile-originated buffer-overrun! */ if (num_chars > MAX_LEN_USSD_STRING) num_chars = MAX_LEN_USSD_STRING; - gsm_7bit_decode_n_ussd((char *)req->ussd_text, - sizeof(req->ussd_text), - &(uss_req_data[7]), num_chars); + + num_chars = gsm_7bit_decode_n_ussd((char *)req->ussd_text, + sizeof(req->ussd_text), &(uss_req_data[7]), num_chars); + + req->ussd_text_language = 0x80; + req->ussd_text_len = num_chars; rc = 1; } } @@ -464,7 +471,7 @@ /* Parse the parameters of a Interrogate/Activate/DeactivateSS Request */ static int parse_ss_for_bs_req(const uint8_t *ss_req_data, uint16_t length, - struct ss_request *req) + struct gsm0480_ss_request *req) { int rc = 0; diff --git a/tests/ussd/ussd_test.c b/tests/ussd/ussd_test.c index 40b4317..e5a734f 100644 --- a/tests/ussd/ussd_test.c +++ b/tests/ussd/ussd_test.c @@ -44,7 +44,7 @@ { uint8_t *data; int rc; - struct ss_request req; + struct gsm0480_ss_request req; struct gsm48_hdr *hdr; data = malloc(len); @@ -60,7 +60,7 @@ { uint8_t *data; int rc; - struct ss_request req; + struct gsm0480_ss_request req; struct gsm48_hdr *hdr; data = malloc(len); @@ -119,7 +119,7 @@ int main(int argc, char **argv) { - struct ss_request req; + struct gsm0480_ss_request req; const int size = sizeof(ussd_request); int i; struct msgb *msg; -- To view, visit https://gerrit.osmocom.org/3374 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I5f8972b86cd4dcb54b643a24b5794a87c8758073 Gerrit-PatchSet: 3 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: Ivan Kluchnikov <kluchnikovi at gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>