radiotap.h

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

Generated on Sat Nov 21 23:16:54 2009 for hostapd by  doxygen 1.6.1