radiotap-rs

Crates.ioradiotap-rs
lib.rsradiotap-rs
version0.1.0
created_at2026-01-04 04:07:52.132475+00
updated_at2026-01-04 04:07:52.132475+00
descriptionno_std compatible radiotap header encoder and decoder.
homepage
repositoryhttps://github.com/wakeful-cloud/radiotap-rs
max_upload_size
id2021284
size296,089
Wakeful Cloud (Wakeful-Cloud)

documentation

README

radiotap-rs

continuous integration continuous deployment

no_std compatible radiotap header encoder and decoder for Rust. Supports repeated fields, vendor-specific fields (both vendor-specific namespaces and vendor- specific TLV fields), and most standard radiotap fields.

Examples

See the examples directory for and header_tests.rs for usage examples.

Documentation

Supported Fields

The following fields are currently supported:

Bit Index Field Name
0 TSFT
1 Flags
2 Rate
3 Channel
4 FHSS
5 Antenna Signal
6 Antenna Noise
7 Lock Quality
8 TX Attenuation
9 db TX Attenuation
10 dbm TX Power
11 Antenna
12 dB Antenna Signal
13 dB Antenna Noise
14 RX Flags
14 FCS in Header
15 TX Flags
15 Hardware Queue
16 RSSI
16 RTS Retries
17 Data Retries
18 XChannel
19 MCS
20 A-MPDU Status
21 VHT
22 Timestamp
22 Extended Flags
23 HE
24 HE-MU
25 HE-MU-Other-User
26 0-Length-PSDU
27 L-SIG
28 TLV
29 Radiotap Namespace
30 Vendor Namespace

Additional, vendor-specific fields are also supported. If you need support for non-vendor-specific fields not listed above, please feel free to submit a pull request.

Gotchas

This section contains some important notes for library consumers and contributors alike.

This Library

As a consequence of some of the quirks of the radiotap specification (See the next subsection for details) and various other factors, you should note the following about this library:

  1. Fields are represented as a list (rather than a struct) to support repeated fields.
  2. Field order matters. Fields are encoded in the order in which they are stored in the list, however, the radiotap specification mandates non-Type-Length-Value (TLV) fields be ordered in ascending order by their bit index (for fields in the same namespace). Therefore, if you pass out-of-order fields (in the same namespace), the encoder will rectify this by splitting the fields across multiple namespaces, potentially resulting in a larger-than-necessary header. Unless you have a specific reason not to do so, you are encouraged to define fields in ascending order by their bit index.
  3. Fields with a bit index < 28 in the first radiotap namespace are encoded using the older implicit-length encoding for backwards compatibility.
  4. Vendor-specific fields are always encoded using TLV encoding. However, vendor-specific fields can be decoded from either implicit-length encoding (in vendor-specific namespaces) or TLV encoding (in the radiotap namespace).

Radiotap Specification

If you aren't familiar with the radiotap specification, it is suggested to read about Type Length Value (TLV) fields, the Radiotap Namespace pseudo-field, and the Vendor Namespace field in particular. Some important observations about the radiotap specification itself are:

  • Radiotap headers start with a subheader containing the header version, padding, and a sequence of bitmasks defining which fields are present immediately following the subheader.
  • Every individual presence bitmask contains 3 special bit indices:
    • $n \cdot 32 - 3$: set to switch to the radiotap namespace (starting with the presence bitmask immediately following this one). This is a pseudo-field (i.e., it only exists within the bitmask and takes up no additional room).
    • $n \cdot 32 - 2$: set to switch to a vendor namespace (starting with the presence bitmask immediately following this one). This is a full field, containing the vendor Organizationally Unique Identifier (OUI), vendor-specific sub-namespace, and the length of the namespace.
    • $n \cdot 32 - 1$: set if another bitmask immediately follows this one. This is a pseudo-field (i.e., it only exists within the bitmask and takes up no additional room).
  • Fields can be repeated by repeating their respective namespaces. For example, the presence bitmasks [0xA0000001, 0x00000001] define 2 TSFT fields back-to-back in 2 separate radiotap namespaces.
  • Fields with a bit index < 28 can either use the older implicit-length encoding or the newer Type-Length-Value (TLV) encoding. Additionally, fields with a bit index >= 32 must use TLV encoding. TLV encoded fields are nested under the TLV field, which itself uses the older encoding.
  • Vendor-specific fields can either use the older implicit-length encoding in vendor-specific namespaces or TLV encoding in the radiotap namespace.
  • Not all field members are nicely aligned (e.g., the HE field's data4 station ID member).
  • Refer to the IEEE 802.11 specification anywhere the radiotap specification lacks details.

Prior Art

Commit count: 0

cargo fmt