1little_endian_packets 2 3// Preliminary definitions 4 5custom_field SizedCustomField : 8 "SizedCustomField" 6custom_field UnsizedCustomField "UnsizedCustomField" 7checksum Checksum : 8 "Checksum" 8 9enum Enum7 : 7 { 10 A = 1, 11 B = 2, 12} 13 14enum Enum16 : 16 { 15 A = 0xaabb, 16 B = 0xccdd, 17} 18 19struct SizedStruct { 20 a: 8, 21} 22 23struct UnsizedStruct { 24 _size_(array): 2, 25 _reserved_: 6, 26 array: 8[], 27} 28 29struct UnknownSizeStruct { 30 array: 8[], 31} 32 33group ScalarGroup { 34 a: 16 35} 36 37group EnumGroup { 38 a: Enum16 39} 40 41packet ScalarParent { 42 a: 8, 43 _size_(_payload_): 8, 44 _payload_ 45} 46 47packet EnumParent { 48 a: Enum16, 49 _size_(_payload_): 8, 50 _payload_ 51} 52 53packet EmptyParent : ScalarParent { 54 _payload_ 55} 56 57// Start: little_endian_only 58packet PartialParent5 { 59 a: 5, 60 _payload_ 61} 62 63packet PartialParent12 { 64 a: 12, 65 _payload_ 66} 67// End: little_endian_only 68 69// Packet bit fields 70 71// The parser must be able to handle bit fields with scalar values 72// up to 64 bits wide. The parser should generate a static size guard. 73packet Packet_Scalar_Field { 74 a: 7, 75 c: 57, 76} 77 78// The parser must be able to handle bit fields with enum values 79// up to 64 bits wide. The parser should generate a static size guard. 80packet Packet_Enum_Field { 81 a: Enum7, 82 c: 57, 83} 84 85// The parser must be able to handle bit fields with reserved fields 86// up to 64 bits wide. The parser should generate a static size guard. 87packet Packet_Reserved_Field { 88 a: 7, 89 _reserved_: 2, 90 c: 55, 91} 92 93// The parser must be able to handle bit fields with size fields 94// up to 64 bits wide. The parser should generate a static size guard. 95packet Packet_Size_Field { 96 _size_(b): 3, 97 a: 61, 98 b: 8[], 99} 100 101// The parser must be able to handle bit fields with count fields 102// up to 64 bits wide. The parser should generate a static size guard. 103packet Packet_Count_Field { 104 _count_(b): 3, 105 a: 61, 106 b: 8[], 107} 108 109// The parser must be able to handle bit fields with fixed scalar values 110// up to 64 bits wide. The parser should generate a static size guard. 111packet Packet_FixedScalar_Field { 112 _fixed_ = 7 : 7, 113 b: 57, 114} 115 116// The parser must be able to handle bit fields with fixed enum values 117// up to 64 bits wide. The parser should generate a static size guard. 118packet Packet_FixedEnum_Field { 119 _fixed_ = A : Enum7, 120 b: 57, 121} 122 123// Packet payload fields 124 125// The parser must be able to handle sized payload fields without 126// size modifier. 127packet Packet_Payload_Field_VariableSize { 128 _size_(_payload_): 3, 129 _reserved_: 5, 130 _payload_ 131} 132 133// The parser must be able to handle sized payload fields with 134// size modifier. 135packet Packet_Payload_Field_SizeModifier { 136 _size_(_payload_): 3, 137 _reserved_: 5, 138 _payload_ : [+2], 139} 140 141// The parser must be able to handle payload fields of unkonwn size followed 142// by fields of statically known size. The remaining span is integrated 143// in the packet. 144packet Packet_Payload_Field_UnknownSize { 145 _payload_, 146 a: 16, 147} 148 149// The parser must be able to handle payload fields of unkonwn size. 150// The remaining span is integrated in the packet. 151packet Packet_Payload_Field_UnknownSize_Terminal { 152 a: 16, 153 _payload_, 154} 155 156// Packet body fields 157 158// The parser must be able to handle sized body fields without 159// size modifier when the packet has no children. 160packet Packet_Body_Field_VariableSize { 161 _size_(_body_): 3, 162 _reserved_: 5, 163 _body_ 164} 165 166// The parser must be able to handle body fields of unkonwn size followed 167// by fields of statically known size. The remaining span is integrated 168// in the packet. 169packet Packet_Body_Field_UnknownSize { 170 _body_, 171 a: 16, 172} 173 174// The parser must be able to handle body fields of unkonwn size. 175// The remaining span is integrated in the packet. 176packet Packet_Body_Field_UnknownSize_Terminal { 177 a: 16, 178 _body_, 179} 180 181// Packet group fields 182 183packet Packet_ScalarGroup_Field { 184 ScalarGroup { a = 42 }, 185} 186 187packet Packet_EnumGroup_Field { 188 EnumGroup { a = A }, 189} 190 191// Packet checksum fields 192 193// The parser must be able to handle checksum fields if the checksum value 194// field is positioned at constant offset from the checksum start. 195// The parser should generate a checksum guard for the buffer covered by the 196// checksum. 197packet Packet_Checksum_Field_FromStart { 198 _checksum_start_(crc), 199 a: 16, 200 b: 16, 201 crc: Checksum, 202} 203 204// The parser must be able to handle checksum fields if the checksum value 205// field is positioned at constant offset from the end of the packet. 206// The parser should generate a checksum guard for the buffer covered by the 207// checksum. 208packet Packet_Checksum_Field_FromEnd { 209 _checksum_start_(crc), 210 _payload_, 211 crc: Checksum, 212 a: 16, 213 b: 16, 214} 215 216// Packet typedef fields 217 218// The parser must be able to handle struct fields. 219// The size guard is generated by the Struct parser. 220packet Packet_Struct_Field { 221 a: SizedStruct, 222 b: UnsizedStruct, 223} 224 225// The parser must be able to handle custom fields of constant size. 226// The parser should generate a static size guard. 227packet Packet_Custom_Field_ConstantSize { 228 a: SizedCustomField, 229} 230 231// The parser must be able to handle custom fields of undefined size. 232// No size guard possible. 233packet Packet_Custom_Field_VariableSize { 234 a: UnsizedCustomField, 235} 236 237// Array field configurations. 238// Add constructs for all configurations of type, size, and padding: 239// 240// - type: u8, u16, enum, struct with static size, struct with dynamic size 241// - size: constant, with size field, with count field, unspecified 242// 243// The type u8 is tested separately since it is likely to be handled 244// idiomatically by the specific language generators. 245 246packet Packet_Array_Field_ByteElement_ConstantSize { 247 array: 8[4], 248} 249 250packet Packet_Array_Field_ByteElement_VariableSize { 251 _size_(array) : 4, 252 _reserved_: 4, 253 array: 8[], 254} 255 256packet Packet_Array_Field_ByteElement_VariableCount { 257 _count_(array) : 4, 258 _reserved_: 4, 259 array: 8[], 260} 261 262packet Packet_Array_Field_ByteElement_UnknownSize { 263 array: 8[], 264} 265 266packet Packet_Array_Field_ScalarElement_ConstantSize { 267 array: 16[4], 268} 269 270packet Packet_Array_Field_ScalarElement_VariableSize { 271 _size_(array) : 4, 272 _reserved_: 4, 273 array: 16[], 274} 275 276packet Packet_Array_Field_ScalarElement_VariableCount { 277 _count_(array) : 4, 278 _reserved_: 4, 279 array: 16[], 280} 281 282packet Packet_Array_Field_ScalarElement_UnknownSize { 283 array: 16[], 284} 285 286packet Packet_Array_Field_EnumElement_ConstantSize { 287 array: Enum16[4], 288} 289 290packet Packet_Array_Field_EnumElement_VariableSize { 291 _size_(array) : 4, 292 _reserved_: 4, 293 array: Enum16[], 294} 295 296packet Packet_Array_Field_EnumElement_VariableCount { 297 _count_(array) : 4, 298 _reserved_: 4, 299 array: Enum16[], 300} 301 302packet Packet_Array_Field_EnumElement_UnknownSize { 303 array: Enum16[], 304} 305 306packet Packet_Array_Field_SizedElement_ConstantSize { 307 array: SizedStruct[4], 308} 309 310packet Packet_Array_Field_SizedElement_VariableSize { 311 _size_(array) : 4, 312 _reserved_: 4, 313 array: SizedStruct[], 314} 315 316packet Packet_Array_Field_SizedElement_VariableCount { 317 _count_(array) : 4, 318 _reserved_: 4, 319 array: SizedStruct[], 320} 321 322packet Packet_Array_Field_SizedElement_UnknownSize { 323 array: SizedStruct[], 324} 325 326packet Packet_Array_Field_UnsizedElement_ConstantSize { 327 array: UnsizedStruct[4], 328} 329 330packet Packet_Array_Field_UnsizedElement_VariableSize { 331 _size_(array) : 4, 332 _reserved_: 4, 333 array: UnsizedStruct[], 334} 335 336packet Packet_Array_Field_UnsizedElement_VariableCount { 337 _count_(array) : 4, 338 _reserved_: 4, 339 array: UnsizedStruct[], 340} 341 342packet Packet_Array_Field_UnsizedElement_UnknownSize { 343 array: UnsizedStruct[], 344} 345 346// The parser must support complex size modifiers on arrays whose size is 347// specified by a size field. 348packet Packet_Array_Field_UnsizedElement_SizeModifier { 349 _size_(array) : 4, 350 _reserved_: 4, 351 array: UnsizedStruct[+2], 352} 353 354// The parser must be able to handle arrays with padded size. 355packet Packet_Array_Field_SizedElement_VariableSize_Padded { 356 _size_(array) : 4, 357 _reserved_: 4, 358 array: 16[], 359 _padding_ [16], 360} 361 362// The parser must be able to handle arrays with padded size. 363packet Packet_Array_Field_UnsizedElement_VariableCount_Padded { 364 _count_(array) : 8, 365 array: UnsizedStruct[], 366 _padding_ [16], 367} 368 369packet Packet_Array_Field_VariableElementSize_ConstantSize { 370 _elementsize_(array): 4, 371 _reserved_: 4, 372 array: UnknownSizeStruct[4], 373} 374 375packet Packet_Array_Field_VariableElementSize_VariableSize { 376 _size_(array) : 4, 377 _reserved_: 4, 378 _elementsize_(array): 4, 379 _reserved_: 4, 380 array: UnknownSizeStruct[], 381 tail: 8[], 382} 383 384packet Packet_Array_Field_VariableElementSize_VariableCount { 385 _count_(array) : 4, 386 _reserved_: 4, 387 _elementsize_(array): 4, 388 _reserved_: 4, 389 array: UnknownSizeStruct[], 390 tail: 8[], 391} 392 393packet Packet_Array_Field_VariableElementSize_UnknownSize { 394 _elementsize_(array): 4, 395 _reserved_: 4, 396 array: UnknownSizeStruct[], 397} 398 399packet Packet_Optional_Scalar_Field { 400 c0: 1, 401 c1: 1, 402 _reserved_: 6, 403 a: 24 if c0 = 0, 404 b: 32 if c1 = 1, 405} 406 407packet Packet_Optional_Enum_Field { 408 c0: 1, 409 c1: 1, 410 _reserved_: 6, 411 a: Enum16 if c0 = 0, 412 b: Enum16 if c1 = 1, 413} 414 415packet Packet_Optional_Struct_Field { 416 c0: 1, 417 c1: 1, 418 _reserved_: 6, 419 a: SizedStruct if c0 = 0, 420 b: UnsizedStruct if c1 = 1, 421} 422 423// Packet inheritance 424 425// The parser must handle specialization into 426// any child packet of a parent packet with scalar constraints. 427packet ScalarChild_A : ScalarParent (a = 0) { 428 b: 8, 429} 430 431// The parser must handle specialization into 432// any child packet of a parent packet with scalar constraints. 433packet ScalarChild_B : ScalarParent (a = 1) { 434 c: 16, 435} 436 437// The parser must handle specialization into 438// any child packet of a parent packet with enum constraints. 439packet EnumChild_A : EnumParent (a = A) { 440 b: 8, 441} 442 443// The parser must handle specialization into 444// any child packet of a parent packet with enum constraints. 445packet EnumChild_B : EnumParent (a = B) { 446 c: 16, 447} 448 449// The parser must handle aliasing of packets 450// through inheritance with no constraints 451packet AliasedChild_A : EmptyParent (a = 2) { 452 b: 8, 453} 454 455// The parser must handle aliasing of packets 456// through inheritance with no constraints 457packet AliasedChild_B : EmptyParent (a = 3) { 458 c: 16, 459} 460 461// Start: little_endian_only 462 463// The parser must handle inheritance of packets with payloads starting 464// on a shifted byte boundary, as long as the first fields of the child 465// complete the bit fields. 466packet PartialChild5_A : PartialParent5 (a = 0) { 467 b: 11, 468} 469 470// The parser must handle inheritance of packets with payloads starting 471// on a shifted byte boundary, as long as the first fields of the child 472// complete the bit fields. 473packet PartialChild5_B : PartialParent5 (a = 1) { 474 c: 27, 475} 476 477// The parser must handle inheritance of packets with payloads starting 478// on a shifted byte boundary, as long as the first fields of the child 479// complete the bit fields. 480packet PartialChild12_A : PartialParent12 (a = 2) { 481 d: 4, 482} 483 484// The parser must handle inheritance of packets with payloads starting 485// on a shifted byte boundary, as long as the first fields of the child 486// complete the bit fields. 487packet PartialChild12_B : PartialParent12 (a = 3) { 488 e: 20, 489} 490 491// End: little_endian_only 492 493// Struct bit fields 494 495// The parser must be able to handle bit fields with scalar values 496// up to 64 bits wide. The parser should generate a static size guard. 497struct Struct_Scalar_Field { 498 a: 7, 499 c: 57, 500} 501 502// The parser must be able to handle bit fields with enum values 503// up to 64 bits wide. The parser should generate a static size guard. 504struct Struct_Enum_Field_ { 505 a: Enum7, 506 c: 57, 507} 508packet Struct_Enum_Field { 509 s: Struct_Enum_Field_, 510} 511 512// The parser must be able to handle bit fields with reserved fields 513// up to 64 bits wide. The parser should generate a static size guard. 514struct Struct_Reserved_Field_ { 515 a: 7, 516 _reserved_: 2, 517 c: 55, 518} 519packet Struct_Reserved_Field { 520 s: Struct_Reserved_Field_, 521} 522 523// The parser must be able to handle bit fields with size fields 524// up to 64 bits wide. The parser should generate a static size guard. 525struct Struct_Size_Field_ { 526 _size_(b): 3, 527 a: 61, 528 b: 8[], 529} 530packet Struct_Size_Field { 531 s: Struct_Size_Field_, 532} 533 534// The parser must be able to handle bit fields with count fields 535// up to 64 bits wide. The parser should generate a static size guard. 536struct Struct_Count_Field_ { 537 _count_(b): 3, 538 a: 61, 539 b: 8[], 540} 541packet Struct_Count_Field { 542 s: Struct_Count_Field_, 543} 544 545// The parser must be able to handle bit fields with fixed scalar values 546// up to 64 bits wide. The parser should generate a static size guard. 547struct Struct_FixedScalar_Field_ { 548 _fixed_ = 7 : 7, 549 b: 57, 550} 551packet Struct_FixedScalar_Field { 552 s: Struct_FixedScalar_Field_, 553} 554 555// The parser must be able to handle bit fields with fixed enum values 556// up to 64 bits wide. The parser should generate a static size guard. 557struct Struct_FixedEnum_Field_ { 558 _fixed_ = A : Enum7, 559 b: 57, 560} 561packet Struct_FixedEnum_Field { 562 s: Struct_FixedEnum_Field_, 563} 564 565// Struct group fields 566 567struct Struct_ScalarGroup_Field_ { 568 ScalarGroup { a = 42 }, 569} 570packet Struct_ScalarGroup_Field { 571 s: Struct_ScalarGroup_Field_, 572} 573 574struct Struct_EnumGroup_Field_ { 575 EnumGroup { a = A }, 576} 577packet Struct_EnumGroup_Field { 578 s: Struct_EnumGroup_Field_, 579} 580 581// Struct checksum fields 582 583// The parser must be able to handle checksum fields if the checksum value 584// field is positioned at constant offset from the checksum start. 585// The parser should generate a checksum guard for the buffer covered by the 586// checksum. 587struct Struct_Checksum_Field_FromStart_ { 588 _checksum_start_(crc), 589 a: 16, 590 b: 16, 591 crc: Checksum, 592} 593packet Struct_Checksum_Field_FromStart { 594 s: Struct_Checksum_Field_FromStart_, 595} 596 597// The parser must be able to handle checksum fields if the checksum value 598// field is positioned at constant offset from the end of the packet. 599// The parser should generate a checksum guard for the buffer covered by the 600// checksum. 601struct Struct_Checksum_Field_FromEnd_ { 602 _checksum_start_(crc), 603 _payload_, 604 crc: Checksum, 605 a: 16, 606 b: 16, 607} 608packet Struct_Checksum_Field_FromEnd { 609 s: Struct_Checksum_Field_FromEnd_, 610} 611 612// Struct typedef fields 613 614// The parser must be able to handle struct fields. 615// The size guard is generated by the Struct parser. 616packet Struct_Struct_Field { 617 a: SizedStruct, 618 b: UnsizedStruct, 619} 620 621// The parser must be able to handle custom fields of constant size. 622// The parser should generate a static size guard. 623struct Struct_Custom_Field_ConstantSize_ { 624 a: SizedCustomField, 625} 626packet Struct_Custom_Field_ConstantSize { 627 s: Struct_Custom_Field_ConstantSize_, 628} 629 630// The parser must be able to handle custom fields of undefined size. 631// No size guard possible. 632struct Struct_Custom_Field_VariableSize_ { 633 a: UnsizedCustomField, 634} 635packet Struct_Custom_Field_VariableSize { 636 s: Struct_Custom_Field_VariableSize_, 637} 638 639// Array field configurations. 640// Add constructs for all configurations of type, size, and padding: 641// 642// - type: u8, u16, enum, struct with static size, struct with dynamic size 643// - size: constant, with size field, with count field, unspecified 644// 645// The type u8 is tested separately since it is likely to be handled 646// idiomatically by the specific language generators. 647 648struct Struct_Array_Field_ByteElement_ConstantSize_ { 649 array: 8[4], 650} 651packet Struct_Array_Field_ByteElement_ConstantSize { 652 s: Struct_Array_Field_ByteElement_ConstantSize_, 653} 654 655struct Struct_Array_Field_ByteElement_VariableSize_ { 656 _size_(array) : 4, 657 _reserved_: 4, 658 array: 8[], 659} 660packet Struct_Array_Field_ByteElement_VariableSize { 661 s: Struct_Array_Field_ByteElement_VariableSize_, 662} 663 664struct Struct_Array_Field_ByteElement_VariableCount_ { 665 _count_(array) : 4, 666 _reserved_: 4, 667 array: 8[], 668} 669packet Struct_Array_Field_ByteElement_VariableCount { 670 s: Struct_Array_Field_ByteElement_VariableCount_, 671} 672 673struct Struct_Array_Field_ByteElement_UnknownSize_ { 674 array: 8[], 675} 676packet Struct_Array_Field_ByteElement_UnknownSize { 677 s: Struct_Array_Field_ByteElement_UnknownSize_, 678} 679 680struct Struct_Array_Field_ScalarElement_ConstantSize_ { 681 array: 16[4], 682} 683packet Struct_Array_Field_ScalarElement_ConstantSize { 684 s: Struct_Array_Field_ScalarElement_ConstantSize_, 685} 686 687struct Struct_Array_Field_ScalarElement_VariableSize_ { 688 _size_(array) : 4, 689 _reserved_: 4, 690 array: 16[], 691} 692packet Struct_Array_Field_ScalarElement_VariableSize { 693 s: Struct_Array_Field_ScalarElement_VariableSize_, 694} 695 696struct Struct_Array_Field_ScalarElement_VariableCount_ { 697 _count_(array) : 4, 698 _reserved_: 4, 699 array: 16[], 700} 701packet Struct_Array_Field_ScalarElement_VariableCount { 702 s: Struct_Array_Field_ScalarElement_VariableCount_, 703} 704 705struct Struct_Array_Field_ScalarElement_UnknownSize_ { 706 array: 16[], 707} 708packet Struct_Array_Field_ScalarElement_UnknownSize { 709 s: Struct_Array_Field_ScalarElement_UnknownSize_, 710} 711 712struct Struct_Array_Field_EnumElement_ConstantSize_ { 713 array: Enum16[4], 714} 715packet Struct_Array_Field_EnumElement_ConstantSize { 716 s: Struct_Array_Field_EnumElement_ConstantSize_, 717} 718 719struct Struct_Array_Field_EnumElement_VariableSize_ { 720 _size_(array) : 4, 721 _reserved_: 4, 722 array: Enum16[], 723} 724packet Struct_Array_Field_EnumElement_VariableSize { 725 s: Struct_Array_Field_EnumElement_VariableSize_, 726} 727 728struct Struct_Array_Field_EnumElement_VariableCount_ { 729 _count_(array) : 4, 730 _reserved_: 4, 731 array: Enum16[], 732} 733packet Struct_Array_Field_EnumElement_VariableCount { 734 s: Struct_Array_Field_EnumElement_VariableCount_, 735} 736 737struct Struct_Array_Field_EnumElement_UnknownSize_ { 738 array: Enum16[], 739} 740packet Struct_Array_Field_EnumElement_UnknownSize { 741 s: Struct_Array_Field_EnumElement_UnknownSize_, 742} 743 744struct Struct_Array_Field_SizedElement_ConstantSize_ { 745 array: SizedStruct[4], 746} 747packet Struct_Array_Field_SizedElement_ConstantSize { 748 s: Struct_Array_Field_SizedElement_ConstantSize_, 749} 750 751struct Struct_Array_Field_SizedElement_VariableSize_ { 752 _size_(array) : 4, 753 _reserved_: 4, 754 array: SizedStruct[], 755} 756packet Struct_Array_Field_SizedElement_VariableSize { 757 s: Struct_Array_Field_SizedElement_VariableSize_, 758} 759 760struct Struct_Array_Field_SizedElement_VariableCount_ { 761 _count_(array) : 4, 762 _reserved_: 4, 763 array: SizedStruct[], 764} 765packet Struct_Array_Field_SizedElement_VariableCount { 766 s: Struct_Array_Field_SizedElement_VariableCount_, 767} 768 769struct Struct_Array_Field_SizedElement_UnknownSize_ { 770 array: SizedStruct[], 771} 772packet Struct_Array_Field_SizedElement_UnknownSize { 773 s: Struct_Array_Field_SizedElement_UnknownSize_, 774} 775 776struct Struct_Array_Field_UnsizedElement_ConstantSize_ { 777 array: UnsizedStruct[4], 778} 779packet Struct_Array_Field_UnsizedElement_ConstantSize { 780 s: Struct_Array_Field_UnsizedElement_ConstantSize_, 781} 782 783struct Struct_Array_Field_UnsizedElement_VariableSize_ { 784 _size_(array) : 4, 785 _reserved_: 4, 786 array: UnsizedStruct[], 787} 788packet Struct_Array_Field_UnsizedElement_VariableSize { 789 s: Struct_Array_Field_UnsizedElement_VariableSize_, 790} 791 792struct Struct_Array_Field_UnsizedElement_VariableCount_ { 793 _count_(array) : 4, 794 _reserved_: 4, 795 array: UnsizedStruct[], 796} 797packet Struct_Array_Field_UnsizedElement_VariableCount { 798 s: Struct_Array_Field_UnsizedElement_VariableCount_, 799} 800 801struct Struct_Array_Field_UnsizedElement_UnknownSize_ { 802 array: UnsizedStruct[], 803} 804packet Struct_Array_Field_UnsizedElement_UnknownSize { 805 s: Struct_Array_Field_UnsizedElement_UnknownSize_, 806} 807 808// The parser must support complex size modifiers on arrays whose size is 809// specified by a size field. 810struct Struct_Array_Field_UnsizedElement_SizeModifier_ { 811 _size_(array) : 4, 812 _reserved_: 4, 813 array: UnsizedStruct[+2], 814} 815packet Struct_Array_Field_UnsizedElement_SizeModifier { 816 s: Struct_Array_Field_UnsizedElement_SizeModifier_, 817} 818 819// The parser must be able to handle arrays with padded size. 820struct Struct_Array_Field_SizedElement_VariableSize_Padded_ { 821 _size_(array) : 4, 822 _reserved_: 4, 823 array: 16[], 824 _padding_ [16], 825} 826packet Struct_Array_Field_SizedElement_VariableSize_Padded { 827 s: Struct_Array_Field_SizedElement_VariableSize_Padded_, 828} 829 830// The parser must be able to handle arrays with padded size. 831struct Struct_Array_Field_UnsizedElement_VariableCount_Padded_ { 832 _count_(array) : 8, 833 array: UnsizedStruct[], 834 _padding_ [16], 835} 836packet Struct_Array_Field_UnsizedElement_VariableCount_Padded { 837 s: Struct_Array_Field_UnsizedElement_VariableCount_Padded_, 838} 839 840struct Struct_Optional_Scalar_Field_ { 841 c0: 1, 842 c1: 1, 843 _reserved_: 6, 844 a: 24 if c0 = 0, 845 b: 32 if c1 = 1, 846} 847 848packet Struct_Optional_Scalar_Field { 849 s: Struct_Optional_Scalar_Field_, 850} 851 852struct Struct_Optional_Enum_Field_ { 853 c0: 1, 854 c1: 1, 855 _reserved_: 6, 856 a: Enum16 if c0 = 0, 857 b: Enum16 if c1 = 1, 858} 859 860packet Struct_Optional_Enum_Field { 861 s: Struct_Optional_Enum_Field_, 862} 863 864struct Struct_Optional_Struct_Field_ { 865 c0: 1, 866 c1: 1, 867 _reserved_: 6, 868 a: SizedStruct if c0 = 0, 869 b: UnsizedStruct if c1 = 1, 870} 871 872packet Struct_Optional_Struct_Field { 873 s: Struct_Optional_Struct_Field_, 874} 875 876// Enum declarations 877// 878// Test enum declarations with exhaustive configurations for the 879// following criterias: 880// 881// 1. truncated: is the enum width a multiple of 8 or not ? 882// this characteristic has an impact for some language generators 883// 2. complete: does the enum define all possible values ? 884// 3. open: does the enum allow for unknown or undefined values ? 885// 4. with range: does the enum use a tag range declarations ? 886 887enum Enum_Incomplete_Truncated_Closed_ : 3 { 888 A = 0, 889 B = 1, 890} 891 892packet Enum_Incomplete_Truncated_Closed { 893 e: Enum_Incomplete_Truncated_Closed_, 894 _reserved_ : 5, 895} 896 897enum Enum_Incomplete_Truncated_Open_ : 3 { 898 A = 0, 899 B = 1, 900 UNKNOWN = .. 901} 902 903packet Enum_Incomplete_Truncated_Open { 904 e: Enum_Incomplete_Truncated_Open_, 905 _reserved_ : 5, 906} 907 908enum Enum_Incomplete_Truncated_Closed_WithRange_ : 3 { 909 A = 0, 910 B = 1..6 { 911 X = 1, 912 Y = 2, 913 } 914} 915 916packet Enum_Incomplete_Truncated_Closed_WithRange { 917 e: Enum_Incomplete_Truncated_Closed_WithRange_, 918 _reserved_ : 5, 919} 920 921enum Enum_Incomplete_Truncated_Open_WithRange_ : 3 { 922 A = 0, 923 B = 1..6 { 924 X = 1, 925 Y = 2, 926 }, 927 UNKNOWN = .. 928} 929 930packet Enum_Incomplete_Truncated_Open_WithRange { 931 e: Enum_Incomplete_Truncated_Open_WithRange_, 932 _reserved_ : 5, 933} 934 935enum Enum_Complete_Truncated_ : 3 { 936 A = 0, 937 B = 1, 938 C = 2, 939 D = 3, 940 E = 4, 941 F = 5, 942 G = 6, 943 H = 7, 944} 945 946packet Enum_Complete_Truncated { 947 e: Enum_Complete_Truncated_, 948 _reserved_ : 5, 949} 950 951enum Enum_Complete_Truncated_WithRange_ : 3 { 952 A = 0, 953 B = 1..7 { 954 X = 1, 955 Y = 2, 956 } 957} 958 959packet Enum_Complete_Truncated_WithRange { 960 e: Enum_Complete_Truncated_WithRange_, 961 _reserved_ : 5, 962} 963 964enum Enum_Complete_WithRange_ : 8 { 965 A = 0, 966 B = 1, 967 C = 2..255, 968} 969 970packet Enum_Complete_WithRange { 971 e: Enum_Complete_WithRange_, 972} 973