• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

fields/25-Apr-2025-3,0961,553

test/25-Apr-2025-3,1712,492

Android.bpD25-Apr-20251.5 KiB5351

BUILD.gnD25-Apr-20252.2 KiB9281

READMED25-Apr-20252 KiB6349

bison.gniD25-Apr-20252.4 KiB7668

checksum_def.ccD25-Apr-20251.3 KiB3614

checksum_def.hD25-Apr-20251.1 KiB3814

custom_field_def.ccD25-Apr-20252.5 KiB7448

custom_field_def.hD25-Apr-20251.3 KiB4618

declarations.hD25-Apr-20252.5 KiB9262

enum_def.ccD25-Apr-20251.6 KiB4924

enum_def.hD25-Apr-20251.2 KiB4618

enum_gen.ccD25-Apr-20252.1 KiB6238

enum_gen.hD25-Apr-2025918 3611

field_list.hD25-Apr-20255.1 KiB195126

flex.gniD25-Apr-20252.3 KiB7466

gen_cpp.ccD25-Apr-20259.7 KiB299239

language_l.llD25-Apr-20253.8 KiB131106

language_y.yyD25-Apr-202521.5 KiB782689

logging.hD25-Apr-20252.5 KiB9962

main.ccD25-Apr-20255.8 KiB177128

packet_def.ccD25-Apr-202528.1 KiB823673

packet_def.hD25-Apr-20252 KiB6931

packet_dependency.ccD25-Apr-20255.9 KiB15288

packet_dependency.hD25-Apr-20251.4 KiB4220

packetgen.gniD25-Apr-20252 KiB6456

parent_def.ccD25-Apr-202521.6 KiB626504

parent_def.hD25-Apr-20253 KiB10045

parse_location.hD25-Apr-2025799 309

size.hD25-Apr-20253.2 KiB13491

struct_def.ccD25-Apr-202512.7 KiB418336

struct_def.hD25-Apr-20251.5 KiB5726

struct_parser_generator.ccD25-Apr-20253.8 KiB10380

struct_parser_generator.hD25-Apr-20251.3 KiB4522

type_def.hD25-Apr-20251.2 KiB4922

util.hD25-Apr-20254.5 KiB194134

README

1This file just contains some notes about the design and usage of the PDL language.
2
3-------
4 TERMS
5-------
6.pdl
7  The file type that defines packet definitions. You may think of each pdl file
8  as its own translation unit.
9
10Packet Views and Builders
11  Generated from a packet definition. Views are used to validate packets and
12  extract the fields that are defined in the pdl file.  Builders check the input
13  arguments and can be serialized.
14
15Checksum types
16  checksum MyChecksumClass : 16 "path/to/the/class/"
17  Checksum fields need to implement the following three methods:
18    void Initialize(MyChecksumClass&);
19    void AddByte(MyChecksumClass&, uint8_t);
20    // Assuming a 16-bit (uint16_t) checksum:
21    uint16_t GetChecksum(MyChecksumClass&);
22-------------
23 LIMITATIONS
24-------------
25  - Size fields for a variable length field MUST come before the definition
26    of said field.
27
28  - Payload fields must be byte-aligned unless they have an unknown size.
29    Body fields are allowed to not be byte aligned.
30
31  - No conditionals
32
33  - Can not have to fields with the same name anywhere in the in an inheritence chain
34
35  - Can't handle size for Body type fields yet since they might not be byte aligned.
36
37  - Currently no arrays of custom types (might change later)
38
39-------
40 NOTES
41-------
42All field names should be in snake_case.  Types should be in CamelCase.
43
44The _payload_ keyword generates a getter but _body_ doesn't. Therefore, a
45_payload_ must be byte aligned.
46
47Supports constraints on grandparents
48Supports multiple constraints
49Every field handles its own generation.
50One pdl file will result in one header file with all the packets
51
52Things to cover -
53  Constraints
54  Inheritance vs Contains
55
56Custom fields with fixed size must extend and implement:
57  packet::CustomFieldFixedSizeInterface
58
59Custom fields with variable size need the following functions:
60  static void Serialize(const Type&, MutableView&);
61  static std::optional<size_t> Size(Iterator);
62  static Type Parse(Iterator);
63  std::string ToString();