indent corrupted the file
authorMatthias Wachs <wachs@net.in.tum.de>
Mon, 22 Aug 2011 09:33:05 +0000 (09:33 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Mon, 22 Aug 2011 09:33:05 +0000 (09:33 +0000)
src/transport/wlan/byteorder.h

index 9fc58c8d882e61c7184cb906ec81f3c861da0c51..798cabf74931ae805e1eecd07d4702edff06233c 100644 (file)
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */  
-    
+ */
+
 #ifndef _AIRCRACK_NG_BYTEORDER_H_
 #define _AIRCRACK_NG_BYTEORDER_H_
-    
+
 #define ___my_swab16(x) \
-    ((u_int16_t)
-     (\\r(((u_int16_t) (x) & (u_int16_t) 0x00ffU) << 8) |
-      \\r(((u_int16_t) (x) & (u_int16_t) 0xff00U) >> 8))) 
+((u_int16_t)( \
+  (((u_int16_t)(x) & (u_int16_t)0x00ffU) << 8) | \
+  (((u_int16_t)(x) & (u_int16_t)0xff00U) >> 8) ))
+
 #define ___my_swab32(x) \
-    ((u_int32_t)
-     (\\r(((u_int32_t) (x) & (u_int32_t) 0x000000ffUL) << 24) |
-      \\r(((u_int32_t) (x) & (u_int32_t) 0x0000ff00UL) << 8) |
-      \\r(((u_int32_t) (x) & (u_int32_t) 0x00ff0000UL) >> 8) |
-      \\r(((u_int32_t) (x) & (u_int32_t) 0xff000000UL) >> 24))) 
+((u_int32_t)( \
+  (((u_int32_t)(x) & (u_int32_t)0x000000ffUL) << 24) | \
+  (((u_int32_t)(x) & (u_int32_t)0x0000ff00UL) <<  8) | \
+  (((u_int32_t)(x) & (u_int32_t)0x00ff0000UL) >>  8) | \
+  (((u_int32_t)(x) & (u_int32_t)0xff000000UL) >> 24) ))
 #define ___my_swab64(x) \
-    ((u_int64_t)
-     (\\r(u_int64_t)
-      (((u_int64_t) (x) & (u_int64_t) 0x00000000000000ffULL) << 56) |
-      \\r(u_int64_t) (((u_int64_t) (x) & (u_int64_t) 0x000000000000ff00ULL) <<
-                     40) | \\r(u_int64_t) (((u_int64_t) (x) & (u_int64_t)
-                                           0x0000000000ff0000ULL) << 24) |
-      \\r(u_int64_t) (((u_int64_t) (x) & (u_int64_t) 0x00000000ff000000ULL) << 8)
-      | \\r(u_int64_t) (((u_int64_t) (x) & (u_int64_t) 0x000000ff00000000ULL) >>
-                       8) | \\r(u_int64_t) (((u_int64_t) (x) & (u_int64_t)
-                                            0x0000ff0000000000ULL) >> 24) |
-      \\r(u_int64_t) (((u_int64_t) (x) & (u_int64_t) 0x00ff000000000000ULL) >>
-                     40) | \\r(u_int64_t) (((u_int64_t) (x) & (u_int64_t)
-                                           0xff00000000000000ULL) >> 56))) \r \r 
+((u_int64_t)( \
+  (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0x00000000000000ffULL) << 56) | \
+  (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0x000000000000ff00ULL) << 40) | \
+  (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0x0000000000ff0000ULL) << 24) | \
+  (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0x00000000ff000000ULL) <<  8) | \
+  (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0x000000ff00000000ULL) >>  8) | \
+  (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0x0000ff0000000000ULL) >> 24) | \
+  (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0x00ff000000000000ULL) >> 40) | \
+  (u_int64_t)(((u_int64_t)(x) & (u_int64_t)0xff00000000000000ULL) >> 56) ))
+
     /*
      * Linux
-     */ 
+     */
 #if defined(linux) || defined(Linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux__)
 #include <endian.h>
 #include <unistd.h>
 #include <stdint.h>
-    
+
 #ifndef __int8_t_defined
 typedef uint64_t u_int64_t;
 \rtypedef uint32_t u_int32_t;
@@ -61,19 +59,19 @@ typedef uint64_t u_int64_t;
 
 
 #endif /* \r */
-    
+
 #ifndef htole16
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #define htobe16(x) ___my_swab16 (x)
 #define htole16(x) (x)
 #define be16toh(x) ___my_swab16 (x)
 #define le16toh(x) (x)
-    
+
 #define htobe32(x) ___my_swab32 (x)
 #define htole32(x) (x)
 #define be32toh(x) ___my_swab32 (x)
 #define le32toh(x) (x)
-    
+
 #define htobe64(x) ___my_swab64 (x)
 #define htole64(x) (x)
 #define be64toh(x) ___my_swab64 (x)
@@ -83,28 +81,26 @@ typedef uint64_t u_int64_t;
 #define htole16(x) ___my_swab16 (x)
 #define be16toh(x) (x)
 #define le16toh(x) ___my_swab16 (x)
