xref: /freebsd/contrib/wpa/src/utils/radiotap_iter.h (revision 7431dfd4580e850375fe5478d92ec770344db098)
1 /*
2  * Radiotap parser
3  *
4  * Copyright 2007		Andy Green <andy@warmcat.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * Alternatively, this software may be distributed under the terms of BSD
11  * license.
12  *
13  * See README and COPYING for more details.
14  */
15 
16 #ifndef __RADIOTAP_ITER_H
17 #define __RADIOTAP_ITER_H
18 
19 #include "radiotap.h"
20 
21 /* Radiotap header iteration
22  *   implemented in radiotap.c
23  */
24 /**
25  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
26  * @rtheader: pointer to the radiotap header we are walking through
27  * @max_length: length of radiotap header in cpu byte ordering
28  * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg
29  * @this_arg: pointer to current radiotap arg
30  * @arg_index: internal next argument index
31  * @arg: internal next argument pointer
32  * @next_bitmap: internal pointer to next present u32
33  * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
34  */
35 
36 struct ieee80211_radiotap_iterator {
37 	struct ieee80211_radiotap_header *rtheader;
38 	int max_length;
39 	int this_arg_index;
40 	unsigned char *this_arg;
41 
42 	int arg_index;
43 	unsigned char *arg;
44 	uint32_t *next_bitmap;
45 	uint32_t bitmap_shifter;
46 };
47 
48 extern int ieee80211_radiotap_iterator_init(
49    struct ieee80211_radiotap_iterator *iterator,
50    struct ieee80211_radiotap_header *radiotap_header,
51    int max_length);
52 
53 extern int ieee80211_radiotap_iterator_next(
54    struct ieee80211_radiotap_iterator *iterator);
55 
56 #endif /* __RADIOTAP_ITER_H */
57