<p>Vadim Yanitskiy has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/9370">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">msc: introduce USSD helper functions<br><br>Change-Id: Ic528b968a9bc7c12e8395364e895400aa016c8f5<br>---<br>A msc/USSD_Helpers.ttcn<br>M msc/gen_links.sh<br>2 files changed, 62 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/70/9370/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/msc/USSD_Helpers.ttcn b/msc/USSD_Helpers.ttcn</span><br><span>new file mode 100644</span><br><span>index 0000000..d9f05a8</span><br><span>--- /dev/null</span><br><span>+++ b/msc/USSD_Helpers.ttcn</span><br><span>@@ -0,0 +1,61 @@</span><br><span style="color: hsl(120, 100%, 40%);">+module USSD_Helpers {</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* USSD helpers for composing messages, building on top</span><br><span style="color: hsl(120, 100%, 40%);">+ * of both L3_Templates and USSD_Templates.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * (C) 2018 by Vadim Yanitskiy <axilirator@gmail.com></span><br><span style="color: hsl(120, 100%, 40%);">+ * All rights reserved.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Released under the terms of GNU General Public License, Version 2 or</span><br><span style="color: hsl(120, 100%, 40%);">+ * (at your option) any later version.</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%);">+import from General_Types all;</span><br><span style="color: hsl(120, 100%, 40%);">+import from TCCEncoding_Functions all;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+import from USSD_Templates all;</span><br><span style="color: hsl(120, 100%, 40%);">+import from SS_Types all;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+function f_USSD_FACILITY_IE_INVOKE(</span><br><span style="color: hsl(120, 100%, 40%);">+ integer invoke_id := 1,</span><br><span style="color: hsl(120, 100%, 40%);">+       integer op_code := 59, // (Process)UnstructuredSS-Request (59 or 60)</span><br><span style="color: hsl(120, 100%, 40%);">+  charstring ussd_string // ASCII string</span><br><span style="color: hsl(120, 100%, 40%);">+) return octetstring {</span><br><span style="color: hsl(120, 100%, 40%);">+        var SS_FacilityInformation facility_ie;</span><br><span style="color: hsl(120, 100%, 40%);">+       var octetstring ussd_string_enc;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    /* Encode input string with GSM 7-bit encoding */</span><br><span style="color: hsl(120, 100%, 40%);">+     ussd_string_enc := f_encGSM7bit(ussd_string);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       /* Encode Facility IE */</span><br><span style="color: hsl(120, 100%, 40%);">+      facility_ie := valueof(ts_ML3_FACILITY_USSD_INVOKE(</span><br><span style="color: hsl(120, 100%, 40%);">+           invoke_id := invoke_id,</span><br><span style="color: hsl(120, 100%, 40%);">+               op_code := op_code,</span><br><span style="color: hsl(120, 100%, 40%);">+           ussd_string := ussd_string_enc</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%);">+ return enc_SS_FacilityInformation(facility_ie);</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%);">+function f_USSD_FACILITY_IE_RETURN_RESULT(</span><br><span style="color: hsl(120, 100%, 40%);">+      integer invoke_id := 1,</span><br><span style="color: hsl(120, 100%, 40%);">+       integer op_code := 59, // (Process)UnstructuredSS-Request (59 or 60)</span><br><span style="color: hsl(120, 100%, 40%);">+  charstring ussd_string // ASCII string</span><br><span style="color: hsl(120, 100%, 40%);">+) return octetstring {</span><br><span style="color: hsl(120, 100%, 40%);">+        var SS_FacilityInformation facility_ie;</span><br><span style="color: hsl(120, 100%, 40%);">+       var octetstring ussd_string_enc;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    /* Encode input string with GSM 7-bit encoding */</span><br><span style="color: hsl(120, 100%, 40%);">+     ussd_string_enc := f_encGSM7bit(ussd_string);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       /* Encode Facility IE */</span><br><span style="color: hsl(120, 100%, 40%);">+      facility_ie := valueof(ts_ML3_FACILITY_USSD_RETURN_RESULT(</span><br><span style="color: hsl(120, 100%, 40%);">+            invoke_id := invoke_id,</span><br><span style="color: hsl(120, 100%, 40%);">+               op_code := op_code,</span><br><span style="color: hsl(120, 100%, 40%);">+           ussd_string := ussd_string_enc</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%);">+ return enc_SS_FacilityInformation(facility_ie);</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%);">+}</span><br><span>diff --git a/msc/gen_links.sh b/msc/gen_links.sh</span><br><span>index 1fe5d6e..5f3024b 100755</span><br><span>--- a/msc/gen_links.sh</span><br><span>+++ b/msc/gen_links.sh</span><br><span>@@ -90,6 +90,7 @@</span><br><span> FILES+="RTP_CodecPort.ttcn RTP_CodecPort_CtrlFunctDef.cc "</span><br><span> FILES+="MGCP_CodecPort.ttcn MGCP_CodecPort_CtrlFunctDef.cc "</span><br><span> FILES+="SMPP_CodecPort.ttcn SMPP_CodecPort_CtrlFunct.ttcn SMPP_CodecPort_CtrlFunctDef.cc SMPP_Emulation.ttcn SMPP_Templates.ttcn "</span><br><span style="color: hsl(120, 100%, 40%);">+FILES+="USSD_Templates.ttcn "</span><br><span> gen_links $DIR $FILES</span><br><span> </span><br><span> ignore_pp_results</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/9370">change 9370</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/9370"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ttcn3-hacks </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ic528b968a9bc7c12e8395364e895400aa016c8f5 </div>
<div style="display:none"> Gerrit-Change-Number: 9370 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Vadim Yanitskiy <axilirator@gmail.com> </div>