Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » RAW coder: Handle a variable-length payload + fixed footer
RAW coder: Handle a variable-length payload + fixed footer [message #1768774] Sun, 23 July 2017 19:06 Go to next message
Harald Welte is currently offline Harald WelteFriend
Messages: 140
Registered: July 2017
Location: Berlin, Germany
Senior Member

I'm trying to express the 3GPP TS 04.064 (GPRS-LLC) message format using the TITAN RAW codec.

One peculiarity of the message structure is that there is:
* a header (Address + Control field) that I can express without problems in TTCN-3 with TITAN RAW "variant"s
* a variable-length payload field (without an explciit length field!)
* a 3-byte footer (the Frame Check Sequence)

If I express this as
        type integer uint24_t (0..16777215) with { variant "unsigned 24 bit" };
        type uint24_t LlcFcs;

        type record LlcPdu {
                LlcAddressField    addr,
                LlcCtrlUnion       ctrl,
                octetstring        payload,
                LlcFcs             fcs
        } with { variant "" };

then the "payload" variable-length octetstrign field always grabs the FCS, too, and the TITAN runtime complains about 0 bits being left for FCS:
20:47:25.157225 Test.ttcn:163: Dynamic test case error: While RAW-decoding type '@LLC_Types.LlcPdu': There are not enough bits in the buffer to decode type @LLC_Types.LlcPdu.fcs (needed: 24, found: 0).


The full module can be found at http://git.osmocom.org/osmo-ttcn3-hacks/tree/gprs_gb/LLC_Types.ttcn

What am I missing here? How can I express this?

Thanks in advance!
Re: RAW coder: Handle a variable-length payload + fixed footer [message #1768812 is a reply to message #1768774] Mon, 24 July 2017 06:22 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Harald,

there are two strategies I know of when designing protocols with fields of variable length:

-the first one tries to specify the length of these fields by attaching a header containing the length info (easy to parse but with an overhead )
-the other one uses delimiters which signify end of field of variable length, e.g. a null byte (more difficult to parse as each byte has to be read, plus the delimiter has to be avoided in the field itself )

Now in this case you are assuming that the payload is an opaque octetstring (thus second variant) with variable length but it really is not: if you check 3GPP TS 44.064 ( I suppose you wrote 04.064 by mistake as I could not find that one) you'll find that it is structured and decoding has to consider this structure (so it's first variant).

I have sent you an example I will make open source soonest.


Best regards
Elemer




Re: RAW coder: Handle a variable-length payload + fixed footer [message #1768826 is a reply to message #1768812] Mon, 24 July 2017 07:58 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Harald,

As you can see from the code I have sent for the moment the RAW codec alone cannot resolve all structures is confronted with , and it needs some help in the C++ code; the extension of the RAW codec
is on our list but other priorities figure higher on that list. However as soon as we can find the time we'll work on it.

Best regards
Elemer



Re: RAW coder: Handle a variable-length payload + fixed footer [message #1768851 is a reply to message #1768826] Mon, 24 July 2017 10:53 Go to previous message
Harald Welte is currently offline Harald WelteFriend
Messages: 140
Registered: July 2017
Location: Berlin, Germany
Senior Member

As usual, thanks for your quick help!
Previous Topic:RAW coder: Handle a variable-lengh length field?
Next Topic:CSN.1 integration to TITAN?
Goto Forum:
  


Current Time: Fri Apr 26 22:49:41 GMT 2024

Powered by FUDForum. Page generated in 0.03105 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top