blob: bd7e65fab60a2a0e6534e01d574ec13fe7765b89 [file] [log] [blame]
big_endian_packets
// Preliminary definitions
enum Enum7 : 7 {
A = 1,
B = 2,
}
enum Enum16 : 16 {
A = 0xaabb,
B = 0xccdd,
}
struct SizedStruct {
a: 8,
}
struct UnsizedStruct {
_size_(array): 2,
_reserved_: 6,
array: 8[],
}
enum MaxDiscriminantEnum : 64 {
Max = 0xffffffffffffffff,
}
// Packet bit fields
// The parser must be able to handle bit fields with scalar values
// up to 64 bits wide. The parser should generate a static size guard.
packet Packet_Scalar_Field {
a: 7,
c: 57,
}
// The parser must be able to handle bit fields with enum values
// up to 64 bits wide. The parser should generate a static size guard.
packet Packet_Enum_Field {
a: Enum7,
c: 57,
}
// The parser must be able to handle bit fields with reserved fields
// up to 64 bits wide. The parser should generate a static size guard.
packet Packet_Reserved_Field {
a: 7,
_reserved_: 2,
c: 55,
}
// The parser must be able to handle bit fields with size fields
// up to 64 bits wide. The parser should generate a static size guard.
packet Packet_Size_Field {
_size_(b): 3,
a: 61,
b: 8[],
}
// The parser must be able to handle bit fields with count fields
// up to 64 bits wide. The parser should generate a static size guard.
packet Packet_Count_Field {
_count_(b): 3,
a: 61,
b: 8[],
}
// The parser must be able to handle bit fields with fixed scalar values
// up to 64 bits wide. The parser should generate a static size guard.
packet Packet_FixedScalar_Field {
_fixed_ = 7 : 7,
b: 57,
}
// The parser must be able to handle bit fields with fixed enum values
// up to 64 bits wide. The parser should generate a static size guard.
packet Packet_FixedEnum_Field {
_fixed_ = A : Enum7,
b: 57,
}
packet Packet_Array_Field_ByteElement_ConstantSize {
array: 8[4],
}
packet Packet_Array_Field_ByteElement_UnknownSize {
array: 8[],
}
packet Packet_Array_Field_ScalarElement_ConstantSize {
array: 16[4],
}
packet Packet_Array_Field_ScalarElement_UnknownSize {
array: 16[],
}
packet Packet_Array_Field_EnumElement_ConstantSize {
array: Enum16[4],
}
packet Packet_Array_Field_EnumElement_UnknownSize {
array: Enum16[],
}
packet Packet_Array_Field_SizedElement_ConstantSize {
array: SizedStruct[4],
}
packet Packet_Array_Field_SizedElement_UnknownSize {
array: SizedStruct[],
}
packet Packet_Array_Field_UnsizedElement_ConstantSize {
array: UnsizedStruct[4],
}
packet Packet_Array_Field_UnsizedElement_VariableSize {
_size_(array) : 4,
_reserved_: 4,
array: UnsizedStruct[],
}
packet Packet_Array_Field_UnsizedElement_VariableCount {
_count_(array) : 4,
_reserved_: 4,
array: UnsizedStruct[],
}
packet Packet_Array_Field_UnsizedElement_UnknownSize {
array: UnsizedStruct[],
}
// The parser must be able to handle bit fields with fixed scalar values
// up to 64 bits wide. The parser should generate a static size guard.
struct Struct_FixedScalar_Field_ {
_fixed_ = 7 : 7,
b: 57,
}
// The parser must be able to handle bit fields with fixed enum values
// up to 64 bits wide. The parser should generate a static size guard.
struct Struct_FixedEnum_Field_ {
_fixed_ = A : Enum7,
b: 57,
}
packet ScalarParent {
a: 8,
_size_(_payload_): 8,
_payload_
}
packet EnumParent {
a: Enum16,
_size_(_payload_): 8,
_payload_
}
// Packet inheritance
// The parser must handle specialization into
// any child packet of a parent packet with scalar constraints.
packet ScalarChild_A : ScalarParent (a = 0) {
b: 8,
}
// The parser must handle specialization into
// any child packet of a parent packet with scalar constraints.
packet ScalarChild_B : ScalarParent (a = 1) {
c: 16,
}
// The parser must handle specialization into
// any child packet of a parent packet with enum constraints.
packet EnumChild_A : EnumParent (a = A) {
b: 8,
}
// The parser must handle specialization into
// any child packet of a parent packet with enum constraints.
packet EnumChild_B : EnumParent (a = B) {
c: 16,
}
// Packet payload fields
// The parser must be able to handle sized payload fields without
// size modifier.
packet Packet_Payload_Field_VariableSize {
_size_(_payload_): 3,
_reserved_: 5,
_payload_
}
// The parser must be able to handle payload fields of unkonwn size followed
// by fields of statically known size. The remaining span is integrated
// in the packet.
packet Packet_Payload_Field_UnknownSize {
_payload_,
a: 16,
}
// The parser must be able to handle payload fields of unkonwn size.
// The remaining span is integrated in the packet.
packet Packet_Payload_Field_UnknownSize_Terminal {
a: 16,
_payload_,
}