aboutsummaryrefslogtreecommitdiff
path: root/src/transport/wlan/radiotap-parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/wlan/radiotap-parser.h')
-rw-r--r--src/transport/wlan/radiotap-parser.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/transport/wlan/radiotap-parser.h b/src/transport/wlan/radiotap-parser.h
new file mode 100644
index 000000000..b36037369
--- /dev/null
+++ b/src/transport/wlan/radiotap-parser.h
@@ -0,0 +1,78 @@
1/*
2 * Copyright (c) 2007, 2008, Andy Green <andy@warmcat.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18
19#define __user
20#include "byteorder.h"
21#include <stdint.h>
22
23typedef uint64_t u64;
24typedef uint32_t u32;
25typedef uint16_t u16;
26typedef uint8_t u8;
27
28#ifndef unlikely
29#define unlikely(x) (x)
30#endif
31
32#include "ieee80211_radiotap.h"
33
34
35/*
36 * Radiotap header iteration
37 * implemented in src/radiotap-parser.c
38 *
39 * call __ieee80211_radiotap_iterator_init() to init a semi-opaque iterator
40 * struct ieee80211_radiotap_iterator (no need to init the struct beforehand)
41 * then loop calling __ieee80211_radiotap_iterator_next()... it returns -1
42 * if there are no more args in the header, or the next argument type index
43 * that is present. The iterator's this_arg member points to the start of the
44 * argument associated with the current argument index that is present,
45 * which can be found in the iterator's this_arg_index member. This arg
46 * index corresponds to the IEEE80211_RADIOTAP_... defines.
47 */
48/**
49 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
50 * @rtheader: pointer to the radiotap header we are walking through
51 * @max_length: length of radiotap header in cpu byte ordering
52 * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg
53 * @this_arg: pointer to current radiotap arg
54 * @arg_index: internal next argument index
55 * @arg: internal next argument pointer
56 * @next_bitmap: internal pointer to next present u32
57 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
58 */
59
60struct ieee80211_radiotap_iterator {
61 struct ieee80211_radiotap_header *rtheader;
62 int max_length;
63 int this_arg_index;
64 u8 * this_arg;
65
66 int arg_index;
67 u8 * arg;
68 u32 *next_bitmap;
69 u32 bitmap_shifter;
70};
71
72int ieee80211_radiotap_iterator_init(
73 struct ieee80211_radiotap_iterator * iterator,
74 struct ieee80211_radiotap_header * radiotap_header,
75 int max_length);
76
77int ieee80211_radiotap_iterator_next(
78 struct ieee80211_radiotap_iterator * iterator);