A parser for the radiotap capture format.
Add to your project with
sh
cargo add radiotap
or directly editing your Cargo.toml
toml
[dependencies]
radiotap = "2"
See the documentation here.
See examples/ for more.
```rust // a capture off the wire or from a pcap file let capture = &[0, 0, 0xd, 0x0, 0x5, 0, 0, 0, 0x78, 0x56, 0x34, 0x12, 0, 0, 0, 0, 0x30, /* ... */ ];
// parse the radiotap header from the capture into a Header
struct
let header: radiotap::Header = radiotap::parse(capture)?;
// get the length of the entire header let length = header.length();
// Unpack the rate
field if it is present
if let radiotap::Header { rate: Some(rate), .. } = header {
asserteq!(rate.tombps(), 24.0);
}
// using the length we can determine the rest of the capture // i.e. IEEE 802.11 header and body let rest = &capture[length..]; ```
Licensed under either of
at your option.