$search
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 #ifndef IEEE80211RADIOTAP_H 00039 #define IEEE80211RADIOTAP_H 00040 00041 #include <stdint.h> 00042 00043 /* Base version of the radiotap packet header data */ 00044 #define PKTHDR_RADIOTAP_VERSION 0 00045 00046 /* A generic radio capture format is desirable. There is one for 00047 * Linux, but it is neither rigidly defined (there were not even 00048 * units given for some fields) nor easily extensible. 00049 * 00050 * I suggest the following extensible radio capture format. It is 00051 * based on a bitmap indicating which fields are present. 00052 * 00053 * I am trying to describe precisely what the application programmer 00054 * should expect in the following, and for that reason I tell the 00055 * units and origin of each measurement (where it applies), or else I 00056 * use sufficiently weaselly language ("is a monotonically nondecreasing 00057 * function of...") that I cannot set false expectations for lawyerly 00058 * readers. 00059 */ 00060 00061 /* The radio capture header precedes the 802.11 header. 00062 * All data in the header is little endian on all platforms. 00063 */ 00064 struct ieee80211_radiotap_header { 00065 uint8_t it_version; /* Version 0. Only increases 00066 * for drastic changes, 00067 * introduction of compatible 00068 * new fields does not count. 00069 */ 00070 uint8_t it_pad; 00071 uint16_t it_len; /* length of the whole 00072 * header in bytes, including 00073 * it_version, it_pad, 00074 * it_len, and data fields. 00075 */ 00076 uint32_t it_present; /* A bitmap telling which 00077 * fields are present. Set bit 31 00078 * (0x80000000) to extend the 00079 * bitmap by another 32 bits. 00080 * Additional extensions are made 00081 * by setting bit 31. 00082 */ 00083 }; 00084 00085 /* Name Data type Units 00086 * ---- --------- ----- 00087 * 00088 * IEEE80211_RADIOTAP_TSFT __le64 microseconds 00089 * 00090 * Value in microseconds of the MAC's 64-bit 802.11 Time 00091 * Synchronization Function timer when the first bit of the 00092 * MPDU arrived at the MAC. For received frames, only. 00093 * 00094 * IEEE80211_RADIOTAP_CHANNEL 2 x uint16_t MHz, bitmap 00095 * 00096 * Tx/Rx frequency in MHz, followed by flags (see below). 00097 * 00098 * IEEE80211_RADIOTAP_FHSS uint16_t see below 00099 * 00100 * For frequency-hopping radios, the hop set (first byte) 00101 * and pattern (second byte). 00102 * 00103 * IEEE80211_RADIOTAP_RATE u8 500kb/s 00104 * 00105 * Tx/Rx data rate 00106 * 00107 * IEEE80211_RADIOTAP_DBM_ANTSIGNAL s8 decibels from 00108 * one milliwatt (dBm) 00109 * 00110 * RF signal power at the antenna, decibel difference from 00111 * one milliwatt. 00112 * 00113 * IEEE80211_RADIOTAP_DBM_ANTNOISE s8 decibels from 00114 * one milliwatt (dBm) 00115 * 00116 * RF noise power at the antenna, decibel difference from one 00117 * milliwatt. 00118 * 00119 * IEEE80211_RADIOTAP_DB_ANTSIGNAL u8 decibel (dB) 00120 * 00121 * RF signal power at the antenna, decibel difference from an 00122 * arbitrary, fixed reference. 00123 * 00124 * IEEE80211_RADIOTAP_DB_ANTNOISE u8 decibel (dB) 00125 * 00126 * RF noise power at the antenna, decibel difference from an 00127 * arbitrary, fixed reference point. 00128 * 00129 * IEEE80211_RADIOTAP_LOCK_QUALITY uint16_t unitless 00130 * 00131 * Quality of Barker code lock. Unitless. Monotonically 00132 * nondecreasing with "better" lock strength. Called "Signal 00133 * Quality" in datasheets. (Is there a standard way to measure 00134 * this?) 00135 * 00136 * IEEE80211_RADIOTAP_TX_ATTENUATION uint16_t unitless 00137 * 00138 * Transmit power expressed as unitless distance from max 00139 * power set at factory calibration. 0 is max power. 00140 * Monotonically nondecreasing with lower power levels. 00141 * 00142 * IEEE80211_RADIOTAP_DB_TX_ATTENUATION uint16_t decibels (dB) 00143 * 00144 * Transmit power expressed as decibel distance from max power 00145 * set at factory calibration. 0 is max power. Monotonically 00146 * nondecreasing with lower power levels. 00147 * 00148 * IEEE80211_RADIOTAP_DBM_TX_POWER s8 decibels from 00149 * one milliwatt (dBm) 00150 * 00151 * Transmit power expressed as dBm (decibels from a 1 milliwatt 00152 * reference). This is the absolute power level measured at 00153 * the antenna port. 00154 * 00155 * IEEE80211_RADIOTAP_FLAGS u8 bitmap 00156 * 00157 * Properties of transmitted and received frames. See flags 00158 * defined below. 00159 * 00160 * IEEE80211_RADIOTAP_ANTENNA u8 antenna index 00161 * 00162 * Unitless indication of the Rx/Tx antenna for this packet. 00163 * The first antenna is antenna 0. 00164 * 00165 * IEEE80211_RADIOTAP_RX_FLAGS uint16_t bitmap 00166 * 00167 * Properties of received frames. See flags defined below. 00168 * 00169 * IEEE80211_RADIOTAP_TX_FLAGS uint16_t bitmap 00170 * 00171 * Properties of transmitted frames. See flags defined below. 00172 * 00173 * IEEE80211_RADIOTAP_RTS_RETRIES u8 data 00174 * 00175 * Number of rts retries a transmitted frame used. 00176 * 00177 * IEEE80211_RADIOTAP_DATA_RETRIES u8 data 00178 * 00179 * Number of unicast retries a transmitted frame used. 00180 * 00181 */ 00182 enum ieee80211_radiotap_type { 00183 IEEE80211_RADIOTAP_TSFT = 0, 00184 IEEE80211_RADIOTAP_FLAGS = 1, 00185 IEEE80211_RADIOTAP_RATE = 2, 00186 IEEE80211_RADIOTAP_CHANNEL = 3, 00187 IEEE80211_RADIOTAP_FHSS = 4, 00188 IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, 00189 IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, 00190 IEEE80211_RADIOTAP_LOCK_QUALITY = 7, 00191 IEEE80211_RADIOTAP_TX_ATTENUATION = 8, 00192 IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, 00193 IEEE80211_RADIOTAP_DBM_TX_POWER = 10, 00194 IEEE80211_RADIOTAP_ANTENNA = 11, 00195 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, 00196 IEEE80211_RADIOTAP_DB_ANTNOISE = 13, 00197 IEEE80211_RADIOTAP_RX_FLAGS = 14, 00198 IEEE80211_RADIOTAP_TX_FLAGS = 15, 00199 IEEE80211_RADIOTAP_RTS_RETRIES = 16, 00200 IEEE80211_RADIOTAP_DATA_RETRIES = 17, 00201 IEEE80211_RADIOTAP_EXT = 31 00202 }; 00203 00204 /* Channel flags. */ 00205 #define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ 00206 #define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ 00207 #define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ 00208 #define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ 00209 #define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ 00210 #define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ 00211 #define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ 00212 #define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ 00213 00214 /* For IEEE80211_RADIOTAP_FLAGS */ 00215 #define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received 00216 * during CFP 00217 */ 00218 #define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received 00219 * with short 00220 * preamble 00221 */ 00222 #define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received 00223 * with WEP encryption 00224 */ 00225 #define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received 00226 * with fragmentation 00227 */ 00228 #define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */ 00229 #define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between 00230 * 802.11 header and payload 00231 * (to 32-bit boundary) 00232 */ 00233 /* For IEEE80211_RADIOTAP_RX_FLAGS */ 00234 #define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /* frame failed crc check */ 00235 00236 /* For IEEE80211_RADIOTAP_TX_FLAGS */ 00237 #define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive 00238 * retries */ 00239 #define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */ 00240 #define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */ 00241 00242 #endif /* IEEE80211_RADIOTAP_H */