|
Re: ETSI ITS Security: IntX support [message #1755104 is a reply to message #1755103] |
Tue, 28 February 2017 08:10 |
|
Hi Yann,
yes it does,
see reference guide 4.23.4.7:
4.23.4.7 Type-specific attributes
IntX
Attribute syntax: IntX
Default value: none
Can be used with: integer types
Description: Encodes an integer value as the IntX type in the ETSI Common Library (defined in ETSI TS 103 097).
This is a variable length encoding for integers. Its length depends on the encoded value (but is always a multiple of 8 bits).
The data starts with a series of ones followed by a zero. This represents the length of the encoded value: the number of ones is equal to the number of additional octets needed to encode the value besides those used (partially) to encode the length. The following bits contain the encoding of the integer value (as it would otherwise be encoded).
Comment: Since the length of the encoding is variable, attribute FIELDLENGTH is ignored. Furthermore, IntX also sets BITORDER and BITORDERINFIELD to msb, and BYTEORDER to first, overwriting any manual settings of these attributes.
Only attribute COMP can be used together with IntX (if it's set to signbit, then the sign bit will be the first bit after the length).
Restrictions: Using IntX in a record or set with FIELDORDER set to lsb is only supported if the IntX field starts at the beginning of a new octet. A compiler error is displayed otherwise. The IntX field may start anywhere if the parent record/set's FIELDORDER is set to msb.
Examples:
// Example 1: Standalone IntX integer type with no sign bit:
type integer IntX_unsigned with { variant "IntX" }
// Encoding integer 10:
// 00001010
// ^ length bit (there are no ones as no additional octets are needed)
// Encoding integer 2184:
// 10001000 10001000
// ^^ length bits (one extra octet is needed after the partial length octet)
// Example 2: Standalone IntX integer type with sign bit:
type integer IntX_signed with { variant "IntX, COMP(signbit)" }
// Encoding integer -2184:
// 10101000 10001000
// length bits ^^
// ^ sign bit
// Example 3: Standalone IntX integer type with 2's complement:
type integer IntX_compl with { variant "IntX, COMP(2scompl)" }
// Encoding integer -2184:
// 10110111 01111000
// ^^ length bits
// Example 4: IntX integer record field (starting in a partial octet):
type record RecIntXPartial {
integer i,
integer ix,
bitstring bs
}
with {
variant "FIELDORDER(msb)";
variant (i) "FIELDLENGTH(12), BITORDER(msb)";
variant (i) "BYTEORDER(first), BITORDERINFIELD(msb)";
variant (ix) "IntX";
variant (bs) "FIELDLENGTH(8)";
}
// Encoding record value { i := 716, ix := 716, bs := '10101010'B }:
// 00101100 11001000 00101100 11001010 10100000
// ^^^^^^^^ ^^^^ field 'i' (same encoding as 'ix', but with no length bits)
// field 'ix' ^^^^ ^^^^^^^^ ^^^^ (the first 2 bits are the length bits)
// field 'bs' ^^^^ ^^^^
// Note: setting the record's FIELDORDER to 'lsb' in this case is not supported
// and would cause the mentioned compiler error.
Best regards
Elemer
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04557 seconds