Migrate 25 crates to monorepo. am: 324eb7dd96

Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/pdl-runtime/+/3248515

Change-Id: I4df95a0f7e68b9d7ca836096596ad7d1f9e94c39
Signed-off-by: Automerger Merge Worker <[email protected]>
tree: 298ce4189e419baffd78abb4be1d766eb16394c8
  1. src/
  2. .cargo_vcs_info.json
  3. Android.bp
  4. Cargo.toml
  5. Cargo.toml.orig
  6. LICENSE
  7. METADATA
  8. MODULE_LICENSE_APACHE2
  9. OWNERS
  10. README.md
README.md

Packet Description Language (PDL)

Crate Build workflow GitHub contributors GitHub stars

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

  1. Write the protocol definition
  2. cargo run my-protocol.pdl --output-format rust > my-protocol.rs

Language specific instructions are provided for all supported backends:

  1. Rust generated code guide
  2. Python generated code guide
  3. C++ generated code guide

Supported Features

Full reference documentation

  • Scalar values
  • Enumerators
  • Arrays
  • Optional fields
  • Nested packets
  • Conditional packet derivation
  • Custom field definitions

Similar projects