aboutsummaryrefslogtreecommitdiff
path: root/src/transport/wlan
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-15 21:46:35 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-15 21:46:35 +0000
commit502af2167f7c218366666ca4944bd7cc54b5b19a (patch)
treea91fec5cc9769d260640bd91c6633cb9cf395524 /src/transport/wlan
parent03af5a603b7cc53432249d5854cd412aa90dde0d (diff)
downloadgnunet-502af2167f7c218366666ca4944bd7cc54b5b19a.tar.gz
gnunet-502af2167f7c218366666ca4944bd7cc54b5b19a.zip
indentation
Diffstat (limited to 'src/transport/wlan')
-rw-r--r--src/transport/wlan/byteorder.h827
-rw-r--r--src/transport/wlan/crctable_osdep.h99
-rw-r--r--src/transport/wlan/helper_common.c82
-rw-r--r--src/transport/wlan/helper_common.h6
-rw-r--r--src/transport/wlan/ieee80211.h532
-rw-r--r--src/transport/wlan/ieee80211_radiotap.h150
-rw-r--r--src/transport/wlan/loopback_helper.h3
-rw-r--r--src/transport/wlan/radiotap-parser.c360
-rw-r--r--src/transport/wlan/radiotap-parser.h31
9 files changed, 1087 insertions, 1003 deletions
diff --git a/src/transport/wlan/byteorder.h b/src/transport/wlan/byteorder.h
index c982669bf..e065e24d6 100644
--- a/src/transport/wlan/byteorder.h
+++ b/src/transport/wlan/byteorder.h
@@ -16,418 +16,421 @@
16 * You should have received a copy of the GNU General Public License 16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20 20
21#ifndef _AIRCRACK_NG_BYTEORDER_H_ 21#ifndef _AIRCRACK_NG_BYTEORDER_H_
22#define _AIRCRACK_NG_BYTEORDER_H_ 22#define _AIRCRACK_NG_BYTEORDER_H_
23 23
24 #define ___my_swab16(x) \ 24#define ___my_swab16(x) \
25 ((u_int16_t)( \ 25 ((u_int16_t) (\
26 (((u_int16_t)(x) & (u_int16_t)0x00ffU) << 8) | \ 26 (((u_int16_t) (x) & (u_int16_t) 0x00ffU) << 8) | \
27 (((u_int16_t)(x) & (u_int16_t)0xff00U) >> 8) )) 27 (((u_int16_t) (x) & (u_int16_t) 0xff00U) >> 8)))
28 #define ___my_swab32(x) \ 28#define ___my_swab32(x) \
29 ((u_int32_t)( \ 29 ((u_int32_t) (\
30 (((u_int32_t)(x) & (u_int32_t)0x000000ffUL) << 24) | \ 30 (((u_int32_t) (x) & (u_int32_t) 0x000000ffUL) << 24) | \
31 (((u_int32_t)(x) & (u_int32_t)0x0000ff00UL) << 8) | \ 31 (((u_int32_t) (x) & (u_int32_t) 0x0000ff00UL) << 8) | \
32 (((u_int32_t)(x) & (u_int32_t)0x00ff0000UL) >> 8) | \ 32 (((u_int32_t) (x) & (u_int32_t) 0x00ff0000UL) >> 8) | \
33 (((u_int32_t)(x) & (u_int32_t)0xff000000UL) >> 24) )) 33 (((u_int32_t) (x) & (u_int32_t) 0xff000000UL) >> 24)))
34 #define ___my_swab64(x) \ 34#define ___my_swab64(x) \
35 ((u_int64_t)( \ 35 ((u_int64_t) (\
36 (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0x00000000000000ffULL) << 56) | \ 36 (u_int64_t) (((u_int64_t) (x) & (u_int64_t)
37 (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0x000000000000ff00ULL) << 40) | \ 37 0x00000000000000ffULL) << 56) |
38 (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0x0000000000ff0000ULL) << 24) | \ 38 \ (u_int64_t) (((u_int64_t) (x) & (u_int64_t)
39 (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0x00000000ff000000ULL) << 8) | \ 39 0x000000000000ff00ULL) << 40) |
40 (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0x000000ff00000000ULL) >> 8) | \ 40 \ (u_int64_t) (((u_int64_t) (x) & (u_int64_t)
41 (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0x0000ff0000000000ULL) >> 24) | \ 41 0x0000000000ff0000ULL) << 24) |
42 (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0x00ff000000000000ULL) >> 40) | \ 42 \ (u_int64_t) (((u_int64_t) (x) & (u_int64_t)
43 (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0xff00000000000000ULL) >> 56) )) 43 0x00000000ff000000ULL) << 8) |
44 44 \ (u_int64_t) (((u_int64_t) (x) & (u_int64_t)
45 45 0x000000ff00000000ULL) >> 8) |
46 /* 46 \ (u_int64_t) (((u_int64_t) (x) & (u_int64_t)
47 * Linux 47 0x0000ff0000000000ULL) >> 24) |
48 */ 48 \ (u_int64_t) (((u_int64_t) (x) & (u_int64_t)
49 #if defined(linux) || defined(Linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux__) 49 0x00ff000000000000ULL) >> 40) |
50 #include <endian.h> 50 \ (u_int64_t) (((u_int64_t) (x) & (u_int64_t)
51 #include <unistd.h> 51 0xff00000000000000ULL) >> 56)))
52 #include <stdint.h> 52 /*
53 53 * Linux
54 #ifndef __int8_t_defined 54 */
55 typedef uint64_t u_int64_t; 55#if defined(linux) || defined(Linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux__)
56 typedef uint32_t u_int32_t; 56#include <endian.h>
57 typedef uint16_t u_int16_t; 57#include <unistd.h>
58 typedef uint8_t u_int8_t; 58#include <stdint.h>
59 #endif 59
60 60#ifndef __int8_t_defined
61typedef uint64_t u_int64_t;
62 typedef uint32_t u_int32_t;
63 typedef uint16_t u_int16_t;
64 typedef uint8_t u_int8_t;
65
66
67#endif /* */
68
61#ifndef htole16 69#ifndef htole16
62# if __BYTE_ORDER == __LITTLE_ENDIAN 70#if __BYTE_ORDER == __LITTLE_ENDIAN
63# define htobe16(x) ___my_swab16 (x) 71#define htobe16(x) ___my_swab16 (x)
64# define htole16(x) (x) 72#define htole16(x) (x)
65# define be16toh(x) ___my_swab16 (x) 73#define be16toh(x) ___my_swab16 (x)
66# define le16toh(x) (x) 74#define le16toh(x) (x)
67 75
68# define htobe32(x) ___my_swab32 (x) 76#define htobe32(x) ___my_swab32 (x)
69# define htole32(x) (x) 77#define htole32(x) (x)
70# define be32toh(x) ___my_swab32 (x) 78#define be32toh(x) ___my_swab32 (x)
71# define le32toh(x) (x) 79#define le32toh(x) (x)
72 80
73# define htobe64(x) ___my_swab64 (x) 81#define htobe64(x) ___my_swab64 (x)
74# define htole64(x) (x) 82#define htole64(x) (x)
75# define be64toh(x) ___my_swab64 (x) 83#define be64toh(x) ___my_swab64 (x)
76# define le64toh(x) (x) 84#define le64toh(x) (x)
77# else 85#else /* */
78# define htobe16(x) (x) 86#define htobe16(x) (x)
79# define htole16(x) ___my_swab16 (x) 87#define htole16(x) ___my_swab16 (x)
80# define be16toh(x) (x) 88#define be16toh(x) (x)
81# define le16toh(x) ___my_swab16 (x) 89#define le16toh(x) ___my_swab16 (x)
82 90
83# define htobe32(x) (x) 91#define htobe32(x) (x)
84# define htole32(x) ___my_swab32 (x) 92#define htole32(x) ___my_swab32 (x)
85# define be32toh(x) (x) 93#define be32toh(x) (x)
86# define le32toh(x) ___my_swab32 (x) 94#define le32toh(x) ___my_swab32 (x)
87 95
88# define htobe64(x) (x) 96#define htobe64(x) (x)
89# define htole64(x) ___my_swab64 (x) 97#define htole64(x) ___my_swab64 (x)
90# define be64toh(x) (x) 98#define be64toh(x) (x)
91# define le64toh(x) ___my_swab64 (x) 99#define le64toh(x) ___my_swab64 (x)
92# endif 100#endif /* */
93#endif 101#endif /* */
94 102
95 103#endif /* */
96 104
97 #endif 105 /*
98 106 * Cygwin
99 /* 107 */
100 * Cygwin 108#if defined(__CYGWIN32__)
101 */ 109#include <asm/byteorder.h>
102 #if defined(__CYGWIN32__) 110#include <unistd.h>
103 #include <asm/byteorder.h> 111
104 #include <unistd.h> 112#define __be64_to_cpu(x) ___my_swab64(x)
105 113#define __be32_to_cpu(x) ___my_swab32(x)
106 #define __be64_to_cpu(x) ___my_swab64(x) 114#define __be16_to_cpu(x) ___my_swab16(x)
107 #define __be32_to_cpu(x) ___my_swab32(x) 115#define __cpu_to_be64(x) ___my_swab64(x)
108 #define __be16_to_cpu(x) ___my_swab16(x) 116#define __cpu_to_be32(x) ___my_swab32(x)
109 #define __cpu_to_be64(x) ___my_swab64(x) 117#define __cpu_to_be16(x) ___my_swab16(x)
110 #define __cpu_to_be32(x) ___my_swab32(x) 118#define __le64_to_cpu(x) (x)
111 #define __cpu_to_be16(x) ___my_swab16(x) 119#define __le32_to_cpu(x) (x)
112 #define __le64_to_cpu(x) (x) 120#define __le16_to_cpu(x) (x)
113 #define __le32_to_cpu(x) (x) 121#define __cpu_to_le64(x) (x)
114 #define __le16_to_cpu(x) (x) 122#define __cpu_to_le32(x) (x)
115 #define __cpu_to_le64(x) (x) 123#define __cpu_to_le16(x) (x)
116 #define __cpu_to_le32(x) (x) 124
117 #define __cpu_to_le16(x) (x) 125#define AIRCRACK_NG_BYTE_ORDER_DEFINED
118 126
119 #define AIRCRACK_NG_BYTE_ORDER_DEFINED 127#endif /* */
120 128
121 #endif 129 /*
122 130 * Windows (DDK)
123 /* 131 */
124 * Windows (DDK) 132#if defined(__WIN__)
125 */ 133
126 #if defined(__WIN__) 134#include <io.h>
127 135
128 #include <io.h> 136#define __be64_to_cpu(x) ___my_swab64(x)
129 137#define __be32_to_cpu(x) ___my_swab32(x)
130 #define __be64_to_cpu(x) ___my_swab64(x) 138#define __be16_to_cpu(x) ___my_swab16(x)
131 #define __be32_to_cpu(x) ___my_swab32(x) 139#define __cpu_to_be64(x) ___my_swab64(x)
132 #define __be16_to_cpu(x) ___my_swab16(x) 140#define __cpu_to_be32(x) ___my_swab32(x)
133 #define __cpu_to_be64(x) ___my_swab64(x) 141#define __cpu_to_be16(x) ___my_swab16(x)
134 #define __cpu_to_be32(x) ___my_swab32(x) 142#define __le64_to_cpu(x) (x)
135 #define __cpu_to_be16(x) ___my_swab16(x) 143#define __le32_to_cpu(x) (x)
136 #define __le64_to_cpu(x) (x) 144#define __le16_to_cpu(x) (x)
137 #define __le32_to_cpu(x) (x) 145#define __cpu_to_le64(x) (x)
138 #define __le16_to_cpu(x) (x) 146#define __cpu_to_le32(x) (x)
139 #define __cpu_to_le64(x) (x) 147#define __cpu_to_le16(x) (x)
140 #define __cpu_to_le32(x) (x) 148
141 #define __cpu_to_le16(x) (x) 149#define AIRCRACK_NG_BYTE_ORDER_DEFINED
142 150
143 #define AIRCRACK_NG_BYTE_ORDER_DEFINED 151#endif /* */
144 152
145 #endif 153 /*
146 154 * MAC (Darwin)
147 /* 155 */
148 * MAC (Darwin) 156#if defined(__APPLE_CC__)
149 */ 157#if defined(__x86_64__) && defined(__APPLE__)
150 #if defined(__APPLE_CC__) 158
151 #if defined(__x86_64__) && defined(__APPLE__) 159#include <libkern/OSByteOrder.h>
152 160
153 #include <libkern/OSByteOrder.h> 161#define __swab64(x) (unsigned long long) OSSwapInt64((uint64_t)x)
154 162#define __swab32(x) (unsigned long) OSSwapInt32((uint32_t)x)
155 #define __swab64(x) (unsigned long long) OSSwapInt64((uint64_t)x) 163#define __swab16(x) (unsigned short) OSSwapInt16((uint16_t)x)
156 #define __swab32(x) (unsigned long) OSSwapInt32((uint32_t)x) 164#define __be64_to_cpu(x) (unsigned long long) OSSwapBigToHostInt64((uint64_t)x)
157 #define __swab16(x) (unsigned short) OSSwapInt16((uint16_t)x) 165#define __be32_to_cpu(x) (unsigned long) OSSwapBigToHostInt32((uint32_t)x)
158 #define __be64_to_cpu(x) (unsigned long long) OSSwapBigToHostInt64((uint64_t)x) 166#define __be16_to_cpu(x) (unsigned short) OSSwapBigToHostInt16((uint16_t)x)
159 #define __be32_to_cpu(x) (unsigned long) OSSwapBigToHostInt32((uint32_t)x) 167#define __le64_to_cpu(x) (unsigned long long) OSSwapLittleToHostInt64((uint64_t)x)
160 #define __be16_to_cpu(x) (unsigned short) OSSwapBigToHostInt16((uint16_t)x) 168#define __le32_to_cpu(x) (unsigned long) OSSwapLittleToHostInt32((uint32_t)x)
161 #define __le64_to_cpu(x) (unsigned long long) OSSwapLittleToHostInt64((uint64_t)x) 169#define __le16_to_cpu(x) (unsigned short) OSSwapLittleToHostInt16((uint16_t)x)
162 #define __le32_to_cpu(x) (unsigned long) OSSwapLittleToHostInt32((uint32_t)x) 170#define __cpu_to_be64(x) (unsigned long long) OSSwapHostToBigInt64((uint64_t)x)
163 #define __le16_to_cpu(x) (unsigned short) OSSwapLittleToHostInt16((uint16_t)x) 171#define __cpu_to_be32(x) (unsigned long) OSSwapHostToBigInt32((uint32_t)x)
164 #define __cpu_to_be64(x) (unsigned long long) OSSwapHostToBigInt64((uint64_t)x) 172#define __cpu_to_be16(x) (unsigned short) OSSwapHostToBigInt16((uint16_t)x)
165 #define __cpu_to_be32(x) (unsigned long) OSSwapHostToBigInt32((uint32_t)x) 173#define __cpu_to_le64(x) (unsigned long long) OSSwapHostToLittleInt64((uint64_t)x)
166 #define __cpu_to_be16(x) (unsigned short) OSSwapHostToBigInt16((uint16_t)x) 174#define __cpu_to_le32(x) (unsigned long) OSSwapHostToLittleInt32((uint32_t)x)
167 #define __cpu_to_le64(x) (unsigned long long) OSSwapHostToLittleInt64((uint64_t)x) 175#define __cpu_to_le16(x) (unsigned short) OSSwapHostToLittleInt16((uint16_t)x)
168 #define __cpu_to_le32(x) (unsigned long) OSSwapHostToLittleInt32((uint32_t)x) 176
169 #define __cpu_to_le16(x) (unsigned short) OSSwapHostToLittleInt16((uint16_t)x) 177#else /* */
170 178
171 #else 179#include <architecture/byte_order.h>
172 180
173 #include <architecture/byte_order.h> 181#define __swab64(x) NXSwapLongLong(x)
174 182#define __swab32(x) NXSwapLong(x)
175 #define __swab64(x) NXSwapLongLong(x) 183#define __swab16(x) NXSwapShort(x)
176 #define __swab32(x) NXSwapLong(x) 184#define __be64_to_cpu(x) NXSwapBigLongLongToHost(x)
177 #define __swab16(x) NXSwapShort(x) 185#define __be32_to_cpu(x) NXSwapBigLongToHost(x)
178 #define __be64_to_cpu(x) NXSwapBigLongLongToHost(x) 186#define __be16_to_cpu(x) NXSwapBigShortToHost(x)
179 #define __be32_to_cpu(x) NXSwapBigLongToHost(x) 187#define __le64_to_cpu(x) NXSwapLittleLongLongToHost(x)
180 #define __be16_to_cpu(x) NXSwapBigShortToHost(x) 188#define __le32_to_cpu(x) NXSwapLittleLongToHost(x)
181 #define __le64_to_cpu(x) NXSwapLittleLongLongToHost(x) 189#define __le16_to_cpu(x) NXSwapLittleShortToHost(x)
182 #define __le32_to_cpu(x) NXSwapLittleLongToHost(x) 190#define __cpu_to_be64(x) NXSwapHostLongLongToBig(x)
183 #define __le16_to_cpu(x) NXSwapLittleShortToHost(x) 191#define __cpu_to_be32(x) NXSwapHostLongToBig(x)
184 #define __cpu_to_be64(x) NXSwapHostLongLongToBig(x) 192#define __cpu_to_be16(x) NXSwapHostShortToBig(x)
185 #define __cpu_to_be32(x) NXSwapHostLongToBig(x) 193#define __cpu_to_le64(x) NXSwapHostLongLongToLittle(x)
186 #define __cpu_to_be16(x) NXSwapHostShortToBig(x) 194#define __cpu_to_le32(x) NXSwapHostLongToLittle(x)
187 #define __cpu_to_le64(x) NXSwapHostLongLongToLittle(x) 195#define __cpu_to_le16(x) NXSwapHostShortToLittle(x)
188 #define __cpu_to_le32(x) NXSwapHostLongToLittle(x) 196
189 #define __cpu_to_le16(x) NXSwapHostShortToLittle(x) 197#endif /* */
190 198
191 #endif 199#define __LITTLE_ENDIAN 1234
192 200#define __BIG_ENDIAN 4321
193 #define __LITTLE_ENDIAN 1234 201#define __PDP_ENDIAN 3412
194 #define __BIG_ENDIAN 4321 202#define __BYTE_ORDER __BIG_ENDIAN
195 #define __PDP_ENDIAN 3412 203
196 #define __BYTE_ORDER __BIG_ENDIAN 204#define AIRCRACK_NG_BYTE_ORDER_DEFINED
197 205
198 #define AIRCRACK_NG_BYTE_ORDER_DEFINED 206#endif /* */
199 207
200 #endif 208 /*
201 209 * Solaris
202 /* 210 * -------
203 * Solaris 211 */
204 * ------- 212#if defined(__sparc__) && defined(__sun__)
205 */ 213#include <sys/byteorder.h>
206 #if defined(__sparc__) && defined(__sun__) 214#include <sys/types.h>
207 #include <sys/byteorder.h> 215#include <unistd.h>
208 #include <sys/types.h> 216
209 #include <unistd.h> 217#define __be64_to_cpu(x) (x)
210 218#define __be32_to_cpu(x) (x)
211 #define __be64_to_cpu(x) (x) 219#define __be16_to_cpu(x) (x)
212 #define __be32_to_cpu(x) (x) 220#define __cpu_to_be64(x) (x)
213 #define __be16_to_cpu(x) (x) 221#define __cpu_to_be32(x) (x)
214 #define __cpu_to_be64(x) (x) 222#define __cpu_to_be16(x) (x)
215 #define __cpu_to_be32(x) (x) 223#define __le64_to_cpu(x) ___my_swab64(x)
216 #define __cpu_to_be16(x) (x) 224#define __le32_to_cpu(x) ___my_swab32(x)
217 #define __le64_to_cpu(x) ___my_swab64(x) 225#define __le16_to_cpu(x) ___my_swab16(x)
218 #define __le32_to_cpu(x) ___my_swab32(x) 226#define __cpu_to_le64(x) ___my_swab64(x)
219 #define __le16_to_cpu(x) ___my_swab16(x) 227#define __cpu_to_le32(x) ___my_swab32(x)
220 #define __cpu_to_le64(x) ___my_swab64(x) 228#define __cpu_to_le16(x) ___my_swab16(x)
221 #define __cpu_to_le32(x) ___my_swab32(x) 229 typedef uint64_t u_int64_t;
222 #define __cpu_to_le16(x) ___my_swab16(x) 230 typedef uint32_t u_int32_t;
223 231 typedef uint16_t u_int16_t;
224 typedef uint64_t u_int64_t; 232 typedef uint8_t u_int8_t;
225 typedef uint32_t u_int32_t; 233
226 typedef uint16_t u_int16_t; 234
227 typedef uint8_t u_int8_t; 235#define AIRCRACK_NG_BYTE_ORDER_DEFINED
228 236
229 #define AIRCRACK_NG_BYTE_ORDER_DEFINED 237#endif /* */
230 238
231 #endif 239 /*
232 240 * Custom stuff
233 /* 241 */
234 * Custom stuff 242#if defined(__MACH__) && !defined(__APPLE_CC__)
235 */ 243#include <libkern/OSByteOrder.h>
236 #if defined(__MACH__) && !defined(__APPLE_CC__) 244#define __cpu_to_be64(x) = OSSwapHostToBigInt64(x)
237 #include <libkern/OSByteOrder.h> 245#define __cpu_to_be32(x) = OSSwapHostToBigInt32(x)
238 #define __cpu_to_be64(x) = OSSwapHostToBigInt64(x) 246
239 #define __cpu_to_be32(x) = OSSwapHostToBigInt32(x) 247#define AIRCRACK_NG_BYTE_ORDER_DEFINED
240 248
241 #define AIRCRACK_NG_BYTE_ORDER_DEFINED 249#endif /* */
242 250
243 #endif 251 // FreeBSD
244 252#ifdef __FreeBSD__
245 253#include <machine/endian.h>
246 // FreeBSD 254#endif /* */
247 #ifdef __FreeBSD__ 255
248 #include <machine/endian.h> 256 // XXX: Is there anything to include on OpenBSD/NetBSD/DragonFlyBSD/...?
249 #endif 257
250 258 // XXX: Mac: Check http://www.opensource.apple.com/source/CF/CF-476.18/CFByteOrder.h
251 // XXX: Is there anything to include on OpenBSD/NetBSD/DragonFlyBSD/...? 259 // http://developer.apple.com/DOCUMENTATION/CoreFoundation/Reference/CFByteOrderUtils/Reference/reference.html
252 260 // Write to apple to ask what should be used.
253 261
254 // XXX: Mac: Check http://www.opensource.apple.com/source/CF/CF-476.18/CFByteOrder.h 262#if defined(LITTLE_ENDIAN)
255 // http://developer.apple.com/DOCUMENTATION/CoreFoundation/Reference/CFByteOrderUtils/Reference/reference.html 263#define AIRCRACK_NG_LITTLE_ENDIAN LITTLE_ENDIAN
256 // Write to apple to ask what should be used. 264#elif defined(__LITTLE_ENDIAN)
257 265#define AIRCRACK_NG_LITTLE_ENDIAN __LITTLE_ENDIAN
258 #if defined(LITTLE_ENDIAN) 266#elif defined(_LITTLE_ENDIAN)
259 #define AIRCRACK_NG_LITTLE_ENDIAN LITTLE_ENDIAN 267#define AIRCRACK_NG_LITTLE_ENDIAN _LITTLE_ENDIAN
260 #elif defined(__LITTLE_ENDIAN) 268#endif /* */
261 #define AIRCRACK_NG_LITTLE_ENDIAN __LITTLE_ENDIAN 269
262 #elif defined(_LITTLE_ENDIAN) 270#if defined(BIG_ENDIAN)
263 #define AIRCRACK_NG_LITTLE_ENDIAN _LITTLE_ENDIAN 271#define AIRCRACK_NG_BIG_ENDIAN BIG_ENDIAN
264 #endif 272#elif defined(__BIG_ENDIAN)
265 273#define AIRCRACK_NG_BIG_ENDIAN __BIG_ENDIAN
266 #if defined(BIG_ENDIAN) 274#elif defined(_BIG_ENDIAN)
267 #define AIRCRACK_NG_BIG_ENDIAN BIG_ENDIAN 275#define AIRCRACK_NG_BIG_ENDIAN _BIG_ENDIAN
268 #elif defined(__BIG_ENDIAN) 276#endif /* */
269 #define AIRCRACK_NG_BIG_ENDIAN __BIG_ENDIAN 277
270 #elif defined(_BIG_ENDIAN) 278#if !defined(AIRCRACK_NG_LITTLE_ENDIAN) && !defined(AIRCRACK_NG_BIG_ENDIAN)
271 #define AIRCRACK_NG_BIG_ENDIAN _BIG_ENDIAN 279#error Impossible to determine endianness (Little or Big endian), please contact the author.
272 #endif 280#endif /* */
273 281
274 #if !defined(AIRCRACK_NG_LITTLE_ENDIAN) && !defined(AIRCRACK_NG_BIG_ENDIAN) 282#if defined(BYTE_ORDER)
275 #error Impossible to determine endianness (Little or Big endian), please contact the author. 283#if (BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN)
276 #endif 284#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN
277 285#elif (BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN)
278 #if defined(BYTE_ORDER) 286#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN
279 #if (BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN) 287#endif /* */
280 #define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN 288#elif defined(__BYTE_ORDER)
281 #elif (BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN) 289#if (__BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN)
282 #define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN 290#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN
283 #endif 291#elif (__BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN)
284 #elif defined(__BYTE_ORDER) 292#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN
285 #if (__BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN) 293#endif /* */
286 #define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN 294#elif defined(_BYTE_ORDER)
287 #elif (__BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN) 295#if (_BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN)
288 #define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN 296#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN
289 #endif 297#elif (_BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN)
290 #elif defined(_BYTE_ORDER) 298#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN
291 #if (_BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN) 299#endif /* */
292 #define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN 300#endif /* */
293 #elif (_BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN) 301
294 #define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN 302#ifndef AIRCRACK_NG_BYTE_ORDER
295 #endif 303#error Impossible to determine endianness (Little or Big endian), please contact the author.
296 #endif 304#endif /* */
297 305
298 #ifndef AIRCRACK_NG_BYTE_ORDER 306#if (AIRCRACK_NG_BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN)
299 #error Impossible to determine endianness (Little or Big endian), please contact the author. 307
300 #endif 308#ifndef AIRCRACK_NG_BYTE_ORDER_DEFINED
301 309#define __be64_to_cpu(x) ___my_swab64(x)
302 #if (AIRCRACK_NG_BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN) 310#define __be32_to_cpu(x) ___my_swab32(x)
303 311#define __be16_to_cpu(x) ___my_swab16(x)
304 #ifndef AIRCRACK_NG_BYTE_ORDER_DEFINED 312#define __cpu_to_be64(x) ___my_swab64(x)
305 #define __be64_to_cpu(x) ___my_swab64(x) 313#define __cpu_to_be32(x) ___my_swab32(x)
306 #define __be32_to_cpu(x) ___my_swab32(x) 314#define __cpu_to_be16(x) ___my_swab16(x)
307 #define __be16_to_cpu(x) ___my_swab16(x) 315#define __le64_to_cpu(x) (x)
308 #define __cpu_to_be64(x) ___my_swab64(x) 316#define __le32_to_cpu(x) (x)
309 #define __cpu_to_be32(x) ___my_swab32(x) 317#define __le16_to_cpu(x) (x)
310 #define __cpu_to_be16(x) ___my_swab16(x) 318#define __cpu_to_le64(x) (x)
311 #define __le64_to_cpu(x) (x) 319#define __cpu_to_le32(x) (x)
312 #define __le32_to_cpu(x) (x) 320#define __cpu_to_le16(x) (x)
313 #define __le16_to_cpu(x) (x) 321#endif /* */
314 #define __cpu_to_le64(x) (x) 322
315 #define __cpu_to_le32(x) (x) 323#ifndef htobe16
316 #define __cpu_to_le16(x) (x) 324#define htobe16 ___my_swab16
317 #endif 325#endif /* */
318 326#ifndef htobe32
319 #ifndef htobe16 327#define htobe32 ___my_swab32
320 #define htobe16 ___my_swab16 328#endif /* */
321 #endif 329#ifndef betoh16
322 #ifndef htobe32 330#define betoh16 ___my_swab16
323 #define htobe32 ___my_swab32 331#endif /* */
324 #endif 332#ifndef betoh32
325 #ifndef betoh16 333#define betoh32 ___my_swab32
326 #define betoh16 ___my_swab16 334#endif /* */
327 #endif 335
328 #ifndef betoh32 336#ifndef htole16
329 #define betoh32 ___my_swab32 337#define htole16(x) (x)
330 #endif 338#endif /* */
331 339#ifndef htole32
332 #ifndef htole16 340#define htole32(x) (x)
333 #define htole16(x) (x) 341#endif /* */
334 #endif 342#ifndef letoh16
335 #ifndef htole32 343#define letoh16(x) (x)
336 #define htole32(x) (x) 344#endif /* */
337 #endif 345#ifndef letoh32
338 #ifndef letoh16 346#define letoh32(x) (x)
339 #define letoh16(x) (x) 347#endif /* */
340 #endif 348
341 #ifndef letoh32 349#endif /* */
342 #define letoh32(x) (x) 350
343 #endif 351#if (AIRCRACK_NG_BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN)
344 352
345 #endif 353#ifndef AIRCRACK_NG_BYTE_ORDER_DEFINED
346 354#define __be64_to_cpu(x) (x)
347 #if (AIRCRACK_NG_BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN) 355#define __be32_to_cpu(x) (x)
348 356#define __be16_to_cpu(x) (x)
349 #ifndef AIRCRACK_NG_BYTE_ORDER_DEFINED 357#define __cpu_to_be64(x) (x)
350 #define __be64_to_cpu(x) (x) 358#define __cpu_to_be32(x) (x)
351 #define __be32_to_cpu(x) (x) 359#define __cpu_to_be16(x) (x)
352 #define __be16_to_cpu(x) (x) 360#define __le64_to_cpu(x) ___my_swab64(x)
353 #define __cpu_to_be64(x) (x) 361#define __le32_to_cpu(x) ___my_swab32(x)
354 #define __cpu_to_be32(x) (x) 362#define __le16_to_cpu(x) ___my_swab16(x)
355 #define __cpu_to_be16(x) (x) 363#define __cpu_to_le64(x) ___my_swab64(x)
356 #define __le64_to_cpu(x) ___my_swab64(x) 364#define __cpu_to_le32(x) ___my_swab32(x)
357 #define __le32_to_cpu(x) ___my_swab32(x) 365#define __cpu_to_le16(x) ___my_swab16(x)
358 #define __le16_to_cpu(x) ___my_swab16(x) 366#endif /* */
359 #define __cpu_to_le64(x) ___my_swab64(x) 367
360 #define __cpu_to_le32(x) ___my_swab32(x) 368#ifndef htobe16
361 #define __cpu_to_le16(x) ___my_swab16(x) 369#define htobe16(x) (x)
362 #endif 370#endif /* */
363 371#ifndef htobe32
364 #ifndef htobe16 372#define htobe32(x) (x)
365 #define htobe16(x) (x) 373#endif /* */
366 #endif 374#ifndef betoh16
367 #ifndef htobe32 375#define betoh16(x) (x)
368 #define htobe32(x) (x) 376#endif /* */
369 #endif 377#ifndef betoh32
370 #ifndef betoh16 378#define betoh32(x) (x)
371 #define betoh16(x) (x) 379#endif /* */
372 #endif 380
373 #ifndef betoh32 381#ifndef htole16
374 #define betoh32(x) (x) 382#define htole16 ___my_swab16
375 #endif 383#endif /* */
376 384#ifndef htole32
377 #ifndef htole16 385#define htole32 ___my_swab32
378 #define htole16 ___my_swab16 386#endif /* */
379 #endif 387#ifndef letoh16
380 #ifndef htole32 388#define letoh16 ___my_swab16
381 #define htole32 ___my_swab32 389#endif /* */
382 #endif 390#ifndef letoh32
383 #ifndef letoh16 391#define letoh32 ___my_swab32
384 #define letoh16 ___my_swab16 392#endif /* */
385 #endif 393
386 #ifndef letoh32 394#endif /* */
387 #define letoh32 ___my_swab32 395
388 #endif 396 // Common defines
389 397#define cpu_to_le64 __cpu_to_le64
390 #endif 398#define le64_to_cpu __le64_to_cpu
391 399#define cpu_to_le32 __cpu_to_le32
392 // Common defines 400#define le32_to_cpu __le32_to_cpu
393 #define cpu_to_le64 __cpu_to_le64 401#define cpu_to_le16 __cpu_to_le16
394 #define le64_to_cpu __le64_to_cpu 402#define le16_to_cpu __le16_to_cpu
395 #define cpu_to_le32 __cpu_to_le32 403#define cpu_to_be64 __cpu_to_be64
396 #define le32_to_cpu __le32_to_cpu 404#define be64_to_cpu __be64_to_cpu
397 #define cpu_to_le16 __cpu_to_le16 405#define cpu_to_be32 __cpu_to_be32
398 #define le16_to_cpu __le16_to_cpu 406#define be32_to_cpu __be32_to_cpu
399 #define cpu_to_be64 __cpu_to_be64 407#define cpu_to_be16 __cpu_to_be16
400 #define be64_to_cpu __be64_to_cpu 408#define be16_to_cpu __be16_to_cpu
401 #define cpu_to_be32 __cpu_to_be32 409
402 #define be32_to_cpu __be32_to_cpu 410#ifndef le16toh
403 #define cpu_to_be16 __cpu_to_be16 411#define le16toh le16_to_cpu
404 #define be16_to_cpu __be16_to_cpu 412#endif /* */
405 413#ifndef be16toh
406 #ifndef le16toh 414#define be16toh be16_to_cpu
407 #define le16toh le16_to_cpu 415#endif /* */
408 #endif 416#ifndef le32toh
409 #ifndef be16toh 417#define le32toh le32_to_cpu
410 #define be16toh be16_to_cpu 418#endif /* */
411 #endif 419#ifndef be32toh
412 #ifndef le32toh 420#define be32toh be32_to_cpu
413 #define le32toh le32_to_cpu 421#endif /* */
414 #endif 422
415 #ifndef be32toh 423#ifndef htons
416 #define be32toh be32_to_cpu 424#define htons be16_to_cpu
417 #endif 425#endif /* */
418 426#ifndef htonl
419 427#define htonl cpu_to_be16
420 #ifndef htons 428#endif /* */
421 #define htons be16_to_cpu 429#ifndef ntohs
422 #endif 430#define ntohs cpu_to_be16
423 #ifndef htonl 431#endif /* */
424 #define htonl cpu_to_be16 432#ifndef ntohl
425 #endif 433#define ntohl cpu_to_be32
426 #ifndef ntohs 434#endif /* */
427 #define ntohs cpu_to_be16 435
428 #endif 436#endif /* */
429 #ifndef ntohl
430 #define ntohl cpu_to_be32
431 #endif
432
433#endif
diff --git a/src/transport/wlan/crctable_osdep.h b/src/transport/wlan/crctable_osdep.h
index 4f14d245b..04c769f2a 100644
--- a/src/transport/wlan/crctable_osdep.h
+++ b/src/transport/wlan/crctable_osdep.h
@@ -1,40 +1,71 @@
1#ifndef _CRCTABLE_OSDEP_H 1#ifndef _CRCTABLE_OSDEP_H
2#define _CRCTABLE_OSDEP_H 2#define _CRCTABLE_OSDEP_H
3 3
4const unsigned long int crc_tbl_osdep[256] = 4const unsigned long int crc_tbl_osdep[256] = {
5{ 5 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F,
6 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 6 0xE963A535, 0x9E6495A3,
7 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 7 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD,
8 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 8 0xE7B82D07, 0x90BF1D91,
9 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 9 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB,
10 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 10 0xF4D4B551, 0x83D385C7,
11 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 11 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,
12 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 12 0xFA0F3D63, 0x8D080DF5,
13 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 13 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447,
14 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, 14 0xD20D85FD, 0xA50AB56B,
15 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 15 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75,
16 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 16 0xDCD60DCF, 0xABD13D59,
17 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 17 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423,
18 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 18 0xCFBA9599, 0xB8BDA50F,
19 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 19 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11,
20 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, 20 0xC1611DAB, 0xB6662D3D,
21 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 21 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F,
22 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 22 0x9FBFE4A5, 0xE8B8D433,
23 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 23 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D,
24 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 24 0x91646C97, 0xE6635C01,
25 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 25 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B,
26 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 26 0x8208F4C1, 0xF50FC457,
27 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 27 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49,
28 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 28 0x8CD37CF3, 0xFBD44C65,
29 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 29 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7,
30 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 30 0xA4D1C46D, 0xD3D6F4FB,
31 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 31 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5,
32 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 32 0xAA0A4C5F, 0xDD0D7CC9,
33 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 33 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3,
34 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 34 0xB966D409, 0xCE61E49F,
35 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 35 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
36 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 36 0xB7BD5C3B, 0xC0BA6CAD,
37 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D 37 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF,
38 0x04DB2615, 0x73DC1683,
39 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D,
40 0x0A00AE27, 0x7D079EB1,
41 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,
42 0x196C3671, 0x6E6B06E7,
43 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9,
44 0x17B7BE43, 0x60B08ED5,
45 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767,
46 0x3FB506DD, 0x48B2364B,
47 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55,
48 0x316E8EEF, 0x4669BE79,
49 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703,
50 0x220216B9, 0x5505262F,
51 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31,
52 0x2CD99E8B, 0x5BDEAE1D,
53 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F,
54 0x72076785, 0x05005713,
55 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D,
56 0x7CDCEFB7, 0x0BDBDF21,
57 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B,
58 0x6FB077E1, 0x18B74777,
59 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69,
60 0x616BFFD3, 0x166CCF45,
61 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7,
62 0x4969474D, 0x3E6E77DB,
63 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5,
64 0x47B2CF7F, 0x30B5FFE9,
65 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693,
66 0x54DE5729, 0x23D967BF,
67 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1,
68 0x5A05DF1B, 0x2D02EF8D
38}; 69};
39 70
40#endif /* crctable_osdep.h */ 71#endif /* crctable_osdep.h */
diff --git a/src/transport/wlan/helper_common.c b/src/transport/wlan/helper_common.c
index 24782ed11..d4b1204f6 100644
--- a/src/transport/wlan/helper_common.c
+++ b/src/transport/wlan/helper_common.c
@@ -34,17 +34,17 @@
34 * @return number of bytes written 34 * @return number of bytes written
35 */ 35 */
36int 36int
37send_mac_to_plugin(char * buffer, uint8_t * mac) 37send_mac_to_plugin (char *buffer, uint8_t * mac)
38{ 38{
39 39
40 struct Wlan_Helper_Control_Message macmsg; 40 struct Wlan_Helper_Control_Message macmsg;
41 41
42 memcpy(macmsg.mac.mac, mac, sizeof(struct MacAddress)); 42 memcpy (macmsg.mac.mac, mac, sizeof (struct MacAddress));
43 macmsg.hdr.size = htons(sizeof(struct Wlan_Helper_Control_Message)); 43 macmsg.hdr.size = htons (sizeof (struct Wlan_Helper_Control_Message));
44 macmsg.hdr.type = htons(GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); 44 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
45 45
46 memcpy(buffer, &macmsg, sizeof(struct Wlan_Helper_Control_Message)); 46 memcpy (buffer, &macmsg, sizeof (struct Wlan_Helper_Control_Message));
47 return sizeof(struct Wlan_Helper_Control_Message); 47 return sizeof (struct Wlan_Helper_Control_Message);
48} 48}
49 49
50/* 50/*
@@ -70,40 +70,54 @@ send_mac_to_plugin(char * buffer, uint8_t * mac)
70/** 70/**
71 * Return the frequency in Mhz from a channel number 71 * Return the frequency in Mhz from a channel number
72 */ 72 */
73int getFrequencyFromChannel(int channel) 73int
74getFrequencyFromChannel (int channel)
74{ 75{
75 static int frequencies[] = { 76 static int frequencies[] = {
76 -1, // No channel 0 77 -1, // No channel 0
77 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484, 78 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467,
78 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // Nothing from channel 15 to 34 (exclusive) 79 2472, 2484,
79 5170, 5175, 5180, 5185, 5190, 5195, 5200, 5205, 5210, 5215, 5220, 5225, 5230, 5235, 5240, 5245, 80 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // Nothing from channel 15 to 34 (exclusive)
80 5250, 5255, 5260, 5265, 5270, 5275, 5280, 5285, 5290, 5295, 5300, 5305, 5310, 5315, 5320, 5325, 81 5170, 5175, 5180, 5185, 5190, 5195, 5200, 5205, 5210, 5215, 5220, 5225,
81 5330, 5335, 5340, 5345, 5350, 5355, 5360, 5365, 5370, 5375, 5380, 5385, 5390, 5395, 5400, 5405, 82 5230, 5235, 5240, 5245,
82 5410, 5415, 5420, 5425, 5430, 5435, 5440, 5445, 5450, 5455, 5460, 5465, 5470, 5475, 5480, 5485, 83 5250, 5255, 5260, 5265, 5270, 5275, 5280, 5285, 5290, 5295, 5300, 5305,
83 5490, 5495, 5500, 5505, 5510, 5515, 5520, 5525, 5530, 5535, 5540, 5545, 5550, 5555, 5560, 5565, 84 5310, 5315, 5320, 5325,
84 5570, 5575, 5580, 5585, 5590, 5595, 5600, 5605, 5610, 5615, 5620, 5625, 5630, 5635, 5640, 5645, 85 5330, 5335, 5340, 5345, 5350, 5355, 5360, 5365, 5370, 5375, 5380, 5385,
85 5650, 5655, 5660, 5665, 5670, 5675, 5680, 5685, 5690, 5695, 5700, 5705, 5710, 5715, 5720, 5725, 86 5390, 5395, 5400, 5405,
86 5730, 5735, 5740, 5745, 5750, 5755, 5760, 5765, 5770, 5775, 5780, 5785, 5790, 5795, 5800, 5805, 87 5410, 5415, 5420, 5425, 5430, 5435, 5440, 5445, 5450, 5455, 5460, 5465,
87 5810, 5815, 5820, 5825, 5830, 5835, 5840, 5845, 5850, 5855, 5860, 5865, 5870, 5875, 5880, 5885, 88 5470, 5475, 5480, 5485,
88 5890, 5895, 5900, 5905, 5910, 5915, 5920, 5925, 5930, 5935, 5940, 5945, 5950, 5955, 5960, 5965, 89 5490, 5495, 5500, 5505, 5510, 5515, 5520, 5525, 5530, 5535, 5540, 5545,
89 5970, 5975, 5980, 5985, 5990, 5995, 6000, 6005, 6010, 6015, 6020, 6025, 6030, 6035, 6040, 6045, 90 5550, 5555, 5560, 5565,
90 6050, 6055, 6060, 6065, 6070, 6075, 6080, 6085, 6090, 6095, 6100 91 5570, 5575, 5580, 5585, 5590, 5595, 5600, 5605, 5610, 5615, 5620, 5625,
91 }; 92 5630, 5635, 5640, 5645,
93 5650, 5655, 5660, 5665, 5670, 5675, 5680, 5685, 5690, 5695, 5700, 5705,
94 5710, 5715, 5720, 5725,
95 5730, 5735, 5740, 5745, 5750, 5755, 5760, 5765, 5770, 5775, 5780, 5785,
96 5790, 5795, 5800, 5805,
97 5810, 5815, 5820, 5825, 5830, 5835, 5840, 5845, 5850, 5855, 5860, 5865,
98 5870, 5875, 5880, 5885,
99 5890, 5895, 5900, 5905, 5910, 5915, 5920, 5925, 5930, 5935, 5940, 5945,
100 5950, 5955, 5960, 5965,
101 5970, 5975, 5980, 5985, 5990, 5995, 6000, 6005, 6010, 6015, 6020, 6025,
102 6030, 6035, 6040, 6045,
103 6050, 6055, 6060, 6065, 6070, 6075, 6080, 6085, 6090, 6095, 6100
104 };
92 105
93 return (channel > 0 && channel <= 221) ? frequencies[channel] : -1; 106 return (channel > 0 && channel <= 221) ? frequencies[channel] : -1;
94} 107}
95 108
96/** 109/**
97 * Return the channel from the frequency (in Mhz) 110 * Return the channel from the frequency (in Mhz)
98 */ 111 */
99int getChannelFromFrequency(int frequency) 112int
113getChannelFromFrequency (int frequency)
100{ 114{
101 if (frequency >= 2412 && frequency <= 2472) 115 if (frequency >= 2412 && frequency <= 2472)
102 return (frequency - 2407) / 5; 116 return (frequency - 2407) / 5;
103 else if (frequency == 2484) 117 else if (frequency == 2484)
104 return 14; 118 return 14;
105 else if (frequency >= 5000 && frequency <= 6100) 119 else if (frequency >= 5000 && frequency <= 6100)
106 return (frequency - 5000) / 5; 120 return (frequency - 5000) / 5;
107 else 121 else
108 return -1; 122 return -1;
109} 123}
diff --git a/src/transport/wlan/helper_common.h b/src/transport/wlan/helper_common.h
index 71c3e1b9b..550ebda6f 100644
--- a/src/transport/wlan/helper_common.h
+++ b/src/transport/wlan/helper_common.h
@@ -8,8 +8,8 @@
8#ifndef HELPER_COMMON_H_ 8#ifndef HELPER_COMMON_H_
9#define HELPER_COMMON_H_ 9#define HELPER_COMMON_H_
10 10
11int getFrequencyFromChannel(int channel); 11int getFrequencyFromChannel (int channel);
12int getChannelFromFrequency(int frequency); 12int getChannelFromFrequency (int frequency);
13int send_mac_to_plugin(char * buffer, uint8_t * mac); 13int send_mac_to_plugin (char *buffer, uint8_t * mac);
14 14
15#endif /* HELPER_COMMON_H_ */ 15#endif /* HELPER_COMMON_H_ */
diff --git a/src/transport/wlan/ieee80211.h b/src/transport/wlan/ieee80211.h
index 8df1d2c29..a952674ca 100644
--- a/src/transport/wlan/ieee80211.h
+++ b/src/transport/wlan/ieee80211.h
@@ -38,72 +38,78 @@
38 * 802.11 protocol definitions. 38 * 802.11 protocol definitions.
39 */ 39 */
40 40
41#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ 41#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
42/* is 802.11 address multicast/broadcast? */ 42/* is 802.11 address multicast/broadcast? */
43#define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01) 43#define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01)
44 44
45/* IEEE 802.11 PLCP header */ 45/* IEEE 802.11 PLCP header */
46struct ieee80211_plcp_hdr { 46struct ieee80211_plcp_hdr
47 u_int16_t i_sfd; 47{
48 u_int8_t i_signal; 48 u_int16_t i_sfd;
49 u_int8_t i_service; 49 u_int8_t i_signal;
50 u_int16_t i_length; 50 u_int8_t i_service;
51 u_int16_t i_crc; 51 u_int16_t i_length;
52 u_int16_t i_crc;
52} GNUNET_PACKED; 53} GNUNET_PACKED;
53 54
54#define IEEE80211_PLCP_SFD 0xF3A0 55#define IEEE80211_PLCP_SFD 0xF3A0
55#define IEEE80211_PLCP_SERVICE 0x00 56#define IEEE80211_PLCP_SERVICE 0x00
56 57
57/* 58/*
58 * generic definitions for IEEE 802.11 frames 59 * generic definitions for IEEE 802.11 frames
59 */ 60 */
60struct ieee80211_frame { 61struct ieee80211_frame
61 u_int8_t i_fc[2]; 62{
62 u_int8_t i_dur[2]; 63 u_int8_t i_fc[2];
63 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 64 u_int8_t i_dur[2];
64 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 65 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
65 u_int8_t i_addr3[IEEE80211_ADDR_LEN]; 66 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
66 u_int8_t i_seq[2]; 67 u_int8_t i_addr3[IEEE80211_ADDR_LEN];
67 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ 68 u_int8_t i_seq[2];
68 /* see below */ 69 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
70 /* see below */
69} GNUNET_PACKED; 71} GNUNET_PACKED;
70 72
71struct ieee80211_qosframe { 73struct ieee80211_qosframe
72 u_int8_t i_fc[2]; 74{
73 u_int8_t i_dur[2]; 75 u_int8_t i_fc[2];
74 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 76 u_int8_t i_dur[2];
75 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 77 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
76 u_int8_t i_addr3[IEEE80211_ADDR_LEN]; 78 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
77 u_int8_t i_seq[2]; 79 u_int8_t i_addr3[IEEE80211_ADDR_LEN];
78 u_int8_t i_qos[2]; 80 u_int8_t i_seq[2];
79 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ 81 u_int8_t i_qos[2];
80 /* see below */ 82 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
83 /* see below */
81} GNUNET_PACKED; 84} GNUNET_PACKED;
82 85
83struct ieee80211_qoscntl { 86struct ieee80211_qoscntl
84 u_int8_t i_qos[2]; 87{
88 u_int8_t i_qos[2];
85}; 89};
86 90
87struct ieee80211_frame_addr4 { 91struct ieee80211_frame_addr4
88 u_int8_t i_fc[2]; 92{
89 u_int8_t i_dur[2]; 93 u_int8_t i_fc[2];
90 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 94 u_int8_t i_dur[2];
91 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 95 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
92 u_int8_t i_addr3[IEEE80211_ADDR_LEN]; 96 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
93 u_int8_t i_seq[2]; 97 u_int8_t i_addr3[IEEE80211_ADDR_LEN];
94 u_int8_t i_addr4[IEEE80211_ADDR_LEN]; 98 u_int8_t i_seq[2];
99 u_int8_t i_addr4[IEEE80211_ADDR_LEN];
95} GNUNET_PACKED; 100} GNUNET_PACKED;
96 101
97 102
98struct ieee80211_qosframe_addr4 { 103struct ieee80211_qosframe_addr4
99 u_int8_t i_fc[2]; 104{
100 u_int8_t i_dur[2]; 105 u_int8_t i_fc[2];
101 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 106 u_int8_t i_dur[2];
102 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 107 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
103 u_int8_t i_addr3[IEEE80211_ADDR_LEN]; 108 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
104 u_int8_t i_seq[2]; 109 u_int8_t i_addr3[IEEE80211_ADDR_LEN];
105 u_int8_t i_addr4[IEEE80211_ADDR_LEN]; 110 u_int8_t i_seq[2];
106 u_int8_t i_qos[2]; 111 u_int8_t i_addr4[IEEE80211_ADDR_LEN];
112 u_int8_t i_qos[2];
107} GNUNET_PACKED; 113} GNUNET_PACKED;
108 114
109#define IEEE80211_FC0_VERSION_MASK 0x03 115#define IEEE80211_FC0_VERSION_MASK 0x03
@@ -149,10 +155,10 @@ struct ieee80211_qosframe_addr4 {
149#define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0 155#define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0
150 156
151#define IEEE80211_FC1_DIR_MASK 0x03 157#define IEEE80211_FC1_DIR_MASK 0x03
152#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ 158#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */
153#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ 159#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */
154#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ 160#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */
155#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ 161#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */
156 162
157#define IEEE80211_FC1_MORE_FRAG 0x04 163#define IEEE80211_FC1_MORE_FRAG 0x04
158#define IEEE80211_FC1_RETRY 0x08 164#define IEEE80211_FC1_RETRY 0x08
@@ -185,65 +191,68 @@ struct ieee80211_qosframe_addr4 {
185/* 191/*
186 * WME/802.11e information element. 192 * WME/802.11e information element.
187 */ 193 */
188struct ieee80211_wme_info { 194struct ieee80211_wme_info
189 u_int8_t wme_id; /* IEEE80211_ELEMID_VENDOR */ 195{
190 u_int8_t wme_len; /* length in bytes */ 196 u_int8_t wme_id; /* IEEE80211_ELEMID_VENDOR */
191 u_int8_t wme_oui[3]; /* 0x00, 0x50, 0xf2 */ 197 u_int8_t wme_len; /* length in bytes */
192 u_int8_t wme_type; /* OUI type */ 198 u_int8_t wme_oui[3]; /* 0x00, 0x50, 0xf2 */
193 u_int8_t wme_subtype; /* OUI subtype */ 199 u_int8_t wme_type; /* OUI type */
194 u_int8_t wme_version; /* spec revision */ 200 u_int8_t wme_subtype; /* OUI subtype */
195 u_int8_t wme_info; /* QoS info */ 201 u_int8_t wme_version; /* spec revision */
202 u_int8_t wme_info; /* QoS info */
196} GNUNET_PACKED; 203} GNUNET_PACKED;
197 204
198/* 205/*
199 * WME/802.11e Tspec Element 206 * WME/802.11e Tspec Element
200 */ 207 */
201struct ieee80211_wme_tspec { 208struct ieee80211_wme_tspec
202 u_int8_t ts_id; 209{
203 u_int8_t ts_len; 210 u_int8_t ts_id;
204 u_int8_t ts_oui[3]; 211 u_int8_t ts_len;
205 u_int8_t ts_oui_type; 212 u_int8_t ts_oui[3];
206 u_int8_t ts_oui_subtype; 213 u_int8_t ts_oui_type;
207 u_int8_t ts_version; 214 u_int8_t ts_oui_subtype;
208 u_int8_t ts_tsinfo[3]; 215 u_int8_t ts_version;
209 u_int8_t ts_nom_msdu[2]; 216 u_int8_t ts_tsinfo[3];
210 u_int8_t ts_max_msdu[2]; 217 u_int8_t ts_nom_msdu[2];
211 u_int8_t ts_min_svc[4]; 218 u_int8_t ts_max_msdu[2];
212 u_int8_t ts_max_svc[4]; 219 u_int8_t ts_min_svc[4];
213 u_int8_t ts_inactv_intv[4]; 220 u_int8_t ts_max_svc[4];
214 u_int8_t ts_susp_intv[4]; 221 u_int8_t ts_inactv_intv[4];
215 u_int8_t ts_start_svc[4]; 222 u_int8_t ts_susp_intv[4];
216 u_int8_t ts_min_rate[4]; 223 u_int8_t ts_start_svc[4];
217 u_int8_t ts_mean_rate[4]; 224 u_int8_t ts_min_rate[4];
218 u_int8_t ts_max_burst[4]; 225 u_int8_t ts_mean_rate[4];
219 u_int8_t ts_min_phy[4]; 226 u_int8_t ts_max_burst[4];
220 u_int8_t ts_peak_rate[4]; 227 u_int8_t ts_min_phy[4];
221 u_int8_t ts_delay[4]; 228 u_int8_t ts_peak_rate[4];
222 u_int8_t ts_surplus[2]; 229 u_int8_t ts_delay[4];
223 u_int8_t ts_medium_time[2]; 230 u_int8_t ts_surplus[2];
231 u_int8_t ts_medium_time[2];
224} GNUNET_PACKED; 232} GNUNET_PACKED;
225 233
226/* 234/*
227 * WME AC parameter field 235 * WME AC parameter field
228 */ 236 */
229struct ieee80211_wme_acparams { 237struct ieee80211_wme_acparams
230 u_int8_t acp_aci_aifsn; 238{
231 u_int8_t acp_logcwminmax; 239 u_int8_t acp_aci_aifsn;
232 u_int16_t acp_txop; 240 u_int8_t acp_logcwminmax;
241 u_int16_t acp_txop;
233} GNUNET_PACKED; 242} GNUNET_PACKED;
234 243
235#define WME_NUM_AC 4 /* 4 AC categories */ 244#define WME_NUM_AC 4 /* 4 AC categories */
236 245
237#define WME_PARAM_ACI 0x60 /* Mask for ACI field */ 246#define WME_PARAM_ACI 0x60 /* Mask for ACI field */
238#define WME_PARAM_ACI_S 5 /* Shift for ACI field */ 247#define WME_PARAM_ACI_S 5 /* Shift for ACI field */
239#define WME_PARAM_ACM 0x10 /* Mask for ACM bit */ 248#define WME_PARAM_ACM 0x10 /* Mask for ACM bit */
240#define WME_PARAM_ACM_S 4 /* Shift for ACM bit */ 249#define WME_PARAM_ACM_S 4 /* Shift for ACM bit */
241#define WME_PARAM_AIFSN 0x0f /* Mask for aifsn field */ 250#define WME_PARAM_AIFSN 0x0f /* Mask for aifsn field */
242#define WME_PARAM_AIFSN_S 0 /* Shift for aifsn field */ 251#define WME_PARAM_AIFSN_S 0 /* Shift for aifsn field */
243#define WME_PARAM_LOGCWMIN 0x0f /* Mask for CwMin field (in log) */ 252#define WME_PARAM_LOGCWMIN 0x0f /* Mask for CwMin field (in log) */
244#define WME_PARAM_LOGCWMIN_S 0 /* Shift for CwMin field */ 253#define WME_PARAM_LOGCWMIN_S 0 /* Shift for CwMin field */
245#define WME_PARAM_LOGCWMAX 0xf0 /* Mask for CwMax field (in log) */ 254#define WME_PARAM_LOGCWMAX 0xf0 /* Mask for CwMax field (in log) */
246#define WME_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */ 255#define WME_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */
247 256
248#define WME_AC_TO_TID(_ac) ( \ 257#define WME_AC_TO_TID(_ac) ( \
249 ((_ac) == WME_AC_VO) ? 6 : \ 258 ((_ac) == WME_AC_VO) ? 6 : \
@@ -260,28 +269,31 @@ struct ieee80211_wme_acparams {
260/* 269/*
261 * WME Parameter Element 270 * WME Parameter Element
262 */ 271 */
263struct ieee80211_wme_param { 272struct ieee80211_wme_param
264 u_int8_t param_id; 273{
265 u_int8_t param_len; 274 u_int8_t param_id;
266 u_int8_t param_oui[3]; 275 u_int8_t param_len;
267 u_int8_t param_oui_type; 276 u_int8_t param_oui[3];
268 u_int8_t param_oui_sybtype; 277 u_int8_t param_oui_type;
269 u_int8_t param_version; 278 u_int8_t param_oui_sybtype;
270 u_int8_t param_qosInfo; 279 u_int8_t param_version;
271#define WME_QOSINFO_COUNT 0x0f /* Mask for param count field */ 280 u_int8_t param_qosInfo;
272 u_int8_t param_reserved; 281#define WME_QOSINFO_COUNT 0x0f /* Mask for param count field */
273 struct ieee80211_wme_acparams params_acParams[WME_NUM_AC]; 282 u_int8_t param_reserved;
283 struct ieee80211_wme_acparams params_acParams[WME_NUM_AC];
274} GNUNET_PACKED; 284} GNUNET_PACKED;
275 285
276/* 286/*
277 * Management Notification Frame 287 * Management Notification Frame
278 */ 288 */
279struct ieee80211_mnf { 289struct ieee80211_mnf
280 u_int8_t mnf_category; 290{
281 u_int8_t mnf_action; 291 u_int8_t mnf_category;
282 u_int8_t mnf_dialog; 292 u_int8_t mnf_action;
283 u_int8_t mnf_status; 293 u_int8_t mnf_dialog;
294 u_int8_t mnf_status;
284} GNUNET_PACKED; 295} GNUNET_PACKED;
296
285#define MNF_SETUP_REQ 0 297#define MNF_SETUP_REQ 0
286#define MNF_SETUP_RESP 1 298#define MNF_SETUP_RESP 1
287#define MNF_TEARDOWN 2 299#define MNF_TEARDOWN 2
@@ -289,50 +301,56 @@ struct ieee80211_mnf {
289/* 301/*
290 * Control frames. 302 * Control frames.
291 */ 303 */
292struct ieee80211_frame_min { 304struct ieee80211_frame_min
293 u_int8_t i_fc[2]; 305{
294 u_int8_t i_dur[2]; 306 u_int8_t i_fc[2];
295 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 307 u_int8_t i_dur[2];
296 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 308 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
297 /* FCS */ 309 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
310 /* FCS */
298} GNUNET_PACKED; 311} GNUNET_PACKED;
299 312
300struct ieee80211_frame_rts { 313struct ieee80211_frame_rts
301 u_int8_t i_fc[2]; 314{
302 u_int8_t i_dur[2]; 315 u_int8_t i_fc[2];
303 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 316 u_int8_t i_dur[2];
304 u_int8_t i_ta[IEEE80211_ADDR_LEN]; 317 u_int8_t i_ra[IEEE80211_ADDR_LEN];
305 /* FCS */ 318 u_int8_t i_ta[IEEE80211_ADDR_LEN];
319 /* FCS */
306} GNUNET_PACKED; 320} GNUNET_PACKED;
307 321
308struct ieee80211_frame_cts { 322struct ieee80211_frame_cts
309 u_int8_t i_fc[2]; 323{
310 u_int8_t i_dur[2]; 324 u_int8_t i_fc[2];
311 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 325 u_int8_t i_dur[2];
312 /* FCS */ 326 u_int8_t i_ra[IEEE80211_ADDR_LEN];
327 /* FCS */
313} GNUNET_PACKED; 328} GNUNET_PACKED;
314 329
315struct ieee80211_frame_ack { 330struct ieee80211_frame_ack
316 u_int8_t i_fc[2]; 331{
317 u_int8_t i_dur[2]; 332 u_int8_t i_fc[2];
318 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 333 u_int8_t i_dur[2];
319 /* FCS */ 334 u_int8_t i_ra[IEEE80211_ADDR_LEN];
335 /* FCS */
320} GNUNET_PACKED; 336} GNUNET_PACKED;
321 337
322struct ieee80211_frame_pspoll { 338struct ieee80211_frame_pspoll
323 u_int8_t i_fc[2]; 339{
324 u_int8_t i_aid[2]; 340 u_int8_t i_fc[2];
325 u_int8_t i_bssid[IEEE80211_ADDR_LEN]; 341 u_int8_t i_aid[2];
326 u_int8_t i_ta[IEEE80211_ADDR_LEN]; 342 u_int8_t i_bssid[IEEE80211_ADDR_LEN];
327 /* FCS */ 343 u_int8_t i_ta[IEEE80211_ADDR_LEN];
344 /* FCS */
328} GNUNET_PACKED; 345} GNUNET_PACKED;
329 346
330struct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */ 347struct ieee80211_frame_cfend
331 u_int8_t i_fc[2]; 348{ /* NB: also CF-End+CF-Ack */
332 u_int8_t i_dur[2]; /* should be zero */ 349 u_int8_t i_fc[2];
333 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 350 u_int8_t i_dur[2]; /* should be zero */
334 u_int8_t i_bssid[IEEE80211_ADDR_LEN]; 351 u_int8_t i_ra[IEEE80211_ADDR_LEN];
335 /* FCS */ 352 u_int8_t i_bssid[IEEE80211_ADDR_LEN];
353 /* FCS */
336} GNUNET_PACKED; 354} GNUNET_PACKED;
337 355
338/* 356/*
@@ -372,63 +390,68 @@ typedef u_int8_t *ieee80211_mgt_beacon_t;
372/* 390/*
373 * 802.11i/WPA information element (maximally sized). 391 * 802.11i/WPA information element (maximally sized).
374 */ 392 */
375struct ieee80211_ie_wpa { 393struct ieee80211_ie_wpa
376 u_int8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */ 394{
377 u_int8_t wpa_len; /* length in bytes */ 395 u_int8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */
378 u_int8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */ 396 u_int8_t wpa_len; /* length in bytes */
379 u_int8_t wpa_type; /* OUI type */ 397 u_int8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */
380 u_int16_t wpa_version; /* spec revision */ 398 u_int8_t wpa_type; /* OUI type */
381 u_int32_t wpa_mcipher[1]; /* multicast/group key cipher */ 399 u_int16_t wpa_version; /* spec revision */
382 u_int16_t wpa_uciphercnt; /* # pairwise key ciphers */ 400 u_int32_t wpa_mcipher[1]; /* multicast/group key cipher */
383 u_int32_t wpa_uciphers[8];/* ciphers */ 401 u_int16_t wpa_uciphercnt; /* # pairwise key ciphers */
384 u_int16_t wpa_authselcnt; /* authentication selector cnt*/ 402 u_int32_t wpa_uciphers[8]; /* ciphers */
385 u_int32_t wpa_authsels[8];/* selectors */ 403 u_int16_t wpa_authselcnt; /* authentication selector cnt */
386 u_int16_t wpa_caps; /* 802.11i capabilities */ 404 u_int32_t wpa_authsels[8]; /* selectors */
387 u_int16_t wpa_pmkidcnt; /* 802.11i pmkid count */ 405 u_int16_t wpa_caps; /* 802.11i capabilities */
388 u_int16_t wpa_pmkids[8]; /* 802.11i pmkids */ 406 u_int16_t wpa_pmkidcnt; /* 802.11i pmkid count */
407 u_int16_t wpa_pmkids[8]; /* 802.11i pmkids */
389} GNUNET_PACKED; 408} GNUNET_PACKED;
390 409
391/* 410/*
392 * Management information element payloads. 411 * Management information element payloads.
393 */ 412 */
394 413
395enum { 414enum
396 IEEE80211_ELEMID_SSID = 0, 415{
397 IEEE80211_ELEMID_RATES = 1, 416 IEEE80211_ELEMID_SSID = 0,
398 IEEE80211_ELEMID_FHPARMS = 2, 417 IEEE80211_ELEMID_RATES = 1,
399 IEEE80211_ELEMID_DSPARMS = 3, 418 IEEE80211_ELEMID_FHPARMS = 2,
400 IEEE80211_ELEMID_CFPARMS = 4, 419 IEEE80211_ELEMID_DSPARMS = 3,
401 IEEE80211_ELEMID_TIM = 5, 420 IEEE80211_ELEMID_CFPARMS = 4,
402 IEEE80211_ELEMID_IBSSPARMS = 6, 421 IEEE80211_ELEMID_TIM = 5,
403 IEEE80211_ELEMID_COUNTRY = 7, 422 IEEE80211_ELEMID_IBSSPARMS = 6,
404 IEEE80211_ELEMID_CHALLENGE = 16, 423 IEEE80211_ELEMID_COUNTRY = 7,
405 /* 17-31 reserved for challenge text extension */ 424 IEEE80211_ELEMID_CHALLENGE = 16,
406 IEEE80211_ELEMID_ERP = 42, 425 /* 17-31 reserved for challenge text extension */
407 IEEE80211_ELEMID_RSN = 48, 426 IEEE80211_ELEMID_ERP = 42,
408 IEEE80211_ELEMID_XRATES = 50, 427 IEEE80211_ELEMID_RSN = 48,
409 IEEE80211_ELEMID_TPC = 150, 428 IEEE80211_ELEMID_XRATES = 50,
410 IEEE80211_ELEMID_CCKM = 156, 429 IEEE80211_ELEMID_TPC = 150,
411 IEEE80211_ELEMID_VENDOR = 221, /* vendor private */ 430 IEEE80211_ELEMID_CCKM = 156,
431 IEEE80211_ELEMID_VENDOR = 221, /* vendor private */
412}; 432};
413 433
414struct ieee80211_tim_ie { 434struct ieee80211_tim_ie
415 u_int8_t tim_ie; /* IEEE80211_ELEMID_TIM */ 435{
416 u_int8_t tim_len; 436 u_int8_t tim_ie; /* IEEE80211_ELEMID_TIM */
417 u_int8_t tim_count; /* DTIM count */ 437 u_int8_t tim_len;
418 u_int8_t tim_period; /* DTIM period */ 438 u_int8_t tim_count; /* DTIM count */
419 u_int8_t tim_bitctl; /* bitmap control */ 439 u_int8_t tim_period; /* DTIM period */
420 u_int8_t tim_bitmap[1]; /* variable-length bitmap */ 440 u_int8_t tim_bitctl; /* bitmap control */
441 u_int8_t tim_bitmap[1]; /* variable-length bitmap */
421} GNUNET_PACKED; 442} GNUNET_PACKED;
422 443
423struct ieee80211_country_ie { 444struct ieee80211_country_ie
424 u_int8_t ie; /* IEEE80211_ELEMID_COUNTRY */ 445{
425 u_int8_t len; 446 u_int8_t ie; /* IEEE80211_ELEMID_COUNTRY */
426 u_int8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */ 447 u_int8_t len;
427 struct { 448 u_int8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */
428 u_int8_t schan; /* starting channel */ 449 struct
429 u_int8_t nchan; /* number channels */ 450 {
430 u_int8_t maxtxpwr; /* tx power cap */ 451 u_int8_t schan; /* starting channel */
431 } GNUNET_PACKED band[4]; /* up to 4 sub bands */ 452 u_int8_t nchan; /* number channels */
453 u_int8_t maxtxpwr; /* tx power cap */
454 } GNUNET_PACKED band[4]; /* up to 4 sub bands */
432} GNUNET_PACKED; 455} GNUNET_PACKED;
433 456
434#define IEEE80211_CHALLENGE_LEN 128 457#define IEEE80211_CHALLENGE_LEN 128
@@ -448,13 +471,13 @@ struct ieee80211_country_ie {
448/* bits 3-6 reserved */ 471/* bits 3-6 reserved */
449#define ATHEROS_CAP_BOOST 0x80 472#define ATHEROS_CAP_BOOST 0x80
450 473
451#define ATH_OUI 0x7f0300 /* Atheros OUI */ 474#define ATH_OUI 0x7f0300 /* Atheros OUI */
452#define ATH_OUI_TYPE 0x01 475#define ATH_OUI_TYPE 0x01
453#define ATH_OUI_VERSION 0x01 476#define ATH_OUI_VERSION 0x01
454 477
455#define WPA_OUI 0xf25000 478#define WPA_OUI 0xf25000
456#define WPA_OUI_TYPE 0x01 479#define WPA_OUI_TYPE 0x01
457#define WPA_VERSION 1 /* current supported version */ 480#define WPA_VERSION 1 /* current supported version */
458 481
459#define WPA_CSE_NULL 0x00 482#define WPA_CSE_NULL 0x00
460#define WPA_CSE_WEP40 0x01 483#define WPA_CSE_WEP40 0x01
@@ -467,7 +490,7 @@ struct ieee80211_country_ie {
467#define WPA_ASE_8021X_PSK 0x02 490#define WPA_ASE_8021X_PSK 0x02
468 491
469#define RSN_OUI 0xac0f00 492#define RSN_OUI 0xac0f00
470#define RSN_VERSION 1 /* current supported version */ 493#define RSN_VERSION 1 /* current supported version */
471 494
472#define RSN_CSE_NULL 0x00 495#define RSN_CSE_NULL 0x00
473#define RSN_CSE_WEP40 0x01 496#define RSN_CSE_WEP40 0x01
@@ -489,10 +512,10 @@ struct ieee80211_country_ie {
489#define WME_VERSION 1 512#define WME_VERSION 1
490 513
491/* WME stream classes */ 514/* WME stream classes */
492#define WME_AC_BE 0 /* best effort */ 515#define WME_AC_BE 0 /* best effort */
493#define WME_AC_BK 1 /* background */ 516#define WME_AC_BK 1 /* background */
494#define WME_AC_VI 2 /* video */ 517#define WME_AC_VI 2 /* video */
495#define WME_AC_VO 3 /* voice */ 518#define WME_AC_VO 3 /* voice */
496 519
497/* 520/*
498 * AUTH management packets 521 * AUTH management packets
@@ -518,16 +541,18 @@ typedef u_int8_t *ieee80211_mgt_auth_t;
518#define IEEE80211_AUTH_ALG_SHARED 0x0001 541#define IEEE80211_AUTH_ALG_SHARED 0x0001
519#define IEEE80211_AUTH_ALG_LEAP 0x0080 542#define IEEE80211_AUTH_ALG_LEAP 0x0080
520 543
521enum { 544enum
522 IEEE80211_AUTH_OPEN_REQUEST = 1, 545{
523 IEEE80211_AUTH_OPEN_RESPONSE = 2, 546 IEEE80211_AUTH_OPEN_REQUEST = 1,
547 IEEE80211_AUTH_OPEN_RESPONSE = 2,
524}; 548};
525 549
526enum { 550enum
527 IEEE80211_AUTH_SHARED_REQUEST = 1, 551{
528 IEEE80211_AUTH_SHARED_CHALLENGE = 2, 552 IEEE80211_AUTH_SHARED_REQUEST = 1,
529 IEEE80211_AUTH_SHARED_RESPONSE = 3, 553 IEEE80211_AUTH_SHARED_CHALLENGE = 2,
530 IEEE80211_AUTH_SHARED_PASS = 4, 554 IEEE80211_AUTH_SHARED_RESPONSE = 3,
555 IEEE80211_AUTH_SHARED_PASS = 4,
531}; 556};
532 557
533/* 558/*
@@ -536,47 +561,48 @@ enum {
536 * Unlisted codes are reserved 561 * Unlisted codes are reserved
537 */ 562 */
538 563
539enum { 564enum
540 IEEE80211_REASON_UNSPECIFIED = 1, 565{
541 IEEE80211_REASON_AUTH_EXPIRE = 2, 566 IEEE80211_REASON_UNSPECIFIED = 1,
542 IEEE80211_REASON_AUTH_LEAVE = 3, 567 IEEE80211_REASON_AUTH_EXPIRE = 2,
543 IEEE80211_REASON_ASSOC_EXPIRE = 4, 568 IEEE80211_REASON_AUTH_LEAVE = 3,
544 IEEE80211_REASON_ASSOC_TOOMANY = 5, 569 IEEE80211_REASON_ASSOC_EXPIRE = 4,
545 IEEE80211_REASON_NOT_AUTHED = 6, 570 IEEE80211_REASON_ASSOC_TOOMANY = 5,
546 IEEE80211_REASON_NOT_ASSOCED = 7, 571 IEEE80211_REASON_NOT_AUTHED = 6,
547 IEEE80211_REASON_ASSOC_LEAVE = 8, 572 IEEE80211_REASON_NOT_ASSOCED = 7,
548 IEEE80211_REASON_ASSOC_NOT_AUTHED = 9, 573 IEEE80211_REASON_ASSOC_LEAVE = 8,
549 574 IEEE80211_REASON_ASSOC_NOT_AUTHED = 9,
550 IEEE80211_REASON_RSN_REQUIRED = 11, 575
551 IEEE80211_REASON_RSN_INCONSISTENT = 12, 576 IEEE80211_REASON_RSN_REQUIRED = 11,
552 IEEE80211_REASON_IE_INVALID = 13, 577 IEEE80211_REASON_RSN_INCONSISTENT = 12,
553 IEEE80211_REASON_MIC_FAILURE = 14, 578 IEEE80211_REASON_IE_INVALID = 13,
554 579 IEEE80211_REASON_MIC_FAILURE = 14,
555 IEEE80211_STATUS_SUCCESS = 0, 580
556 IEEE80211_STATUS_UNSPECIFIED = 1, 581 IEEE80211_STATUS_SUCCESS = 0,
557 IEEE80211_STATUS_CAPINFO = 10, 582 IEEE80211_STATUS_UNSPECIFIED = 1,
558 IEEE80211_STATUS_NOT_ASSOCED = 11, 583 IEEE80211_STATUS_CAPINFO = 10,
559 IEEE80211_STATUS_OTHER = 12, 584 IEEE80211_STATUS_NOT_ASSOCED = 11,
560 IEEE80211_STATUS_ALG = 13, 585 IEEE80211_STATUS_OTHER = 12,
561 IEEE80211_STATUS_SEQUENCE = 14, 586 IEEE80211_STATUS_ALG = 13,
562 IEEE80211_STATUS_CHALLENGE = 15, 587 IEEE80211_STATUS_SEQUENCE = 14,
563 IEEE80211_STATUS_TIMEOUT = 16, 588 IEEE80211_STATUS_CHALLENGE = 15,
564 IEEE80211_STATUS_TOOMANY = 17, 589 IEEE80211_STATUS_TIMEOUT = 16,
565 IEEE80211_STATUS_BASIC_RATE = 18, 590 IEEE80211_STATUS_TOOMANY = 17,
566 IEEE80211_STATUS_SP_REQUIRED = 19, 591 IEEE80211_STATUS_BASIC_RATE = 18,
567 IEEE80211_STATUS_PBCC_REQUIRED = 20, 592 IEEE80211_STATUS_SP_REQUIRED = 19,
568 IEEE80211_STATUS_CA_REQUIRED = 21, 593 IEEE80211_STATUS_PBCC_REQUIRED = 20,
569 IEEE80211_STATUS_TOO_MANY_STATIONS = 22, 594 IEEE80211_STATUS_CA_REQUIRED = 21,
570 IEEE80211_STATUS_RATES = 23, 595 IEEE80211_STATUS_TOO_MANY_STATIONS = 22,
571 IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25, 596 IEEE80211_STATUS_RATES = 23,
572 IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26, 597 IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25,
598 IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26,
573}; 599};
574 600
575#define IEEE80211_WEP_KEYLEN 5 /* 40bit */ 601#define IEEE80211_WEP_KEYLEN 5 /* 40bit */
576#define IEEE80211_WEP_IVLEN 3 /* 24bit */ 602#define IEEE80211_WEP_IVLEN 3 /* 24bit */
577#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ 603#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */
578#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ 604#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */
579#define IEEE80211_WEP_NKID 4 /* number of key ids */ 605#define IEEE80211_WEP_NKID 4 /* number of key ids */
580 606
581/* 607/*
582 * 802.11i defines an extended IV for use with non-WEP ciphers. 608 * 802.11i defines an extended IV for use with non-WEP ciphers.
@@ -586,8 +612,8 @@ enum {
586 * CCMP header rather than IV+extended-IV. 612 * CCMP header rather than IV+extended-IV.
587 */ 613 */
588#define IEEE80211_WEP_EXTIV 0x20 614#define IEEE80211_WEP_EXTIV 0x20
589#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */ 615#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */
590#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */ 616#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */
591 617
592#define IEEE80211_CRC_LEN 4 618#define IEEE80211_CRC_LEN 4
593 619
@@ -641,16 +667,16 @@ enum {
641 * As above, we treat default as implementation-dependent so 667 * As above, we treat default as implementation-dependent so
642 * define it elsewhere. 668 * define it elsewhere.
643 */ 669 */
644#define IEEE80211_BINTVAL_MAX 1000 /* max beacon interval (TU's) */ 670#define IEEE80211_BINTVAL_MAX 1000 /* max beacon interval (TU's) */
645#define IEEE80211_BINTVAL_MIN 25 /* min beacon interval (TU's) */ 671#define IEEE80211_BINTVAL_MIN 25 /* min beacon interval (TU's) */
646 672
647/* 673/*
648 * DTIM period (beacons). Min+max are not really defined 674 * DTIM period (beacons). Min+max are not really defined
649 * by the protocol but we want them publicly visible so 675 * by the protocol but we want them publicly visible so
650 * define them here. 676 * define them here.
651 */ 677 */
652#define IEEE80211_DTIM_MAX 15 /* max DTIM period */ 678#define IEEE80211_DTIM_MAX 15 /* max DTIM period */
653#define IEEE80211_DTIM_MIN 1 /* min DTIM period */ 679#define IEEE80211_DTIM_MIN 1 /* min DTIM period */
654 680
655/* 681/*
656 * Beacon miss threshold (beacons). As for DTIM, we define 682 * Beacon miss threshold (beacons). As for DTIM, we define
diff --git a/src/transport/wlan/ieee80211_radiotap.h b/src/transport/wlan/ieee80211_radiotap.h
index b132d402d..f3afbecce 100644
--- a/src/transport/wlan/ieee80211_radiotap.h
+++ b/src/transport/wlan/ieee80211_radiotap.h
@@ -66,25 +66,26 @@
66/* The radio capture header precedes the 802.11 header. 66/* The radio capture header precedes the 802.11 header.
67 * All data in the header is little endian on all platforms. 67 * All data in the header is little endian on all platforms.
68 */ 68 */
69struct ieee80211_radiotap_header { 69struct ieee80211_radiotap_header
70 u8 it_version; /* Version 0. Only increases 70{
71 * for drastic changes, 71 u8 it_version; /* Version 0. Only increases
72 * introduction of compatible 72 * for drastic changes,
73 * new fields does not count. 73 * introduction of compatible
74 */ 74 * new fields does not count.
75 u8 it_pad; 75 */
76 u16 it_len; /* length of the whole 76 u8 it_pad;
77 * header in bytes, including 77 u16 it_len; /* length of the whole
78 * it_version, it_pad, 78 * header in bytes, including
79 * it_len, and data fields. 79 * it_version, it_pad,
80 */ 80 * it_len, and data fields.
81 u32 it_present; /* A bitmap telling which 81 */
82 * fields are present. Set bit 31 82 u32 it_present; /* A bitmap telling which
83 * (0x80000000) to extend the 83 * fields are present. Set bit 31
84 * bitmap by another 32 bits. 84 * (0x80000000) to extend the
85 * Additional extensions are made 85 * bitmap by another 32 bits.
86 * by setting bit 31. 86 * Additional extensions are made
87 */ 87 * by setting bit 31.
88 */
88}; 89};
89 90
90#define IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK 0x80000000 91#define IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK 0x80000000
@@ -186,68 +187,69 @@ struct ieee80211_radiotap_header {
186 * Number of unicast retries a transmitted frame used. 187 * Number of unicast retries a transmitted frame used.
187 * 188 *
188 */ 189 */
189enum ieee80211_radiotap_type { 190enum ieee80211_radiotap_type
190 IEEE80211_RADIOTAP_TSFT = 0, 191{
191 IEEE80211_RADIOTAP_FLAGS = 1, 192 IEEE80211_RADIOTAP_TSFT = 0,
192 IEEE80211_RADIOTAP_RATE = 2, 193 IEEE80211_RADIOTAP_FLAGS = 1,
193 IEEE80211_RADIOTAP_CHANNEL = 3, 194 IEEE80211_RADIOTAP_RATE = 2,
194 IEEE80211_RADIOTAP_FHSS = 4, 195 IEEE80211_RADIOTAP_CHANNEL = 3,
195 IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, 196 IEEE80211_RADIOTAP_FHSS = 4,
196 IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, 197 IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
197 IEEE80211_RADIOTAP_LOCK_QUALITY = 7, 198 IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
198 IEEE80211_RADIOTAP_TX_ATTENUATION = 8, 199 IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
199 IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, 200 IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
200 IEEE80211_RADIOTAP_DBM_TX_POWER = 10, 201 IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
201 IEEE80211_RADIOTAP_ANTENNA = 11, 202 IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
202 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, 203 IEEE80211_RADIOTAP_ANTENNA = 11,
203 IEEE80211_RADIOTAP_DB_ANTNOISE = 13, 204 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
204 IEEE80211_RADIOTAP_RX_FLAGS = 14, 205 IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
205 IEEE80211_RADIOTAP_TX_FLAGS = 15, 206 IEEE80211_RADIOTAP_RX_FLAGS = 14,
206 IEEE80211_RADIOTAP_RTS_RETRIES = 16, 207 IEEE80211_RADIOTAP_TX_FLAGS = 15,
207 IEEE80211_RADIOTAP_DATA_RETRIES = 17, 208 IEEE80211_RADIOTAP_RTS_RETRIES = 16,
208 IEEE80211_RADIOTAP_EXT = 31 209 IEEE80211_RADIOTAP_DATA_RETRIES = 17,
210 IEEE80211_RADIOTAP_EXT = 31
209}; 211};
210 212
211/* Channel flags. */ 213/* Channel flags. */
212#define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ 214#define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */
213#define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ 215#define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */
214#define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ 216#define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */
215#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ 217#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */
216#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ 218#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */
217#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ 219#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */
218#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ 220#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */
219#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ 221#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */
220 222
221/* For IEEE80211_RADIOTAP_FLAGS */ 223/* For IEEE80211_RADIOTAP_FLAGS */
222#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received 224#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received
223 * during CFP 225 * during CFP
224 */ 226 */
225#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received 227#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received
226 * with short 228 * with short
227 * preamble 229 * preamble
228 */ 230 */
229#define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received 231#define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received
230 * with WEP encryption 232 * with WEP encryption
231 */ 233 */
232#define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received 234#define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received
233 * with fragmentation 235 * with fragmentation
234 */ 236 */
235#define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */ 237#define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */
236#define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between 238#define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between
237 * 802.11 header and payload 239 * 802.11 header and payload
238 * (to 32-bit boundary) 240 * (to 32-bit boundary)
239 */ 241 */
240/* For IEEE80211_RADIOTAP_RX_FLAGS */ 242/* For IEEE80211_RADIOTAP_RX_FLAGS */
241#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /* frame failed crc check */ 243#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /* frame failed crc check */
242 244
243/* For IEEE80211_RADIOTAP_TX_FLAGS */ 245/* For IEEE80211_RADIOTAP_TX_FLAGS */
244#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive 246#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive
245 * retries */ 247 * retries */
246#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */ 248#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */
247#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */ 249#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */
248#define IEEE80211_RADIOTAP_F_TX_NOACK 0x0008 /* frame should not be ACKed */ 250#define IEEE80211_RADIOTAP_F_TX_NOACK 0x0008 /* frame should not be ACKed */
249#define IEEE80211_RADIOTAP_F_TX_NOSEQ 0x0010 /* sequence number handled 251#define IEEE80211_RADIOTAP_F_TX_NOSEQ 0x0010 /* sequence number handled
250 * by userspace */ 252 * by userspace */
251 253
252/* Ugly macro to convert literal channel numbers into their mhz equivalents 254/* Ugly macro to convert literal channel numbers into their mhz equivalents
253 * There are certianly some conditions that will break this (like feeding it '30') 255 * There are certianly some conditions that will break this (like feeding it '30')
@@ -257,4 +259,4 @@ enum ieee80211_radiotap_type {
257 (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \ 259 (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \
258 ((x) + 1000) * 5) 260 ((x) + 1000) * 5)
259 261
260#endif /* IEEE80211_RADIOTAP_H */ 262#endif /* IEEE80211_RADIOTAP_H */
diff --git a/src/transport/wlan/loopback_helper.h b/src/transport/wlan/loopback_helper.h
index 7c9fd5d07..d6afb1129 100644
--- a/src/transport/wlan/loopback_helper.h
+++ b/src/transport/wlan/loopback_helper.h
@@ -14,7 +14,6 @@
14 14
15//static void file_in_send(void *cls, void *client, const struct GNUNET_MessageHeader *hdr); 15//static void file_in_send(void *cls, void *client, const struct GNUNET_MessageHeader *hdr);
16 16
17int 17int testmode (int argc, char *argv[]);
18testmode(int argc, char *argv[]);
19 18
20#endif /* LOOPBACK_HELPER_H_ */ 19#endif /* LOOPBACK_HELPER_H_ */
diff --git a/src/transport/wlan/radiotap-parser.c b/src/transport/wlan/radiotap-parser.c
index 46ea6d542..51dfd7107 100644
--- a/src/transport/wlan/radiotap-parser.c
+++ b/src/transport/wlan/radiotap-parser.c
@@ -38,67 +38,69 @@
38 */ 38 */
39 39
40 40
41int ieee80211_radiotap_iterator_init( 41int
42 struct ieee80211_radiotap_iterator * iterator, 42ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator *iterator,
43 struct ieee80211_radiotap_header * radiotap_header, 43 struct ieee80211_radiotap_header
44 int max_length) 44 *radiotap_header, int max_length)
45{ 45{
46 if(iterator == NULL) 46 if (iterator == NULL)
47 return (-EINVAL); 47 return (-EINVAL);
48 48
49 if(radiotap_header == NULL) 49 if (radiotap_header == NULL)
50 return (-EINVAL); 50 return (-EINVAL);
51 /* Linux only supports version 0 radiotap format */ 51 /* Linux only supports version 0 radiotap format */
52 52
53 if (radiotap_header->it_version) 53 if (radiotap_header->it_version)
54 return (-EINVAL); 54 return (-EINVAL);
55 55
56 /* sanity check for allowed length and radiotap length field */ 56 /* sanity check for allowed length and radiotap length field */
57 57
58 if (max_length < (le16_to_cpu(radiotap_header->it_len))) 58 if (max_length < (le16_to_cpu (radiotap_header->it_len)))
59 return (-EINVAL); 59 return (-EINVAL);
60 60
61 iterator->rtheader = radiotap_header; 61 iterator->rtheader = radiotap_header;
62 iterator->max_length = le16_to_cpu(radiotap_header->it_len); 62 iterator->max_length = le16_to_cpu (radiotap_header->it_len);
63 iterator->arg_index = 0; 63 iterator->arg_index = 0;
64 iterator->bitmap_shifter = le32_to_cpu(radiotap_header->it_present); 64 iterator->bitmap_shifter = le32_to_cpu (radiotap_header->it_present);
65 iterator->arg = ((u8 *)radiotap_header) + 65 iterator->arg = ((u8 *) radiotap_header) +
66 sizeof (struct ieee80211_radiotap_header); 66 sizeof (struct ieee80211_radiotap_header);
67 iterator->this_arg = 0; 67 iterator->this_arg = 0;
68 68
69 /* find payload start allowing for extended bitmap(s) */ 69 /* find payload start allowing for extended bitmap(s) */
70 70
71 if (unlikely(iterator->bitmap_shifter & 71 if (unlikely (iterator->bitmap_shifter &
72 IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK)) { 72 IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK))
73 while (le32_to_cpu(*((u32 *)iterator->arg)) & 73 {
74 IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK) { 74 while (le32_to_cpu (*((u32 *) iterator->arg)) &
75 iterator->arg += sizeof (u32); 75 IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK)
76 {
77 iterator->arg += sizeof (u32);
76 78
77 /* 79 /*
78 * check for insanity where the present bitmaps 80 * check for insanity where the present bitmaps
79 * keep claiming to extend up to or even beyond the 81 * keep claiming to extend up to or even beyond the
80 * stated radiotap header length 82 * stated radiotap header length
81 */ 83 */
82 84
83 if ((((void*)iterator->arg) - ((void*)iterator->rtheader)) > 85 if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) >
84 iterator->max_length) 86 iterator->max_length)
85 return (-EINVAL); 87 return (-EINVAL);
86 88
87 } 89 }
88 90
89 iterator->arg += sizeof (u32); 91 iterator->arg += sizeof (u32);
90 92
91 /* 93 /*
92 * no need to check again for blowing past stated radiotap 94 * no need to check again for blowing past stated radiotap
93 * header length, becuase ieee80211_radiotap_iterator_next 95 * header length, becuase ieee80211_radiotap_iterator_next
94 * checks it before it is dereferenced 96 * checks it before it is dereferenced
95 */ 97 */
96 98
97 } 99 }
98 100
99 /* we are all initialized happily */ 101 /* we are all initialized happily */
100 102
101 return (0); 103 return (0);
102} 104}
103 105
104 106
@@ -115,137 +117,143 @@ int ieee80211_radiotap_iterator_init(
115 * format. 117 * format.
116 */ 118 */
117 119
118int ieee80211_radiotap_iterator_next( 120int
119 struct ieee80211_radiotap_iterator * iterator) 121ieee80211_radiotap_iterator_next (struct ieee80211_radiotap_iterator *iterator)
120{ 122{
121 123
122 /* 124 /*
123 * small length lookup table for all radiotap types we heard of 125 * small length lookup table for all radiotap types we heard of
124 * starting from b0 in the bitmap, so we can walk the payload 126 * starting from b0 in the bitmap, so we can walk the payload
125 * area of the radiotap header 127 * area of the radiotap header
126 * 128 *
127 * There is a requirement to pad args, so that args 129 * There is a requirement to pad args, so that args
128 * of a given length must begin at a boundary of that length 130 * of a given length must begin at a boundary of that length
129 * -- but note that compound args are allowed (eg, 2 x u16 131 * -- but note that compound args are allowed (eg, 2 x u16
130 * for IEEE80211_RADIOTAP_CHANNEL) so total arg length is not 132 * for IEEE80211_RADIOTAP_CHANNEL) so total arg length is not
131 * a reliable indicator of alignment requirement. 133 * a reliable indicator of alignment requirement.
132 * 134 *
133 * upper nybble: content alignment for arg 135 * upper nybble: content alignment for arg
134 * lower nybble: content length for arg 136 * lower nybble: content length for arg
135 */ 137 */
136 138
137 static const u8 rt_sizes[] = { 139 static const u8 rt_sizes[] = {
138 [IEEE80211_RADIOTAP_TSFT] = 0x88, 140 [IEEE80211_RADIOTAP_TSFT] = 0x88,
139 [IEEE80211_RADIOTAP_FLAGS] = 0x11, 141 [IEEE80211_RADIOTAP_FLAGS] = 0x11,
140 [IEEE80211_RADIOTAP_RATE] = 0x11, 142 [IEEE80211_RADIOTAP_RATE] = 0x11,
141 [IEEE80211_RADIOTAP_CHANNEL] = 0x24, 143 [IEEE80211_RADIOTAP_CHANNEL] = 0x24,
142 [IEEE80211_RADIOTAP_FHSS] = 0x22, 144 [IEEE80211_RADIOTAP_FHSS] = 0x22,
143 [IEEE80211_RADIOTAP_DBM_ANTSIGNAL] = 0x11, 145 [IEEE80211_RADIOTAP_DBM_ANTSIGNAL] = 0x11,
144 [IEEE80211_RADIOTAP_DBM_ANTNOISE] = 0x11, 146 [IEEE80211_RADIOTAP_DBM_ANTNOISE] = 0x11,
145 [IEEE80211_RADIOTAP_LOCK_QUALITY] = 0x22, 147 [IEEE80211_RADIOTAP_LOCK_QUALITY] = 0x22,
146 [IEEE80211_RADIOTAP_TX_ATTENUATION] = 0x22, 148 [IEEE80211_RADIOTAP_TX_ATTENUATION] = 0x22,
147 [IEEE80211_RADIOTAP_DB_TX_ATTENUATION] = 0x22, 149 [IEEE80211_RADIOTAP_DB_TX_ATTENUATION] = 0x22,
148 [IEEE80211_RADIOTAP_DBM_TX_POWER] = 0x11, 150 [IEEE80211_RADIOTAP_DBM_TX_POWER] = 0x11,
149 [IEEE80211_RADIOTAP_ANTENNA] = 0x11, 151 [IEEE80211_RADIOTAP_ANTENNA] = 0x11,
150 [IEEE80211_RADIOTAP_DB_ANTSIGNAL] = 0x11, 152 [IEEE80211_RADIOTAP_DB_ANTSIGNAL] = 0x11,
151 [IEEE80211_RADIOTAP_DB_ANTNOISE] = 0x11, 153 [IEEE80211_RADIOTAP_DB_ANTNOISE] = 0x11,
152 [IEEE80211_RADIOTAP_TX_FLAGS] = 0x22, 154 [IEEE80211_RADIOTAP_TX_FLAGS] = 0x22,
153 [IEEE80211_RADIOTAP_RX_FLAGS] = 0x22, 155 [IEEE80211_RADIOTAP_RX_FLAGS] = 0x22,
154 [IEEE80211_RADIOTAP_RTS_RETRIES] = 0x11, 156 [IEEE80211_RADIOTAP_RTS_RETRIES] = 0x11,
155 [IEEE80211_RADIOTAP_DATA_RETRIES] = 0x11 157 [IEEE80211_RADIOTAP_DATA_RETRIES] = 0x11
156 /* 158 /*
157 * add more here as they are defined in 159 * add more here as they are defined in
158 * include/net/ieee80211_radiotap.h 160 * include/net/ieee80211_radiotap.h
159 */ 161 */
160 }; 162 };
161 163
162 /* 164 /*
163 * for every radiotap entry we can at 165 * for every radiotap entry we can at
164 * least skip (by knowing the length)... 166 * least skip (by knowing the length)...
165 */ 167 */
166 168
167 while (iterator->arg_index < (int)sizeof (rt_sizes)) { 169 while (iterator->arg_index < (int) sizeof (rt_sizes))
168 int hit = 0; 170 {
169 171 int hit = 0;
170 if (!(iterator->bitmap_shifter & 1)) 172
171 goto next_entry; /* arg not present */ 173 if (!(iterator->bitmap_shifter & 1))
172 174 goto next_entry; /* arg not present */
173 /* 175
174 * arg is present, account for alignment padding 176 /*
175 * 8-bit args can be at any alignment 177 * arg is present, account for alignment padding
176 * 16-bit args must start on 16-bit boundary 178 * 8-bit args can be at any alignment
177 * 32-bit args must start on 32-bit boundary 179 * 16-bit args must start on 16-bit boundary
178 * 64-bit args must start on 64-bit boundary 180 * 32-bit args must start on 32-bit boundary
179 * 181 * 64-bit args must start on 64-bit boundary
180 * note that total arg size can differ from alignment of 182 *
181 * elements inside arg, so we use upper nybble of length 183 * note that total arg size can differ from alignment of
182 * table to base alignment on 184 * elements inside arg, so we use upper nybble of length
183 * 185 * table to base alignment on
184 * also note: these alignments are ** relative to the 186 *
185 * start of the radiotap header **. There is no guarantee 187 * also note: these alignments are ** relative to the
186 * that the radiotap header itself is aligned on any 188 * start of the radiotap header **. There is no guarantee
187 * kind of boundary. 189 * that the radiotap header itself is aligned on any
188 */ 190 * kind of boundary.
189 191 */
190 if ((((void*)iterator->arg)-((void*)iterator->rtheader)) & 192
191 ((rt_sizes[iterator->arg_index] >> 4) - 1)) 193 if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) &
192 iterator->arg_index += 194 ((rt_sizes[iterator->arg_index] >> 4) - 1))
193 (rt_sizes[iterator->arg_index] >> 4) - 195 iterator->arg_index +=
194 ((((void*)iterator->arg) - 196 (rt_sizes[iterator->arg_index] >> 4) -
195 ((void*)iterator->rtheader)) & 197 ((((void *) iterator->arg) -
196 ((rt_sizes[iterator->arg_index] >> 4) - 1)); 198 ((void *) iterator->rtheader)) &
197 199 ((rt_sizes[iterator->arg_index] >> 4) - 1));
198 /* 200
199 * this is what we will return to user, but we need to 201 /*
200 * move on first so next call has something fresh to test 202 * this is what we will return to user, but we need to
201 */ 203 * move on first so next call has something fresh to test
202 204 */
203 iterator->this_arg_index = iterator->arg_index; 205
204 iterator->this_arg = iterator->arg; 206 iterator->this_arg_index = iterator->arg_index;
205 hit = 1; 207 iterator->this_arg = iterator->arg;
206 208 hit = 1;
207 /* internally move on the size of this arg */ 209
208 210 /* internally move on the size of this arg */
209 iterator->arg += rt_sizes[iterator->arg_index] & 0x0f; 211
210 212 iterator->arg += rt_sizes[iterator->arg_index] & 0x0f;
211 /* 213
212 * check for insanity where we are given a bitmap that 214 /*
213 * claims to have more arg content than the length of the 215 * check for insanity where we are given a bitmap that
214 * radiotap section. We will normally end up equalling this 216 * claims to have more arg content than the length of the
215 * max_length on the last arg, never exceeding it. 217 * radiotap section. We will normally end up equalling this
216 */ 218 * max_length on the last arg, never exceeding it.
217 219 */
218 if ((((void*)iterator->arg) - ((void*)iterator->rtheader)) > 220
219 iterator->max_length) 221 if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) >
220 return (-EINVAL); 222 iterator->max_length)
221 223 return (-EINVAL);
222 next_entry: 224
223 225next_entry:
224 iterator->arg_index++; 226
225 if (unlikely((iterator->arg_index & 31) == 0)) { 227 iterator->arg_index++;
226 /* completed current u32 bitmap */ 228 if (unlikely ((iterator->arg_index & 31) == 0))
227 if (iterator->bitmap_shifter & 1) { 229 {
228 /* b31 was set, there is more */ 230 /* completed current u32 bitmap */
229 /* move to next u32 bitmap */ 231 if (iterator->bitmap_shifter & 1)
230 iterator->bitmap_shifter = le32_to_cpu( 232 {
231 *iterator->next_bitmap); 233 /* b31 was set, there is more */
232 iterator->next_bitmap++; 234 /* move to next u32 bitmap */
233 } else { 235 iterator->bitmap_shifter = le32_to_cpu (*iterator->next_bitmap);
234 /* no more bitmaps: end */ 236 iterator->next_bitmap++;
235 iterator->arg_index = sizeof (rt_sizes); 237 }
236 } 238 else
237 } else { /* just try the next bit */ 239 {
238 iterator->bitmap_shifter >>= 1; 240 /* no more bitmaps: end */
239 } 241 iterator->arg_index = sizeof (rt_sizes);
240 242 }
241 /* if we found a valid arg earlier, return it now */ 243 }
242 244 else
243 if (hit) 245 { /* just try the next bit */
244 return (iterator->this_arg_index); 246 iterator->bitmap_shifter >>= 1;
245 247 }
246 } 248
247 249 /* if we found a valid arg earlier, return it now */
248 /* we don't know how to handle any more args, we're done */ 250
249 251 if (hit)
250 return (-1); 252 return (iterator->this_arg_index);
253
254 }
255
256 /* we don't know how to handle any more args, we're done */
257
258 return (-1);
251} 259}
diff --git a/src/transport/wlan/radiotap-parser.h b/src/transport/wlan/radiotap-parser.h
index b36037369..fb6d8e2af 100644
--- a/src/transport/wlan/radiotap-parser.h
+++ b/src/transport/wlan/radiotap-parser.h
@@ -57,22 +57,23 @@ typedef uint8_t u8;
57 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 57 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
58 */ 58 */
59 59
60struct ieee80211_radiotap_iterator { 60struct ieee80211_radiotap_iterator
61 struct ieee80211_radiotap_header *rtheader; 61{
62 int max_length; 62 struct ieee80211_radiotap_header *rtheader;
63 int this_arg_index; 63 int max_length;
64 u8 * this_arg; 64 int this_arg_index;
65 u8 *this_arg;
65 66
66 int arg_index; 67 int arg_index;
67 u8 * arg; 68 u8 *arg;
68 u32 *next_bitmap; 69 u32 *next_bitmap;
69 u32 bitmap_shifter; 70 u32 bitmap_shifter;
70}; 71};
71 72
72int ieee80211_radiotap_iterator_init( 73int ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator
73 struct ieee80211_radiotap_iterator * iterator, 74 *iterator,
74 struct ieee80211_radiotap_header * radiotap_header, 75 struct ieee80211_radiotap_header
75 int max_length); 76 *radiotap_header, int max_length);
76 77
77int ieee80211_radiotap_iterator_next( 78int ieee80211_radiotap_iterator_next (struct ieee80211_radiotap_iterator
78 struct ieee80211_radiotap_iterator * iterator); 79 *iterator);