4 releases
0.2.3 | Nov 13, 2023 |
---|---|
0.2.2 | Oct 30, 2023 |
0.2.1 | Oct 18, 2023 |
0.2.0 | Sep 29, 2023 |
#113 in Parser tooling
641 downloads per month
Used in pdl-derive
7KB
Packet Description Language (PDL)
PDL is a domain specific language for writing the definition of binary protocol packets. Parsing and validating packets from raw bytes is tedious and error prone in any language. PDL generates memory safe and tailored backends for multiple target languages:
- Rust
- C++
- Python
Historically PDL was developed as part of the Android Bluetooth stack (bluetooth_packetgen) as a way to generate the parser and serializer for Bluetooth packets, and reduce the number of memory safety issues that come with manipulating and validating raw data.
How to use PDL
- Write the protocol definition
cargo run my-protocol.pdl --output-format rust > my-protocol.rs
Language specific instructions are provided for all supported backends:
Supported Features
- Scalar values
- Enumerators
- Arrays
- Optional fields
- Nested packets
- Conditional packet derivation
- Custom field definitions
Similar projects
Dependencies
~0.5–1MB
~22K SLoC