• Home
Name Date Size #Lines LOC

..--

fields/06-Sep-2024-3,2291,702

test/06-Sep-2024-3,1632,488

Android.bpD06-Sep-20241.5 KiB5351

BUILD.gnD06-Sep-20242.2 KiB9281

READMED06-Sep-20242 KiB6349

bison.gniD06-Sep-20242.4 KiB7668

checksum_def.ccD06-Sep-20241.3 KiB3614

checksum_def.hD06-Sep-20241.1 KiB3814

custom_field_def.ccD06-Sep-20242.5 KiB7347

custom_field_def.hD06-Sep-20241.3 KiB4618

declarations.hD06-Sep-20242.5 KiB9262

enum_def.ccD06-Sep-20241.6 KiB5126

enum_def.hD06-Sep-20241.2 KiB4618

enum_gen.ccD06-Sep-20242.1 KiB6238

enum_gen.hD06-Sep-2024919 3611

field_list.hD06-Sep-20245.1 KiB211142

flex.gniD06-Sep-20242.3 KiB7466

gen_cpp.ccD06-Sep-20249.5 KiB300241

language_l.llD06-Sep-20243.8 KiB131106

language_y.yyD06-Sep-202421.5 KiB782689

logging.hD06-Sep-20242.5 KiB9761

main.ccD06-Sep-20245.8 KiB187138

packet_def.ccD06-Sep-202427.9 KiB810660

packet_def.hD06-Sep-20242 KiB6931

packet_dependency.ccD06-Sep-20245.8 KiB15288

packet_dependency.hD06-Sep-20241.4 KiB4220

packetgen.gniD06-Sep-20242 KiB6456

parent_def.ccD06-Sep-202421.3 KiB608487

parent_def.hD06-Sep-20243 KiB9945

parse_location.hD06-Sep-2024807 3211

size.hD06-Sep-20243.2 KiB143100

struct_def.ccD06-Sep-202412.5 KiB404322

struct_def.hD06-Sep-20241.5 KiB5726

struct_parser_generator.ccD06-Sep-20243.8 KiB9976

struct_parser_generator.hD06-Sep-20241.3 KiB4522

type_def.hD06-Sep-20241.2 KiB5124

util.hD06-Sep-20244.4 KiB180120

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();