<p>Harald Welte has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/10220">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">USSD: Introduce gsm0480_gen_ussd_resp_7bit()<br><br>Contrary to the existing gsm0480_create_ussd_resp(), the new function<br>only generates the value part of the FACILITY IE, and not the IE<br>Tag/Length or the 04.08 L3 header.  This is needed in the context of<br>GSUP-encapsulated USSD, as here we don't work with L3 messages, but<br>only pass on the FACILITY IE value.<br><br>Change-Id: Ide240279240322f643e142229eb7829f538c6314<br>---<br>M include/osmocom/gsm/gsm0480.h<br>M src/gsm/gsm0480.c<br>M src/gsm/libosmogsm.map<br>3 files changed, 24 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/20/10220/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/gsm/gsm0480.h b/include/osmocom/gsm/gsm0480.h</span><br><span>index 6a596ea..9fa84b0 100644</span><br><span>--- a/include/osmocom/gsm/gsm0480.h</span><br><span>+++ b/include/osmocom/gsm/gsm0480.h</span><br><span>@@ -109,6 +109,7 @@</span><br><span>                              struct ss_request *request);</span><br><span> </span><br><span> struct msgb *gsm0480_msgb_alloc_name(const char *name);</span><br><span style="color: hsl(120, 100%, 40%);">+struct msgb *gsm0480_gen_ussd_resp_7bit(uint8_t invoke_id, const char *text);</span><br><span> </span><br><span> struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text);</span><br><span> struct msgb *gsm0480_create_unstructuredSS_Notify(int alertPattern, const char *text);</span><br><span>diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c</span><br><span>index ac0fa12..db28f0d 100644</span><br><span>--- a/src/gsm/gsm0480.c</span><br><span>+++ b/src/gsm/gsm0480.c</span><br><span>@@ -792,7 +792,11 @@</span><br><span>    return msgb_alloc_headroom(1024, 128, name);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text)</span><br><span style="color: hsl(120, 100%, 40%);">+/*! Generate a USSD ReturnResult component containing a string in default GSM alphabet.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] invoke_id             InvokeID of the request to which we respond</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] text         USSD text in ASCII; to be encoded as GSM 7-but alphabet</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+struct msgb *gsm0480_gen_ussd_resp_7bit(uint8_t invoke_id, const char *text)</span><br><span> {</span><br><span>      struct msgb *msg;</span><br><span>    uint8_t *ptr8;</span><br><span>@@ -829,6 +833,23 @@</span><br><span>        /* Wrap this up as a Return Result component */</span><br><span>      msgb_wrap_with_TL(msg, GSM0480_CTYPE_RETURN_RESULT);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+      return msg;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*! Legacy helper: Generate USSD response including FACILITY IE + L3 header.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This function is just like \ref gsm0480_gen_ussd_resp_7bit, but it generates</span><br><span style="color: hsl(120, 100%, 40%);">+ * not only the FACILITY value, but the full L3 message including message header</span><br><span style="color: hsl(120, 100%, 40%);">+ * and FACILITY IE Tag+Length.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+   struct msgb *msg;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   msg = gsm0480_gen_ussd_resp_7bit(invoke_id, text);</span><br><span style="color: hsl(120, 100%, 40%);">+    if (!msg)</span><br><span style="color: hsl(120, 100%, 40%);">+             return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>       /* Wrap the component in a Facility message */</span><br><span>       msgb_wrap_with_TL(msg, GSM0480_IE_FACILITY);</span><br><span> </span><br><span>diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map</span><br><span>index 312c990..d21514c 100644</span><br><span>--- a/src/gsm/libosmogsm.map</span><br><span>+++ b/src/gsm/libosmogsm.map</span><br><span>@@ -98,6 +98,7 @@</span><br><span> gsm0480_comp_type_names;</span><br><span> gsm0480_op_code_names;</span><br><span> gsm0480_msgb_alloc_name;</span><br><span style="color: hsl(120, 100%, 40%);">+gsm0480_gen_ussd_resp_7bit;</span><br><span> </span><br><span> gsm0502_calc_paging_group;</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10220">change 10220</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/10220"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ide240279240322f643e142229eb7829f538c6314 </div>
<div style="display:none"> Gerrit-Change-Number: 10220 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Harald Welte <laforge@gnumonks.org> </div>