13ff40c12SJohn Marino /*- 23ff40c12SJohn Marino * Copyright (c) 2003, 2004 David Young. All rights reserved. 33ff40c12SJohn Marino * 43ff40c12SJohn Marino * Redistribution and use in source and binary forms, with or without 53ff40c12SJohn Marino * modification, are permitted provided that the following conditions 63ff40c12SJohn Marino * are met: 73ff40c12SJohn Marino * 1. Redistributions of source code must retain the above copyright 83ff40c12SJohn Marino * notice, this list of conditions and the following disclaimer. 93ff40c12SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 103ff40c12SJohn Marino * notice, this list of conditions and the following disclaimer in the 113ff40c12SJohn Marino * documentation and/or other materials provided with the distribution. 123ff40c12SJohn Marino * 3. The name of David Young may not be used to endorse or promote 133ff40c12SJohn Marino * products derived from this software without specific prior 143ff40c12SJohn Marino * written permission. 153ff40c12SJohn Marino * 163ff40c12SJohn Marino * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY 173ff40c12SJohn Marino * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 183ff40c12SJohn Marino * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 193ff40c12SJohn Marino * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID 203ff40c12SJohn Marino * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 213ff40c12SJohn Marino * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 223ff40c12SJohn Marino * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 233ff40c12SJohn Marino * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 243ff40c12SJohn Marino * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 253ff40c12SJohn Marino * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 263ff40c12SJohn Marino * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 273ff40c12SJohn Marino * OF SUCH DAMAGE. 283ff40c12SJohn Marino */ 293ff40c12SJohn Marino 303ff40c12SJohn Marino /* 313ff40c12SJohn Marino * Modifications to fit into the linux IEEE 802.11 stack, 323ff40c12SJohn Marino * Mike Kershaw (dragorn@kismetwireless.net) 333ff40c12SJohn Marino */ 343ff40c12SJohn Marino 353ff40c12SJohn Marino #ifndef IEEE80211RADIOTAP_H 363ff40c12SJohn Marino #define IEEE80211RADIOTAP_H 373ff40c12SJohn Marino 383ff40c12SJohn Marino #include <stdint.h> 393ff40c12SJohn Marino 403ff40c12SJohn Marino /* Base version of the radiotap packet header data */ 413ff40c12SJohn Marino #define PKTHDR_RADIOTAP_VERSION 0 423ff40c12SJohn Marino 433ff40c12SJohn Marino /* A generic radio capture format is desirable. There is one for 443ff40c12SJohn Marino * Linux, but it is neither rigidly defined (there were not even 453ff40c12SJohn Marino * units given for some fields) nor easily extensible. 463ff40c12SJohn Marino * 473ff40c12SJohn Marino * I suggest the following extensible radio capture format. It is 483ff40c12SJohn Marino * based on a bitmap indicating which fields are present. 493ff40c12SJohn Marino * 503ff40c12SJohn Marino * I am trying to describe precisely what the application programmer 513ff40c12SJohn Marino * should expect in the following, and for that reason I tell the 523ff40c12SJohn Marino * units and origin of each measurement (where it applies), or else I 533ff40c12SJohn Marino * use sufficiently weaselly language ("is a monotonically nondecreasing 543ff40c12SJohn Marino * function of...") that I cannot set false expectations for lawyerly 553ff40c12SJohn Marino * readers. 563ff40c12SJohn Marino */ 573ff40c12SJohn Marino 583ff40c12SJohn Marino /* The radio capture header precedes the 802.11 header. 593ff40c12SJohn Marino * All data in the header is little endian on all platforms. 603ff40c12SJohn Marino */ 613ff40c12SJohn Marino struct ieee80211_radiotap_header { 623ff40c12SJohn Marino uint8_t it_version; /* Version 0. Only increases 633ff40c12SJohn Marino * for drastic changes, 643ff40c12SJohn Marino * introduction of compatible 653ff40c12SJohn Marino * new fields does not count. 663ff40c12SJohn Marino */ 673ff40c12SJohn Marino uint8_t it_pad; 68*a1157835SDaniel Fojt le16 it_len; /* length of the whole 693ff40c12SJohn Marino * header in bytes, including 703ff40c12SJohn Marino * it_version, it_pad, 713ff40c12SJohn Marino * it_len, and data fields. 723ff40c12SJohn Marino */ 73*a1157835SDaniel Fojt le32 it_present; /* A bitmap telling which 743ff40c12SJohn Marino * fields are present. Set bit 31 753ff40c12SJohn Marino * (0x80000000) to extend the 763ff40c12SJohn Marino * bitmap by another 32 bits. 773ff40c12SJohn Marino * Additional extensions are made 783ff40c12SJohn Marino * by setting bit 31. 793ff40c12SJohn Marino */ 803ff40c12SJohn Marino }; 813ff40c12SJohn Marino 823ff40c12SJohn Marino /* Name Data type Units 833ff40c12SJohn Marino * ---- --------- ----- 843ff40c12SJohn Marino * 853ff40c12SJohn Marino * IEEE80211_RADIOTAP_TSFT __le64 microseconds 863ff40c12SJohn Marino * 873ff40c12SJohn Marino * Value in microseconds of the MAC's 64-bit 802.11 Time 883ff40c12SJohn Marino * Synchronization Function timer when the first bit of the 893ff40c12SJohn Marino * MPDU arrived at the MAC. For received frames, only. 903ff40c12SJohn Marino * 913ff40c12SJohn Marino * IEEE80211_RADIOTAP_CHANNEL 2 x uint16_t MHz, bitmap 923ff40c12SJohn Marino * 933ff40c12SJohn Marino * Tx/Rx frequency in MHz, followed by flags (see below). 943ff40c12SJohn Marino * 953ff40c12SJohn Marino * IEEE80211_RADIOTAP_FHSS uint16_t see below 963ff40c12SJohn Marino * 973ff40c12SJohn Marino * For frequency-hopping radios, the hop set (first byte) 983ff40c12SJohn Marino * and pattern (second byte). 993ff40c12SJohn Marino * 1003ff40c12SJohn Marino * IEEE80211_RADIOTAP_RATE u8 500kb/s 1013ff40c12SJohn Marino * 1023ff40c12SJohn Marino * Tx/Rx data rate 1033ff40c12SJohn Marino * 1043ff40c12SJohn Marino * IEEE80211_RADIOTAP_DBM_ANTSIGNAL s8 decibels from 1053ff40c12SJohn Marino * one milliwatt (dBm) 1063ff40c12SJohn Marino * 1073ff40c12SJohn Marino * RF signal power at the antenna, decibel difference from 1083ff40c12SJohn Marino * one milliwatt. 1093ff40c12SJohn Marino * 1103ff40c12SJohn Marino * IEEE80211_RADIOTAP_DBM_ANTNOISE s8 decibels from 1113ff40c12SJohn Marino * one milliwatt (dBm) 1123ff40c12SJohn Marino * 1133ff40c12SJohn Marino * RF noise power at the antenna, decibel difference from one 1143ff40c12SJohn Marino * milliwatt. 1153ff40c12SJohn Marino * 1163ff40c12SJohn Marino * IEEE80211_RADIOTAP_DB_ANTSIGNAL u8 decibel (dB) 1173ff40c12SJohn Marino * 1183ff40c12SJohn Marino * RF signal power at the antenna, decibel difference from an 1193ff40c12SJohn Marino * arbitrary, fixed reference. 1203ff40c12SJohn Marino * 1213ff40c12SJohn Marino * IEEE80211_RADIOTAP_DB_ANTNOISE u8 decibel (dB) 1223ff40c12SJohn Marino * 1233ff40c12SJohn Marino * RF noise power at the antenna, decibel difference from an 1243ff40c12SJohn Marino * arbitrary, fixed reference point. 1253ff40c12SJohn Marino * 1263ff40c12SJohn Marino * IEEE80211_RADIOTAP_LOCK_QUALITY uint16_t unitless 1273ff40c12SJohn Marino * 1283ff40c12SJohn Marino * Quality of Barker code lock. Unitless. Monotonically 1293ff40c12SJohn Marino * nondecreasing with "better" lock strength. Called "Signal 1303ff40c12SJohn Marino * Quality" in datasheets. (Is there a standard way to measure 1313ff40c12SJohn Marino * this?) 1323ff40c12SJohn Marino * 1333ff40c12SJohn Marino * IEEE80211_RADIOTAP_TX_ATTENUATION uint16_t unitless 1343ff40c12SJohn Marino * 1353ff40c12SJohn Marino * Transmit power expressed as unitless distance from max 1363ff40c12SJohn Marino * power set at factory calibration. 0 is max power. 1373ff40c12SJohn Marino * Monotonically nondecreasing with lower power levels. 1383ff40c12SJohn Marino * 1393ff40c12SJohn Marino * IEEE80211_RADIOTAP_DB_TX_ATTENUATION uint16_t decibels (dB) 1403ff40c12SJohn Marino * 1413ff40c12SJohn Marino * Transmit power expressed as decibel distance from max power 1423ff40c12SJohn Marino * set at factory calibration. 0 is max power. Monotonically 1433ff40c12SJohn Marino * nondecreasing with lower power levels. 1443ff40c12SJohn Marino * 1453ff40c12SJohn Marino * IEEE80211_RADIOTAP_DBM_TX_POWER s8 decibels from 1463ff40c12SJohn Marino * one milliwatt (dBm) 1473ff40c12SJohn Marino * 1483ff40c12SJohn Marino * Transmit power expressed as dBm (decibels from a 1 milliwatt 1493ff40c12SJohn Marino * reference). This is the absolute power level measured at 1503ff40c12SJohn Marino * the antenna port. 1513ff40c12SJohn Marino * 1523ff40c12SJohn Marino * IEEE80211_RADIOTAP_FLAGS u8 bitmap 1533ff40c12SJohn Marino * 1543ff40c12SJohn Marino * Properties of transmitted and received frames. See flags 1553ff40c12SJohn Marino * defined below. 1563ff40c12SJohn Marino * 1573ff40c12SJohn Marino * IEEE80211_RADIOTAP_ANTENNA u8 antenna index 1583ff40c12SJohn Marino * 1593ff40c12SJohn Marino * Unitless indication of the Rx/Tx antenna for this packet. 1603ff40c12SJohn Marino * The first antenna is antenna 0. 1613ff40c12SJohn Marino * 1623ff40c12SJohn Marino * IEEE80211_RADIOTAP_RX_FLAGS uint16_t bitmap 1633ff40c12SJohn Marino * 1643ff40c12SJohn Marino * Properties of received frames. See flags defined below. 1653ff40c12SJohn Marino * 1663ff40c12SJohn Marino * IEEE80211_RADIOTAP_TX_FLAGS uint16_t bitmap 1673ff40c12SJohn Marino * 1683ff40c12SJohn Marino * Properties of transmitted frames. See flags defined below. 1693ff40c12SJohn Marino * 1703ff40c12SJohn Marino * IEEE80211_RADIOTAP_RTS_RETRIES u8 data 1713ff40c12SJohn Marino * 1723ff40c12SJohn Marino * Number of rts retries a transmitted frame used. 1733ff40c12SJohn Marino * 1743ff40c12SJohn Marino * IEEE80211_RADIOTAP_DATA_RETRIES u8 data 1753ff40c12SJohn Marino * 1763ff40c12SJohn Marino * Number of unicast retries a transmitted frame used. 1773ff40c12SJohn Marino * 178*a1157835SDaniel Fojt * IEEE80211_RADIOTAP_MCS u8, u8, u8 unitless 179*a1157835SDaniel Fojt * 180*a1157835SDaniel Fojt * Contains a bitmap of known fields/flags, the flags, and 181*a1157835SDaniel Fojt * the MCS index. 182*a1157835SDaniel Fojt * 183*a1157835SDaniel Fojt * IEEE80211_RADIOTAP_AMPDU_STATUS u32, u16, u8, u8 unitlesss 184*a1157835SDaniel Fojt * 185*a1157835SDaniel Fojt * Contains the AMPDU information for the subframe. 1863ff40c12SJohn Marino */ 1873ff40c12SJohn Marino enum ieee80211_radiotap_type { 1883ff40c12SJohn Marino IEEE80211_RADIOTAP_TSFT = 0, 1893ff40c12SJohn Marino IEEE80211_RADIOTAP_FLAGS = 1, 1903ff40c12SJohn Marino IEEE80211_RADIOTAP_RATE = 2, 1913ff40c12SJohn Marino IEEE80211_RADIOTAP_CHANNEL = 3, 1923ff40c12SJohn Marino IEEE80211_RADIOTAP_FHSS = 4, 1933ff40c12SJohn Marino IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, 1943ff40c12SJohn Marino IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, 1953ff40c12SJohn Marino IEEE80211_RADIOTAP_LOCK_QUALITY = 7, 1963ff40c12SJohn Marino IEEE80211_RADIOTAP_TX_ATTENUATION = 8, 1973ff40c12SJohn Marino IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, 1983ff40c12SJohn Marino IEEE80211_RADIOTAP_DBM_TX_POWER = 10, 1993ff40c12SJohn Marino IEEE80211_RADIOTAP_ANTENNA = 11, 2003ff40c12SJohn Marino IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, 2013ff40c12SJohn Marino IEEE80211_RADIOTAP_DB_ANTNOISE = 13, 2023ff40c12SJohn Marino IEEE80211_RADIOTAP_RX_FLAGS = 14, 2033ff40c12SJohn Marino IEEE80211_RADIOTAP_TX_FLAGS = 15, 2043ff40c12SJohn Marino IEEE80211_RADIOTAP_RTS_RETRIES = 16, 2053ff40c12SJohn Marino IEEE80211_RADIOTAP_DATA_RETRIES = 17, 206*a1157835SDaniel Fojt 207*a1157835SDaniel Fojt IEEE80211_RADIOTAP_MCS = 19, 208*a1157835SDaniel Fojt IEEE80211_RADIOTAP_AMPDU_STATUS = 20, 209*a1157835SDaniel Fojt 210*a1157835SDaniel Fojt /* valid in every it_present bitmap, even vendor namespaces */ 211*a1157835SDaniel Fojt IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, 212*a1157835SDaniel Fojt IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30, 2133ff40c12SJohn Marino IEEE80211_RADIOTAP_EXT = 31 2143ff40c12SJohn Marino }; 2153ff40c12SJohn Marino 2163ff40c12SJohn Marino /* Channel flags. */ 2173ff40c12SJohn Marino #define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ 2183ff40c12SJohn Marino #define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ 2193ff40c12SJohn Marino #define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ 2203ff40c12SJohn Marino #define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ 2213ff40c12SJohn Marino #define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ 2223ff40c12SJohn Marino #define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ 2233ff40c12SJohn Marino #define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ 2243ff40c12SJohn Marino #define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ 2253ff40c12SJohn Marino 2263ff40c12SJohn Marino /* For IEEE80211_RADIOTAP_FLAGS */ 2273ff40c12SJohn Marino #define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received 2283ff40c12SJohn Marino * during CFP 2293ff40c12SJohn Marino */ 2303ff40c12SJohn Marino #define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received 2313ff40c12SJohn Marino * with short 2323ff40c12SJohn Marino * preamble 2333ff40c12SJohn Marino */ 2343ff40c12SJohn Marino #define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received 2353ff40c12SJohn Marino * with WEP encryption 2363ff40c12SJohn Marino */ 2373ff40c12SJohn Marino #define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received 2383ff40c12SJohn Marino * with fragmentation 2393ff40c12SJohn Marino */ 2403ff40c12SJohn Marino #define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */ 2413ff40c12SJohn Marino #define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between 2423ff40c12SJohn Marino * 802.11 header and payload 2433ff40c12SJohn Marino * (to 32-bit boundary) 2443ff40c12SJohn Marino */ 245*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_F_BADFCS 0x40 /* frame failed FCS check */ 246*a1157835SDaniel Fojt 2473ff40c12SJohn Marino /* For IEEE80211_RADIOTAP_RX_FLAGS */ 248*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_F_RX_BADPLCP 0x0002 /* bad PLCP */ 2493ff40c12SJohn Marino 2503ff40c12SJohn Marino /* For IEEE80211_RADIOTAP_TX_FLAGS */ 2513ff40c12SJohn Marino #define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive 2523ff40c12SJohn Marino * retries */ 2533ff40c12SJohn Marino #define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */ 2543ff40c12SJohn Marino #define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */ 2553ff40c12SJohn Marino #define IEEE80211_RADIOTAP_F_TX_NOACK 0x0008 /* don't expect an ACK */ 2563ff40c12SJohn Marino 257*a1157835SDaniel Fojt /* For IEEE80211_RADIOTAP_AMPDU_STATUS */ 258*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN 0x0001 259*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_AMPDU_IS_ZEROLEN 0x0002 260*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_AMPDU_LAST_KNOWN 0x0004 261*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_AMPDU_IS_LAST 0x0008 262*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR 0x0010 263*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN 0x0020 264*a1157835SDaniel Fojt 265*a1157835SDaniel Fojt /* For IEEE80211_RADIOTAP_MCS */ 266*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_HAVE_BW 0x01 267*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_HAVE_MCS 0x02 268*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_HAVE_GI 0x04 269*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_HAVE_FMT 0x08 270*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_HAVE_FEC 0x10 271*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_HAVE_STBC 0x20 272*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_HAVE_NESS 0x40 273*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_NESS_BIT1 0x80 274*a1157835SDaniel Fojt 275*a1157835SDaniel Fojt 276*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_BW_MASK 0x03 277*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_BW_20 0 278*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_BW_40 1 279*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_BW_20L 2 280*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_BW_20U 3 281*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_SGI 0x04 282*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08 283*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10 284*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_STBC_MASK 0x60 285*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_STBC_SHIFT 5 286*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_STBC_1 1 287*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_STBC_2 2 288*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_STBC_3 3 289*a1157835SDaniel Fojt #define IEEE80211_RADIOTAP_MCS_NESS_BIT0 0x80 290*a1157835SDaniel Fojt 2913ff40c12SJohn Marino #endif /* IEEE80211_RADIOTAP_H */ 292