diff options
author | Greg KH <greg@press.(none)> | 2005-10-28 13:13:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 13:13:16 -0400 |
commit | 6fbfddcb52d8d9fa2cd209f5ac2a1c87497d55b5 (patch) | |
tree | c0414e89678fcef7ce3493e048d855bde781ae8d /include/net/ieee80211_radiotap.h | |
parent | 1a222bca26ca691e83be1b08f5e96ae96d0d8cae (diff) | |
parent | 27d1097d39509494706eaa2620ef3b1e780a3224 (diff) |
Merge ../bleed-2.6
Diffstat (limited to 'include/net/ieee80211_radiotap.h')
-rw-r--r-- | include/net/ieee80211_radiotap.h | 231 |
1 files changed, 231 insertions, 0 deletions
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h new file mode 100644 index 000000000000..429b73892a5f --- /dev/null +++ b/include/net/ieee80211_radiotap.h | |||
@@ -0,0 +1,231 @@ | |||
1 | /* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.5 2005/01/22 20:12:05 sam Exp $ */ | ||
2 | /* $NetBSD: ieee80211_radiotap.h,v 1.11 2005/06/22 06:16:02 dyoung Exp $ */ | ||
3 | |||
4 | /*- | ||
5 | * Copyright (c) 2003, 2004 David Young. All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions | ||
9 | * are met: | ||
10 | * 1. Redistributions of source code must retain the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer. | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * 3. The name of David Young may not be used to endorse or promote | ||
16 | * products derived from this software without specific prior | ||
17 | * written permission. | ||
18 | * | ||
19 | * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY | ||
20 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
21 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID | ||
23 | * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
25 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY | ||
30 | * OF SUCH DAMAGE. | ||
31 | */ | ||
32 | |||
33 | /* | ||
34 | * Modifications to fit into the linux IEEE 802.11 stack, | ||
35 | * Mike Kershaw (dragorn@kismetwireless.net) | ||
36 | */ | ||
37 | |||
38 | #ifndef IEEE80211RADIOTAP_H | ||
39 | #define IEEE80211RADIOTAP_H | ||
40 | |||
41 | #include <linux/if_ether.h> | ||
42 | #include <linux/kernel.h> | ||
43 | |||
44 | /* Radiotap header version (from official NetBSD feed) */ | ||
45 | #define IEEE80211RADIOTAP_VERSION "1.5" | ||
46 | /* Base version of the radiotap packet header data */ | ||
47 | #define PKTHDR_RADIOTAP_VERSION 0 | ||
48 | |||
49 | /* A generic radio capture format is desirable. There is one for | ||
50 | * Linux, but it is neither rigidly defined (there were not even | ||
51 | * units given for some fields) nor easily extensible. | ||
52 | * | ||
53 | * I suggest the following extensible radio capture format. It is | ||
54 | * based on a bitmap indicating which fields are present. | ||
55 | * | ||
56 | * I am trying to describe precisely what the application programmer | ||
57 | * should expect in the following, and for that reason I tell the | ||
58 | * units and origin of each measurement (where it applies), or else I | ||
59 | * use sufficiently weaselly language ("is a monotonically nondecreasing | ||
60 | * function of...") that I cannot set false expectations for lawyerly | ||
61 | * readers. | ||
62 | */ | ||
63 | |||
64 | /* XXX tcpdump/libpcap do not tolerate variable-length headers, | ||
65 | * yet, so we pad every radiotap header to 64 bytes. Ugh. | ||
66 | */ | ||
67 | #define IEEE80211_RADIOTAP_HDRLEN 64 | ||
68 | |||
69 | /* The radio capture header precedes the 802.11 header. */ | ||
70 | struct ieee80211_radiotap_header { | ||
71 | u8 it_version; /* Version 0. Only increases | ||
72 | * for drastic changes, | ||
73 | * introduction of compatible | ||
74 | * new fields does not count. | ||
75 | */ | ||
76 | u8 it_pad; | ||
77 | u16 it_len; /* length of the whole | ||
78 | * header in bytes, including | ||
79 | * it_version, it_pad, | ||
80 | * it_len, and data fields. | ||
81 | */ | ||
82 | u32 it_present; /* A bitmap telling which | ||
83 | * fields are present. Set bit 31 | ||
84 | * (0x80000000) to extend the | ||
85 | * bitmap by another 32 bits. | ||
86 | * Additional extensions are made | ||
87 | * by setting bit 31. | ||
88 | */ | ||
89 | }; | ||
90 | |||
91 | /* Name Data type Units | ||
92 | * ---- --------- ----- | ||
93 | * | ||
94 | * IEEE80211_RADIOTAP_TSFT u64 microseconds | ||
95 | * | ||
96 | * Value in microseconds of the MAC's 64-bit 802.11 Time | ||
97 | * Synchronization Function timer when the first bit of the | ||
98 | * MPDU arrived at the MAC. For received frames, only. | ||
99 | * | ||
100 | * IEEE80211_RADIOTAP_CHANNEL 2 x u16 MHz, bitmap | ||
101 | * | ||
102 | * Tx/Rx frequency in MHz, followed by flags (see below). | ||
103 | * | ||
104 | * IEEE80211_RADIOTAP_FHSS u16 see below | ||
105 | * | ||
106 | * For frequency-hopping radios, the hop set (first byte) | ||
107 | * and pattern (second byte). | ||
108 | * | ||
109 | * IEEE80211_RADIOTAP_RATE u8 500kb/s | ||
110 | * | ||
111 | * Tx/Rx data rate | ||
112 | * | ||
113 | * IEEE80211_RADIOTAP_DBM_ANTSIGNAL int8_t decibels from | ||
114 | * one milliwatt (dBm) | ||
115 | * | ||
116 | * RF signal power at the antenna, decibel difference from | ||
117 | * one milliwatt. | ||
118 | * | ||
119 | * IEEE80211_RADIOTAP_DBM_ANTNOISE int8_t decibels from | ||
120 | * one milliwatt (dBm) | ||
121 | * | ||
122 | * RF noise power at the antenna, decibel difference from one | ||
123 | * milliwatt. | ||
124 | * | ||
125 | * IEEE80211_RADIOTAP_DB_ANTSIGNAL u8 decibel (dB) | ||
126 | * | ||
127 | * RF signal power at the antenna, decibel difference from an | ||
128 | * arbitrary, fixed reference. | ||
129 | * | ||
130 | * IEEE80211_RADIOTAP_DB_ANTNOISE u8 decibel (dB) | ||
131 | * | ||
132 | * RF noise power at the antenna, decibel difference from an | ||
133 | * arbitrary, fixed reference point. | ||
134 | * | ||
135 | * IEEE80211_RADIOTAP_LOCK_QUALITY u16 unitless | ||
136 | * | ||
137 | * Quality of Barker code lock. Unitless. Monotonically | ||
138 | * nondecreasing with "better" lock strength. Called "Signal | ||
139 | * Quality" in datasheets. (Is there a standard way to measure | ||
140 | * this?) | ||
141 | * | ||
142 | * IEEE80211_RADIOTAP_TX_ATTENUATION u16 unitless | ||
143 | * | ||
144 | * Transmit power expressed as unitless distance from max | ||
145 | * power set at factory calibration. 0 is max power. | ||
146 | * Monotonically nondecreasing with lower power levels. | ||
147 | * | ||
148 | * IEEE80211_RADIOTAP_DB_TX_ATTENUATION u16 decibels (dB) | ||
149 | * | ||
150 | * Transmit power expressed as decibel distance from max power | ||
151 | * set at factory calibration. 0 is max power. Monotonically | ||
152 | * nondecreasing with lower power levels. | ||
153 | * | ||
154 | * IEEE80211_RADIOTAP_DBM_TX_POWER int8_t decibels from | ||
155 | * one milliwatt (dBm) | ||
156 | * | ||
157 | * Transmit power expressed as dBm (decibels from a 1 milliwatt | ||
158 | * reference). This is the absolute power level measured at | ||
159 | * the antenna port. | ||
160 | * | ||
161 | * IEEE80211_RADIOTAP_FLAGS u8 bitmap | ||
162 | * | ||
163 | * Properties of transmitted and received frames. See flags | ||
164 | * defined below. | ||
165 | * | ||
166 | * IEEE80211_RADIOTAP_ANTENNA u8 antenna index | ||
167 | * | ||
168 | * Unitless indication of the Rx/Tx antenna for this packet. | ||
169 | * The first antenna is antenna 0. | ||
170 | * | ||
171 | * IEEE80211_RADIOTAP_FCS u32 data | ||
172 | * | ||
173 | * FCS from frame in network byte order. | ||
174 | */ | ||
175 | enum ieee80211_radiotap_type { | ||
176 | IEEE80211_RADIOTAP_TSFT = 0, | ||
177 | IEEE80211_RADIOTAP_FLAGS = 1, | ||
178 | IEEE80211_RADIOTAP_RATE = 2, | ||
179 | IEEE80211_RADIOTAP_CHANNEL = 3, | ||
180 | IEEE80211_RADIOTAP_FHSS = 4, | ||
181 | IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, | ||
182 | IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, | ||
183 | IEEE80211_RADIOTAP_LOCK_QUALITY = 7, | ||
184 | IEEE80211_RADIOTAP_TX_ATTENUATION = 8, | ||
185 | IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, | ||
186 | IEEE80211_RADIOTAP_DBM_TX_POWER = 10, | ||
187 | IEEE80211_RADIOTAP_ANTENNA = 11, | ||
188 | IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, | ||
189 | IEEE80211_RADIOTAP_DB_ANTNOISE = 13, | ||
190 | IEEE80211_RADIOTAP_EXT = 31, | ||
191 | }; | ||
192 | |||
193 | /* Channel flags. */ | ||
194 | #define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ | ||
195 | #define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ | ||
196 | #define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ | ||
197 | #define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ | ||
198 | #define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ | ||
199 | #define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ | ||
200 | #define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ | ||
201 | #define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ | ||
202 | |||
203 | /* For IEEE80211_RADIOTAP_FLAGS */ | ||
204 | #define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received | ||
205 | * during CFP | ||
206 | */ | ||
207 | #define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received | ||
208 | * with short | ||
209 | * preamble | ||
210 | */ | ||
211 | #define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received | ||
212 | * with WEP encryption | ||
213 | */ | ||
214 | #define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received | ||
215 | * with fragmentation | ||
216 | */ | ||
217 | #define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */ | ||
218 | #define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between | ||
219 | * 802.11 header and payload | ||
220 | * (to 32-bit boundary) | ||
221 | */ | ||
222 | |||
223 | /* Ugly macro to convert literal channel numbers into their mhz equivalents | ||
224 | * There are certianly some conditions that will break this (like feeding it '30') | ||
225 | * but they shouldn't arise since nothing talks on channel 30. */ | ||
226 | #define ieee80211chan2mhz(x) \ | ||
227 | (((x) <= 14) ? \ | ||
228 | (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \ | ||
229 | ((x) + 1000) * 5) | ||
230 | |||
231 | #endif /* IEEE80211_RADIOTAP_H */ | ||