RAW coder: Handle a variable-length payload + fixed footer [message #1768774] |
Sun, 23 July 2017 19:06 |
|
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 |
|
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 |
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.07500 seconds