linux_ieee80211_radiotap.h

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

Generated on Fri Jul 25 17:10:34 2008 for WifiScanner by  doxygen 1.5.5