• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef __RADIOTAP_ITER_H
2 #define __RADIOTAP_ITER_H
3 
4 #include <stdint.h>
5 #include "radiotap.h"
6 
7 /* Radiotap header iteration
8  *   implemented in radiotap.c
9  */
10 
11 struct radiotap_override {
12 	uint8_t field;
13 	uint8_t align:4, size:4;
14 };
15 
16 struct radiotap_align_size {
17 	uint8_t align:4, size:4;
18 };
19 
20 struct ieee80211_radiotap_namespace {
21 	const struct radiotap_align_size *align_size;
22 	int n_bits;
23 	uint32_t oui;
24 	uint8_t subns;
25 };
26 
27 struct ieee80211_radiotap_vendor_namespaces {
28 	const struct ieee80211_radiotap_namespace *ns;
29 	int n_ns;
30 };
31 
32 /**
33  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
34  * @this_arg_index: index of current arg, valid after each successful call
35  *	to ieee80211_radiotap_iterator_next()
36  * @this_arg: pointer to current radiotap arg; it is valid after each
37  *	call to ieee80211_radiotap_iterator_next() but also after
38  *	ieee80211_radiotap_iterator_init() where it will point to
39  *	the beginning of the actual data portion
40  * @this_arg_size: length of the current arg, for convenience
41  * @current_namespace: pointer to the current namespace definition
42  *	(or internally %NULL if the current namespace is unknown)
43  * @is_radiotap_ns: indicates whether the current namespace is the default
44  *	radiotap namespace or not
45  *
46  * @overrides: override standard radiotap fields
47  * @n_overrides: number of overrides
48  *
49  * @_rtheader: pointer to the radiotap header we are walking through
50  * @_max_length: length of radiotap header in cpu byte ordering
51  * @_arg_index: next argument index
52  * @_arg: next argument pointer
53  * @_next_bitmap: internal pointer to next present u32
54  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
55  * @_vns: vendor namespace definitions
56  * @_next_ns_data: beginning of the next namespace's data
57  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
58  *	next bitmap word
59  *
60  * Describes the radiotap parser state. Fields prefixed with an underscore
61  * must not be used by users of the parser, only by the parser internally.
62  */
63 
64 struct ieee80211_radiotap_iterator {
65 	struct ieee80211_radiotap_header *_rtheader;
66 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
67 	const struct ieee80211_radiotap_namespace *current_namespace;
68 
69 	unsigned char *_arg, *_next_ns_data;
70 	le32 *_next_bitmap;
71 
72 	unsigned char *this_arg;
73 #ifdef RADIOTAP_SUPPORT_OVERRIDES
74 	const struct radiotap_override *overrides;
75 	int n_overrides;
76 #endif
77 	int this_arg_index;
78 	int this_arg_size;
79 
80 	int is_radiotap_ns;
81 
82 	int _max_length;
83 	int _arg_index;
84 	uint32_t _bitmap_shifter;
85 	int _reset_on_ext;
86 };
87 
88 extern int ieee80211_radiotap_iterator_init(
89 	struct ieee80211_radiotap_iterator *iterator,
90 	struct ieee80211_radiotap_header *radiotap_header,
91 	int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);
92 
93 extern int ieee80211_radiotap_iterator_next(
94 	struct ieee80211_radiotap_iterator *iterator);
95 
96 #endif /* __RADIOTAP_ITER_H */
97