aboutsummaryrefslogtreecommitdiff
path: root/src/transport/ieee80211_radiotap.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/ieee80211_radiotap.h')
-rw-r--r--src/transport/ieee80211_radiotap.h164
1 files changed, 84 insertions, 80 deletions
diff --git a/src/transport/ieee80211_radiotap.h b/src/transport/ieee80211_radiotap.h
index 91d197995..ed1cd69dd 100644
--- a/src/transport/ieee80211_radiotap.h
+++ b/src/transport/ieee80211_radiotap.h
@@ -61,25 +61,26 @@
61 * The radio capture header precedes the 802.11 header. 61 * The radio capture header precedes the 802.11 header.
62 * All data in the header is little endian on all platforms. 62 * All data in the header is little endian on all platforms.
63 */ 63 */
64struct ieee80211_radiotap_header { 64struct ieee80211_radiotap_header
65 u8 it_version; /* Version 0. Only increases 65{
66 * for drastic changes, 66 u8 it_version; /* Version 0. Only increases
67 * introduction of compatible 67 * for drastic changes,
68 * new fields does not count. 68 * introduction of compatible
69 */ 69 * new fields does not count.
70 u8 it_pad; 70 */
71 __le16 it_len; /* length of the whole 71 u8 it_pad;
72 * header in bytes, including 72 __le16 it_len; /* length of the whole
73 * it_version, it_pad, 73 * header in bytes, including
74 * it_len, and data fields. 74 * it_version, it_pad,
75 */ 75 * it_len, and data fields.
76 __le32 it_present; /* A bitmap telling which 76 */
77 * fields are present. Set bit 31 77 __le32 it_present; /* A bitmap telling which
78 * (0x80000000) to extend the 78 * fields are present. Set bit 31
79 * bitmap by another 32 bits. 79 * (0x80000000) to extend the
80 * Additional extensions are made 80 * bitmap by another 32 bits.
81 * by setting bit 31. 81 * Additional extensions are made
82 */ 82 * by setting bit 31.
83 */
83} __packed; 84} __packed;
84 85
85/* Name Data type Units 86/* Name Data type Units
@@ -179,71 +180,72 @@ struct ieee80211_radiotap_header {
179 * Number of unicast retries a transmitted frame used. 180 * Number of unicast retries a transmitted frame used.
180 * 181 *
181 */ 182 */
182enum ieee80211_radiotap_type { 183enum ieee80211_radiotap_type
183 IEEE80211_RADIOTAP_TSFT = 0, 184{
184 IEEE80211_RADIOTAP_FLAGS = 1, 185 IEEE80211_RADIOTAP_TSFT = 0,
185 IEEE80211_RADIOTAP_RATE = 2, 186 IEEE80211_RADIOTAP_FLAGS = 1,
186 IEEE80211_RADIOTAP_CHANNEL = 3, 187 IEEE80211_RADIOTAP_RATE = 2,
187 IEEE80211_RADIOTAP_FHSS = 4, 188 IEEE80211_RADIOTAP_CHANNEL = 3,
188 IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, 189 IEEE80211_RADIOTAP_FHSS = 4,
189 IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, 190 IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
190 IEEE80211_RADIOTAP_LOCK_QUALITY = 7, 191 IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
191 IEEE80211_RADIOTAP_TX_ATTENUATION = 8, 192 IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
192 IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, 193 IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
193 IEEE80211_RADIOTAP_DBM_TX_POWER = 10, 194 IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
194 IEEE80211_RADIOTAP_ANTENNA = 11, 195 IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
195 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, 196 IEEE80211_RADIOTAP_ANTENNA = 11,
196 IEEE80211_RADIOTAP_DB_ANTNOISE = 13, 197 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
197 IEEE80211_RADIOTAP_RX_FLAGS = 14, 198 IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
198 IEEE80211_RADIOTAP_TX_FLAGS = 15, 199 IEEE80211_RADIOTAP_RX_FLAGS = 14,
199 IEEE80211_RADIOTAP_RTS_RETRIES = 16, 200 IEEE80211_RADIOTAP_TX_FLAGS = 15,
200 IEEE80211_RADIOTAP_DATA_RETRIES = 17, 201 IEEE80211_RADIOTAP_RTS_RETRIES = 16,
202 IEEE80211_RADIOTAP_DATA_RETRIES = 17,
201 203
202 /* valid in every it_present bitmap, even vendor namespaces */ 204 /* valid in every it_present bitmap, even vendor namespaces */
203 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, 205 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
204 IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30, 206 IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30,
205 IEEE80211_RADIOTAP_EXT = 31 207 IEEE80211_RADIOTAP_EXT = 31
206}; 208};
207 209
208/* Channel flags. */ 210/* Channel flags. */
209#define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ 211#define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */
210#define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ 212#define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */
211#define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ 213#define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */
212#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ 214#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */
213#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ 215#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */
214#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ 216#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */
215#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ 217#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */
216#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ 218#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */
217 219
218/* For IEEE80211_RADIOTAP_FLAGS */ 220/* For IEEE80211_RADIOTAP_FLAGS */
219#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received 221#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received
220 * during CFP 222 * during CFP
221 */ 223 */
222#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received 224#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received
223 * with short 225 * with short
224 * preamble 226 * preamble
225 */ 227 */
226#define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received 228#define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received
227 * with WEP encryption 229 * with WEP encryption
228 */ 230 */
229#define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received 231#define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received
230 * with fragmentation 232 * with fragmentation
231 */ 233 */
232#define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */ 234#define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */
233#define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between 235#define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between
234 * 802.11 header and payload 236 * 802.11 header and payload
235 * (to 32-bit boundary) 237 * (to 32-bit boundary)
236 */ 238 */
237#define IEEE80211_RADIOTAP_F_BADFCS 0x40 /* bad FCS */ 239#define IEEE80211_RADIOTAP_F_BADFCS 0x40 /* bad FCS */
238 240
239/* For IEEE80211_RADIOTAP_RX_FLAGS */ 241/* For IEEE80211_RADIOTAP_RX_FLAGS */
240#define IEEE80211_RADIOTAP_F_RX_BADPLCP 0x0002 /* frame has bad PLCP */ 242#define IEEE80211_RADIOTAP_F_RX_BADPLCP 0x0002 /* frame has bad PLCP */
241 243
242/* For IEEE80211_RADIOTAP_TX_FLAGS */ 244/* For IEEE80211_RADIOTAP_TX_FLAGS */
243#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive 245#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive
244 * retries */ 246 * retries */
245#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */ 247#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */
246#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */ 248#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */
247 249
248/* Ugly macro to convert literal channel numbers into their mhz equivalents 250/* Ugly macro to convert literal channel numbers into their mhz equivalents
249 * There are certianly some conditions that will break this (like feeding it '30') 251 * There are certianly some conditions that will break this (like feeding it '30')
@@ -254,18 +256,20 @@ enum ieee80211_radiotap_type {
254 ((x) + 1000) * 5) 256 ((x) + 1000) * 5)
255 257
256/* helpers */ 258/* helpers */
257static inline u16 get_unaligned_le16(const u8 *p) 259static inline u16
260get_unaligned_le16 (const u8 *p)
258{ 261{
259 return p[0] | p[1] << 8; 262 return p[0] | p[1] << 8;
260} 263}
261 264
262 265
263static inline int ieee80211_get_radiotap_len(unsigned char *data) 266static inline int
267ieee80211_get_radiotap_len (unsigned char *data)
264{ 268{
265 struct ieee80211_radiotap_header *hdr = 269 struct ieee80211_radiotap_header *hdr =
266 (struct ieee80211_radiotap_header *)data; 270 (struct ieee80211_radiotap_header *) data;
267 271
268 return get_unaligned_le16( (const u8 *) &hdr->it_len); 272 return get_unaligned_le16 ((const u8 *) &hdr->it_len);
269} 273}
270 274
271#endif /* IEEE80211_RADIOTAP_H */ 275#endif /* IEEE80211_RADIOTAP_H */