-    
+
 #define htobe32(x) (x)
 #define htole32(x) ___my_swab32 (x)
 #define be32toh(x) (x)
 #define le32toh(x) ___my_swab32 (x)
-    
+
 #define htobe64(x) (x)
 #define htole64(x) ___my_swab64 (x)
 #define be64toh(x) (x)
 #define le64toh(x) ___my_swab64 (x)
 #endif /* \r */
 #endif /* \r */
-    \r \r 
+
 #endif /* \r */
-    
     /*
      * Cygwin
-     */ 
+     */
 #if defined(__CYGWIN32__)
 #include <asm/byteorder.h>
 #include <unistd.h>
-    
 #define __be64_to_cpu(x) ___my_swab64(x)
 #define __be32_to_cpu(x) ___my_swab32(x)
 #define __be16_to_cpu(x) ___my_swab16(x)
@@ -117,18 +113,13 @@ typedef uint64_t u_int64_t;
 #define __cpu_to_le64(x) (x)
 #define __cpu_to_le32(x) (x)
 #define __cpu_to_le16(x) (x)
-    
 #define AIRCRACK_NG_BYTE_ORDER_DEFINED
-    
 #endif /* \r */
-    
     /*
      * Windows (DDK)
-     */ 
+     */
 #if defined(__WIN__)
-    
 #include <io.h>
-    
 #define __be64_to_cpu(x) ___my_swab64(x)
 #define __be32_to_cpu(x) ___my_swab32(x)
 #define __be16_to_cpu(x) ___my_swab16(x)
@@ -141,19 +132,14 @@ typedef uint64_t u_int64_t;
 #define __cpu_to_le64(x) (x)
 #define __cpu_to_le32(x) (x)
 #define __cpu_to_le16(x) (x)
-    
 #define AIRCRACK_NG_BYTE_ORDER_DEFINED
-    
 #endif /* \r */
-    
     /*
      * MAC (Darwin)
-     */ 
+     */
 #if defined(__APPLE_CC__)
 #if defined(__x86_64__) && defined(__APPLE__)
-    
 #include <libkern/OSByteOrder.h>
-    
 #define __swab64(x)      (unsigned long long) OSSwapInt64((uint64_t)x)
 #define __swab32(x)      (unsigned long) OSSwapInt32((uint32_t)x)
 #define __swab16(x)      (unsigned short) OSSwapInt16((uint16_t)x)
@@ -169,11 +155,8 @@ typedef uint64_t u_int64_t;
 #define __cpu_to_le64(x) (unsigned long long) OSSwapHostToLittleInt64((uint64_t)x)
 #define __cpu_to_le32(x) (unsigned long) OSSwapHostToLittleInt32((uint32_t)x)
 #define __cpu_to_le16(x) (unsigned short) OSSwapHostToLittleInt16((uint16_t)x)
-    
 #else /* \r */
-    
 #include <architecture/byte_order.h>
-    
 #define __swab64(x)      NXSwapLongLong(x)
 #define __swab32(x)      NXSwapLong(x)
 #define __swab16(x)      NXSwapShort(x)
@@ -189,27 +172,21 @@ typedef uint64_t u_int64_t;
 #define __cpu_to_le64(x) NXSwapHostLongLongToLittle(x)
 #define __cpu_to_le32(x) NXSwapHostLongToLittle(x)
 #define __cpu_to_le16(x) NXSwapHostShortToLittle(x)
-    
 #endif /* \r */
-    
 #define __LITTLE_ENDIAN 1234
 #define __BIG_ENDIAN    4321
 #define __PDP_ENDIAN    3412
 #define __BYTE_ORDER    __BIG_ENDIAN
-    
 #define AIRCRACK_NG_BYTE_ORDER_DEFINED
-    
 #endif /* \r */
-    
     /*
      * Solaris
      * -------
-     */ 
+     */
 #if defined(__sparc__) && defined(__sun__)
 #include <sys/byteorder.h>
 #include <sys/types.h>
 #include <unistd.h>
-    
 #define __be64_to_cpu(x) (x)
 #define __be32_to_cpu(x) (x)
 #define __be16_to_cpu(x) (x)
@@ -227,34 +204,28 @@ typedef uint64_t u_int64_t;
 \rtypedef uint16_t u_int16_t;
 \rtypedef uint8_t u_int8_t;
 
-\r 
+
 #define AIRCRACK_NG_BYTE_ORDER_DEFINED
-    
 #endif /* \r */
-    
     /*
      * Custom stuff
-     */ 
+     */
 #if  defined(__MACH__) && !defined(__APPLE_CC__)
 #include <libkern/OSByteOrder.h>
 #define __cpu_to_be64(x) = OSSwapHostToBigInt64(x)
 #define __cpu_to_be32(x) = OSSwapHostToBigInt32(x)
-    
 #define AIRCRACK_NG_BYTE_ORDER_DEFINED
-    
 #endif /* \r */
-    \r 
+
     // FreeBSD
 #ifdef __FreeBSD__
 #include <machine/endian.h>
 #endif /* \r */
