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
Wed Sep 18 21:16:23 UTC 2019


fixeria has uploaded this change for review. ( 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, 16 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/71/15571/1

diff --git a/library/PCUIF_CodecPort.ttcn b/library/PCUIF_CodecPort.ttcn
index 3d6ceac..caeceb2 100644
--- a/library/PCUIF_CodecPort.ttcn
+++ b/library/PCUIF_CodecPort.ttcn
@@ -26,9 +26,25 @@
 	pout.data := enc_PCUIF_Message(pin.data);
 } with { extension "prototype(fast)" };
 
+private function fix_padding(inout PCUIF_data data) {
+	var octetstring res;
+
+	for (var integer i := 0; i < data.len; i := i + 1) {
+		res[i] := data.data[i];
+	}
+
+	data.data := res;
+}
+
 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: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190918/36fd7bd4/attachment.htm>


More information about the gerrit-log mailing list