<commit_before>.\"
.\" Copyright (c) 2004	<NAME> <<EMAIL>>,
.\"			<NAME> <<EMAIL>>,
.\"			<NAME> <<EMAIL>>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\" $Id: ieee80211_radiotap.9,v 1.3 2004/03/04 11:38:52 bruce Exp $
.\"
.Dd March 2, 2004
.Dt IEEE80211_RADIOTAP 9
.Os
.Sh NAME
.Nm ieee80211_radiotap
.Nd software 802.11 stack packet capture definitions
.Sh SYNOPSIS
.In net80211/ieee80211_var.h
.In net80211/ieee80211_ioctl.h
.In net80211/ieee80211_radiotap.h
.In net/bpf.h
.\"
.Sh DESCRIPTION
The
.Nm
definitions provide a device-independent
.Xr bpf 4
attachment for the
capture of information about 802.11 traffic which is not part of
the 802.11 frame structure.
.Pp
Radiotap was designed to balance the desire for a capture format
that conserved CPU and memory bandwidth on embedded systems,
with the desire for a hardware-independent, extensible format
that would support the diverse capabilities of virtually all
802.11
radios.
.Pp
These considerations led radiotap to settle on a format consisting of
a standard preamble followed by an extensible bitmap indicating the
presence of optional capture fields.
.Pp
The capture fields were packed into the header as compactly as possible,
modulo the requirements that they had to be packed swiftly,
with suitable alignment, in the same order as the bits indicating
their presence.
.Pp
This typically includes information such as signal quality and
timestamps.
This information may be used by a variety of user agents, including
.Xr tcpdump 1 .
It is requested by using the
.Xr bpf 4
data-link type
.Dv DLT_IEEE_80211_RADIO .
.Pp
.\"
Each frame using this attachment has the following header prepended to it:
.Bd -literal -offset indent
struct ieee80211_radiotap_header {
	u_int8_t	it_version;	/* set to 0 */
	u_int8_t	it_pad;
	u_int16_t	it_len;		/* entire length */
	u_int32_t	it_present;	/* fields present */
} __attribute__((__packed__));
.Ed
.Pp
.\"
A device driver implementing
.Vt radiotap
typically defines a packed structure embedding an instance of
.Vt "struct ieee80211_radiotap_header"
at the beginning,
with subsequent fields in the appropriate order,
and a macro to set the bits of the
.Va it_present
bitmap to indicate which fields exist and are filled in by the driver.
.\"
.Pp
Radiotap headers are copied to the userland via a separate bpf attachment.
It is necessary for the driver to create this attachment after calling
.Xr ieee80211_ifattach 9
by calling
.Fn bpfattach2
with the data-link type set to
.Dv DLT_IEEE_80211_RADIO .
.Pp
.\"
When the the information is available,
usually immediately before a link-layer transmission or after a receive,
the driver copies it to the bpf layer using the
.Fn bpf_mtap2
function.
.Pp
.\"
The following extension fields are defined for
.Vt radiotap ,
in the order in which they should appear in the buffer copied to userland:
.Bl -tag -width indent
.It Dv IEEE80211_RADIOTAP_TSFT
This field contains the unsigned 64-bit value, in microseconds,
of the MAC's 802.11 Time Synchronization Function timer,
when the first bit of the MPDU arrived at the MAC.
This field should be present for received frames only.
.It Dv IEEE80211_RADIOTAP_FLAGS
This field contains a single unsigned 8-bit value, containing a bitmap
of flags specifying properties of the frame being transmitted or received.
.It Dv IEEE80211_RADIOTAP_RATE
This field contains a single unsigned 8-bit value, which is the data rate in
use in units of 500Kbps.
.It Dv IEEE80211_RADIOTAP_CHANNEL
This field contains two unsigned 16-bit values.
The first value is the frequency upon which this PDU was transmitted
or received.
The second value is a bitmap containing flags which specify properties of
the channel in use.
These are documented within the header file,<commit_msg>MFC: rev. 1.4 + 1.5<commit_after>.\"
.\" Copyright (c) 2004	<NAME> <<EMAIL>>,
.\"			<NAME> <<EMAIL>>,
.\"			<NAME> <<EMAIL>>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\" $Id: ieee80211_radiotap.9,v 1.3 2004/03/04 11:38:52 bruce Exp $
.\"
.Dd March 17, 2008
.Dt IEEE80211_RADIOTAP 9
.Os
.Sh NAME
.Nm ieee80211_radiotap
.Nd software 802.11 stack packet capture definitions
.Sh SYNOPSIS
.In net80211/ieee80211_var.h
.In net80211/ieee80211_ioctl.h
.In net80211/ieee80211_radiotap.h
.In net/bpf.h
.\"
.Sh DESCRIPTION
The
.Nm
definitions provide a device-independent
.Xr bpf 4
attachment for the
capture of information about 802.11 traffic which is not part of
the 802.11 frame structure.
.Pp
Radiotap was designed to balance the desire for a capture format
that conserved CPU and memory bandwidth on embedded systems,
with the desire for a hardware-independent, extensible format
that would support the diverse capabilities of virtually all
802.11
radios.
.Pp
These considerations led radiotap to settle on a format consisting of
a standard preamble followed by an extensible bitmap indicating the
presence of optional capture fields.
.Pp
The capture fields were packed into the header as compactly as possible,
modulo the requirements that they had to be packed swiftly,
with suitable alignment, in the same order as the bits indicating
their presence.
.Pp
This typically includes information such as signal quality and
timestamps.
This information may be used by a variety of user agents, including
.Xr tcpdump 1 .
It is requested by using the
.Xr bpf 4
data-link type
.Dv DLT_IEEE802_11_RADIO .
.Pp
.\"
Each frame using this attachment has the following header prepended to it:
.Bd -literal -offset indent
struct ieee80211_radiotap_header {
	u_int8_t	it_version;	/* set to 0 */
	u_int8_t	it_pad;
	u_int16_t	it_len;		/* entire length */
	u_int32_t	it_present;	/* fields present */
} __attribute__((__packed__));
.Ed
.Pp
.\"
A device driver implementing
.Vt radiotap
typically defines a packed structure embedding an instance of
.Vt "struct ieee80211_radiotap_header"
at the beginning,
with subsequent fields in the appropriate order,
and a macro to set the bits of the
.Va it_present
bitmap to indicate which fields exist and are filled in by the driver.
.\"
.Pp
Radiotap headers are copied to the userland via a separate bpf attachment.
It is necessary for the driver to create this attachment after calling
.Xr ieee80211_ifattach 9
by calling
.Fn bpfattach2
with the data-link type set to
.Dv DLT_IEEE802_11_RADIO .
.Pp
.\"
When the the information is available,
usually immediately before a link-layer transmission or after a receive,
the driver copies it to the bpf layer using the
.Fn bpf_mtap2
function.
.Pp
.\"
The following extension fields are defined for
.Vt radiotap ,
in the order in which they should appear in the buffer copied to userland:
.Bl -tag -width indent
.It Dv IEEE80211_RADIOTAP_TSFT
This field contains the unsigned 64-bit value, in microseconds,
of the MAC's 802.11 Time Synchronization Function timer,
when the first bit of the MPDU arrived at the MAC.
This field should be present for received frames only.
.It Dv IEEE80211_RADIOTAP_FLAGS
This field contains a single unsigned 8-bit value, containing a bitmap
of flags specifying properties of the frame being transmitted or received.
.It Dv IEEE80211_RADIOTAP_RATE
This field contains a single unsigned 8-bit value, which is the data rate in
use in units of 500Kbps.
.It Dv IEEE80211_RADIOTAP_CHANNEL
This field contains two unsigned 16-bit values.
The first value is the frequency upon which this PDU was transmitted
or received.
The second value is a bitmap containing flags which specify properties of
the channel in use.
These are documented within the header file,
{'fraction_non_alphanumeric': 0.06302562580389828, 'fraction_numerical': 0.033343227466112596, 'mean_word_length': 4.204943357363542, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4134103', 'n_tokens_mistral': 3269, 'n_tokens_neox': 2771, 'n_words': 1452}