little_endian_packets custom_field SixBytes : 48 "packet/parser/test/" custom_field Variable "packet/parser/test/" packet Parent { _fixed_ = 0x12 : 8, _size_(_payload_) : 8, _payload_, footer : 8, } packet Child : Parent { field_name : 16, } enum FourBits : 4 { ONE = 1, TWO = 2, THREE = 3, FIVE = 5, TEN = 10, LAZY_ME = 15, } packet ParentTwo { _reserved_ : 4, four_bits : FourBits, _payload_, } packet ChildTwoThree : ParentTwo (four_bits = THREE) { more_bits : FourBits, _reserved_ : 4, sixteen_bits : 16 } packet ChildTwoTwo : ParentTwo (four_bits = TWO) { more_bits : FourBits, _reserved_ : 4, } packet ChildTwoTwoThree :ChildTwoTwo (more_bits = THREE) { } enum TwoBits : 2 { ZERO = 0, ONE = 1, TWO = 2, THREE = 3, } packet MiddleFourBits { low_two : TwoBits, next_four : FourBits, straddle : FourBits, four_more : FourBits, high_two : TwoBits, } packet ParentWithSixBytes { two_bytes : 16, six_bytes : SixBytes, _payload_, } packet ChildWithSixBytes : ParentWithSixBytes (two_bytes = 0x1234) { child_six_bytes : SixBytes, } checksum SimpleSum : 16 "packet/parser/test/" packet ParentWithSum { two_bytes : 16, _checksum_start_(example_checksum), sum_bytes : 16, _payload_, example_checksum : SimpleSum, } packet ChildWithSum : ParentWithSum { more_bytes : 32, another_byte : 8, } packet ChildWithNestedSum : ParentWithSum { _checksum_start_(nested_checksum), more_bytes : 32, nested_checksum : SimpleSum, } packet SizedWithSum { two_bytes : 16, _size_(_payload_) : 8, _checksum_start_(example_checksum), _payload_, example_checksum : SimpleSum, } test SizedWithSum { "\x01\x02\x03\x01\x02\x03\x06\x00", } packet ParentSizeModifier { _size_(_payload_) : 8, _payload_ : [+2], // Include two_bytes in the size two_bytes : 16, } packet ChildSizeModifier : ParentSizeModifier (two_bytes = 0x1211) { more_bytes : 32, } packet FieldsEndWithNumbers { field_1 : 16, field_2 : 16, field_10 : 16, field_11 : 16, } enum ForArrays : 16 { ONE = 0x0001, TWO = 0x0002, ONE_TWO = 0x0201, TWO_THREE = 0x0302, FFFF = 0xffff, } packet FixedArrayEnum { enum_array : ForArrays[5], } packet SizedArrayEnum { _size_(enum_array) : 16, enum_array : ForArrays[], } test SizedArrayEnum { "\x00\x00", "\x02\x00\x01\x02", "\x04\x00\x01\x02\x11\x12", "\x06\x00\x01\x02\x11\x12\x21\x22", } packet CountArrayEnum { _count_(enum_array) : 8, enum_array : ForArrays[], } test CountArrayEnum { "\x01\x01\x02", "\x02\x01\x02\x11\x12", "\x03\x01\x02\x11\x12\x21\x22", } packet SizedArrayCustom { _size_(six_bytes_array) : 8, an_extra_byte : 8, six_bytes_array : SixBytes[+1], } packet FixedArrayCustom { six_bytes_array : SixBytes[5], } packet CountArrayCustom { _count_(six_bytes_array) : 8, six_bytes_array : SixBytes[], } packet PacketWithFixedArraysOfBytes { fixed_256bit_in_bytes : 8[32], fixed_256bit_in_words : 32[8], } packet OneVariable { one : Variable, } packet SizedArrayVariable { _size_(variable_array) : 8, variable_array : Variable[], } packet FixedArrayVariable { variable_array : Variable[5], } packet CountArrayVariable { _count_(variable_array) : 8, variable_array : Variable[], } struct TwoRelatedNumbers { id : 8, count : 16, } packet OneStruct { one : TwoRelatedNumbers, } packet TwoStructs { one : TwoRelatedNumbers, two : TwoRelatedNumbers, } packet VectorOfStruct { _count_(array) : 8, array : TwoRelatedNumbers[], } test VectorOfStruct { "\x00", "\x01\x01\x02\x03", "\x02\x01\x02\x03\x11\x12\x13", "\x03\x01\x02\x03\x11\x12\x13\x21\x22\x23", } packet ArrayOfStruct { the_count : 8, array : TwoRelatedNumbers[4], } struct StructWithFixedTypes { four_bits : FourBits, _reserved_ : 4, _checksum_start_(example_checksum), _fixed_ = 0xf3 : 8, id : 8, array : 8[3], example_checksum : SimpleSum, six_bytes : SixBytes, } packet OneFixedTypesStruct { one : StructWithFixedTypes, } packet ArrayOfStructAndAnother { _count_(array) : 8, array : TwoRelatedNumbers[], another : TwoRelatedNumbers, } packet SizedArrayOfStructAndAnother { _size_(array) : 8, array : TwoRelatedNumbers[], another : TwoRelatedNumbers, } struct ArrayOfStructAndAnotherStruct { _count_(array) : 8, array : TwoRelatedNumbers[], another : TwoRelatedNumbers, } struct SizedArrayOfStructAndAnotherStruct { _size_(array) : 8, array : TwoRelatedNumbers[], another : TwoRelatedNumbers, } packet OneArrayOfStructAndAnotherStruct { one : ArrayOfStructAndAnotherStruct, } packet OneSizedArrayOfStructAndAnotherStruct { one : SizedArrayOfStructAndAnotherStruct, } group BitFieldGroup { seven_bits : 7, straddle : 4, five_bits : 5, } packet BitFieldGroupPacket { BitFieldGroup, } packet BitFieldGroupAfterPayloadPacket { _payload_, BitFieldGroup, } packet BitFieldGroupAfterUnsizedArrayPacket : BitFieldGroupAfterPayloadPacket { array : 8[], } struct BitField { seven_bits : 7, straddle : 4, five_bits : 5, } packet BitFieldPacket { bit_field : BitField, } packet BitFieldAfterPayloadPacket { _payload_, bit_field : BitField, } packet BitFieldAfterUnsizedArrayPacket : BitFieldAfterPayloadPacket { array : 8[], } packet BitFieldArrayPacket { _size_(array): 8, array : BitField[], } struct VersionlessStruct { one_number : 8, } packet OneVersionlessStructPacket { versionless : VersionlessStruct, _payload_, } packet OneVersionedStructPacket : OneVersionlessStructPacket { version : 8, _payload_, } packet OneVersionOneStructPacket : OneVersionedStructPacket(version = 0x01) { just_one_number : 8, } packet OneVersionTwoStructPacket : OneVersionedStructPacket(version = 0x02) { one_number : 8, another_number : 8, } enum StructType : 8 { ZERO_BYTE = 0x00, TWO_BYTE = 0x02, FOUR_BYTE = 0x04, AT_LEAST_FOUR_BYTE = 0x05, VARIABLE = 0x06, } struct UnusedParentStruct { struct_type : StructType, _body_, } struct TwoByteStruct : UnusedParentStruct (struct_type = TWO_BYTE) { two_bytes : 16, } struct FourByteStruct : UnusedParentStruct (struct_type = FOUR_BYTE) { four_bytes : 32, } struct AtLeastFourByteStruct : UnusedParentStruct (struct_type = AT_LEAST_FOUR_BYTE) { four_bytes : 32, struct_type : StructType, _body_, } struct OnlyFourByteStruct : AtLeastFourByteStruct (struct_type = ZERO_BYTE) { } struct SixByteStruct : AtLeastFourByteStruct (struct_type = TWO_BYTE) { two_more_bytes : 16, } struct EightByteStruct : AtLeastFourByteStruct (struct_type = FOUR_BYTE) { four_more_bytes : 32, } packet OneFourByteStruct { one_struct : FourByteStruct, } packet OneGenericStruct { base_struct : UnusedParentStruct, } packet OneGenericStructArray { an_array : UnusedParentStruct[], } packet OneGenericStructFourArray { an_array : UnusedParentStruct[4], } packet ParentWithOnlyFixed { two_bytes : 16, _body_, } packet OneGenericStructArrayAfterFixed : ParentWithOnlyFixed { an_array : UnusedParentStruct[], } enum DataType : 8 { ONE = 0x01, TWO = 0x02, THREE = 0x03, FOUR = 0x04, FIVE = 0x05, UNUSED = 0x06, } struct LengthTypeValueStruct { _size_(value) : 16, type : DataType, value : 8[+1], } packet OneLengthTypeValueStruct { one_array : LengthTypeValueStruct[], } packet SizedParent { _size_(payload) : 8, _payload_, } packet OneLengthTypeValueStructPadded : SizedParent { valid_bytes : 8, one_array : LengthTypeValueStruct[], _padding_[30], after_padding : 8, } packet ByteSizedFields { one : 8, two : 16, three : 24, four : 32, five : 40, six : 48, seven : 56, eight : 64, } enum StructTypeNoZero : 4 { TWO_BYTE = 0x02, FOUR_BYTE = 0x04, AT_LEAST_FOUR_BYTE = 0x05, } struct UnusedParentStructNoZero { struct_type : StructTypeNoZero, _reserved_ : 4, length : 8, _body_, } struct TwoByteStructNoZero : UnusedParentStructNoZero (struct_type = TWO_BYTE, length = 2) { two_bytes : 16, } struct FourByteStructNoZero : UnusedParentStructNoZero (struct_type = FOUR_BYTE, length = 4) { four_bytes : 32, } struct AtLeastFourByteStructNoZero : UnusedParentStructNoZero (struct_type = AT_LEAST_FOUR_BYTE) { four_bytes : 32, struct_type : StructTypeNoZero, _body_, } struct EightByteStructNoZero : AtLeastFourByteStructNoZero (struct_type = FOUR_BYTE, length = 9) { four_more_bytes : 32, } packet OneGenericStructArrayNoZero { an_array : UnusedParentStructNoZero[], } enum BigValue: 64 { MIN = 0, TOO_BIG_FOR_32 = 0x0706050403020100, MAX = 0xffffffffffffffff, } packet OneBigValue { big : BigValue, } test OneBigValue { "\x00\x00\x00\x00\x00\x00\x00\x00", "\xff\xff\xff\xff\xff\xff\xff\xff", "\x00\x01\x02\x03\x04\x05\x06\x07", } packet ArrayOfBytes { _fixed_ = 8 : 8, bytes : 8[], } test ArrayOfBytes { "\x08\x01\x02\x03", "\x08\x05\x04\x03\x02\x01\x00", "\x08\x06\x05\x04\x03\x02\x01\x00", } packet ArrayOfSixteens { _fixed_ = 16 : 8, sixteens : 16[], } test ArrayOfSixteens { "\x10\x01\x11\x02\x12\x03\x13", "\x10\x05\x15\x04\x14\x03\x13\x02\x12\x01\x11\x00\x10", "\x10\x06\x16\x05\x15\x04\x14\x03\x13\x02\x12\x01\x11\x00\x10", } packet ArrayOfThirtyTwo { _fixed_ = 32 : 8, thirtytwos : 32[], } test ArrayOfThirtyTwo { "\x20\x01\x11\x21\x31\x02\x12\x22\x32\x03\x13\x23\x33", "\x20\x05\x15\x25\x35\x04\x14\x24\x34\x03\x13\x23\x33\x02\x12\x22\x32\x01\x11\x21\x31\x00\x10\x20\x30", "\x20\x06\x16\x26\x36\x05\x15\x25\x35\x04\x14\x24\x34\x03\x13\x23\x33\x02\x12\x22\x32\x01\x11\x21\x31\x00\x10\x20\x30", } packet Arrays { _size_(bytes) : 8, bytes : 8[], _size_(sixteens) : 8, sixteens : 16[], _size_(thirtytwos) : 8, thirtytwos : 32[] } test Arrays { "\x03\x01\x02\x03\x06\x01\x11\x02\x12\x03\x13\x0C\x01\x11\x21\x31\x02\x12\x22\x32\x03\x13\x23\x33", "\x06\x05\x04\x03\x02\x01\x00\x0C\x05\x15\x04\x14\x03\x13\x02\x12\x01\x11\x00\x10\x18\x05\x15\x25\x35\x04\x14\x24\x34\x03\x13\x23\x33\x02\x12\x22\x32\x01\x11\x21\x31\x00\x10\x20\x30", }