aboutsummaryrefslogtreecommitdiff
path: root/src/transport/wlan/byteorder.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/wlan/byteorder.h')
-rw-r--r--src/transport/wlan/byteorder.h798
1 files changed, 399 insertions, 399 deletions
diff --git a/src/transport/wlan/byteorder.h b/src/transport/wlan/byteorder.h
index b09328320..9fc58c8d8 100644
--- a/src/transport/wlan/byteorder.h
+++ b/src/transport/wlan/byteorder.h
@@ -1,37 +1,37 @@
1/* 1/*
2 * Compatibility header 2 * Compatibility header
3 * 3 *
4 * Copyright (C) 2009 Thomas d'Otreppe 4 * Copyright (C) 2009 Thomas d'Otreppe
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version. 9 * (at your option) any later version.
10 * 10 *
11 * This program is distributed in the hope that it will be useful, 11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 * 15 *
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) 36 (\ (u_int64_t)
37 (((u_int64_t) (x) & (u_int64_t) 0x00000000000000ffULL) << 56) | 37 (((u_int64_t) (x) & (u_int64_t) 0x00000000000000ffULL) << 56) |
@@ -44,389 +44,389 @@
44 0x0000ff0000000000ULL) >> 24) | 44 0x0000ff0000000000ULL) >> 24) |
45 \ (u_int64_t) (((u_int64_t) (x) & (u_int64_t) 0x00ff000000000000ULL) >> 45 \ (u_int64_t) (((u_int64_t) (x) & (u_int64_t) 0x00ff000000000000ULL) >>
46 40) | \ (u_int64_t) (((u_int64_t) (x) & (u_int64_t) 46 40) | \ (u_int64_t) (((u_int64_t) (x) & (u_int64_t)
47 0xff00000000000000ULL) >> 56))) 47 0xff00000000000000ULL) >> 56)))
48 /* 48 /*
49 * Linux 49 * Linux
50 */ 50 */
51#if defined(linux) || defined(Linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux__) 51#if defined(linux) || defined(Linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux__)
52#include <endian.h> 52#include <endian.h>
53#include <unistd.h> 53#include <unistd.h>
54#include <stdint.h> 54#include <stdint.h>
55 55
56#ifndef __int8_t_defined 56#ifndef __int8_t_defined
57typedef uint64_t u_int64_t; 57typedef uint64_t u_int64_t;
58 typedef uint32_t u_int32_t; 58 typedef uint32_t u_int32_t;
59 typedef uint16_t u_int16_t; 59 typedef uint16_t u_int16_t;
60 typedef uint8_t u_int8_t; 60 typedef uint8_t u_int8_t;
61 61
62 62
63#endif /* */ 63#endif /* */
64 64
65#ifndef htole16 65#ifndef htole16
66#if __BYTE_ORDER == __LITTLE_ENDIAN 66#if __BYTE_ORDER == __LITTLE_ENDIAN
67#define htobe16(x) ___my_swab16 (x) 67#define htobe16(x) ___my_swab16 (x)
68#define htole16(x) (x) 68#define htole16(x) (x)
69#define be16toh(x) ___my_swab16 (x) 69#define be16toh(x) ___my_swab16 (x)
70#define le16toh(x) (x) 70#define le16toh(x) (x)
71 71
72#define htobe32(x) ___my_swab32 (x) 72#define htobe32(x) ___my_swab32 (x)
73#define htole32(x) (x) 73#define htole32(x) (x)
74#define be32toh(x) ___my_swab32 (x) 74#define be32toh(x) ___my_swab32 (x)
75#define le32toh(x) (x) 75#define le32toh(x) (x)
76 76
77#define htobe64(x) ___my_swab64 (x) 77#define htobe64(x) ___my_swab64 (x)
78#define htole64(x) (x) 78#define htole64(x) (x)
79#define be64toh(x) ___my_swab64 (x) 79#define be64toh(x) ___my_swab64 (x)
80#define le64toh(x) (x) 80#define le64toh(x) (x)
81#else /* */ 81#else /* */
82#define htobe16(x) (x) 82#define htobe16(x) (x)
83#define htole16(x) ___my_swab16 (x) 83#define htole16(x) ___my_swab16 (x)
84#define be16toh(x) (x) 84#define be16toh(x) (x)
85#define le16toh(x) ___my_swab16 (x) 85#define le16toh(x) ___my_swab16 (x)
86 86
87#define htobe32(x) (x) 87#define htobe32(x) (x)
88#define htole32(x) ___my_swab32 (x) 88#define htole32(x) ___my_swab32 (x)
89#define be32toh(x) (x) 89#define be32toh(x) (x)
90#define le32toh(x) ___my_swab32 (x) 90#define le32toh(x) ___my_swab32 (x)
91 91
92#define htobe64(x) (x) 92#define htobe64(x) (x)
93#define htole64(x) ___my_swab64 (x) 93#define htole64(x) ___my_swab64 (x)
94#define be64toh(x) (x) 94#define be64toh(x) (x)
95#define le64toh(x) ___my_swab64 (x) 95#define le64toh(x) ___my_swab64 (x)
96#endif /* */ 96#endif /* */
97#endif /* */ 97#endif /* */
98 98
99#endif /* */ 99#endif /* */
100 100
101 /* 101 /*
102 * Cygwin 102 * Cygwin
103 */ 103 */
104#if defined(__CYGWIN32__) 104#if defined(__CYGWIN32__)
105#include <asm/byteorder.h> 105#include <asm/byteorder.h>
106#include <unistd.h> 106#include <unistd.h>
107 107
108#define __be64_to_cpu(x) ___my_swab64(x) 108#define __be64_to_cpu(x) ___my_swab64(x)
109#define __be32_to_cpu(x) ___my_swab32(x) 109#define __be32_to_cpu(x) ___my_swab32(x)
110#define __be16_to_cpu(x) ___my_swab16(x) 110#define __be16_to_cpu(x) ___my_swab16(x)
111#define __cpu_to_be64(x) ___my_swab64(x) 111#define __cpu_to_be64(x) ___my_swab64(x)
112#define __cpu_to_be32(x) ___my_swab32(x) 112#define __cpu_to_be32(x) ___my_swab32(x)
113#define __cpu_to_be16(x) ___my_swab16(x) 113#define __cpu_to_be16(x) ___my_swab16(x)
114#define __le64_to_cpu(x) (x) 114#define __le64_to_cpu(x) (x)
115#define __le32_to_cpu(x) (x) 115#define __le32_to_cpu(x) (x)
116#define __le16_to_cpu(x) (x) 116#define __le16_to_cpu(x) (x)
117#define __cpu_to_le64(x) (x) 117#define __cpu_to_le64(x) (x)
118#define __cpu_to_le32(x) (x) 118#define __cpu_to_le32(x) (x)
119#define __cpu_to_le16(x) (x) 119#define __cpu_to_le16(x) (x)
120 120
121#define AIRCRACK_NG_BYTE_ORDER_DEFINED 121#define AIRCRACK_NG_BYTE_ORDER_DEFINED
122 122
123#endif /* */ 123#endif /* */
124 124
125 /* 125 /*
126 * Windows (DDK) 126 * Windows (DDK)
127 */ 127 */
128#if defined(__WIN__) 128#if defined(__WIN__)
129 129
130#include <io.h> 130#include <io.h>
131 131
132#define __be64_to_cpu(x) ___my_swab64(x) 132#define __be64_to_cpu(x) ___my_swab64(x)
133#define __be32_to_cpu(x) ___my_swab32(x) 133#define __be32_to_cpu(x) ___my_swab32(x)
134#define __be16_to_cpu(x) ___my_swab16(x) 134#define __be16_to_cpu(x) ___my_swab16(x)
135#define __cpu_to_be64(x) ___my_swab64(x) 135#define __cpu_to_be64(x) ___my_swab64(x)
136#define __cpu_to_be32(x) ___my_swab32(x) 136#define __cpu_to_be32(x) ___my_swab32(x)
137#define __cpu_to_be16(x) ___my_swab16(x) 137#define __cpu_to_be16(x) ___my_swab16(x)
138#define __le64_to_cpu(x) (x) 138#define __le64_to_cpu(x) (x)
139#define __le32_to_cpu(x) (x) 139#define __le32_to_cpu(x) (x)
140#define __le16_to_cpu(x) (x) 140#define __le16_to_cpu(x) (x)
141#define __cpu_to_le64(x) (x) 141#define __cpu_to_le64(x) (x)
142#define __cpu_to_le32(x) (x) 142#define __cpu_to_le32(x) (x)
143#define __cpu_to_le16(x) (x) 143#define __cpu_to_le16(x) (x)
144 144
145#define AIRCRACK_NG_BYTE_ORDER_DEFINED 145#define AIRCRACK_NG_BYTE_ORDER_DEFINED
146 146
147#endif /* */ 147#endif /* */
148 148
149 /* 149 /*
150 * MAC (Darwin) 150 * MAC (Darwin)
151 */ 151 */
152#if defined(__APPLE_CC__) 152#if defined(__APPLE_CC__)
153#if defined(__x86_64__) && defined(__APPLE__) 153#if defined(__x86_64__) && defined(__APPLE__)
154 154
155#include <libkern/OSByteOrder.h> 155#include <libkern/OSByteOrder.h>
156 156
157#define __swab64(x) (unsigned long long) OSSwapInt64((uint64_t)x) 157#define __swab64(x) (unsigned long long) OSSwapInt64((uint64_t)x)
158#define __swab32(x) (unsigned long) OSSwapInt32((uint32_t)x) 158#define __swab32(x) (unsigned long) OSSwapInt32((uint32_t)x)
159#define __swab16(x) (unsigned short) OSSwapInt16((uint16_t)x) 159#define __swab16(x) (unsigned short) OSSwapInt16((uint16_t)x)
160#define __be64_to_cpu(x) (unsigned long long) OSSwapBigToHostInt64((uint64_t)x) 160#define __be64_to_cpu(x) (unsigned long long) OSSwapBigToHostInt64((uint64_t)x)
161#define __be32_to_cpu(x) (unsigned long) OSSwapBigToHostInt32((uint32_t)x) 161#define __be32_to_cpu(x) (unsigned long) OSSwapBigToHostInt32((uint32_t)x)
162#define __be16_to_cpu(x) (unsigned short) OSSwapBigToHostInt16((uint16_t)x) 162#define __be16_to_cpu(x) (unsigned short) OSSwapBigToHostInt16((uint16_t)x)
163#define __le64_to_cpu(x) (unsigned long long) OSSwapLittleToHostInt64((uint64_t)x) 163#define __le64_to_cpu(x) (unsigned long long) OSSwapLittleToHostInt64((uint64_t)x)
164#define __le32_to_cpu(x) (unsigned long) OSSwapLittleToHostInt32((uint32_t)x) 164#define __le32_to_cpu(x) (unsigned long) OSSwapLittleToHostInt32((uint32_t)x)
165#define __le16_to_cpu(x) (unsigned short) OSSwapLittleToHostInt16((uint16_t)x) 165#define __le16_to_cpu(x) (unsigned short) OSSwapLittleToHostInt16((uint16_t)x)
166#define __cpu_to_be64(x) (unsigned long long) OSSwapHostToBigInt64((uint64_t)x) 166#define __cpu_to_be64(x) (unsigned long long) OSSwapHostToBigInt64((uint64_t)x)
167#define __cpu_to_be32(x) (unsigned long) OSSwapHostToBigInt32((uint32_t)x) 167#define __cpu_to_be32(x) (unsigned long) OSSwapHostToBigInt32((uint32_t)x)
168#define __cpu_to_be16(x) (unsigned short) OSSwapHostToBigInt16((uint16_t)x) 168#define __cpu_to_be16(x) (unsigned short) OSSwapHostToBigInt16((uint16_t)x)
169#define __cpu_to_le64(x) (unsigned long long) OSSwapHostToLittleInt64((uint64_t)x) 169#define __cpu_to_le64(x) (unsigned long long) OSSwapHostToLittleInt64((uint64_t)x)
170#define __cpu_to_le32(x) (unsigned long) OSSwapHostToLittleInt32((uint32_t)x) 170#define __cpu_to_le32(x) (unsigned long) OSSwapHostToLittleInt32((uint32_t)x)
171#define __cpu_to_le16(x) (unsigned short) OSSwapHostToLittleInt16((uint16_t)x) 171#define __cpu_to_le16(x) (unsigned short) OSSwapHostToLittleInt16((uint16_t)x)
172 172
173#else /* */ 173#else /* */
174 174
175#include <architecture/byte_order.h> 175#include <architecture/byte_order.h>
176 176
177#define __swab64(x) NXSwapLongLong(x) 177#define __swab64(x) NXSwapLongLong(x)
178#define __swab32(x) NXSwapLong(x) 178#define __swab32(x) NXSwapLong(x)
179#define __swab16(x) NXSwapShort(x) 179#define __swab16(x) NXSwapShort(x)
180#define __be64_to_cpu(x) NXSwapBigLongLongToHost(x) 180#define __be64_to_cpu(x) NXSwapBigLongLongToHost(x)
181#define __be32_to_cpu(x) NXSwapBigLongToHost(x) 181#define __be32_to_cpu(x) NXSwapBigLongToHost(x)
182#define __be16_to_cpu(x) NXSwapBigShortToHost(x) 182#define __be16_to_cpu(x) NXSwapBigShortToHost(x)
183#define __le64_to_cpu(x) NXSwapLittleLongLongToHost(x) 183#define __le64_to_cpu(x) NXSwapLittleLongLongToHost(x)
184#define __le32_to_cpu(x) NXSwapLittleLongToHost(x) 184#define __le32_to_cpu(x) NXSwapLittleLongToHost(x)
185#define __le16_to_cpu(x) NXSwapLittleShortToHost(x) 185#define __le16_to_cpu(x) NXSwapLittleShortToHost(x)
186#define __cpu_to_be64(x) NXSwapHostLongLongToBig(x) 186#define __cpu_to_be64(x) NXSwapHostLongLongToBig(x)
187#define __cpu_to_be32(x) NXSwapHostLongToBig(x) 187#define __cpu_to_be32(x) NXSwapHostLongToBig(x)
188#define __cpu_to_be16(x) NXSwapHostShortToBig(x) 188#define __cpu_to_be16(x) NXSwapHostShortToBig(x)
189#define __cpu_to_le64(x) NXSwapHostLongLongToLittle(x) 189#define __cpu_to_le64(x) NXSwapHostLongLongToLittle(x)
190#define __cpu_to_le32(x) NXSwapHostLongToLittle(x) 190#define __cpu_to_le32(x) NXSwapHostLongToLittle(x)
191#define __cpu_to_le16(x) NXSwapHostShortToLittle(x) 191#define __cpu_to_le16(x) NXSwapHostShortToLittle(x)
192 192
193#endif /* */ 193#endif /* */
194 194
195#define __LITTLE_ENDIAN 1234 195#define __LITTLE_ENDIAN 1234
196#define __BIG_ENDIAN 4321 196#define __BIG_ENDIAN 4321
197#define __PDP_ENDIAN 3412 197#define __PDP_ENDIAN 3412
198#define __BYTE_ORDER __BIG_ENDIAN 198#define __BYTE_ORDER __BIG_ENDIAN
199 199
200#define AIRCRACK_NG_BYTE_ORDER_DEFINED 200#define AIRCRACK_NG_BYTE_ORDER_DEFINED
201 201
202#endif /* */ 202#endif /* */
203 203
204 /* 204 /*
205 * Solaris 205 * Solaris
206 * ------- 206 * -------
207 */ 207 */
208#if defined(__sparc__) && defined(__sun__) 208#if defined(__sparc__) && defined(__sun__)
209#include <sys/byteorder.h> 209#include <sys/byteorder.h>
210#include <sys/types.h> 210#include <sys/types.h>
211#include <unistd.h> 211#include <unistd.h>
212 212
213#define __be64_to_cpu(x) (x) 213#define __be64_to_cpu(x) (x)
214#define __be32_to_cpu(x) (x) 214#define __be32_to_cpu(x) (x)
215#define __be16_to_cpu(x) (x) 215#define __be16_to_cpu(x) (x)
216#define __cpu_to_be64(x) (x) 216#define __cpu_to_be64(x) (x)
217#define __cpu_to_be32(x) (x) 217#define __cpu_to_be32(x) (x)
218#define __cpu_to_be16(x) (x) 218#define __cpu_to_be16(x) (x)
219#define __le64_to_cpu(x) ___my_swab64(x) 219#define __le64_to_cpu(x) ___my_swab64(x)
220#define __le32_to_cpu(x) ___my_swab32(x) 220#define __le32_to_cpu(x) ___my_swab32(x)
221#define __le16_to_cpu(x) ___my_swab16(x) 221#define __le16_to_cpu(x) ___my_swab16(x)
222#define __cpu_to_le64(x) ___my_swab64(x) 222#define __cpu_to_le64(x) ___my_swab64(x)
223#define __cpu_to_le32(x) ___my_swab32(x) 223#define __cpu_to_le32(x) ___my_swab32(x)
224#define __cpu_to_le16(x) ___my_swab16(x) 224#define __cpu_to_le16(x) ___my_swab16(x)
225 typedef uint64_t u_int64_t; 225 typedef uint64_t u_int64_t;
226 typedef uint32_t u_int32_t; 226 typedef uint32_t u_int32_t;
227 typedef uint16_t u_int16_t; 227 typedef uint16_t u_int16_t;
228 typedef uint8_t u_int8_t; 228 typedef uint8_t u_int8_t;
229 229
230 230
231#define AIRCRACK_NG_BYTE_ORDER_DEFINED 231#define AIRCRACK_NG_BYTE_ORDER_DEFINED
232 232
233#endif /* */ 233#endif /* */
234 234
235 /* 235 /*
236 * Custom stuff 236 * Custom stuff
237 */ 237 */
238#if defined(__MACH__) && !defined(__APPLE_CC__) 238#if defined(__MACH__) && !defined(__APPLE_CC__)
239#include <libkern/OSByteOrder.h> 239#include <libkern/OSByteOrder.h>
240#define __cpu_to_be64(x) = OSSwapHostToBigInt64(x) 240#define __cpu_to_be64(x) = OSSwapHostToBigInt64(x)
241#define __cpu_to_be32(x) = OSSwapHostToBigInt32(x) 241#define __cpu_to_be32(x) = OSSwapHostToBigInt32(x)
242 242
243#define AIRCRACK_NG_BYTE_ORDER_DEFINED 243#define AIRCRACK_NG_BYTE_ORDER_DEFINED
244 244
245#endif /* */ 245#endif /* */
246 246
247 // FreeBSD 247 // FreeBSD
248#ifdef __FreeBSD__ 248#ifdef __FreeBSD__
249#include <machine/endian.h> 249#include <machine/endian.h>
250#endif /* */ 250#endif /* */
251 251
252 // XXX: Is there anything to include on OpenBSD/NetBSD/DragonFlyBSD/...? 252 // XXX: Is there anything to include on OpenBSD/NetBSD/DragonFlyBSD/...?
253 253
254 // XXX: Mac: Check http://www.opensource.apple.com/source/CF/CF-476.18/CFByteOrder.h 254 // XXX: Mac: Check http://www.opensource.apple.com/source/CF/CF-476.18/CFByteOrder.h
255 // http://developer.apple.com/DOCUMENTATION/CoreFoundation/Reference/CFByteOrderUtils/Reference/reference.html 255 // http://developer.apple.com/DOCUMENTATION/CoreFoundation/Reference/CFByteOrderUtils/Reference/reference.html
256 // Write to apple to ask what should be used. 256 // Write to apple to ask what should be used.
257 257
258#if defined(LITTLE_ENDIAN) 258#if defined(LITTLE_ENDIAN)
259#define AIRCRACK_NG_LITTLE_ENDIAN LITTLE_ENDIAN 259#define AIRCRACK_NG_LITTLE_ENDIAN LITTLE_ENDIAN
260#elif defined(__LITTLE_ENDIAN) 260#elif defined(__LITTLE_ENDIAN)
261#define AIRCRACK_NG_LITTLE_ENDIAN __LITTLE_ENDIAN 261#define AIRCRACK_NG_LITTLE_ENDIAN __LITTLE_ENDIAN
262#elif defined(_LITTLE_ENDIAN) 262#elif defined(_LITTLE_ENDIAN)
263#define AIRCRACK_NG_LITTLE_ENDIAN _LITTLE_ENDIAN 263#define AIRCRACK_NG_LITTLE_ENDIAN _LITTLE_ENDIAN
264#endif /* */ 264#endif /* */
265 265
266#if defined(BIG_ENDIAN) 266#if defined(BIG_ENDIAN)
267#define AIRCRACK_NG_BIG_ENDIAN BIG_ENDIAN 267#define AIRCRACK_NG_BIG_ENDIAN BIG_ENDIAN
268#elif defined(__BIG_ENDIAN) 268#elif defined(__BIG_ENDIAN)
269#define AIRCRACK_NG_BIG_ENDIAN __BIG_ENDIAN 269#define AIRCRACK_NG_BIG_ENDIAN __BIG_ENDIAN
270#elif defined(_BIG_ENDIAN) 270#elif defined(_BIG_ENDIAN)
271#define AIRCRACK_NG_BIG_ENDIAN _BIG_ENDIAN 271#define AIRCRACK_NG_BIG_ENDIAN _BIG_ENDIAN
272#endif /* */ 272#endif /* */
273 273
274#if !defined(AIRCRACK_NG_LITTLE_ENDIAN) && !defined(AIRCRACK_NG_BIG_ENDIAN) 274#if !defined(AIRCRACK_NG_LITTLE_ENDIAN) && !defined(AIRCRACK_NG_BIG_ENDIAN)
275#error Impossible to determine endianness (Little or Big endian), please contact the author. 275#error Impossible to determine endianness (Little or Big endian), please contact the author.
276#endif /* */ 276#endif /* */
277 277
278#if defined(BYTE_ORDER) 278#if defined(BYTE_ORDER)
279#if (BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN) 279#if (BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN)
280#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN 280#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN
281#elif (BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN) 281#elif (BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN)
282#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN 282#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN
283#endif /* */ 283#endif /* */
284#elif defined(__BYTE_ORDER) 284#elif defined(__BYTE_ORDER)
285#if (__BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN) 285#if (__BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN)
286#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN 286#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN
287#elif (__BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN) 287#elif (__BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN)
288#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN 288#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN
289#endif /* */ 289#endif /* */
290#elif defined(_BYTE_ORDER) 290#elif defined(_BYTE_ORDER)
291#if (_BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN) 291#if (_BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN)
292#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN 292#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN
293#elif (_BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN) 293#elif (_BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN)
294#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN 294#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN
295#endif /* */ 295#endif /* */
296#endif /* */ 296#endif /* */
297 297
298#ifndef AIRCRACK_NG_BYTE_ORDER 298#ifndef AIRCRACK_NG_BYTE_ORDER
299#error Impossible to determine endianness (Little or Big endian), please contact the author. 299#error Impossible to determine endianness (Little or Big endian), please contact the author.
300#endif /* */ 300#endif /* */
301 301
302#if (AIRCRACK_NG_BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN) 302#if (AIRCRACK_NG_BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN)
303 303
304#ifndef AIRCRACK_NG_BYTE_ORDER_DEFINED 304#ifndef AIRCRACK_NG_BYTE_ORDER_DEFINED
305#define __be64_to_cpu(x) ___my_swab64(x) 305#define __be64_to_cpu(x) ___my_swab64(x)
306#define __be32_to_cpu(x) ___my_swab32(x) 306#define __be32_to_cpu(x) ___my_swab32(x)
307#define __be16_to_cpu(x) ___my_swab16(x) 307#define __be16_to_cpu(x) ___my_swab16(x)
308#define __cpu_to_be64(x) ___my_swab64(x) 308#define __cpu_to_be64(x) ___my_swab64(x)
309#define __cpu_to_be32(x) ___my_swab32(x) 309#define __cpu_to_be32(x) ___my_swab32(x)
310#define __cpu_to_be16(x) ___my_swab16(x) 310#define __cpu_to_be16(x) ___my_swab16(x)
311#define __le64_to_cpu(x) (x) 311#define __le64_to_cpu(x) (x)
312#define __le32_to_cpu(x) (x) 312#define __le32_to_cpu(x) (x)
313#define __le16_to_cpu(x) (x) 313#define __le16_to_cpu(x) (x)
314#define __cpu_to_le64(x) (x) 314#define __cpu_to_le64(x) (x)
315#define __cpu_to_le32(x) (x) 315#define __cpu_to_le32(x) (x)
316#define __cpu_to_le16(x) (x) 316#define __cpu_to_le16(x) (x)
317#endif /* */ 317#endif /* */
318 318
319#ifndef htobe16 319#ifndef htobe16
320#define htobe16 ___my_swab16 320#define htobe16 ___my_swab16
321#endif /* */ 321#endif /* */
322#ifndef htobe32 322#ifndef htobe32
323#define htobe32 ___my_swab32 323#define htobe32 ___my_swab32
324#endif /* */ 324#endif /* */
325#ifndef betoh16 325#ifndef betoh16
326#define betoh16 ___my_swab16 326#define betoh16 ___my_swab16
327#endif /* */ 327#endif /* */
328#ifndef betoh32 328#ifndef betoh32
329#define betoh32 ___my_swab32 329#define betoh32 ___my_swab32
330#endif /* */ 330#endif /* */
331 331
332#ifndef htole16 332#ifndef htole16
333#define htole16(x) (x) 333#define htole16(x) (x)
334#endif /* */ 334#endif /* */
335#ifndef htole32 335#ifndef htole32
336#define htole32(x) (x) 336#define htole32(x) (x)
337#endif /* */ 337#endif /* */
338#ifndef letoh16 338#ifndef letoh16
339#define letoh16(x) (x) 339#define letoh16(x) (x)
340#endif /* */ 340#endif /* */
341#ifndef letoh32 341#ifndef letoh32
342#define letoh32(x) (x) 342#define letoh32(x) (x)
343#endif /* */ 343#endif /* */
344 344
345#endif /* */ 345#endif /* */
346 346
347#if (AIRCRACK_NG_BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN) 347#if (AIRCRACK_NG_BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN)
348 348
349#ifndef AIRCRACK_NG_BYTE_ORDER_DEFINED 349#ifndef AIRCRACK_NG_BYTE_ORDER_DEFINED
350#define __be64_to_cpu(x) (x) 350#define __be64_to_cpu(x) (x)
351#define __be32_to_cpu(x) (x) 351#define __be32_to_cpu(x) (x)
352#define __be16_to_cpu(x) (x) 352#define __be16_to_cpu(x) (x)
353#define __cpu_to_be64(x) (x) 353#define __cpu_to_be64(x) (x)
354#define __cpu_to_be32(x) (x) 354#define __cpu_to_be32(x) (x)
355#define __cpu_to_be16(x) (x) 355#define __cpu_to_be16(x) (x)
356#define __le64_to_cpu(x) ___my_swab64(x) 356#define __le64_to_cpu(x) ___my_swab64(x)
357#define __le32_to_cpu(x) ___my_swab32(x) 357#define __le32_to_cpu(x) ___my_swab32(x)
358#define __le16_to_cpu(x) ___my_swab16(x) 358#define __le16_to_cpu(x) ___my_swab16(x)
359#define __cpu_to_le64(x) ___my_swab64(x) 359#define __cpu_to_le64(x) ___my_swab64(x)
360#define __cpu_to_le32(x) ___my_swab32(x) 360#define __cpu_to_le32(x) ___my_swab32(x)
361#define __cpu_to_le16(x) ___my_swab16(x) 361#define __cpu_to_le16(x) ___my_swab16(x)
362#endif /* */ 362#endif /* */
363 363
364#ifndef htobe16 364#ifndef htobe16
365#define htobe16(x) (x) 365#define htobe16(x) (x)
366#endif /* */ 366#endif /* */
367#ifndef htobe32 367#ifndef htobe32
368#define htobe32(x) (x) 368#define htobe32(x) (x)
369#endif /* */ 369#endif /* */
370#ifndef betoh16 370#ifndef betoh16
371#define betoh16(x) (x) 371#define betoh16(x) (x)
372#endif /* */ 372#endif /* */
373#ifndef betoh32 373#ifndef betoh32
374#define betoh32(x) (x) 374#define betoh32(x) (x)
375#endif /* */ 375#endif /* */
376 376
377#ifndef htole16 377#ifndef htole16
378#define htole16 ___my_swab16 378#define htole16 ___my_swab16
379#endif /* */ 379#endif /* */
380#ifndef htole32 380#ifndef htole32
381#define htole32 ___my_swab32 381#define htole32 ___my_swab32
382#endif /* */ 382#endif /* */
383#ifndef letoh16 383#ifndef letoh16
384#define letoh16 ___my_swab16 384#define letoh16 ___my_swab16
385#endif /* */ 385#endif /* */
386#ifndef letoh32 386#ifndef letoh32
387#define letoh32 ___my_swab32 387#define letoh32 ___my_swab32
388#endif /* */ 388#endif /* */
389 389
390#endif /* */ 390#endif /* */
391 391
392 // Common defines 392 // Common defines
393#define cpu_to_le64 __cpu_to_le64 393#define cpu_to_le64 __cpu_to_le64
394#define le64_to_cpu __le64_to_cpu 394#define le64_to_cpu __le64_to_cpu
395#define cpu_to_le32 __cpu_to_le32 395#define cpu_to_le32 __cpu_to_le32
396#define le32_to_cpu __le32_to_cpu 396#define le32_to_cpu __le32_to_cpu
397#define cpu_to_le16 __cpu_to_le16 397#define cpu_to_le16 __cpu_to_le16
398#define le16_to_cpu __le16_to_cpu 398#define le16_to_cpu __le16_to_cpu
399#define cpu_to_be64 __cpu_to_be64 399#define cpu_to_be64 __cpu_to_be64
400#define be64_to_cpu __be64_to_cpu 400#define be64_to_cpu __be64_to_cpu
401#define cpu_to_be32 __cpu_to_be32 401#define cpu_to_be32 __cpu_to_be32
402#define be32_to_cpu __be32_to_cpu 402#define be32_to_cpu __be32_to_cpu
403#define cpu_to_be16 __cpu_to_be16 403#define cpu_to_be16 __cpu_to_be16
404#define be16_to_cpu __be16_to_cpu 404#define be16_to_cpu __be16_to_cpu
405 405
406#ifndef le16toh 406#ifndef le16toh
407#define le16toh le16_to_cpu 407#define le16toh le16_to_cpu
408#endif /* */ 408#endif /* */
409#ifndef be16toh 409#ifndef be16toh
410#define be16toh be16_to_cpu 410#define be16toh be16_to_cpu
411#endif /* */ 411#endif /* */
412#ifndef le32toh 412#ifndef le32toh
413#define le32toh le32_to_cpu 413#define le32toh le32_to_cpu
414#endif /* */ 414#endif /* */
415#ifndef be32toh 415#ifndef be32toh
416#define be32toh be32_to_cpu 416#define be32toh be32_to_cpu
417#endif /* */ 417#endif /* */
418 418
419#ifndef htons 419#ifndef htons
420#define htons be16_to_cpu 420#define htons be16_to_cpu
421#endif /* */ 421#endif /* */
422#ifndef htonl 422#ifndef htonl
423#define htonl cpu_to_be16 423#define htonl cpu_to_be16
424#endif /* */ 424#endif /* */
425#ifndef ntohs 425#ifndef ntohs
426#define ntohs cpu_to_be16 426#define ntohs cpu_to_be16
427#endif /* */ 427#endif /* */
428#ifndef ntohl 428#ifndef ntohl
429#define ntohl cpu_to_be32 429#define ntohl cpu_to_be32
430#endif /* */ 430#endif /* */
431 431
432#endif /* */ 432#endif /* */