Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » RAW coder and arrays in records
RAW coder and arrays in records [message #1782722] Wed, 28 February 2018 13:12 Go to next message
Harald Welte is currently offline Harald WelteFriend
Messages: 140
Registered: July 2017
Location: Berlin, Germany
Senior Member

I'm a bit puzzled on how to use an array of one record in another record without loosing the ability to use the RAW codec:

module PCUIF_Proto {

type record PCUIF_InfoTrx {
        uint16_t        arfcn,
        BIT8            pdch_mask,
        OCT1            spare,
        OCT8            tsc,
        uint32_t        hLayer1
} with { variant "" };

type record PCUIF_info_ind {
        uint32_t        version,
        PCUIF_Flags     flags,
        PCUIF_InfoTrx trx[8],
} with { variant "" };

} with { encode "RAW" };


will fail to compile with titan 6.3.0, while titan claiming that PCUIF_info_ind cannot be encoded as RAW. However, when removing the array it can.

What am I missing here? If the size / encoding of an array element is known, why is the size/encoding of an array of those elements not known? What should I do to make the RAW codec understand this? Thanks!
Re: RAW coder and arrays in records [message #1782723 is a reply to message #1782722] Wed, 28 February 2018 13:26 Go to previous messageGo to next message
Gábor Szalai is currently offline Gábor SzalaiFriend
Messages: 131
Registered: December 2015
Senior Member
The arrays are not supported by the RAW encoder.

Try to use record of with a fixed length
Re: RAW coder and arrays in records [message #1782725 is a reply to message #1782722] Wed, 28 February 2018 13:44 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Harald,

the RAW codec was not extended to arrays, see refguide
4.34 4.23 RAW Encoder and Decoder

:

You can use the encoding rules defined in this section to encode and decode the following TTCN3 types:
• bitstring
• boolean
• charstring
• enumerated
• float
• hexstring
• integer
• octetstring
• record
• record of, set of
• set
• union
• universal charstring
:
(no array here)

The why is lost in the depths of time, but I suspect it has to do with the fact
that arrays are not so much useful and they can be replaced with "record of" structures.

So I suggest you try the same:

module PCUIF_Proto {


type record PCUIF_InfoTrx {
        uint16_t        arfcn,
        BIT8            pdch_mask,
        OCT1            spare,
        OCT8            tsc,
        uint32_t        hLayer1
} with { variant "" };


type record length(8)  of PCUIF_InfoTrx RecOfPCUIF_InfoTrx ;

type record PCUIF_info_ind {
        uint32_t             version,
         PCUIF_Flags     flags,
       // PCUIF_InfoTrx trx[8]
        RecOfPCUIF_InfoTrx trx
} with { variant "" };

} with { encode "RAW" };


should give you the desired encoding.

I hope this helps

BR

Elemer


Re: RAW coder and arrays in records [message #1782728 is a reply to message #1782725] Wed, 28 February 2018 14:27 Go to previous messageGo to next message
Harald Welte is currently offline Harald WelteFriend
Messages: 140
Registered: July 2017
Location: Berlin, Germany
Senior Member

Hi Elemer,

thanks for the quick help with a work-around. Seems to compile fine at least so far, I hence expect that the encoding also matches expectations.
Re: RAW coder and arrays in records [message #1782786 is a reply to message #1782722] Thu, 01 March 2018 11:40 Go to previous message
roland gecse is currently offline roland gecseFriend
Messages: 20
Registered: December 2015
Junior Member
The reason is that historically arrays were not allowed to be used within TTCN-3 type definitions.
But this is no longer the case as CL v4.9.1 considers array type definitions to be equivalent to record of type definitions.
Previous Topic:LibCommon compilanion issue
Next Topic:Porting the ETSI IPv6 test suite to Titan part I
Goto Forum:
  


Current Time: Thu Mar 28 13:49:49 GMT 2024

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

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

Back to the top