Change in libosmocore[master]: USSD: Introduce gsm0480_gen_ussd_resp_7bit()

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Jul 29 14:39:36 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10220 )

Change subject: USSD: Introduce gsm0480_gen_ussd_resp_7bit()
......................................................................

USSD: Introduce gsm0480_gen_ussd_resp_7bit()

Contrary to the existing gsm0480_create_ussd_resp(), the new function
only generates the value part of the FACILITY IE, and not the IE
Tag/Length or the 04.08 L3 header.  This is needed in the context of
GSUP-encapsulated USSD, as here we don't work with L3 messages, but
only pass on the FACILITY IE value.

Change-Id: Ide240279240322f643e142229eb7829f538c6314
---
M include/osmocom/gsm/gsm0480.h
M src/gsm/gsm0480.c
M src/gsm/libosmogsm.map
3 files changed, 24 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/gsm/gsm0480.h b/include/osmocom/gsm/gsm0480.h
index 6a596ea..9fa84b0 100644
--- a/include/osmocom/gsm/gsm0480.h
+++ b/include/osmocom/gsm/gsm0480.h
@@ -109,6 +109,7 @@
 				struct ss_request *request);
 
 struct msgb *gsm0480_msgb_alloc_name(const char *name);
+struct msgb *gsm0480_gen_ussd_resp_7bit(uint8_t invoke_id, const char *text);
 
 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 ac0fa12..db28f0d 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -792,7 +792,11 @@
 	return msgb_alloc_headroom(1024, 128, name);
 }
 
-struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text)
+/*! Generate a USSD ReturnResult component containing a string in default GSM alphabet.
+ * \param[in] invoke_id		InvokeID of the request to which we respond
+ * \param[in] text		USSD text in ASCII; to be encoded as GSM 7-but alphabet
+ */
+struct msgb *gsm0480_gen_ussd_resp_7bit(uint8_t invoke_id, const char *text)
 {
 	struct msgb *msg;
 	uint8_t *ptr8;
@@ -829,6 +833,23 @@
 	/* Wrap this up as a Return Result component */
 	msgb_wrap_with_TL(msg, GSM0480_CTYPE_RETURN_RESULT);
 
+	return msg;
+}
+
+/*! Legacy helper: Generate USSD response including FACILITY IE + L3 header.
+ *
+ * This function is just like \ref gsm0480_gen_ussd_resp_7bit, but it generates
+ * not only the FACILITY value, but the full L3 message including message header
+ * and FACILITY IE Tag+Length.
+ */
+struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text)
+{
+	struct msgb *msg;
+
+	msg = gsm0480_gen_ussd_resp_7bit(invoke_id, text);
+	if (!msg)
+		return NULL;
+
 	/* Wrap the component in a Facility message */
 	msgb_wrap_with_TL(msg, GSM0480_IE_FACILITY);
 
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 312c990..d21514c 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -98,6 +98,7 @@
 gsm0480_comp_type_names;
 gsm0480_op_code_names;
 gsm0480_msgb_alloc_name;
+gsm0480_gen_ussd_resp_7bit;
 
 gsm0502_calc_paging_group;
 

-- 
To view, visit https://gerrit.osmocom.org/10220
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ide240279240322f643e142229eb7829f538c6314
Gerrit-Change-Number: 10220
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180729/ec4184c6/attachment.htm>


More information about the gerrit-log mailing list