Radiotap - IEEE 802.11 Radiotap Header¶
pcapkit.protocols.link.radiotap contains
Radiotap
only, which implements the extractor for the radiotap header [*] capture
tools prepend to an 802.11 frame, as seen on a
LINKTYPE_IEEE802_11_RADIOTAP capture, or on a
LINKTYPE_LINUX_SLL/LINKTYPE_LINUX_SLL2 capture whose arphrd_type
is ARPHRD_IEEE80211_RADIOTAP. Radiotap is not part of the 802.11
standard itself – it is a prefix written by the capturing tool, in front of
the raw 802.11 MAC frame. Its fixed start, all little-endian, is described
as below:
Octets |
Bits |
Name |
Description |
|---|---|---|---|
0 |
0 |
|
Header Revision (always |
1 |
8 |
|
Padding |
2 |
16 |
|
Header Length (header included) |
4 |
32 |
|
First Present-Flags Word |
followed by a chain of further present-flags words – bit 31 of a word
signals that another follows – and then the optional-field region those
bitmasks select, each field aligned and sized per its own type. it_len
bounds the whole of it; the 802.11 MAC frame starts at that offset.
Scope¶
This class:
Decodes the fixed 8-octet start –
it_version,it_pad,it_len– and walks the present-flags chain, recording every word aspresent.Keeps the optional-field region those bits select whole, as
fields, which is what a rebuild from the data model writes, and decodes it asdecoded, by the rules below.Hands everything from
it_lenon, the 802.11 MAC frame, toIEEE802_11(NoPayloadwhen nothing follows). The header names no next protocol, since an 802.11 frame always follows it, so the frame is looked up inRadiotap.__proto__underLinkType.IEEE802_11;register_radiotap()replaces the entry.
Field Decoding¶
The bits are walked in order, word by word, and the fields they select follow
one another in the same order, each aligned to its own boundary counted from
the start of the header. A field type is read and made by the methods
Radiotap.__field__
names for it, through the schema the
RadiotapField registry holds
for it: the schema’s fields are the subfields of the type’s page on
radiotap.org, their total is its size, and its __align__ its alignment,
which match the tables of the Linux kernel, Wireshark and radiotap.org’s own
radiotap-library wherever they size it. A page that names no alignment
takes that of its subfields, single octets, but for FHSS, which those three
align to 2. The fields are radiotap.org’s defined ones, and RTS retries and data
retries, bits 16 and 17, from its unofficially used ones, which those three
size alike; OpenBSD writes a 2-octet RSSI field at bit 16 instead, which is not
read. A bitmap radiotap.org defines bit by bit is a member of its flag registry
under pcapkit.const.radiotap, which keeps the bits it does not name. A
bitmap that mixes value subfields with known bits – the MCS flags, the HE
data1 and data2, the HE-MU flags1 and flags2 and the U-SIG
common – is split: each value subfield is an integer, and its other bits,
the undefined ones among them, a member of its known-bits registry. A field
type registered through
register_radiotap_field() is
decoded the same way.
Namespaces. Bits 29 and 30 mean the same in every word. Bit 29, the Radiotap Namespace field, carries nothing, and the next word restarts the radiotap namespace at bit 0. Bit 30, the Vendor Namespace field, carries an OUI, a sub-namespace and a
skip_length; the words up to the next namespace field select vendor fields, whose data is theskip_lengthoctets after it, kept whole. Without either, the next word continues the namespace, each bit numbered 32 past the same bit of the word before.TLVs. Bit 28 makes the rest of the region a list of type-length-value items. An item’s data is decoded where its type has a schema it does not run past, and kept raw otherwise; a vendor item is split into its header and raw data. radiotap.org lets a producer leave out the octets that end an item, which are then zeros, so an item short of its schema, or of the vendor header, is decoded as though they were there. Its decoded data records the cut as
__short_read__, asSchema.unpackdoes, soRadiotap.makewrites the octets that were captured.What is not decoded. A radiotap-namespace bit no field is defined for – 18, FreeBSD’s XChannel, which radiotap.org lists as unofficial, and every one numbered 32 or more, the TLV-only types included – or a field that runs past the region, ends the walk, since nothing after it can be located: an
Unknownentry keeps every octet from there on, and itsreasonsays which of the two it was.
Each bit with data in the radiotap namespace, and each namespace field, has
one entry in decoded,
keyed by its FieldType; the
subfields keep radiotap.org’s names.
make() takes the same entries
as fields and encodes them with zero padding.
- class pcapkit.protocols.link.radiotap.Radiotap(file=None, length=None, **kwargs)[source]¶
Bases:
Link[Radiotap,Radiotap]This class implements the IEEE 802.11 radiotap header.
The 802.11 MAC frame this header precedes is dispatched through the registry below, keyed by the link type of the frame:
Index
Protocol
and each field of the field-data region through
__field__, keyed by itsFieldType. See the module docstring’s Scope and Field Decoding sections for what is, and is not, decoded.- property length: int¶
Header length of current protocol.
This is
self._info.it_lenexactly as captured, even when it disagrees withpresentandfields– seeread().
- read(length=None, **kwargs)[source]¶
Read IEEE 802.11 radiotap header.
Structure of the fixed start this class dissects, all little-endian:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | it_version | it_pad | it_len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | it_present | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
followed, while the previous word’s bit 31 is set, by a further
it_presentword, then by the field-data region those bits select, then by the 802.11 MAC frame at offsetit_len.The region is decoded into
decodedas the module docstring’s Field Decoding section describes: one entry per bit that selects radiotap-namespace data or switches namespace, keyed by itsFieldType. A bit in a vendor namespace has no entry of its own, since its data is in theVendorNamespaceentry, and nothing after the TLV fields or anUnknownentry has one. Octets after the last field stay infieldsalone.
- make(it_version=0, it_pad=0, present=(0,), fields=b'', it_len=None, payload=b'', **kwargs)[source]¶
Make (construct) packet data.
- Parameters:
it_version (
int) – Header revision.it_pad (
int) – Padding octet.present (
Sequence[int]) – Every present-flags word, in order; the first is the mandatory one radiotap.org callsit_present, and each but the last conventionally has bit 31 set (not enforced for rawfields, so a capture that read short of its own chain replays exactly: see theNoteonFRAD.makefor the same tolerance).fields (
bytes|Mapping[FieldType|int,RadiotapField|Mapping[str,Any]] |Sequence[RadiotapField|Tuple[FieldType|int,Mapping[str,Any]]]) – The optional-field regionpresentselects: the raw octets, written as they are, or its fields, which are encoded with zero padding. Fields are given asdecodedholds them, or as a sequence of data models or(type, mapping)pairs, a type being aFieldTypeor anint. There is one per bitread()gives an entry for, in the same order, and anUnknownone, or one of a type no field is defined for, is written raw and ends the region.it_len (
int|None) – Total header length, header included; computed frompresentandfieldswhen omitted.payload (
bytes|ProtocolBase|Schema) – Payload data (the 802.11 MAC frame).**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed packet data.
- Raises:
ProtocolError – If
it_versionorit_paddoes not fit in 8 bits; ifpresentis empty or any of its words does not fit in 32 bits; iffieldsis neitherbytesnor fields; if the fields do not match the bits ofpresent, a word but the last of which ends the chain, or a value does not fit its subfield; if a TLV item’s__short_read__names no field and an octet count, or cuts short a vendor header that data follows; or ifit_lenis given and does not fit in 16 bits.
- classmethod register(code, protocol)[source]¶
Register a new protocol class for the frame a radiotap header precedes.
Notes
The fully qualified class name of the new protocol class should be
{protocol.module}.{protocol.name}.- Parameters:
protocol (
ModuleDescriptor[ProtocolBase] |Type[ProtocolBase]) – module descriptor or aProtocolBasesubclass
Important
This overrides
Link.registerbecauseself.__proto__is keyed by link type rather than by EtherType. Any link type is accepted, butread()consultsLinkType.IEEE802_11alone: that is the key a replacement 802.11 dissector takes, and an entry under any other key is stored and never reached.- Raises:
pcapkit.utilities.exceptions.RegistryError – If
protocolis not a class, or not aProtocolBasesubclass.- Warns:
pcapkit.utilities.warnings.RegistryWarning– If this link type is already registered and the incumbent differs from the replacement; seeProtocol.registerfor the guard, and for the shipped descriptor a restore puts back (#1504).
- classmethod register_field(code, meth)[source]¶
Register a field parser.
- Parameters:
code (
FieldType) – Radiotap field type.meth (
str|tuple[Callable[[FieldType,RadiotapField],RadiotapField],Callable[[FieldType,RadiotapField|Mapping[str,Any]],RadiotapField]]) – Method name, or a(parser, constructor)pair of callables, to parse and construct the field; see__field__.
- Warns:
RegistryWarning– If a different entry is already registered forcode; it is overwritten. Handing back the entry already stored, or one equal to it, is a silent no-op. Re-registering the entrycodeshipped with is accepted like any other, so an override can be undone (#1362, #1363).
- __length_hint__()[source]¶
Return an estimated length for the object.
The fixed start alone,
8– the shortest a radiotap header can structurally be (an empty present-flags word, no extended words, no field data). A capture shorter than this is not a radiotap header at all, so it is kept asRawrather than parsed; seeProtocol._parse_next_layer.- Return type:
Literal[8]
- classmethod __index__()[source]¶
Numeral registry index of the protocol.
- Return type:
- Returns:
Numeral registry index of the protocol in tcpdump link-layer header types.
LinuxSLL.__proto__names its own key for this class,ARPHRD_IEEE80211_RADIOTAP(The Registry Index).
- classmethod _make_data(data)[source]¶
Create key-value pairs from
datafor protocol construction.The field-data region is rebuilt from
fields, the octets as captured, so padding, trailing octets and fields that were not decoded come back exactly; an edit todecodedtakes amake()call that passes it asfields.
- _read_radiotap_fields(present, fields)[source]¶
Decode the field-data region.
- Parameters:
- Return type:
- Returns:
The decoded fields, as
read()describes them.
- _make_radiotap_fields(present, fields)[source]¶
Encode the field-data region, the inverse of
_read_radiotap_fields().- Parameters:
- Return type:
- Returns:
The field-data region.
- Raises:
ProtocolError – If the fields do not match the bits of
present, a word but the last of which ends the chain, or a value does not fit its subfield.
- _read_field_unknown(field_type, schema, *, reason=_REASON_NO_LAYOUT)[source]¶
Read the octets of a field type with no layout, or of a field that runs past the field-data region.
- _read_field_antenna_signal(field_type, schema)[source]¶
Read an Antenna signal field.
- Parameters:
field_type (
FieldType) – type of the fieldschema (
AntennaSignal) – parsed field schema
- Return type:
- Returns:
Parsed field data.
- _read_field_antenna_noise(field_type, schema)[source]¶
Read an Antenna noise field.
- Parameters:
field_type (
FieldType) – type of the fieldschema (
AntennaNoise) – parsed field schema
- Return type:
- Returns:
Parsed field data.
- _read_field_lock_quality(field_type, schema)[source]¶
Read a Lock quality field.
- Parameters:
field_type (
FieldType) – type of the fieldschema (
LockQuality) – parsed field schema
- Return type:
- Returns:
Parsed field data.
- _read_field_tx_attenuation(field_type, schema)[source]¶
Read a TX attenuation field.
- Parameters:
field_type (
FieldType) – type of the fieldschema (
TXAttenuation) – parsed field schema
- Return type:
- Returns:
Parsed field data.
- _read_field_db_tx_attenuation(field_type, schema)[source]¶
Read a dB TX attenuation field.
- Parameters:
field_type (
FieldType) – type of the fieldschema (
DBTXAttenuation) – parsed field schema
- Return type:
- Returns:
Parsed field data.
- _read_field_dbm_tx_power(field_type, schema)[source]¶
Read a dBm TX power field.
- Parameters:
field_type (
FieldType) – type of the fieldschema (
DBmTXPower) – parsed field schema
- Return type:
- Returns:
Parsed field data.
- _read_field_db_antenna_signal(field_type, schema)[source]¶
Read a dB antenna signal field.
- Parameters:
field_type (
FieldType) – type of the fieldschema (
DBAntennaSignal) – parsed field schema
- Return type:
- Returns:
Parsed field data.
- _read_field_db_antenna_noise(field_type, schema)[source]¶
Read a dB antenna noise field.
- Parameters:
field_type (
FieldType) – type of the fieldschema (
DBAntennaNoise) – parsed field schema
- Return type:
- Returns:
Parsed field data.
- _read_field_rts_retries(field_type, schema)[source]¶
Read an RTS retries field.
- Parameters:
field_type (
FieldType) – type of the fieldschema (
RTSRetries) – parsed field schema
- Return type:
- Returns:
Parsed field data.
- _read_field_data_retries(field_type, schema)[source]¶
Read a data retries field.
- Parameters:
field_type (
FieldType) – type of the fieldschema (
DataRetries) – parsed field schema
- Return type:
- Returns:
Parsed field data.
- _read_field_ampdu_status(field_type, schema)[source]¶
Read an A-MPDU status field.
- Parameters:
field_type (
FieldType) – type of the fieldschema (
AMPDUStatus) – parsed field schema
- Return type:
- Returns:
Parsed field data.
- _read_field_he_mu_other_user(field_type, schema)[source]¶
Read an HE-MU-other-user field.
- Parameters:
field_type (
FieldType) – type of the fieldschema (
HEMUOtherUser) – parsed field schema
- Return type:
- Returns:
Parsed field data.
- _read_field_zero_length_psdu(field_type, schema)[source]¶
Read a 0-length-PSDU field.
- Parameters:
field_type (
FieldType) – type of the fieldschema (
ZeroLengthPSDU) – parsed field schema
- Return type:
- Returns:
Parsed field data.
- _make_field_unknown(field_type, entry)[source]¶
Make the octets of a field that is written raw: an unknown one, or one of a type with no layout.
- Parameters:
field_type (
FieldType) – type of the fieldentry (
RadiotapField|Mapping[str,Any]) – field data, whosedatais the octets
- Return type:
- Returns:
Constructed field schema.
- Raises:
ProtocolError – If
datais notbytes.
- _make_field_antenna_signal(field_type, entry)[source]¶
Make an Antenna signal field.
- Parameters:
field_type (
FieldType) – type of the fieldentry (
AntennaSignal|Mapping[str,Any]) – field data, a data model or a mapping of its subfields
- Return type:
- Returns:
Constructed field schema.
- _make_field_antenna_noise(field_type, entry)[source]¶
Make an Antenna noise field.
- Parameters:
field_type (
FieldType) – type of the fieldentry (
AntennaNoise|Mapping[str,Any]) – field data, a data model or a mapping of its subfields
- Return type:
- Returns:
Constructed field schema.
- _make_field_lock_quality(field_type, entry)[source]¶
Make a Lock quality field.
- Parameters:
field_type (
FieldType) – type of the fieldentry (
LockQuality|Mapping[str,Any]) – field data, a data model or a mapping of its subfields
- Return type:
- Returns:
Constructed field schema.
- _make_field_tx_attenuation(field_type, entry)[source]¶
Make a TX attenuation field.
- Parameters:
field_type (
FieldType) – type of the fieldentry (
TXAttenuation|Mapping[str,Any]) – field data, a data model or a mapping of its subfields
- Return type:
- Returns:
Constructed field schema.
- _make_field_db_tx_attenuation(field_type, entry)[source]¶
Make a dB TX attenuation field.
- Parameters:
field_type (
FieldType) – type of the fieldentry (
DBTXAttenuation|Mapping[str,Any]) – field data, a data model or a mapping of its subfields
- Return type:
- Returns:
Constructed field schema.
- _make_field_dbm_tx_power(field_type, entry)[source]¶
Make a dBm TX power field.
- Parameters:
field_type (
FieldType) – type of the fieldentry (
DBmTXPower|Mapping[str,Any]) – field data, a data model or a mapping of its subfields
- Return type:
- Returns:
Constructed field schema.
- _make_field_db_antenna_signal(field_type, entry)[source]¶
Make a dB antenna signal field.
- Parameters:
field_type (
FieldType) – type of the fieldentry (
DBAntennaSignal|Mapping[str,Any]) – field data, a data model or a mapping of its subfields
- Return type:
- Returns:
Constructed field schema.
- _make_field_db_antenna_noise(field_type, entry)[source]¶
Make a dB antenna noise field.
- Parameters:
field_type (
FieldType) – type of the fieldentry (
DBAntennaNoise|Mapping[str,Any]) – field data, a data model or a mapping of its subfields
- Return type:
- Returns:
Constructed field schema.
- _make_field_rts_retries(field_type, entry)[source]¶
Make an RTS retries field.
- Parameters:
field_type (
FieldType) – type of the fieldentry (
RTSRetries|Mapping[str,Any]) – field data, a data model or a mapping of its subfields
- Return type:
- Returns:
Constructed field schema.
- _make_field_data_retries(field_type, entry)[source]¶
Make a data retries field.
- Parameters:
field_type (
FieldType) – type of the fieldentry (
DataRetries|Mapping[str,Any]) – field data, a data model or a mapping of its subfields
- Return type:
- Returns:
Constructed field schema.
- _make_field_ampdu_status(field_type, entry)[source]¶
Make an A-MPDU status field.
- Parameters:
field_type (
FieldType) – type of the fieldentry (
AMPDUStatus|Mapping[str,Any]) – field data, a data model or a mapping of its subfields
- Return type:
- Returns:
Constructed field schema.
- _make_field_he_mu_other_user(field_type, entry)[source]¶
Make an HE-MU-other-user field.
- Parameters:
field_type (
FieldType) – type of the fieldentry (
HEMUOtherUser|Mapping[str,Any]) – field data, a data model or a mapping of its subfields
- Return type:
- Returns:
Constructed field schema.
- _make_field_zero_length_psdu(field_type, entry)[source]¶
Make a 0-length-PSDU field.
- Parameters:
field_type (
FieldType) – type of the fieldentry (
ZeroLengthPSDU|Mapping[str,Any]) – field data, a data model or a mapping of its subfields
- Return type:
- Returns:
Constructed field schema.
- _get_payload()[source]¶
Get the 802.11 MAC frame this header precedes.
The header schema’s payload starts right after the fixed 8-octet start, so it also holds the present-flags chain and the field-data region it selects; those belong to this header, and the frame starts
self._mac_offsetoctets in, asread()records it. BothProtocol._import_next_layerand theRawthatbeholder()falls back to on a refused frame read from here.
- __proto__: DefaultDict[int | LinkType, ModuleDescriptor[ProtocolBase] | Type[ProtocolBase]]¶
Protocol index mapping for decoding next layer, keyed by the link type of the frame the header precedes;
read()always looks upLinkType.IEEE802_11.
- __proto_key__: ClassVar[tuple[Type[EnumRegistry], bool]]¶
What
__proto__is keyed by, declared asLink.__proto_key__is.
- __field__: DefaultDict[FieldType | int, str | tuple[Callable[[FieldType, RadiotapField], RadiotapField], Callable[[FieldType, RadiotapField | Mapping[str, Any]], RadiotapField]]]¶
Field type to method mapping, see
_read_radiotap_fields()and_make_radiotap_fields(). Astrvalue names the methods_read_field_${name}and_make_field_${name}, any other value is a(parser, constructor)pair; either works on the type’s schema in theRadiotapFieldregistry. A type missing from either has no layout and is kept raw. Presence bits 28 to 30 and vendor namespace TLV items follow rules of their own, see the module docstring; a type from 32 on is reached as a TLV item only.
Header Schemas¶
- class pcapkit.protocols.schema.link.radiotap.Radiotap(it_version=NO_VALUE, it_pad=NO_VALUE, it_len=NO_VALUE, it_present=NO_VALUE, payload=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for an IEEE 802.11 radiotap header.
Only the fixed 8-octet start –
it_version,it_pad,it_lenand the firstit_presentword – is given its own field, all little-endian per radiotap.org. Everything that follows – any extended present-flags words, the optional-field region they select, and the 802.11 MAC frame behind it – is captured together aspayload, since where one ends and the next begins is only known once the present-flags chain itself has been walked; seeRadiotap.read. Each field in the region is aRadiotapFieldof its own.
- class pcapkit.protocols.schema.link.radiotap.RadiotapField(*args, **kwargs)[source]¶
Bases:
EnumSchema[FieldType]Header schema for a radiotap field, little-endian on the wire.
A subclass registered with a field type is the layout of that type’s field, as its page on radiotap.org gives it: its subfields are the schema’s fields, its size their total, and its alignment
__align__. A field a presence bit selects has a fixed size.
- class pcapkit.protocols.schema.link.radiotap.Unknown(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for an octet run a field type does not decode, kept whole.
- class pcapkit.protocols.schema.link.radiotap.TSFT(mactime=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the TSFT field, bit 0.
- class pcapkit.protocols.schema.link.radiotap.Flags(flags=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the Flags field, bit 1.
- class pcapkit.protocols.schema.link.radiotap.Rate(rate=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the Rate field, bit 2.
- class pcapkit.protocols.schema.link.radiotap.Channel(frequency=NO_VALUE, flags=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the Channel field, bit 3.
- flags: ChannelFlags = <EnumField flags>¶
Channel flags.
- class pcapkit.protocols.schema.link.radiotap.FHSS(hop_set=NO_VALUE, hop_pattern=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the FHSS field, bit 4.
Its page names no alignment; the Linux kernel, Wireshark and radiotap-library align it to 2.
- class pcapkit.protocols.schema.link.radiotap.AntennaSignal(signal=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the Antenna signal field, bit 5.
- class pcapkit.protocols.schema.link.radiotap.AntennaNoise(noise=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the Antenna noise field, bit 6.
- class pcapkit.protocols.schema.link.radiotap.LockQuality(quality=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the Lock quality field, bit 7.
- class pcapkit.protocols.schema.link.radiotap.TXAttenuation(attenuation=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the TX attenuation field, bit 8.
- class pcapkit.protocols.schema.link.radiotap.DBTXAttenuation(attenuation=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the dB TX attenuation field, bit 9.
- class pcapkit.protocols.schema.link.radiotap.DBmTXPower(power=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the dBm TX power field, bit 10.
- class pcapkit.protocols.schema.link.radiotap.Antenna(antenna=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the Antenna field, bit 11.
- class pcapkit.protocols.schema.link.radiotap.DBAntennaSignal(signal=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the dB antenna signal field, bit 12.
- class pcapkit.protocols.schema.link.radiotap.DBAntennaNoise(noise=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the dB antenna noise field, bit 13.
- class pcapkit.protocols.schema.link.radiotap.RXFlags(flags=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the RX flags field, bit 14.
- class pcapkit.protocols.schema.link.radiotap.TXFlags(flags=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the TX flags field, bit 15.
- class pcapkit.protocols.schema.link.radiotap.RTSRetries(retries=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the RTS retries field, bit 16, from radiotap.org’s unofficial fields.
- class pcapkit.protocols.schema.link.radiotap.DataRetries(retries=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the data retries field, bit 17, from radiotap.org’s unofficial fields.
- class pcapkit.protocols.schema.link.radiotap.MCS(known=NO_VALUE, flags=NO_VALUE, mcs=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the MCS field, bit 19.
- class pcapkit.protocols.schema.link.radiotap.AMPDUStatus(reference=NO_VALUE, flags=NO_VALUE, delimiter_crc=NO_VALUE, reserved=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the A-MPDU status field, bit 20.
- flags: AMPDUFlags = <EnumField flags>¶
Flags.
- class pcapkit.protocols.schema.link.radiotap.VHT(known=NO_VALUE, flags=NO_VALUE, bandwidth=NO_VALUE, mcs_nss=NO_VALUE, coding=NO_VALUE, group_id=NO_VALUE, partial_aid=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the VHT field, bit 21.
- class pcapkit.protocols.schema.link.radiotap.Timestamp(timestamp=NO_VALUE, accuracy=NO_VALUE, unit_position=NO_VALUE, flags=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the timestamp field, bit 22.
- flags: TimestampFlags = <EnumField flags>¶
Flags.
- class pcapkit.protocols.schema.link.radiotap.HE(data1=NO_VALUE, data2=NO_VALUE, data3=NO_VALUE, data4=NO_VALUE, data5=NO_VALUE, data6=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the HE field, bit 23.
- class pcapkit.protocols.schema.link.radiotap.HEMU(flags1=NO_VALUE, flags2=NO_VALUE, ru_channel1=NO_VALUE, ru_channel2=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the HE-MU field, bit 24.
- flags1: dict[str, Any] = <BitmapField flags1>¶
SIG-B MCS and DCM, the channel 1 center 26-tone RU, and which subfields are known.
- class pcapkit.protocols.schema.link.radiotap.HEMUOtherUser(per_user_1=NO_VALUE, per_user_2=NO_VALUE, per_user_position=NO_VALUE, per_user_known=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the HE-MU-other-user field, bit 25.
- per_user_known: HEMUOtherUserKnown = <EnumField per_user_known>¶
Which of the per-user subfields are known.
- class pcapkit.protocols.schema.link.radiotap.ZeroLengthPSDU(psdu_type=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the 0-length-PSDU field, bit 26.
- class pcapkit.protocols.schema.link.radiotap.LSIG(data1=NO_VALUE, data2=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the L-SIG field, bit 27.
- class pcapkit.protocols.schema.link.radiotap.VendorNamespace(oui=NO_VALUE, sub_namespace=NO_VALUE, skip_length=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the Vendor Namespace field, bit 30.
The vendor data it gives the length of follows it, and is not a subfield of its own; nor is the schema registered, since a vendor namespace TLV is a
VendorTLVinstead.
- class pcapkit.protocols.schema.link.radiotap.S1G(known=NO_VALUE, data1=NO_VALUE, data2=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the S1G field, type 32, which only a TLV carries.
- class pcapkit.protocols.schema.link.radiotap.USIG(common=NO_VALUE, value=NO_VALUE, mask=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the U-SIG field, type 33, which only a TLV carries.
- class pcapkit.protocols.schema.link.radiotap.EHT(known=NO_VALUE, data=NO_VALUE, user_info=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the EHT field, type 34, which only a TLV carries.
- class pcapkit.protocols.schema.link.radiotap.TLV(type=NO_VALUE, length=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
RadiotapFieldHeader schema for the type and length opening a TLV item, bit 28.
The item’s data follows, then padding to its
__align__, which the TLV list is aligned to as well. The schema is not registered, since a TLV item is no field of a type of its own.
- class pcapkit.protocols.schema.link.radiotap.VendorTLV(oui=NO_VALUE, subtype=NO_VALUE, presence_type=NO_VALUE, reserved=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for the vendor header opening the data of a vendor namespace TLV item.
The vendor data follows, to the end of the item.
Data Models¶
- class pcapkit.protocols.data.link.radiotap.Radiotap(it_version, it_pad, it_len, present, fields, decoded)[source]¶
Bases:
ProtocolData model for an IEEE 802.11 radiotap header.
The fixed 8-octet start and the present-flags chain are decoded field by field; the optional-field region is kept whole as
fields, which is what a rebuild writes, and decoded asdecoded. See the module docstring’s Scope section onpcapkit.protocols.link.radiotap.- it_version: int¶
Header revision;
0is the only version radiotap.org defines, and the only one this package decodes.
- it_len: int¶
Total length of the radiotap header – the fixed 8-octet start, every extended present-flags word, and the optional-field region they select – in octets; the 802.11 MAC frame starts here. Kept exactly as captured, even where it disagrees with
presentandfields.
- present: tuple[int, ...]¶
Every present-flags word in the chain that was actually read, in order; index
0is the mandatory first word (radiotap.org’s ownit_present). Bit 31 of a word signals that another word follows; it is clear on the last word read, unless the capture ran out before a word it claimed would follow.
- decoded: OrderedMultiInfo[FieldType, RadiotapField]¶
The fields of
fields, decoded in wire order, keyed by type: one per bit ofpresentthat selects data in the radiotap namespace or switches namespace. SeeRadiotap.read.
- class pcapkit.protocols.data.link.radiotap.RadiotapField(*args, **kwargs)[source]¶
Bases:
DataData model for a radiotap field.
Each field’s subfields are named as its own page on radiotap.org names them, and each is the little-endian integer read off the wire. A bitmap radiotap.org defines bit by bit is a member of its flag registry under
pcapkit.const.radiotap, which keeps the bits it does not name; any other bitmap stays the integer.
- class pcapkit.protocols.data.link.radiotap.Unknown(type, data, reason)[source]¶
Bases:
RadiotapFieldData model for an octet run a field type does not decode.
It is the field of a presence bit no field is defined for, or of a field that does not fit in what the header holds, and it holds every octet from the end of the field before it to the end of the field-data region, since what follows cannot be located without knowing its size.
- reason: str¶
The reason the walk stopped here, that the field type has no layout or that the field runs past the field-data region.
Radiotap.makedoes not read it.
- class pcapkit.protocols.data.link.radiotap.TSFT(type, mactime)[source]¶
Bases:
RadiotapFieldData model for the TSFT field, bit 0.
- class pcapkit.protocols.data.link.radiotap.Flags(type, flags)[source]¶
Bases:
RadiotapFieldData model for the Flags field, bit 1.
- class pcapkit.protocols.data.link.radiotap.Rate(type, rate)[source]¶
Bases:
RadiotapFieldData model for the Rate field, bit 2.
- class pcapkit.protocols.data.link.radiotap.Channel(type, frequency, flags)[source]¶
Bases:
RadiotapFieldData model for the Channel field, bit 3.
- flags: ChannelFlags¶
Channel flags.
- class pcapkit.protocols.data.link.radiotap.FHSS(type, hop_set, hop_pattern)[source]¶
Bases:
RadiotapFieldData model for the FHSS field, bit 4.
- class pcapkit.protocols.data.link.radiotap.AntennaSignal(type, signal)[source]¶
Bases:
RadiotapFieldData model for the Antenna signal field, bit 5.
- class pcapkit.protocols.data.link.radiotap.AntennaNoise(type, noise)[source]¶
Bases:
RadiotapFieldData model for the Antenna noise field, bit 6.
- class pcapkit.protocols.data.link.radiotap.LockQuality(type, quality)[source]¶
Bases:
RadiotapFieldData model for the Lock quality field, bit 7.
- class pcapkit.protocols.data.link.radiotap.TXAttenuation(type, attenuation)[source]¶
Bases:
RadiotapFieldData model for the TX attenuation field, bit 8.
- class pcapkit.protocols.data.link.radiotap.DBTXAttenuation(type, attenuation)[source]¶
Bases:
RadiotapFieldData model for the dB TX attenuation field, bit 9.
- class pcapkit.protocols.data.link.radiotap.DBmTXPower(type, power)[source]¶
Bases:
RadiotapFieldData model for the dBm TX power field, bit 10.
- class pcapkit.protocols.data.link.radiotap.Antenna(type, antenna)[source]¶
Bases:
RadiotapFieldData model for the Antenna field, bit 11.
- class pcapkit.protocols.data.link.radiotap.DBAntennaSignal(type, signal)[source]¶
Bases:
RadiotapFieldData model for the dB antenna signal field, bit 12.
- class pcapkit.protocols.data.link.radiotap.DBAntennaNoise(type, noise)[source]¶
Bases:
RadiotapFieldData model for the dB antenna noise field, bit 13.
- class pcapkit.protocols.data.link.radiotap.RXFlags(type, flags)[source]¶
Bases:
RadiotapFieldData model for the RX flags field, bit 14.
- class pcapkit.protocols.data.link.radiotap.TXFlags(type, flags)[source]¶
Bases:
RadiotapFieldData model for the TX flags field, bit 15.
- class pcapkit.protocols.data.link.radiotap.RTSRetries(type, retries)[source]¶
Bases:
RadiotapFieldData model for the RTS retries field, bit 16, which radiotap.org lists as unofficial.
- class pcapkit.protocols.data.link.radiotap.DataRetries(type, retries)[source]¶
Bases:
RadiotapFieldData model for the data retries field, bit 17, which radiotap.org lists as unofficial.
- class pcapkit.protocols.data.link.radiotap.MCS(type, known, flags, mcs)[source]¶
Bases:
RadiotapFieldData model for the MCS field, bit 19.
- class pcapkit.protocols.data.link.radiotap.MCSFlags(bandwidth, guard_interval, ht_format, fec_type, stbc_streams, ness_bit0)[source]¶
Bases:
DataData model for the MCS field’s
flags, each a value subfield.Added in version 1.6.0.
- class pcapkit.protocols.data.link.radiotap.AMPDUStatus(type, reference, flags, delimiter_crc, reserved)[source]¶
Bases:
RadiotapFieldData model for the A-MPDU status field, bit 20.
- flags: AMPDUFlags¶
A-MPDU flags.
- class pcapkit.protocols.data.link.radiotap.VHT(type, known, flags, bandwidth, mcs_nss, coding, group_id, partial_aid)[source]¶
Bases:
RadiotapFieldData model for the VHT field, bit 21.
- class pcapkit.protocols.data.link.radiotap.Timestamp(type, timestamp, accuracy, unit_position, flags)[source]¶
Bases:
RadiotapFieldData model for the timestamp field, bit 22.
- timestamp: int¶
The timestamp, in the unit
unit_positionnames.
- flags: TimestampFlags¶
Timestamp flags.
- class pcapkit.protocols.data.link.radiotap.HE(type, data1, data2, data3, data4, data5, data6)[source]¶
Bases:
RadiotapFieldData model for the HE field, bit 23, mostly the common part of HE-SIG-A.
- class pcapkit.protocols.data.link.radiotap.HEData1(ppdu_format, known)[source]¶
Bases:
DataData model for the HE field’s
data1, a value subfield and known bits.Added in version 1.6.0.
- known: HEData1Known¶
Which of the other subfields are known.
- class pcapkit.protocols.data.link.radiotap.HEData2(ru_offset, pri_sec_80mhz, known)[source]¶
Bases:
DataData model for the HE field’s
data2, value subfields and known bits.Added in version 1.6.0.
- known: HEData2Known¶
Which of the other subfields are known.
- class pcapkit.protocols.data.link.radiotap.HEMU(type, flags1, flags2, ru_channel1, ru_channel2)[source]¶
Bases:
RadiotapFieldData model for the HE-MU field, bit 24, from HE-SIG-A and HE-SIG-B.
- flags1: HEMUFlags1¶
SIG-B MCS and DCM, the channel 1 center 26-tone RU, and which subfields are known.
- flags2: HEMUFlags2¶
Bandwidth, SIG-B compression, SIG-B symbols or MU-MIMO users, preamble puncturing and the channel 2 center 26-tone RU.
- class pcapkit.protocols.data.link.radiotap.HEMUFlags1(sig_b_mcs, sig_b_dcm, ch1_center_26_tone_ru, known)[source]¶
Bases:
DataData model for the HE-MU field’s
flags1, value subfields and known bits.Added in version 1.6.0.
- known: HEMUFlags1Known¶
Which of the subfields of this word and of
flags2are known.
- class pcapkit.protocols.data.link.radiotap.HEMUFlags2(bandwidth, sig_b_compression, sig_b_symbols_users, preamble_puncturing, ch2_center_26_tone_ru, known)[source]¶
Bases:
DataData model for the HE-MU field’s
flags2, value subfields and known bits.Added in version 1.6.0.
- bandwidth: int¶
Bandwidth from the Bandwidth field of HE-SIG-A,
0for 20 MHz up to3for 160 or 80+80 MHz.
- known: HEMUFlags2Known¶
Which of the bandwidth and preamble puncturing are known.
- class pcapkit.protocols.data.link.radiotap.HEMUOtherUser(type, per_user_1, per_user_2, per_user_position, per_user_known)[source]¶
Bases:
RadiotapFieldData model for the HE-MU-other-user field, bit 25, a SIG-B user field.
- per_user_known: HEMUOtherUserKnown¶
Which of the subfields are known.
- class pcapkit.protocols.data.link.radiotap.ZeroLengthPSDU(type, psdu_type)[source]¶
Bases:
RadiotapFieldData model for the 0-length-PSDU field, bit 26.
- class pcapkit.protocols.data.link.radiotap.LSIG(type, data1, data2)[source]¶
Bases:
RadiotapFieldData model for the L-SIG field, bit 27.
- class pcapkit.protocols.data.link.radiotap.TLVFields(type, tlvs)[source]¶
Bases:
RadiotapFieldData model for the TLV fields in radiotap, bit 28.
The items fill the rest of the field-data region, each padded to a multiple of 4 octets.
- class pcapkit.protocols.data.link.radiotap.RadiotapNamespace(type)[source]¶
Bases:
RadiotapFieldData model for the Radiotap Namespace field, bit 29 of a presence word.
It has no contents. The presence word after the one carrying it starts the radiotap namespace afresh, from bit 0.
- class pcapkit.protocols.data.link.radiotap.VendorNamespace(type, oui, sub_namespace, skip_length, data)[source]¶
Bases:
RadiotapFieldData model for the Vendor Namespace field, bit 30 of a presence word.
The presence words after the one carrying it, up to the next namespace field, select fields of the vendor namespace, and the data of every one of them is in
data, kept whole.
- class pcapkit.protocols.data.link.radiotap.S1G(type, known, data1, data2)[source]¶
Bases:
RadiotapFieldData model for the S1G field, TLV type 32.
- class pcapkit.protocols.data.link.radiotap.USIG(type, common, value, mask)[source]¶
Bases:
RadiotapFieldData model for the U-SIG field, TLV type 33.
- common: USIGCommon¶
The common subfields, and which are known.
- class pcapkit.protocols.data.link.radiotap.USIGCommon(phy_version, bandwidth, ul_dl, bss_color, txop, known)[source]¶
Bases:
DataData model for the U-SIG field’s
common, value subfields and known bits.Added in version 1.6.0.
- bandwidth: int¶
Bandwidth,
0for 20 MHz up to3for 160 MHz, and4and5for the two 320 MHz channelizations.
- known: USIGCommonKnown¶
Which of the subfields are known, and whether the U-SIG CRC failed and its validate bits were checked and found right.
- class pcapkit.protocols.data.link.radiotap.EHT(type, known, data, user_info)[source]¶
Bases:
RadiotapFieldData model for the EHT field, TLV type 34.
- class pcapkit.protocols.data.link.radiotap.TLV(type, length, data)[source]¶
Bases:
DataData model for one item of the TLV fields in radiotap.
- data: RadiotapField | VendorTLV | bytes¶
The data, decoded where the type defines a layout
lengthdoes not run past; the raw octets otherwise. Data short of the layout is decoded with the octets it lacks as zeros, and records the cut as__short_read__.
- class pcapkit.protocols.data.link.radiotap.VendorTLV(oui, subtype, presence_type, reserved, data)[source]¶
Bases:
DataData model for the data of a vendor namespace TLV, type 30.
Footnotes