radiotap

Crates.ioradiotap
lib.rsradiotap
version2.0.0-beta.1
sourcesrc
created_at2018-05-24 07:40:59.156372
updated_at2020-09-01 16:40:38.476505
descriptionA parser for the radiotap capture format.
homepagehttps://github.com/rossmacarthur/radiotap
repositoryhttps://github.com/rossmacarthur/radiotap
max_upload_size
id66872
size94,288
Ross MacArthur (rossmacarthur)

documentation

README

radiotap

Crates.io Version Docs.rs Latest Build Status

A parser for the radiotap capture format.

Getting started

Add to your project with

cargo add radiotap

or directly editing your Cargo.toml

[dependencies]
radiotap = "2"

See the documentation here.

Usage

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..];

License

Licensed under either of

at your option.

Commit count: 16

cargo fmt