Change in ...osmo-ttcn3-hacks[master]: library/PCUIF_CodecPort.ttcn: strip padding bytes from PCUIF_data

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

fixeria gerrit-no-reply at lists.osmocom.org
Fri Sep 27 03:17:54 UTC 2019


fixeria has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15571 )

Change subject: library/PCUIF_CodecPort.ttcn: strip padding bytes from PCUIF_data
......................................................................

library/PCUIF_CodecPort.ttcn: strip padding bytes from PCUIF_data

In Ieefa61232eb215a19a02e490255332e28e23b8f8, I had to revert
I5808954b5c67c3239e795e43ae77035152d359ef, because that change
broke encoding of messages on the PCU interface.

Since we cannot use 'PADDING' attribute until its implementation
is fixed in TITAN, let's work this around by stripping padding
bytes manually in UD_to_PCUIF().

Change-Id: Ibd698094c897d395208e80189457444a91018beb
---
M library/PCUIF_CodecPort.ttcn
1 file changed, 10 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/library/PCUIF_CodecPort.ttcn b/library/PCUIF_CodecPort.ttcn
index 3d6ceac..4b2a8ce 100644
--- a/library/PCUIF_CodecPort.ttcn
+++ b/library/PCUIF_CodecPort.ttcn
@@ -26,9 +26,19 @@
 	pout.data := enc_PCUIF_Message(pin.data);
 } with { extension "prototype(fast)" };
 
+private function fix_padding(inout PCUIF_data data) {
+	data.data := substr(data.data, 0, data.len);
+}
+
 private function UD_to_PCUIF(in UD_send_data pin, out PCUIF_send_data pout) {
 	pout.id := pin.id;
 	pout.data := dec_PCUIF_Message(pin.data);
+
+	/* HACK: fix padding in decoded message. Due to a bug in TITAN, we
+	 * cannot just use its 'PADDING' attribute because it breaks decoding. */
+	if (ischosen(pout.data.u.data_req)) { fix_padding(pout.data.u.data_req); }
+	if (ischosen(pout.data.u.data_cnf)) { fix_padding(pout.data.u.data_cnf); }
+	if (ischosen(pout.data.u.data_ind)) { fix_padding(pout.data.u.data_ind); }
 } with { extension "prototype(fast)" };
 
 type port PCUIF_CODEC_PT message {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15571
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ibd698094c897d395208e80189457444a91018beb
Gerrit-Change-Number: 15571
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190927/ce19062e/attachment.htm>


More information about the gerrit-log mailing list