[PATCH] libosmocore[master]: gsm0480: modify USSD structures to support external handling

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.org
Sat Jul 29 08:04:25 UTC 2017


Review at  https://gerrit.osmocom.org/3374

gsm0480: modify USSD structures to support external handling

This change adds the following new fields to ss_request struct:

  - 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

Also, the MAX_LEN_USSD_STRING was increased to 182.

Change-Id: I5f8972b86cd4dcb54b643a24b5794a87c8758073
---
M include/osmocom/gsm/gsm0480.h
M src/gsm/gsm0480.c
2 files changed, 33 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/74/3374/1

diff --git a/include/osmocom/gsm/gsm0480.h b/include/osmocom/gsm/gsm0480.h
index 672ffe5..e3b15d2 100644
--- a/include/osmocom/gsm/gsm0480.h
+++ b/include/osmocom/gsm/gsm0480.h
@@ -7,7 +7,7 @@
 #include <osmocom/gsm/protocol/gsm_04_08.h>
 #include <osmocom/gsm/protocol/gsm_04_80.h>
 
-#define MAX_LEN_USSD_STRING	31
+#define MAX_LEN_USSD_STRING	182
 
 /* deprecated */
 struct ussd_request {
@@ -21,11 +21,31 @@
 				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];
+	/*! 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,
diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 38693d4..1c01e64 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -264,6 +264,7 @@
 	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");
@@ -333,6 +334,8 @@
 			LOGP(0, LOGL_ERROR, "Component does not fit.\n");
 			return 0;
 		}
+
+		req->component_type = component_type;
 
 		switch (component_type) {
 		case GSM0480_CTYPE_INVOKE:
@@ -443,9 +446,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;
 			}
 		}

-- 
To view, visit https://gerrit.osmocom.org/3374
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f8972b86cd4dcb54b643a24b5794a87c8758073
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>



More information about the gerrit-log mailing list