<p>fixeria has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/18026">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">library: fix enc_SystemInformation(): properly pad messages<br><br>Due to a buggy nature of TITAN's padding attributes, we cannot<br>apply them to individual fields of the records that are embedded<br>into other structured types, like records and unions.<br><br>Ensure that encoded System Information messages are padded to<br>either 23 or 19 octets, depending on their type. In order to<br>achieve this, rename and wrap the external encoding function.<br><br>Change-Id: I3368df52985e576ad180c9a74d4925dd9c952b55<br>Signed-off-by: Vadim Yanitskiy <axilirator@gmail.com><br>---<br>M library/GSM_SystemInformation.ttcn<br>1 file changed, 25 insertions(+), 1 deletion(-)<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/26/18026/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/library/GSM_SystemInformation.ttcn b/library/GSM_SystemInformation.ttcn</span><br><span>index de1fcf7..758ad1c 100644</span><br><span>--- a/library/GSM_SystemInformation.ttcn</span><br><span>+++ b/library/GSM_SystemInformation.ttcn</span><br><span>@@ -228,9 +228,33 @@</span><br><span> other, OTHERWISE;</span><br><span> )" };</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- external function enc_SystemInformation(in SystemInformation si) return octetstring</span><br><span style="color: hsl(120, 100%, 40%);">+ external function enc_SystemInformationNoPad(in SystemInformation si) return octetstring</span><br><span> with { extension "prototype(convert) encode(RAW)" };</span><br><span> external function dec_SystemInformation(in octetstring stream) return SystemInformation</span><br><span> with { extension "prototype(convert) decode(RAW)" };</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ /* Due to a buggy nature of TITAN's padding attributes, we have to apply padding manually. */</span><br><span style="color: hsl(120, 100%, 40%);">+ function enc_SystemInformation(in SystemInformation si) return octetstring</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span style="color: hsl(120, 100%, 40%);">+ var octetstring si_enc := enc_SystemInformationNoPad(si);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Resulting message length depends on SI Type */</span><br><span style="color: hsl(120, 100%, 40%);">+ select (si.header.message_type) {</span><br><span style="color: hsl(120, 100%, 40%);">+ case (SYSTEM_INFORMATION_TYPE_5,</span><br><span style="color: hsl(120, 100%, 40%);">+ SYSTEM_INFORMATION_TYPE_5bis,</span><br><span style="color: hsl(120, 100%, 40%);">+ SYSTEM_INFORMATION_TYPE_5ter) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* SACCH: no Rest Octets, return 'as-is' */</span><br><span style="color: hsl(120, 100%, 40%);">+ return si_enc;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ case (SYSTEM_INFORMATION_TYPE_6) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* SACCH: pad to 19 octets, leave room for L1/LAPDm headers */</span><br><span style="color: hsl(120, 100%, 40%);">+ return f_pad_oct(si_enc, 19, '2B'O);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ case else {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* BCCH: pad to 23 octets */</span><br><span style="color: hsl(120, 100%, 40%);">+ return f_pad_oct(si_enc, 23, '2B'O);</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 style="color: hsl(120, 100%, 40%);">+</span><br><span> } with { encode "RAW"; variant "FIELDORDER(msb)" }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/18026">change 18026</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/+/18026"/><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: I3368df52985e576ad180c9a74d4925dd9c952b55 </div>
<div style="display:none"> Gerrit-Change-Number: 18026 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>