1big_endian_packets
2
3custom_field SixBytes : 48 "packet/parser/test/"
4custom_field Variable "packet/parser/test/"
5
6packet ParentBe {
7  _fixed_ = 0x12 : 8,
8  _size_(_payload_) : 8,
9  _payload_,
10  footer : 8,
11}
12
13packet ChildBe  : ParentBe {
14  field_name : 16,
15}
16
17enum FourBitsBe : 4 {
18  ONE = 1,
19  TWO = 2,
20  THREE = 3,
21  FIVE = 5,
22  TEN = 10,
23  LAZY_ME = 15,
24}
25
26packet ParentTwoBe {
27  _reserved_ : 4,
28  four_bits : FourBitsBe,
29  _payload_,
30}
31
32packet ChildTwoThreeBe  : ParentTwoBe (four_bits = THREE) {
33  more_bits : FourBitsBe,
34  _reserved_ : 4,
35  sixteen_bits : 16
36}
37
38packet ChildTwoTwoBe  : ParentTwoBe (four_bits = TWO) {
39  more_bits : FourBitsBe,
40  _reserved_ : 4,
41}
42
43packet ChildTwoTwoThreeBe  :ChildTwoTwoBe (more_bits = THREE) {
44}
45
46enum TwoBitsBe : 2 {
47  ZERO = 0,
48  ONE = 1,
49  TWO = 2,
50  THREE = 3,
51}
52
53packet MiddleFourBitsBe {
54  low_two : TwoBitsBe,
55  next_four : FourBitsBe,
56  straddle : FourBitsBe,
57  four_more : FourBitsBe,
58  high_two : TwoBitsBe,
59}
60
61packet ParentWithSixBytesBe {
62  two_bytes : 16,
63  six_bytes : SixBytes,
64  _payload_,
65}
66
67packet ChildWithSixBytesBe  : ParentWithSixBytesBe (two_bytes = 0x1234) {
68  child_six_bytes : SixBytes,
69}
70
71checksum SimpleSum : 16 "packet/parser/test/"
72
73packet ParentWithSumBe {
74  two_bytes : 16,
75  _checksum_start_(example_checksum),
76  sum_bytes : 16,
77  _payload_,
78  example_checksum : SimpleSum,
79}
80
81packet ChildWithSumBe  : ParentWithSumBe {
82  more_bytes : 32,
83  another_byte : 8,
84}
85
86packet ChildWithNestedSumBe  : ParentWithSumBe {
87  _checksum_start_(nested_checksum),
88  more_bytes : 32,
89  nested_checksum : SimpleSum,
90}
91
92packet ParentSizeModifierBe {
93  _size_(_payload_) : 8,
94  _payload_ : [+2*8], // Include two_bytes in the size
95  two_bytes : 16,
96}
97
98packet ChildSizeModifierBe  : ParentSizeModifierBe (two_bytes = 0x1211) {
99  more_bytes : 32,
100}
101
102enum ForArraysBe : 16 {
103  ONE = 0x0001,
104  TWO = 0x0002,
105  ONE_TWO = 0x0201,
106  TWO_THREE = 0x0302,
107  FFFF = 0xffff,
108}
109
110packet FixedArrayEnumBe {
111  enum_array : ForArraysBe[5],
112}
113
114packet SizedArrayEnumBe {
115  _size_(enum_array) : 16,
116  enum_array : ForArraysBe[],
117}
118
119packet CountArrayEnumBe {
120  _count_(enum_array) : 8,
121  enum_array : ForArraysBe[],
122}
123
124packet SizedArrayCustomBe {
125  _size_(six_bytes_array) : 8,
126  an_extra_byte : 8,
127  six_bytes_array : SixBytes[+1*8],
128}
129
130packet FixedArrayCustomBe {
131  six_bytes_array : SixBytes[5],
132}
133
134packet CountArrayCustomBe {
135  _count_(six_bytes_array) : 8,
136  six_bytes_array : SixBytes[],
137}
138
139packet PacketWithFixedArraysOfBytesBe {
140  fixed_256bit_in_bytes : 8[32],
141  fixed_256bit_in_words : 32[8],
142}
143
144packet OneVariableBe {
145  one : Variable,
146}
147
148packet SizedArrayVariableBe {
149  _size_(variable_array) : 8,
150  variable_array : Variable[],
151}
152
153packet FixedArrayVariableBe {
154  variable_array : Variable[5],
155}
156
157packet CountArrayVariableBe {
158  _count_(variable_array) : 8,
159  variable_array : Variable[],
160}
161
162struct TwoRelatedNumbersBe {
163  id : 8,
164  count : 16,
165}
166
167packet OneStructBe {
168  one : TwoRelatedNumbersBe,
169}
170
171packet TwoStructsBe {
172  one : TwoRelatedNumbersBe,
173  two : TwoRelatedNumbersBe,
174}
175
176packet ArrayOfStructBe {
177  _count_(array) : 8,
178  array : TwoRelatedNumbersBe[],
179}
180
181struct StructWithFixedTypesBe {
182  four_bits : FourBitsBe,
183  _reserved_ : 4,
184  _checksum_start_(example_checksum),
185  _fixed_ = 0xf3 : 8,
186  id : 8,
187  array : 8[3],
188  example_checksum : SimpleSum,
189  six_bytes : SixBytes,
190}
191
192packet OneFixedTypesStructBe {
193  one : StructWithFixedTypesBe,
194}
195
196packet ArrayOfStructAndAnotherBe {
197  _count_(array) : 8,
198  array : TwoRelatedNumbersBe[],
199  another : TwoRelatedNumbersBe,
200}
201
202group BitFieldGroupBe {
203  seven_bits : 7,
204  straddle : 4,
205  five_bits : 5,
206}
207
208packet BitFieldGroupPacketBe {
209  BitFieldGroupBe,
210}
211
212packet BitFieldGroupAfterPayloadPacketBe {
213  _payload_,
214  BitFieldGroupBe,
215}
216
217packet BitFieldGroupAfterUnsizedArrayPacketBe  : BitFieldGroupAfterPayloadPacketBe {
218  array : 8[],
219}
220
221struct BitFieldBe {
222  seven_bits : 7,
223  straddle : 4,
224  five_bits : 5,
225}
226
227packet BitFieldPacketBe {
228  bit_field : BitFieldBe,
229}
230
231packet BitFieldAfterPayloadPacketBe {
232  _payload_,
233  bit_field : BitFieldBe,
234}
235
236packet BitFieldAfterUnsizedArrayPacketBe  : BitFieldAfterPayloadPacketBe {
237  array : 8[],
238}
239
240packet BitFieldArrayPacketBe {
241  _size_(array): 8,
242  array : BitFieldBe[],
243}
244
245struct VersionlessStructBe {
246  one_number : 8,
247}
248
249packet OneVersionlessStructPacketBe {
250  versionless : VersionlessStructBe,
251  _payload_,
252}
253
254packet OneVersionedStructPacketBe  : OneVersionlessStructPacketBe {
255  version : 8,
256  _payload_,
257}
258
259packet OneVersionOneStructPacketBe  : OneVersionedStructPacketBe (version = 0x01) {
260  just_one_number : 8,
261}
262
263packet OneVersionTwoStructPacketBe  : OneVersionedStructPacketBe (version = 0x02) {
264  one_number : 8,
265  another_number : 8,
266}
267