<p>fixeria has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26458">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">library/IPA_Types: WIP codec for IPA UnitID (site/bts/trx)<br><br>Change-Id: I68eb0d9e28bbf5d2d8ffe916aae5a66a0fdb9bd0<br>---<br>M library/IPA_Types.ttcn<br>1 file changed, 40 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/58/26458/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/library/IPA_Types.ttcn b/library/IPA_Types.ttcn</span><br><span>index 95623ef..6bb7d07 100644</span><br><span>--- a/library/IPA_Types.ttcn</span><br><span>+++ b/library/IPA_Types.ttcn</span><br><span>@@ -132,6 +132,46 @@</span><br><span>        extension "decode(RAW)"</span><br><span>      }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* Example: 1234/0/1 (site 1234, BTS#0, TRX#0) */</span><br><span style="color: hsl(120, 100%, 40%);">+type record IpaUnitId {</span><br><span style="color: hsl(120, 100%, 40%);">+      integer         site_id,</span><br><span style="color: hsl(120, 100%, 40%);">+      integer         bts_id,</span><br><span style="color: hsl(120, 100%, 40%);">+       integer         trx_id</span><br><span style="color: hsl(120, 100%, 40%);">+} with {</span><br><span style="color: hsl(120, 100%, 40%);">+      encode "TEXT"</span><br><span style="color: hsl(120, 100%, 40%);">+       variant "SEPARATOR('/', '/')"</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%);">+external function enc_IpaUnitId(in IpaUnitId unit_id) return charstring</span><br><span style="color: hsl(120, 100%, 40%);">+        with { extension "prototype(convert) encode(TEXT)" }</span><br><span style="color: hsl(120, 100%, 40%);">+external function dec_IpaUnitId(in charstring stream) return IpaUnitId</span><br><span style="color: hsl(120, 100%, 40%);">+        with { extension "prototype(convert) decode(TEXT)" }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+template (value) IpaUnitId ts_IpaUnitId(integer site_id := 1234,</span><br><span style="color: hsl(120, 100%, 40%);">+                                    integer bts_id := 0,</span><br><span style="color: hsl(120, 100%, 40%);">+                                  integer trx_id := 0) := {</span><br><span style="color: hsl(120, 100%, 40%);">+     site_id := site_id,</span><br><span style="color: hsl(120, 100%, 40%);">+   bts_id  := bts_id,</span><br><span style="color: hsl(120, 100%, 40%);">+    trx_id  := trx_id</span><br><span style="color: hsl(120, 100%, 40%);">+};</span><br><span style="color: hsl(120, 100%, 40%);">+template IpaUnitId tr_IpaUnitId(template (present) integer site_id := ?,</span><br><span style="color: hsl(120, 100%, 40%);">+                               template (present) integer bts_id := ?,</span><br><span style="color: hsl(120, 100%, 40%);">+                               template (present) integer trx_id := ?) := {</span><br><span style="color: hsl(120, 100%, 40%);">+  site_id := site_id,</span><br><span style="color: hsl(120, 100%, 40%);">+   bts_id  := bts_id,</span><br><span style="color: hsl(120, 100%, 40%);">+    trx_id  := trx_id</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%);">+private type component Dummy_CT {  };</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+testcase TC_selftest_IpaUnitId() runs on Dummy_CT {</span><br><span style="color: hsl(120, 100%, 40%);">+ var IpaUnitId unit_id := valueof(ts_IpaUnitId(1234, 0, 3));</span><br><span style="color: hsl(120, 100%, 40%);">+   var charstring unit_id_enc := enc_IpaUnitId(unit_id);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       log("Enc: ", unit_id_enc);</span><br><span style="color: hsl(120, 100%, 40%);">+  log("Dec: ", dec_IpaUnitId(unit_id_enc & "\00"));</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* Finds an IE with the given tag in IPA IDENTITY RESPONSE.</span><br><span>  * Returns index of an IE if found, -1 otherwise. */</span><br><span> function f_ipa_id_resp_find_ie(in IpaCcmIdResp resp, IpaCcmIdTag tag)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26458">change 26458</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/c/osmo-ttcn3-hacks/+/26458"/><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-Change-Id: I68eb0d9e28bbf5d2d8ffe916aae5a66a0fdb9bd0 </div>
<div style="display:none"> Gerrit-Change-Number: 26458 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>