fix usage of mesh_api
[oweals/gnunet.git] / src / transport / gnunet-transport-wlan-helper.h
1 /*
2      This file is part of GNUnet.
3      (C) 2009 Christian Grothoff (and other contributing authors)
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published
7      by the Free Software Foundation; either version 3, or (at your
8      option) any later version.
9
10      GNUnet is distributed in the hope that it will be useful, but
11      WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      General Public License for more details.
14
15      You should have received a copy of the GNU General Public License
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19 */
20
21 /**
22  * @file transport/gnunet-transport-wlan-helper.h
23  * @brief common internal definitions for the wlan mediator
24  * @author David Brodski
25  */
26  
27 #ifndef gnunet_wlan_H
28 #define gnunet_wlan_H
29
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <errno.h>
33 #include <resolv.h>
34 #include <string.h>
35 #include <utime.h>
36 #include <unistd.h>
37 #include <getopt.h>
38 #include <pcap.h>
39 //#include <endian.h>
40 #include <pcap.h>
41
42
43 typedef unsigned int u32;
44 typedef unsigned short u16;
45 typedef unsigned char u8;
46 typedef u32 __le32;
47
48 #if __BYTE_ORDER == __LITTLE_ENDIAN
49 #define le16_to_cpu(x) (x)
50 #define le32_to_cpu(x) (x)
51 #else
52 #define le16_to_cpu(x) ((((x)&0xff)<<8)|(((x)&0xff00)>>8))
53 #define le32_to_cpu(x) \
54 ((((x)&0xff)<<24)|(((x)&0xff00)<<8)|(((x)&0xff0000)>>8)|(((x)&0xff000000)>>24))
55 #endif
56 #define unlikely(x) (x)
57
58
59 #endif /* gnunet_wlan_H */
60
61
62 /* Radiotap header iteration
63  *   implemented in net/wireless/radiotap.c
64  *   docs in Documentation/networking/radiotap-headers.txt
65  */
66 /**
67  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
68  * rtheader: pointer to the radiotap header we are walking through
69  * max_length: length of radiotap header in cpu byte ordering
70  * this_arg_index: IEEE80211_RADIOTAP_... index of current arg
71  * this_arg: pointer to current radiotap arg
72  * arg_index: internal next argument index
73  * arg: internal next argument pointer
74  * next_bitmap: internal pointer to next present u32
75  * bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
76  */
77
78 struct ieee80211_radiotap_iterator {
79         struct ieee80211_radiotap_header *rtheader;
80         int max_length;
81         int this_arg_index;
82         u8 *this_arg;
83
84         int arg_index;
85         u8 *arg;
86         __le32 *next_bitmap;
87         u32 bitmap_shifter;
88 };
89
90 extern int ieee80211_radiotap_iterator_init(
91    struct ieee80211_radiotap_iterator *iterator,
92    struct ieee80211_radiotap_header *radiotap_header,
93    int max_length);
94
95 extern int ieee80211_radiotap_iterator_next(
96    struct ieee80211_radiotap_iterator *iterator);