~ubuntu-branches/debian/sid/aircrack-ng/sid

« back to all changes in this revision

Viewing changes to .pc/003-fix-ftbfs-590765.diff/src/osdep/byteorder.h

  • Committer: Package Import Robot
  • Author(s): Carlos Alberto Lopez Perez
  • Date: 2014-05-30 19:21:38 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20140530192138-0k5gmmyf1e4p7ihd
Tags: 1:1.2-0~beta3-1
* New upstream release.
  * Remove all Debian patches that are now merged upstream.
* Apply: "wrap-and-sort -sa"
* Build with PCRE: Add support for regular expression matching for ESSID
  in airodump-ng.
* Build with libgcrypt20 by default, but allow to use libgcrypt11 otherwise.
* Fix libnl detection (Debian patches 002-fix-libnl-detection.diff and
  003-dont-abort-libnl-nolinux.diff).
* Add build dependency on libnl-genl-3-dev.
* Remove airdriver-ng (LP: #499513) (Closes: #449299).
* Not longer recommend wget, because we don't ship airdriver-ng neither
  airoump-ng-oui-update.
* Recommend the Debian package ieee-data that contains the OUI data.
  Add Debian patch 001-Airodump_whitespace_oui.diff to correctly parse it.
  Not longer ship airodump-ng-oui-update (Use update-oui instead).
  (Closes: #739199)
* Switch to debhelper 9 and enable all hardening flags (PIE works now).
* Update debian/watch and debian/copyright.
* Upgrade to new standards version.

Show diffs side-by-side

added added

removed removed

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