radiotap.h
Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 2003, 2004 David Young.  All rights reserved.
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  * 1. Redistributions of source code must retain the above copyright
00008  *    notice, this list of conditions and the following disclaimer.
00009  * 2. Redistributions in binary form must reproduce the above copyright
00010  *    notice, this list of conditions and the following disclaimer in the
00011  *    documentation and/or other materials provided with the distribution.
00012  * 3. The name of David Young may not be used to endorse or promote
00013  *    products derived from this software without specific prior
00014  *    written permission.
00015  *
00016  * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY
00017  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00018  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00019  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DAVID
00020  * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00021  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
00022  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00025  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00027  * OF SUCH DAMAGE.
00028  */
00029 
00030 /*
00031  * Modifications to fit into the linux IEEE 802.11 stack,
00032  * Mike Kershaw (dragorn@kismetwireless.net)
00033  */
00034 
00035 #ifndef IEEE80211RADIOTAP_H
00036 #define IEEE80211RADIOTAP_H
00037 
00038 #include <stdint.h>
00039 
00040 /* Base version of the radiotap packet header data */
00041 #define PKTHDR_RADIOTAP_VERSION         0
00042 
00043 /* A generic radio capture format is desirable. There is one for
00044  * Linux, but it is neither rigidly defined (there were not even
00045  * units given for some fields) nor easily extensible.
00046  *
00047  * I suggest the following extensible radio capture format. It is
00048  * based on a bitmap indicating which fields are present.
00049  *
00050  * I am trying to describe precisely what the application programmer
00051  * should expect in the following, and for that reason I tell the
00052  * units and origin of each measurement (where it applies), or else I
00053  * use sufficiently weaselly language ("is a monotonically nondecreasing
00054  * function of...") that I cannot set false expectations for lawyerly
00055  * readers.
00056  */
00057 
00058 /* The radio capture header precedes the 802.11 header.
00059  * All data in the header is little endian on all platforms.
00060  */
00061 struct ieee80211_radiotap_header {
00062         uint8_t it_version;     /* Version 0. Only increases
00063                                  * for drastic changes,
00064                                  * introduction of compatible
00065                                  * new fields does not count.
00066                                  */
00067         uint8_t it_pad;
00068         uint16_t it_len;        /* length of the whole
00069                                  * header in bytes, including
00070                                  * it_version, it_pad,
00071                                  * it_len, and data fields.
00072                                  */
00073         uint32_t it_present;    /* A bitmap telling which
00074                                  * fields are present. Set bit 31
00075                                  * (0x80000000) to extend the
00076                                  * bitmap by another 32 bits.
00077                                  * Additional extensions are made
00078                                  * by setting bit 31.
00079                                  */
00080 };
00081 
00082 /* Name                                 Data type    Units
00083  * ----                                 ---------    -----
00084  *
00085  * IEEE80211_RADIOTAP_TSFT              __le64       microseconds
00086  *
00087  *      Value in microseconds of the MAC's 64-bit 802.11 Time
00088  *      Synchronization Function timer when the first bit of the
00089  *      MPDU arrived at the MAC. For received frames, only.
00090  *
00091  * IEEE80211_RADIOTAP_CHANNEL           2 x uint16_t   MHz, bitmap
00092  *
00093  *      Tx/Rx frequency in MHz, followed by flags (see below).
00094  *
00095  * IEEE80211_RADIOTAP_FHSS              uint16_t       see below
00096  *
00097  *      For frequency-hopping radios, the hop set (first byte)
00098  *      and pattern (second byte).
00099  *
00100  * IEEE80211_RADIOTAP_RATE              u8           500kb/s
00101  *
00102  *      Tx/Rx data rate
00103  *
00104  * IEEE80211_RADIOTAP_DBM_ANTSIGNAL     s8           decibels from
00105  *                                                   one milliwatt (dBm)
00106  *
00107  *      RF signal power at the antenna, decibel difference from
00108  *      one milliwatt.
00109  *
00110  * IEEE80211_RADIOTAP_DBM_ANTNOISE      s8           decibels from
00111  *                                                   one milliwatt (dBm)
00112  *
00113  *      RF noise power at the antenna, decibel difference from one
00114  *      milliwatt.
00115  *
00116  * IEEE80211_RADIOTAP_DB_ANTSIGNAL      u8           decibel (dB)
00117  *
00118  *      RF signal power at the antenna, decibel difference from an
00119  *      arbitrary, fixed reference.
00120  *
00121  * IEEE80211_RADIOTAP_DB_ANTNOISE       u8           decibel (dB)
00122  *
00123  *      RF noise power at the antenna, decibel difference from an
00124  *      arbitrary, fixed reference point.
00125  *
00126  * IEEE80211_RADIOTAP_LOCK_QUALITY      uint16_t       unitless
00127  *
00128  *      Quality of Barker code lock. Unitless. Monotonically
00129  *      nondecreasing with "better" lock strength. Called "Signal
00130  *      Quality" in datasheets.  (Is there a standard way to measure
00131  *      this?)
00132  *
00133  * IEEE80211_RADIOTAP_TX_ATTENUATION    uint16_t       unitless
00134  *
00135  *      Transmit power expressed as unitless distance from max
00136  *      power set at factory calibration.  0 is max power.
00137  *      Monotonically nondecreasing with lower power levels.
00138  *
00139  * IEEE80211_RADIOTAP_DB_TX_ATTENUATION uint16_t       decibels (dB)
00140  *
00141  *      Transmit power expressed as decibel distance from max power
00142  *      set at factory calibration.  0 is max power.  Monotonically
00143  *      nondecreasing with lower power levels.
00144  *
00145  * IEEE80211_RADIOTAP_DBM_TX_POWER      s8           decibels from
00146  *                                                   one milliwatt (dBm)
00147  *
00148  *      Transmit power expressed as dBm (decibels from a 1 milliwatt
00149  *      reference). This is the absolute power level measured at
00150  *      the antenna port.
00151  *
00152  * IEEE80211_RADIOTAP_FLAGS             u8           bitmap
00153  *
00154  *      Properties of transmitted and received frames. See flags
00155  *      defined below.
00156  *
00157  * IEEE80211_RADIOTAP_ANTENNA           u8           antenna index
00158  *
00159  *      Unitless indication of the Rx/Tx antenna for this packet.
00160  *      The first antenna is antenna 0.
00161  *
00162  * IEEE80211_RADIOTAP_RX_FLAGS          uint16_t       bitmap
00163  *
00164  *     Properties of received frames. See flags defined below.
00165  *
00166  * IEEE80211_RADIOTAP_TX_FLAGS          uint16_t       bitmap
00167  *
00168  *     Properties of transmitted frames. See flags defined below.
00169  *
00170  * IEEE80211_RADIOTAP_RTS_RETRIES       u8           data
00171  *
00172  *     Number of rts retries a transmitted frame used.
00173  *
00174  * IEEE80211_RADIOTAP_DATA_RETRIES      u8           data
00175  *
00176  *     Number of unicast retries a transmitted frame used.
00177  *
00178  * IEEE80211_RADIOTAP_MCS       u8, u8, u8              unitless
00179  *
00180  *     Contains a bitmap of known fields/flags, the flags, and
00181  *     the MCS index.
00182  *
00183  * IEEE80211_RADIOTAP_AMPDU_STATUS      u32, u16, u8, u8        unitlesss
00184  *
00185  *      Contains the AMPDU information for the subframe.
00186  */
00187 enum ieee80211_radiotap_type {
00188         IEEE80211_RADIOTAP_TSFT = 0,
00189         IEEE80211_RADIOTAP_FLAGS = 1,
00190         IEEE80211_RADIOTAP_RATE = 2,
00191         IEEE80211_RADIOTAP_CHANNEL = 3,
00192         IEEE80211_RADIOTAP_FHSS = 4,
00193         IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
00194         IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
00195         IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
00196         IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
00197         IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
00198         IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
00199         IEEE80211_RADIOTAP_ANTENNA = 11,
00200         IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
00201         IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
00202         IEEE80211_RADIOTAP_RX_FLAGS = 14,
00203         IEEE80211_RADIOTAP_TX_FLAGS = 15,
00204         IEEE80211_RADIOTAP_RTS_RETRIES = 16,
00205         IEEE80211_RADIOTAP_DATA_RETRIES = 17,
00206 
00207         IEEE80211_RADIOTAP_MCS = 19,
00208         IEEE80211_RADIOTAP_AMPDU_STATUS = 20,
00209 
00210         /* valid in every it_present bitmap, even vendor namespaces */
00211         IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
00212         IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30,
00213         IEEE80211_RADIOTAP_EXT = 31
00214 };
00215 
00216 /* Channel flags. */
00217 #define IEEE80211_CHAN_TURBO    0x0010  /* Turbo channel */
00218 #define IEEE80211_CHAN_CCK      0x0020  /* CCK channel */
00219 #define IEEE80211_CHAN_OFDM     0x0040  /* OFDM channel */
00220 #define IEEE80211_CHAN_2GHZ     0x0080  /* 2 GHz spectrum channel. */
00221 #define IEEE80211_CHAN_5GHZ     0x0100  /* 5 GHz spectrum channel */
00222 #define IEEE80211_CHAN_PASSIVE  0x0200  /* Only passive scan allowed */
00223 #define IEEE80211_CHAN_DYN      0x0400  /* Dynamic CCK-OFDM channel */
00224 #define IEEE80211_CHAN_GFSK     0x0800  /* GFSK channel (FHSS PHY) */
00225 
00226 /* For IEEE80211_RADIOTAP_FLAGS */
00227 #define IEEE80211_RADIOTAP_F_CFP        0x01    /* sent/received
00228                                                  * during CFP
00229                                                  */
00230 #define IEEE80211_RADIOTAP_F_SHORTPRE   0x02    /* sent/received
00231                                                  * with short
00232                                                  * preamble
00233                                                  */
00234 #define IEEE80211_RADIOTAP_F_WEP        0x04    /* sent/received
00235                                                  * with WEP encryption
00236                                                  */
00237 #define IEEE80211_RADIOTAP_F_FRAG       0x08    /* sent/received
00238                                                  * with fragmentation
00239                                                  */
00240 #define IEEE80211_RADIOTAP_F_FCS        0x10    /* frame includes FCS */
00241 #define IEEE80211_RADIOTAP_F_DATAPAD    0x20    /* frame has padding between
00242                                                  * 802.11 header and payload
00243                                                  * (to 32-bit boundary)
00244                                                  */
00245 #define IEEE80211_RADIOTAP_F_BADFCS     0x40    /* frame failed FCS check */
00246 
00247 /* For IEEE80211_RADIOTAP_RX_FLAGS */
00248 #define IEEE80211_RADIOTAP_F_RX_BADPLCP 0x0002 /* bad PLCP */
00249 
00250 /* For IEEE80211_RADIOTAP_TX_FLAGS */
00251 #define IEEE80211_RADIOTAP_F_TX_FAIL    0x0001  /* failed due to excessive
00252                                                  * retries */
00253 #define IEEE80211_RADIOTAP_F_TX_CTS     0x0002  /* used cts 'protection' */
00254 #define IEEE80211_RADIOTAP_F_TX_RTS     0x0004  /* used rts/cts handshake */
00255 
00256 /* For IEEE80211_RADIOTAP_AMPDU_STATUS */
00257 #define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN         0x0001
00258 #define IEEE80211_RADIOTAP_AMPDU_IS_ZEROLEN             0x0002
00259 #define IEEE80211_RADIOTAP_AMPDU_LAST_KNOWN             0x0004
00260 #define IEEE80211_RADIOTAP_AMPDU_IS_LAST                0x0008
00261 #define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR          0x0010
00262 #define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN        0x0020
00263 
00264 /* For IEEE80211_RADIOTAP_MCS */
00265 #define IEEE80211_RADIOTAP_MCS_HAVE_BW          0x01
00266 #define IEEE80211_RADIOTAP_MCS_HAVE_MCS         0x02
00267 #define IEEE80211_RADIOTAP_MCS_HAVE_GI          0x04
00268 #define IEEE80211_RADIOTAP_MCS_HAVE_FMT         0x08
00269 #define IEEE80211_RADIOTAP_MCS_HAVE_FEC         0x10
00270 
00271 #define IEEE80211_RADIOTAP_MCS_BW_MASK          0x03
00272 #define         IEEE80211_RADIOTAP_MCS_BW_20    0
00273 #define         IEEE80211_RADIOTAP_MCS_BW_40    1
00274 #define         IEEE80211_RADIOTAP_MCS_BW_20L   2
00275 #define         IEEE80211_RADIOTAP_MCS_BW_20U   3
00276 #define IEEE80211_RADIOTAP_MCS_SGI              0x04
00277 #define IEEE80211_RADIOTAP_MCS_FMT_GF           0x08
00278 #define IEEE80211_RADIOTAP_MCS_FEC_LDPC         0x10
00279 
00280 #endif                          /* IEEE80211_RADIOTAP_H */


ros_rt_wmp
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Mon Oct 6 2014 08:27:10