diff options
author | David Brodski <david@brodski.eu> | 2010-09-05 05:57:58 +0000 |
---|---|---|
committer | David Brodski <david@brodski.eu> | 2010-09-05 05:57:58 +0000 |
commit | 89de3fe552fcf8206e6981fc81cc179c97e5ac65 (patch) | |
tree | c64b2be6e3d7de0a720ab90453cdf35a07f89411 /src/transport/gnunet-transport-wlan-helper.h | |
parent | d6498d0f807edde6e6f667e635c1454de0109247 (diff) | |
download | gnunet-89de3fe552fcf8206e6981fc81cc179c97e5ac65.tar.gz gnunet-89de3fe552fcf8206e6981fc81cc179c97e5ac65.zip |
Some changes and new files.
I will not have internet till 7. September so if there are errors just revert the changes.
Diffstat (limited to 'src/transport/gnunet-transport-wlan-helper.h')
-rw-r--r-- | src/transport/gnunet-transport-wlan-helper.h | 269 |
1 files changed, 0 insertions, 269 deletions
diff --git a/src/transport/gnunet-transport-wlan-helper.h b/src/transport/gnunet-transport-wlan-helper.h index 84f7fc9a8..757e3dd2c 100644 --- a/src/transport/gnunet-transport-wlan-helper.h +++ b/src/transport/gnunet-transport-wlan-helper.h | |||
@@ -59,275 +59,6 @@ typedef u32 __le32; | |||
59 | #endif /* gnunet_wlan_H */ | 59 | #endif /* gnunet_wlan_H */ |
60 | 60 | ||
61 | 61 | ||
62 | /* | ||
63 | * Copyright (c) 2003, 2004 David Young. All rights reserved. | ||
64 | * | ||
65 | * Redistribution and use in source and binary forms, with or without | ||
66 | * modification, are permitted provided that the following conditions | ||
67 | * are met: | ||
68 | * 1. Redistributions of source code must retain the above copyright | ||
69 | * notice, this list of conditions and the following disclaimer. | ||
70 | * 2. Redistributions in binary form must reproduce the above copyright | ||
71 | * notice, this list of conditions and the following disclaimer in the | ||
72 | * documentation and/or other materials provided with the distribution. | ||
73 | * 3. The name of David Young may not be used to endorse or promote | ||
74 | * products derived from this software without specific prior | ||
75 | * written permission. | ||
76 | * | ||
77 | * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY | ||
78 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
79 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
80 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID | ||
81 | * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
82 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
83 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
84 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
85 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
86 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
87 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY | ||
88 | * OF SUCH DAMAGE. | ||
89 | */ | ||
90 | |||
91 | /* | ||
92 | * Modifications to fit into the linux IEEE 802.11 stack, | ||
93 | * Mike Kershaw (dragorn@kismetwireless.net) | ||
94 | */ | ||
95 | |||
96 | #ifndef IEEE80211RADIOTAP_H | ||
97 | #define IEEE80211RADIOTAP_H | ||
98 | |||
99 | #include <linux/if_ether.h> | ||
100 | #include <linux/kernel.h> | ||
101 | //#include <asm/unaligned.h> | ||
102 | |||
103 | /* Base version of the radiotap packet header data */ | ||
104 | #define PKTHDR_RADIOTAP_VERSION 0 | ||
105 | |||
106 | /* A generic radio capture format is desirable. There is one for | ||
107 | * Linux, but it is neither rigidly defined (there were not even | ||
108 | * units given for some fields) nor easily extensible. | ||
109 | * | ||
110 | * I suggest the following extensible radio capture format. It is | ||
111 | * based on a bitmap indicating which fields are present. | ||
112 | * | ||
113 | * I am trying to describe precisely what the application programmer | ||
114 | * should expect in the following, and for that reason I tell the | ||
115 | * units and origin of each measurement (where it applies), or else I | ||
116 | * use sufficiently weaselly language ("is a monotonically nondecreasing | ||
117 | * function of...") that I cannot set false expectations for lawyerly | ||
118 | * readers. | ||
119 | */ | ||
120 | |||
121 | /* | ||
122 | * The radio capture header precedes the 802.11 header. | ||
123 | * All data in the header is little endian on all platforms. | ||
124 | */ | ||
125 | struct ieee80211_radiotap_header { | ||
126 | u8 it_version; /* Version 0. Only increases | ||
127 | * for drastic changes, | ||
128 | * introduction of compatible | ||
129 | * new fields does not count. | ||
130 | */ | ||
131 | u8 it_pad; | ||
132 | __le16 it_len; /* length of the whole | ||
133 | * header in bytes, including | ||
134 | * it_version, it_pad, | ||
135 | * it_len, and data fields. | ||
136 | */ | ||
137 | __le32 it_present; /* A bitmap telling which | ||
138 | * fields are present. Set bit 31 | ||
139 | * (0x80000000) to extend the | ||
140 | * bitmap by another 32 bits. | ||
141 | * Additional extensions are made | ||
142 | * by setting bit 31. | ||
143 | */ | ||
144 | } __packed; | ||
145 | |||
146 | /* Name Data type Units | ||
147 | * ---- --------- ----- | ||
148 | * | ||
149 | * IEEE80211_RADIOTAP_TSFT __le64 microseconds | ||
150 | * | ||
151 | * Value in microseconds of the MAC's 64-bit 802.11 Time | ||
152 | * Synchronization Function timer when the first bit of the | ||
153 | * MPDU arrived at the MAC. For received frames, only. | ||
154 | * | ||
155 | * IEEE80211_RADIOTAP_CHANNEL 2 x __le16 MHz, bitmap | ||
156 | * | ||
157 | * Tx/Rx frequency in MHz, followed by flags (see below). | ||
158 | * | ||
159 | * IEEE80211_RADIOTAP_FHSS __le16 see below | ||
160 | * | ||
161 | * For frequency-hopping radios, the hop set (first byte) | ||
162 | * and pattern (second byte). | ||
163 | * | ||
164 | * IEEE80211_RADIOTAP_RATE u8 500kb/s | ||
165 | * | ||
166 | * Tx/Rx data rate | ||
167 | * | ||
168 | * IEEE80211_RADIOTAP_DBM_ANTSIGNAL s8 decibels from | ||
169 | * one milliwatt (dBm) | ||
170 | * | ||
171 | * RF signal power at the antenna, decibel difference from | ||
172 | * one milliwatt. | ||
173 | * | ||
174 | * IEEE80211_RADIOTAP_DBM_ANTNOISE s8 decibels from | ||
175 | * one milliwatt (dBm) | ||
176 | * | ||
177 | * RF noise power at the antenna, decibel difference from one | ||
178 | * milliwatt. | ||
179 | * | ||
180 | * IEEE80211_RADIOTAP_DB_ANTSIGNAL u8 decibel (dB) | ||
181 | * | ||
182 | * RF signal power at the antenna, decibel difference from an | ||
183 | * arbitrary, fixed reference. | ||
184 | * | ||
185 | * IEEE80211_RADIOTAP_DB_ANTNOISE u8 decibel (dB) | ||
186 | * | ||
187 | * RF noise power at the antenna, decibel difference from an | ||
188 | * arbitrary, fixed reference point. | ||
189 | * | ||
190 | * IEEE80211_RADIOTAP_LOCK_QUALITY __le16 unitless | ||
191 | * | ||
192 | * Quality of Barker code lock. Unitless. Monotonically | ||
193 | * nondecreasing with "better" lock strength. Called "Signal | ||
194 | * Quality" in datasheets. (Is there a standard way to measure | ||
195 | * this?) | ||
196 | * | ||
197 | * IEEE80211_RADIOTAP_TX_ATTENUATION __le16 unitless | ||
198 | * | ||
199 | * Transmit power expressed as unitless distance from max | ||
200 | * power set at factory calibration. 0 is max power. | ||
201 | * Monotonically nondecreasing with lower power levels. | ||
202 | * | ||
203 | * IEEE80211_RADIOTAP_DB_TX_ATTENUATION __le16 decibels (dB) | ||
204 | * | ||
205 | * Transmit power expressed as decibel distance from max power | ||
206 | * set at factory calibration. 0 is max power. Monotonically | ||
207 | * nondecreasing with lower power levels. | ||
208 | * | ||
209 | * IEEE80211_RADIOTAP_DBM_TX_POWER s8 decibels from | ||
210 | * one milliwatt (dBm) | ||
211 | * | ||
212 | * Transmit power expressed as dBm (decibels from a 1 milliwatt | ||
213 | * reference). This is the absolute power level measured at | ||
214 | * the antenna port. | ||
215 | * | ||
216 | * IEEE80211_RADIOTAP_FLAGS u8 bitmap | ||
217 | * | ||
218 | * Properties of transmitted and received frames. See flags | ||
219 | * defined below. | ||
220 | * | ||
221 | * IEEE80211_RADIOTAP_ANTENNA u8 antenna index | ||
222 | * | ||
223 | * Unitless indication of the Rx/Tx antenna for this packet. | ||
224 | * The first antenna is antenna 0. | ||
225 | * | ||
226 | * IEEE80211_RADIOTAP_RX_FLAGS __le16 bitmap | ||
227 | * | ||
228 | * Properties of received frames. See flags defined below. | ||
229 | * | ||
230 | * IEEE80211_RADIOTAP_TX_FLAGS __le16 bitmap | ||
231 | * | ||
232 | * Properties of transmitted frames. See flags defined below. | ||
233 | * | ||
234 | * IEEE80211_RADIOTAP_RTS_RETRIES u8 data | ||
235 | * | ||
236 | * Number of rts retries a transmitted frame used. | ||
237 | * | ||
238 | * IEEE80211_RADIOTAP_DATA_RETRIES u8 data | ||
239 | * | ||
240 | * Number of unicast retries a transmitted frame used. | ||
241 | * | ||
242 | */ | ||
243 | enum ieee80211_radiotap_type { | ||
244 | IEEE80211_RADIOTAP_TSFT = 0, | ||
245 | IEEE80211_RADIOTAP_FLAGS = 1, | ||
246 | IEEE80211_RADIOTAP_RATE = 2, | ||
247 | IEEE80211_RADIOTAP_CHANNEL = 3, | ||
248 | IEEE80211_RADIOTAP_FHSS = 4, | ||
249 | IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, | ||
250 | IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, | ||
251 | IEEE80211_RADIOTAP_LOCK_QUALITY = 7, | ||
252 | IEEE80211_RADIOTAP_TX_ATTENUATION = 8, | ||
253 | IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, | ||
254 | IEEE80211_RADIOTAP_DBM_TX_POWER = 10, | ||
255 | IEEE80211_RADIOTAP_ANTENNA = 11, | ||
256 | IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, | ||
257 | IEEE80211_RADIOTAP_DB_ANTNOISE = 13, | ||
258 | IEEE80211_RADIOTAP_RX_FLAGS = 14, | ||
259 | IEEE80211_RADIOTAP_TX_FLAGS = 15, | ||
260 | IEEE80211_RADIOTAP_RTS_RETRIES = 16, | ||
261 | IEEE80211_RADIOTAP_DATA_RETRIES = 17, | ||
262 | |||
263 | /* valid in every it_present bitmap, even vendor namespaces */ | ||
264 | IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, | ||
265 | IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30, | ||
266 | IEEE80211_RADIOTAP_EXT = 31 | ||
267 | }; | ||
268 | |||
269 | /* Channel flags. */ | ||
270 | #define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ | ||
271 | #define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ | ||
272 | #define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ | ||
273 | #define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ | ||
274 | #define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ | ||
275 | #define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ | ||
276 | #define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ | ||
277 | #define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ | ||
278 | |||
279 | /* For IEEE80211_RADIOTAP_FLAGS */ | ||
280 | #define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received | ||
281 | * during CFP | ||
282 | */ | ||
283 | #define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received | ||
284 | * with short | ||
285 | * preamble | ||
286 | */ | ||
287 | #define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received | ||
288 | * with WEP encryption | ||
289 | */ | ||
290 | #define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received | ||
291 | * with fragmentation | ||
292 | */ | ||
293 | #define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */ | ||
294 | #define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between | ||
295 | * 802.11 header and payload | ||
296 | * (to 32-bit boundary) | ||
297 | */ | ||
298 | #define IEEE80211_RADIOTAP_F_BADFCS 0x40 /* bad FCS */ | ||
299 | |||
300 | /* For IEEE80211_RADIOTAP_RX_FLAGS */ | ||
301 | #define IEEE80211_RADIOTAP_F_RX_BADPLCP 0x0002 /* frame has bad PLCP */ | ||
302 | |||
303 | /* For IEEE80211_RADIOTAP_TX_FLAGS */ | ||
304 | #define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive | ||
305 | * retries */ | ||
306 | #define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */ | ||
307 | #define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */ | ||
308 | |||
309 | /* Ugly macro to convert literal channel numbers into their mhz equivalents | ||
310 | * There are certianly some conditions that will break this (like feeding it '30') | ||
311 | * but they shouldn't arise since nothing talks on channel 30. */ | ||
312 | #define ieee80211chan2mhz(x) \ | ||
313 | (((x) <= 14) ? \ | ||
314 | (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \ | ||
315 | ((x) + 1000) * 5) | ||
316 | |||
317 | #if BROKEN | ||
318 | /* helpers */ | ||
319 | static inline int ieee80211_get_radiotap_len(unsigned char *data) | ||
320 | { | ||
321 | struct ieee80211_radiotap_header *hdr = | ||
322 | (struct ieee80211_radiotap_header *)data; | ||
323 | |||
324 | return get_unaligned_le16(&hdr->it_len); | ||
325 | } | ||
326 | #endif | ||
327 | #endif /* IEEE80211_RADIOTAP_H */ | ||
328 | |||
329 | |||
330 | |||
331 | /* Radiotap header iteration | 62 | /* Radiotap header iteration |
332 | * implemented in net/wireless/radiotap.c | 63 | * implemented in net/wireless/radiotap.c |
333 | * docs in Documentation/networking/radiotap-headers.txt | 64 | * docs in Documentation/networking/radiotap-headers.txt |