Main Page | Data Structures | Directories | File List | Data Fields | Globals

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.10 2005/01/04 00:34:58 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 #ifndef _NET_IF_IEEE80211RADIOTAP_H_
00033 #define _NET_IF_IEEE80211RADIOTAP_H_
00034 
00035 /* A generic radio capture format is desirable. There is one for
00036  * Linux, but it is neither rigidly defined (there were not even
00037  * units given for some fields) nor easily extensible.
00038  *
00039  * I suggest the following extensible radio capture format. It is
00040  * based on a bitmap indicating which fields are present.
00041  *
00042  * I am trying to describe precisely what the application programmer
00043  * should expect in the following, and for that reason I tell the
00044  * units and origin of each measurement (where it applies), or else I
00045  * use sufficiently weaselly language ("is a monotonically nondecreasing
00046  * function of...") that I cannot set false expectations for lawyerly
00047  * readers.
00048  */
00049 #if defined(__KERNEL__) || defined(_KERNEL)
00050 #ifndef DLT_IEEE802_11_RADIO
00051 #define DLT_IEEE802_11_RADIO    127     /* 802.11 plus WLAN header */
00052 #endif
00053 #endif /* defined(__KERNEL__) || defined(_KERNEL) */
00054 
00055 /* XXX tcpdump/libpcap do not tolerate variable-length headers,
00056  * yet, so we pad every radiotap header to 64 bytes. Ugh.
00057  */
00058 #define IEEE80211_RADIOTAP_HDRLEN       64
00059 
00060 /* The radio capture header precedes the 802.11 header. */
00061 struct ieee80211_radiotap_header {
00062         u_int8_t        it_version;     /* Version 0. Only increases
00063                                          * for drastic changes,
00064                                          * introduction of compatible
00065                                          * new fields does not count.
00066                                          */
00067         u_int8_t        it_pad;
00068         u_int16_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         u_int32_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 } __attribute__((__packed__));
00081 
00082 /* Name                                 Data type       Units
00083  * ----                                 ---------       -----
00084  *
00085  * IEEE80211_RADIOTAP_TSFT              u_int64_t       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 u_int16_t   MHz, bitmap
00092  *
00093  *      Tx/Rx frequency in MHz, followed by flags (see below).
00094  *
00095  * IEEE80211_RADIOTAP_FHSS              u_int16_t       see below
00096  *
00097  *      For frequency-hopping radios, the hop set (first byte)
00098  *      and pattern (second byte).
00099  *
00100  * IEEE80211_RADIOTAP_RATE              u_int8_t        500kb/s
00101  *
00102  *      Tx/Rx data rate
00103  *
00104  * IEEE80211_RADIOTAP_DBM_ANTSIGNAL     int8_t          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      int8_t          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      u_int8_t        decibel (dB)
00117  *
00118  *      RF signal power at the antenna, decibel difference from an
00119  *      arbitrary, fixed reference.
00120  *
00121  * IEEE80211_RADIOTAP_DB_ANTNOISE       u_int8_t        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      u_int16_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    u_int16_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 u_int16_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      int8_t          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             u_int8_t        bitmap
00153  *
00154  *      Properties of transmitted and received frames. See flags
00155  *      defined below.
00156  *
00157  * IEEE80211_RADIOTAP_ANTENNA           u_int8_t        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          u_int16_t       bitmap
00163  *
00164  *      Properties of received frames. See flags defined below.
00165  *
00166  * IEEE80211_RADIOTAP_TX_FLAGS          u_int16_t       bitmap
00167  *
00168  *      Properties of transmitted frames. See flags defined below.
00169  *
00170  * IEEE80211_RADIOTAP_RTS_RETRIES       u_int8_t        data
00171  *
00172  *      Number of rts retries a transmitted frame used.
00173  * 
00174  * IEEE80211_RADIOTAP_DATA_RETRIES      u_int8_t        data
00175  *
00176  *      Number of unicast retries a transmitted frame used.
00177  * 
00178  */
00179 enum ieee80211_radiotap_type {
00180         IEEE80211_RADIOTAP_TSFT = 0,
00181         IEEE80211_RADIOTAP_FLAGS = 1,
00182         IEEE80211_RADIOTAP_RATE = 2,
00183         IEEE80211_RADIOTAP_CHANNEL = 3,
00184         IEEE80211_RADIOTAP_FHSS = 4,
00185         IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
00186         IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
00187         IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
00188         IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
00189         IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
00190         IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
00191         IEEE80211_RADIOTAP_ANTENNA = 11,
00192         IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
00193         IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
00194         IEEE80211_RADIOTAP_RX_FLAGS = 14,
00195         IEEE80211_RADIOTAP_TX_FLAGS = 15,
00196         IEEE80211_RADIOTAP_RTS_RETRIES = 16,
00197         IEEE80211_RADIOTAP_DATA_RETRIES = 17,
00198         IEEE80211_RADIOTAP_EXT = 31
00199 };
00200 
00201 #if !defined(__KERNEL__) && !defined(_KERNEL)
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 #endif /* !defined(__KERNEL__) && !defined(_KERNEL) */
00212 
00213 /* For IEEE80211_RADIOTAP_FLAGS */
00214 #define IEEE80211_RADIOTAP_F_CFP        0x01    /* sent/received
00215                                                  * during CFP
00216                                                  */
00217 #define IEEE80211_RADIOTAP_F_SHORTPRE   0x02    /* sent/received
00218                                                  * with short
00219                                                  * preamble
00220                                                  */
00221 #define IEEE80211_RADIOTAP_F_WEP        0x04    /* sent/received
00222                                                  * with WEP encryption
00223                                                  */
00224 #define IEEE80211_RADIOTAP_F_FRAG       0x08    /* sent/received
00225                                                  * with fragmentation
00226                                                  */
00227 #define IEEE80211_RADIOTAP_F_FCS        0x10    /* frame includes FCS */
00228 #define IEEE80211_RADIOTAP_F_DATAPAD    0x20    /* frame has padding between
00229                                                  * 802.11 header and payload
00230                                                  * (to 32-bit boundary)
00231                                                  */
00232 /* For IEEE80211_RADIOTAP_RX_FLAGS */
00233 #define IEEE80211_RADIOTAP_F_RX_BADFCS  0x0001  /* frame failed crc check */
00234 
00235 /* For IEEE80211_RADIOTAP_TX_FLAGS */
00236 #define IEEE80211_RADIOTAP_F_TX_FAIL    0x0001  /* failed due to excessive 
00237                                                  * retries */
00238 
00239 #endif /* _NET_IF_IEEE80211RADIOTAP_H_ */

Generated on Mon Nov 21 15:58:09 2005 for openwifi by  doxygen 1.4.1