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

..--

fields/23-Mar-2024-3,2221,700

test/23-Mar-2024-2,9872,343

Android.bpD23-Mar-20241.3 KiB5352

READMED23-Mar-20242 KiB6349

checksum_def.ccD23-Mar-20241.3 KiB3615

checksum_def.hD23-Mar-20241.1 KiB3814

checksum_type_checker.hD23-Mar-20241.7 KiB5524

custom_field_def.ccD23-Mar-20242.7 KiB7750

custom_field_def.hD23-Mar-20241.4 KiB4819

custom_type_checker.hD23-Mar-20241.7 KiB5326

declarations.hD23-Mar-20242.5 KiB9262

enum_def.ccD23-Mar-20241.6 KiB5126

enum_def.hD23-Mar-20241.2 KiB4316

enum_gen.ccD23-Mar-20242.2 KiB6236

enum_gen.hD23-Mar-2024919 3611

field_list.hD23-Mar-20245.1 KiB211142

language_l.llD23-Mar-20243.6 KiB12299

language_y.yyD23-Mar-202420.4 KiB731644

logging.hD23-Mar-20242.5 KiB9761

main.ccD23-Mar-202416.9 KiB465376

packet_def.ccD23-Mar-202425.5 KiB742599

packet_def.hD23-Mar-20241.9 KiB6830

parent_def.ccD23-Mar-202418.1 KiB485378

parent_def.hD23-Mar-20242.3 KiB7128

parse_location.hD23-Mar-2024807 3211

size.hD23-Mar-20243.2 KiB143100

struct_def.ccD23-Mar-202410 KiB313253

struct_def.hD23-Mar-20241.5 KiB5625

struct_parser_generator.ccD23-Mar-20243.8 KiB9976

struct_parser_generator.hD23-Mar-20241.3 KiB4522

type_def.hD23-Mar-20241.2 KiB5124

util.hD23-Mar-20243.6 KiB13886

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