Crates.io | radiotap |
lib.rs | radiotap |
version | 2.0.0-beta.1 |
source | src |
created_at | 2018-05-24 07:40:59.156372 |
updated_at | 2020-09-01 16:40:38.476505 |
description | A parser for the radiotap capture format. |
homepage | https://github.com/rossmacarthur/radiotap |
repository | https://github.com/rossmacarthur/radiotap |
max_upload_size | |
id | 66872 |
size | 94,288 |
A parser for the radiotap capture format.
Add to your project with
cargo add radiotap
or directly editing your Cargo.toml
[dependencies]
radiotap = "2"
See the documentation here.
See examples/ for more.
// 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 {
assert_eq!(rate.to_mbps(), 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.