summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO-RELEASE4
-rw-r--r--include/osmocom/gsm/gsm0480.h12
-rw-r--r--src/gsm/gsm0480.c26
3 files changed, 32 insertions, 10 deletions
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 928b18d6..16496d68 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -10,4 +10,6 @@
core msgb_queue_free() add inline func to msgb.h
coding gsm0503_rach_ext-encode() add func to gsm0503_coding.h
codec ecu.c / ecu.h implement ECU for FR (Error Concealment Unit)
-fsm fsmc / fsm.h added callback for graceful exit => ABI changed \ No newline at end of file
+fsm fsmc / fsm.h added callback for graceful exit => ABI changed
+gsm gsm0480.c / gsm0480.h the 'ss_request' struct extended with ussd_data,
+ ussd_data_len, and ussd_data_dcs => ABI changed
diff --git a/include/osmocom/gsm/gsm0480.h b/include/osmocom/gsm/gsm0480.h
index 05c26dfc..b0b6aa29 100644
--- a/include/osmocom/gsm/gsm0480.h
+++ b/include/osmocom/gsm/gsm0480.h
@@ -67,6 +67,18 @@ struct ss_request {
uint8_t ussd_text[GSM0480_USSD_OCTET_STRING_LEN];
/**
+ * Represents the data of either an INVOKE, either
+ * a RETURN_RESULT component 'as is'. Useful when
+ * decoding is not supported or not desired.
+ *
+ * Shall be always followed by its length (in bytes)
+ * and DCS (Data Coding Scheme).
+ */
+ uint8_t ussd_data[GSM0480_USSD_OCTET_STRING_LEN];
+ uint8_t ussd_data_len; /* Length in bytes */
+ uint8_t ussd_data_dcs; /* Data Coding Scheme */
+
+ /**
* GSM TS 04.80, section 3.3 "Transaction identifier"
* See GSM TS 04.07, section 11.2.3 for details.
*/
diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 0072812d..38082b32 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -557,6 +557,11 @@ static int parse_process_uss_data(const uint8_t *uss_req_data, uint16_t length,
memcpy(req->ussd_text, uss_req_data + 2, num_chars);
+ /* Copy the data 'as is' */
+ memcpy(req->ussd_data, uss_req_data + 2, num_chars);
+ req->ussd_data_len = num_chars;
+ req->ussd_data_dcs = 0x00;
+
return 1;
}
@@ -580,6 +585,17 @@ static int parse_process_uss_req(const uint8_t *uss_req_data, uint16_t length,
/* Get DCS (Data Coding Scheme) */
dcs = uss_req_data[4];
+ /* Get the amount of bytes */
+ num_chars = uss_req_data[6];
+
+ /* Prevent a mobile-originated buffer-overrun! */
+ if (num_chars > GSM0480_USSD_OCTET_STRING_LEN)
+ num_chars = GSM0480_USSD_OCTET_STRING_LEN;
+
+ /* Copy the data 'as is' */
+ memcpy(req->ussd_data, uss_req_data + 7, num_chars);
+ req->ussd_data_len = num_chars;
+ req->ussd_data_dcs = dcs;
/**
* According to GSM 04.08, 4.4.2 "ASN.1 data types":
@@ -588,7 +604,7 @@ static int parse_process_uss_req(const uint8_t *uss_req_data, uint16_t length,
*/
if (dcs == 0x0F) {
/* Calculate the amount of 7-bit characters */
- num_chars = (uss_req_data[6] * 8) / 7;
+ num_chars = (num_chars * 8) / 7;
/* Prevent a mobile-originated buffer-overrun! */
if (num_chars > GSM0480_USSD_7BIT_STRING_LEN)
@@ -599,15 +615,7 @@ static int parse_process_uss_req(const uint8_t *uss_req_data, uint16_t length,
return 1;
} else {
- /* Get the amount of 8-bit characters */
- num_chars = uss_req_data[6];
-
- /* Prevent a mobile-originated buffer-overrun! */
- if (num_chars > GSM0480_USSD_OCTET_STRING_LEN)
- num_chars = GSM0480_USSD_OCTET_STRING_LEN;
-
memcpy(req->ussd_text, &(uss_req_data[7]), num_chars);
-
return 1;
}