• Home
Name Date Size #Lines LOC

..--

doc/03-May-2024-597454

fields/03-May-2024-3,8392,176

test/03-May-2024-3,1802,496

Android.bpD03-May-20241.6 KiB5755

BUILD.gnD03-May-20242.2 KiB9382

READMED03-May-20242 KiB6349

bison.gniD03-May-20242.4 KiB7668

checksum_def.ccD03-May-20241.3 KiB3615

checksum_def.hD03-May-20241.1 KiB3814

checksum_type_checker.hD03-May-20241.7 KiB5524

custom_field_def.ccD03-May-20242.7 KiB7750

custom_field_def.hD03-May-20241.4 KiB4819

custom_type_checker.hD03-May-20241.7 KiB5427

declarations.hD03-May-20242.5 KiB9262

enum_def.ccD03-May-20241.6 KiB5126

enum_def.hD03-May-20241.2 KiB4517

enum_gen.ccD03-May-20244 KiB10374

enum_gen.hD03-May-2024961 3812

field_list.hD03-May-20245.1 KiB211142

flex.gniD03-May-20242.3 KiB7466

gen_cpp.ccD03-May-202413.9 KiB408331

gen_rust.ccD03-May-20247.3 KiB233190

language_l.llD03-May-20243.8 KiB131106

language_y.yyD03-May-202421.5 KiB782689

logging.hD03-May-20242.5 KiB9761

main.ccD03-May-20246.9 KiB210156

packet_def.ccD03-May-202448.9 KiB1,4421,223

packet_def.hD03-May-20242.4 KiB8639

packet_dependency.ccD03-May-20245.8 KiB15288

packet_dependency.hD03-May-20241.4 KiB4119

packetgen.gniD03-May-20246.2 KiB195172

parent_def.ccD03-May-202426.3 KiB740605

parent_def.hD03-May-20243.1 KiB10145

parse_location.hD03-May-2024807 3211

size.hD03-May-20243.2 KiB143100

struct_def.ccD03-May-202413 KiB425348

struct_def.hD03-May-20241.7 KiB6630

struct_parser_generator.ccD03-May-20243.8 KiB9976

struct_parser_generator.hD03-May-20241.3 KiB4522

type_def.hD03-May-20241.2 KiB5124

util.hD03-May-20244.6 KiB192127

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