-    
     // XXX: Is there anything to include on OpenBSD/NetBSD/DragonFlyBSD/...?
-    \r 
+
     // XXX: Mac: Check http://www.opensource.apple.com/source/CF/CF-476.18/CFByteOrder.h
     //           http://developer.apple.com/DOCUMENTATION/CoreFoundation/Reference/CFByteOrderUtils/Reference/reference.html
     //           Write to apple to ask what should be used.
-    
 #if defined(LITTLE_ENDIAN)
 #define AIRCRACK_NG_LITTLE_ENDIAN LITTLE_ENDIAN
 #elif defined(__LITTLE_ENDIAN)
@@ -262,7 +233,6 @@ typedef uint64_t u_int64_t;
 #elif defined(_LITTLE_ENDIAN)
 #define AIRCRACK_NG_LITTLE_ENDIAN _LITTLE_ENDIAN
 #endif /* \r */
-    
 #if defined(BIG_ENDIAN)
 #define AIRCRACK_NG_BIG_ENDIAN BIG_ENDIAN
 #elif defined(__BIG_ENDIAN)
@@ -270,11 +240,9 @@ typedef uint64_t u_int64_t;
 #elif defined(_BIG_ENDIAN)
 #define AIRCRACK_NG_BIG_ENDIAN _BIG_ENDIAN
 #endif /* \r */
-    
 #if !defined(AIRCRACK_NG_LITTLE_ENDIAN) && !defined(AIRCRACK_NG_BIG_ENDIAN)
 #error Impossible to determine endianness (Little or Big endian), please contact the author.
 #endif /* \r */
-    
 #if defined(BYTE_ORDER)
 #if (BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN)
 #define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN
@@ -294,13 +262,10 @@ typedef uint64_t u_int64_t;
 #define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN
 #endif /* \r */
 #endif /* \r */
-    
 #ifndef AIRCRACK_NG_BYTE_ORDER
 #error Impossible to determine endianness (Little or Big endian), please contact the author.
 #endif /* \r */
-    
 #if (AIRCRACK_NG_BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN)
-    
 #ifndef AIRCRACK_NG_BYTE_ORDER_DEFINED
 #define __be64_to_cpu(x) ___my_swab64(x)
 #define __be32_to_cpu(x) ___my_swab32(x)
@@ -315,7 +280,6 @@ typedef uint64_t u_int64_t;
 #define __cpu_to_le32(x) (x)
 #define __cpu_to_le16(x) (x)
 #endif /* \r */
-    
 #ifndef htobe16
 #define htobe16 ___my_swab16
 #endif /* \r */
@@ -328,7 +292,6 @@ typedef uint64_t u_int64_t;
 #ifndef betoh32
 #define betoh32 ___my_swab32
 #endif /* \r */
-    
 #ifndef htole16
 #define htole16(x) (x)
 #endif /* \r */
@@ -341,11 +304,8 @@ typedef uint64_t u_int64_t;
 #ifndef letoh32
 #define letoh32(x) (x)
 #endif /* \r */
-    
 #endif /* \r */
-    
 #if (AIRCRACK_NG_BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN)
-    
 #ifndef AIRCRACK_NG_BYTE_ORDER_DEFINED
 #define __be64_to_cpu(x) (x)
 #define __be32_to_cpu(x) (x)
@@ -360,7 +320,6 @@ typedef uint64_t u_int64_t;
 #define __cpu_to_le32(x) ___my_swab32(x)
 #define __cpu_to_le16(x) ___my_swab16(x)
 #endif /* \r */
-    
 #ifndef htobe16
 #define htobe16(x) (x)
 #endif /* \r */
@@ -373,7 +332,6 @@ typedef uint64_t u_int64_t;
 #ifndef betoh32
 #define betoh32(x) (x)
 #endif /* \r */
-    
 #ifndef htole16
 #define htole16 ___my_swab16
 #endif /* \r */
@@ -386,9 +344,7 @@ typedef uint64_t u_int64_t;
 #ifndef letoh32
 #define letoh32 ___my_swab32
 #endif /* \r */
-    
 #endif /* \r */
-    
     // Common defines
 #define cpu_to_le64 __cpu_to_le64
 #define le64_to_cpu __le64_to_cpu
@@ -402,7 +358,6 @@ typedef uint64_t u_int64_t;
 #define be32_to_cpu __be32_to_cpu
 #define cpu_to_be16 __cpu_to_be16
 #define be16_to_cpu __be16_to_cpu
-    
 #ifndef le16toh
 #define le16toh le16_to_cpu
 #endif /* \r */
@@ -415,7 +370,7 @@ typedef uint64_t u_int64_t;
 #ifndef be32toh
 #define be32toh be32_to_cpu
 #endif /* \r */
-    \r 
+
 #ifndef htons
 #define htons be16_to_cpu
 #endif /* \r */
@@ -428,5 +383,4 @@ typedef uint64_t u_int64_t;
 #ifndef ntohl
 #define ntohl cpu_to_be32
 #endif /* \r */
-    
 #endif /* \r */