DTP is a lightweight, foundational Rust crate for building simple, layered communication protocols. It provides a set of generic, reusable data structures that represent the different layers of a network stack, allowing developers to focus on the application logic rather than the boilerplate of data encapsulation.
The core of DTP is a set of structs—Frame, Packet, and Segment—that allow you to neatly package your data for transmission, inspired by the OSI model. It is designed to be transport-agnostic, meaning you can use it as the data-structuring backbone for any transmission medium, including serial interfaces or custom network transports.
This project is currently in an active prototyping and development phase. The API is designed to be simple and extensible but is subject to change.
Features
- Layered Architecture: Clearly defined structs for the Data Link (
Frame), Network (Packet), and Transport (Segment) layers. - Generic by Design: Easily define your own address types (e.g.,
MacAddress,Ipv4Address) using the provided macros. - Efficient Payloads: Utilizes
bytes::Bytesfor zero-copy payload handling. - Extensible: A simple, composable design that's easy to build upon for more complex protocols.
Installation
Add DTP to your project's Cargo.toml:
Usage
DTP provides the building blocks to structure your data. Here is a conceptual example of how you would encapsulate a piece of data for transmission.
use ;
use Bytes;
License
This project is licensed under the MIT License - see the LICENSE file for details.