#packets #networking #packet #scapy #parser #network-protocol

macro pkts-macros

procedural macros for deriving pkts library traits

5 releases

0.2.0 Sep 17, 2024
0.1.3 Mar 23, 2023
0.1.2 Mar 16, 2023
0.1.1 Mar 15, 2023
0.1.0 Mar 4, 2023

#59 in #packets


Used in pkts

MIT/Apache

24KB
388 lines

pkts-macros

Latest Version Documentation pkts-macros: rustc 1.65+

pkts-macros - a pkts submodule for generating common code for Layers


Rscap is a multi-purpose library for network packet capture/transmission and packet building. Its aims are twofold:

  1. To provide Rust-native platform tools for packet capture and transmission (comparable to libpcap, but written from the ground up in Rust)
  2. To expose a robust and ergonomic API for building packets and accessing/modifying packet data fields in various network protocols (like scapy, but with strong typing and significantly improved performance)

The pkts module focuses solely on (2). It provides a packet-building API for a wide variety of network protocol layers. This library isn't meant to only cover Datalink through Transport layers or stateless protocols--thanks to Sequence and Session types (which defragment/reorder packets and track packet state, respectively), any application-layer protocol can be easily captured and decoded.

The pkts-macros submodule provides derive macros for pkts that assist in creating new Layer types.

More information about the library can be found in the rscap or pkts crates, or at pkts.org.

License

The source code of this project is licensed under either the MIT License or the Apache 2.0 License, at your option.

Dependencies

~1.5MB
~37K SLoC