From 87cbb6dba24959428c7a71e1aa125f80584e0249 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 25 Nov 2011 09:19:41 +0000 Subject: [PATCH] removing no longer needed wlan directory --- src/transport/wlan/byteorder.h | 387 ------------- src/transport/wlan/crctable_osdep.h | 71 --- src/transport/wlan/ieee80211.h | 689 ------------------------ src/transport/wlan/ieee80211_radiotap.h | 262 --------- src/transport/wlan/radiotap-parser.c | 260 --------- src/transport/wlan/radiotap-parser.h | 79 --- 6 files changed, 1748 deletions(-) delete mode 100644 src/transport/wlan/byteorder.h delete mode 100644 src/transport/wlan/crctable_osdep.h delete mode 100644 src/transport/wlan/ieee80211.h delete mode 100644 src/transport/wlan/ieee80211_radiotap.h delete mode 100644 src/transport/wlan/radiotap-parser.c delete mode 100644 src/transport/wlan/radiotap-parser.h diff --git a/src/transport/wlan/byteorder.h b/src/transport/wlan/byteorder.h deleted file mode 100644 index 1a13470e9..000000000 --- a/src/transport/wlan/byteorder.h +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Compatibility header - * - * Copyright (C) 2009 Thomas d'Otreppe - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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_ - - /* *INDENT-OFF* */ -#define ___my_swab16(x) \ -((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)( \ - (((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)( \ - (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) )) - /* *INDENT-ON* */ - /* - * Linux - */ -#if defined(linux) || defined(Linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux__) -#include -#include -#include - -#ifndef __int8_t_defined -typedef uint64_t u_int64_t; -typedef uint32_t u_int32_t; -typedef uint16_t u_int16_t; -typedef uint8_t u_int8_t; - - -#endif /* */ - -#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) -#define le64toh(x) (x) -#else /* */ -#define htobe16(x) (x) -#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 /* */ -#endif /* */ - -#endif /* */ - /* - * Cygwin - */ -#if defined(__CYGWIN32__) -#include -#include -#define __be64_to_cpu(x) ___my_swab64(x) -#define __be32_to_cpu(x) ___my_swab32(x) -#define __be16_to_cpu(x) ___my_swab16(x) -#define __cpu_to_be64(x) ___my_swab64(x) -#define __cpu_to_be32(x) ___my_swab32(x) -#define __cpu_to_be16(x) ___my_swab16(x) -#define __le64_to_cpu(x) (x) -#define __le32_to_cpu(x) (x) -#define __le16_to_cpu(x) (x) -#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 /* */ - /* - * Windows (DDK) - */ -#if defined(__WIN__) -#include -#define __be64_to_cpu(x) ___my_swab64(x) -#define __be32_to_cpu(x) ___my_swab32(x) -#define __be16_to_cpu(x) ___my_swab16(x) -#define __cpu_to_be64(x) ___my_swab64(x) -#define __cpu_to_be32(x) ___my_swab32(x) -#define __cpu_to_be16(x) ___my_swab16(x) -#define __le64_to_cpu(x) (x) -#define __le32_to_cpu(x) (x) -#define __le16_to_cpu(x) (x) -#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 /* */ - /* - * MAC (Darwin) - */ -#if defined(__APPLE_CC__) -#if defined(__x86_64__) && defined(__APPLE__) -#include -#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) -#define __be64_to_cpu(x) (unsigned long long) OSSwapBigToHostInt64((uint64_t)x) -#define __be32_to_cpu(x) (unsigned long) OSSwapBigToHostInt32((uint32_t)x) -#define __be16_to_cpu(x) (unsigned short) OSSwapBigToHostInt16((uint16_t)x) -#define __le64_to_cpu(x) (unsigned long long) OSSwapLittleToHostInt64((uint64_t)x) -#define __le32_to_cpu(x) (unsigned long) OSSwapLittleToHostInt32((uint32_t)x) -#define __le16_to_cpu(x) (unsigned short) OSSwapLittleToHostInt16((uint16_t)x) -#define __cpu_to_be64(x) (unsigned long long) OSSwapHostToBigInt64((uint64_t)x) -#define __cpu_to_be32(x) (unsigned long) OSSwapHostToBigInt32((uint32_t)x) -#define __cpu_to_be16(x) (unsigned short) OSSwapHostToBigInt16((uint16_t)x) -#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 /* */ -#include -#define __swab64(x) NXSwapLongLong(x) -#define __swab32(x) NXSwapLong(x) -#define __swab16(x) NXSwapShort(x) -#define __be64_to_cpu(x) NXSwapBigLongLongToHost(x) -#define __be32_to_cpu(x) NXSwapBigLongToHost(x) -#define __be16_to_cpu(x) NXSwapBigShortToHost(x) -#define __le64_to_cpu(x) NXSwapLittleLongLongToHost(x) -#define __le32_to_cpu(x) NXSwapLittleLongToHost(x) -#define __le16_to_cpu(x) NXSwapLittleShortToHost(x) -#define __cpu_to_be64(x) NXSwapHostLongLongToBig(x) -#define __cpu_to_be32(x) NXSwapHostLongToBig(x) -#define __cpu_to_be16(x) NXSwapHostShortToBig(x) -#define __cpu_to_le64(x) NXSwapHostLongLongToLittle(x) -#define __cpu_to_le32(x) NXSwapHostLongToLittle(x) -#define __cpu_to_le16(x) NXSwapHostShortToLittle(x) -#endif /* */ -#define __LITTLE_ENDIAN 1234 -#define __BIG_ENDIAN 4321 -#define __PDP_ENDIAN 3412 -#define __BYTE_ORDER __BIG_ENDIAN -#define AIRCRACK_NG_BYTE_ORDER_DEFINED -#endif /* */ - /* - * Solaris - * ------- - */ -#if defined(__sparc__) && defined(__sun__) -#include -#include -#include -#define __be64_to_cpu(x) (x) -#define __be32_to_cpu(x) (x) -#define __be16_to_cpu(x) (x) -#define __cpu_to_be64(x) (x) -#define __cpu_to_be32(x) (x) -#define __cpu_to_be16(x) (x) -#define __le64_to_cpu(x) ___my_swab64(x) -#define __le32_to_cpu(x) ___my_swab32(x) -#define __le16_to_cpu(x) ___my_swab16(x) -#define __cpu_to_le64(x) ___my_swab64(x) -#define __cpu_to_le32(x) ___my_swab32(x) -#define __cpu_to_le16(x) ___my_swab16(x) -typedef uint64_t u_int64_t; -typedef uint32_t u_int32_t; -typedef uint16_t u_int16_t; -typedef uint8_t u_int8_t; - - -#define AIRCRACK_NG_BYTE_ORDER_DEFINED -#endif /* */ - /* - * Custom stuff - */ -#if defined(__MACH__) && !defined(__APPLE_CC__) -#include -#define __cpu_to_be64(x) = OSSwapHostToBigInt64(x) -#define __cpu_to_be32(x) = OSSwapHostToBigInt32(x) -#define AIRCRACK_NG_BYTE_ORDER_DEFINED -#endif /* */ - - // FreeBSD -#ifdef __FreeBSD__ -#include -#endif /* */ - // XXX: Is there anything to include on OpenBSD/NetBSD/DragonFlyBSD/...? - - // 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) -#define AIRCRACK_NG_LITTLE_ENDIAN __LITTLE_ENDIAN -#elif defined(_LITTLE_ENDIAN) -#define AIRCRACK_NG_LITTLE_ENDIAN _LITTLE_ENDIAN -#endif /* */ -#if defined(BIG_ENDIAN) -#define AIRCRACK_NG_BIG_ENDIAN BIG_ENDIAN -#elif defined(__BIG_ENDIAN) -#define AIRCRACK_NG_BIG_ENDIAN __BIG_ENDIAN -#elif defined(_BIG_ENDIAN) -#define AIRCRACK_NG_BIG_ENDIAN _BIG_ENDIAN -#endif /* */ -#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 /* */ -#if defined(BYTE_ORDER) -#if (BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN) -#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN -#elif (BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN) -#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN -#endif /* */ -#elif defined(__BYTE_ORDER) -#if (__BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN) -#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN -#elif (__BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN) -#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN -#endif /* */ -#elif defined(_BYTE_ORDER) -#if (_BYTE_ORDER == AIRCRACK_NG_LITTLE_ENDIAN) -#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_LITTLE_ENDIAN -#elif (_BYTE_ORDER == AIRCRACK_NG_BIG_ENDIAN) -#define AIRCRACK_NG_BYTE_ORDER AIRCRACK_NG_BIG_ENDIAN -#endif /* */ -#endif /* */ -#ifndef AIRCRACK_NG_BYTE_ORDER -#error Impossible to determine endianness (Little or Big endian), please contact the author. -#endif /* */ -#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) -#define __be16_to_cpu(x) ___my_swab16(x) -#define __cpu_to_be64(x) ___my_swab64(x) -#define __cpu_to_be32(x) ___my_swab32(x) -#define __cpu_to_be16(x) ___my_swab16(x) -#define __le64_to_cpu(x) (x) -#define __le32_to_cpu(x) (x) -#define __le16_to_cpu(x) (x) -#define __cpu_to_le64(x) (x) -#define __cpu_to_le32(x) (x) -#define __cpu_to_le16(x) (x) -#endif /* */ -#ifndef htobe16 -#define htobe16 ___my_swab16 -#endif /* */ -#ifndef htobe32 -#define htobe32 ___my_swab32 -#endif /* */ -#ifndef betoh16 -#define betoh16 ___my_swab16 -#endif /* */ -#ifndef betoh32 -#define betoh32 ___my_swab32 -#endif /* */ -#ifndef htole16 -#define htole16(x) (x) -#endif /* */ -#ifndef htole32 -#define htole32(x) (x) -#endif /* */ -#ifndef letoh16 -#define letoh16(x) (x) -#endif /* */ -#ifndef letoh32 -#define letoh32(x) (x) -#endif /* */ -#endif /* */ -#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) -#define __be16_to_cpu(x) (x) -#define __cpu_to_be64(x) (x) -#define __cpu_to_be32(x) (x) -#define __cpu_to_be16(x) (x) -#define __le64_to_cpu(x) ___my_swab64(x) -#define __le32_to_cpu(x) ___my_swab32(x) -#define __le16_to_cpu(x) ___my_swab16(x) -#define __cpu_to_le64(x) ___my_swab64(x) -#define __cpu_to_le32(x) ___my_swab32(x) -#define __cpu_to_le16(x) ___my_swab16(x) -#endif /* */ -#ifndef htobe16 -#define htobe16(x) (x) -#endif /* */ -#ifndef htobe32 -#define htobe32(x) (x) -#endif /* */ -#ifndef betoh16 -#define betoh16(x) (x) -#endif /* */ -#ifndef betoh32 -#define betoh32(x) (x) -#endif /* */ -#ifndef htole16 -#define htole16 ___my_swab16 -#endif /* */ -#ifndef htole32 -#define htole32 ___my_swab32 -#endif /* */ -#ifndef letoh16 -#define letoh16 ___my_swab16 -#endif /* */ -#ifndef letoh32 -#define letoh32 ___my_swab32 -#endif /* */ -#endif /* */ - // Common defines -#define cpu_to_le64 __cpu_to_le64 -#define le64_to_cpu __le64_to_cpu -#define cpu_to_le32 __cpu_to_le32 -#define le32_to_cpu __le32_to_cpu -#define cpu_to_le16 __cpu_to_le16 -#define le16_to_cpu __le16_to_cpu -#define cpu_to_be64 __cpu_to_be64 -#define be64_to_cpu __be64_to_cpu -#define cpu_to_be32 __cpu_to_be32 -#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 /* */ -#ifndef be16toh -#define be16toh be16_to_cpu -#endif /* */ -#ifndef le32toh -#define le32toh le32_to_cpu -#endif /* */ -#ifndef be32toh -#define be32toh be32_to_cpu -#endif /* */ - -#ifndef htons -#define htons be16_to_cpu -#endif /* */ -#ifndef htonl -#define htonl cpu_to_be16 -#endif /* */ -#ifndef ntohs -#define ntohs cpu_to_be16 -#endif /* */ -#ifndef ntohl -#define ntohl cpu_to_be32 -#endif /* */ -#endif /* */ diff --git a/src/transport/wlan/crctable_osdep.h b/src/transport/wlan/crctable_osdep.h deleted file mode 100644 index 04c769f2a..000000000 --- a/src/transport/wlan/crctable_osdep.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef _CRCTABLE_OSDEP_H -#define _CRCTABLE_OSDEP_H - -const unsigned long int crc_tbl_osdep[256] = { - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, - 0xE963A535, 0x9E6495A3, - 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, - 0xE7B82D07, 0x90BF1D91, - 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, - 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, - 0xFA0F3D63, 0x8D080DF5, - 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, - 0xD20D85FD, 0xA50AB56B, - 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, - 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, - 0xCFBA9599, 0xB8BDA50F, - 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, - 0xC1611DAB, 0xB6662D3D, - 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, - 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, - 0x91646C97, 0xE6635C01, - 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, - 0x8208F4C1, 0xF50FC457, - 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, - 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, - 0xA4D1C46D, 0xD3D6F4FB, - 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, - 0xAA0A4C5F, 0xDD0D7CC9, - 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, - 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, - 0xB7BD5C3B, 0xC0BA6CAD, - 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, - 0x04DB2615, 0x73DC1683, - 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, - 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, - 0x196C3671, 0x6E6B06E7, - 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, - 0x17B7BE43, 0x60B08ED5, - 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, - 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, - 0x316E8EEF, 0x4669BE79, - 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, - 0x220216B9, 0x5505262F, - 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, - 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, - 0x72076785, 0x05005713, - 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, - 0x7CDCEFB7, 0x0BDBDF21, - 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, - 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, - 0x616BFFD3, 0x166CCF45, - 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, - 0x4969474D, 0x3E6E77DB, - 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, - 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, - 0x54DE5729, 0x23D967BF, - 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, - 0x5A05DF1B, 0x2D02EF8D -}; - -#endif /* crctable_osdep.h */ diff --git a/src/transport/wlan/ieee80211.h b/src/transport/wlan/ieee80211.h deleted file mode 100644 index fd297f4a4..000000000 --- a/src/transport/wlan/ieee80211.h +++ /dev/null @@ -1,689 +0,0 @@ -/*- - * Copyright (c) 2001 Atsushi Onoe - * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD: src/sys/net80211/ieee80211.h,v 1.12 2006/12/01 18:40:51 imp Exp $ - */ -#ifndef _NET80211_IEEE80211_H_ -#define _NET80211_IEEE80211_H_ - -/* - * 802.11 protocol definitions. - */ - -#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ -/* is 802.11 address multicast/broadcast? */ -#define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01) - -/* IEEE 802.11 PLCP header */ -struct ieee80211_plcp_hdr -{ - u_int16_t i_sfd; - u_int8_t i_signal; - u_int8_t i_service; - u_int16_t i_length; - u_int16_t i_crc; -} GNUNET_PACKED; - -#define IEEE80211_PLCP_SFD 0xF3A0 -#define IEEE80211_PLCP_SERVICE 0x00 - -/* - * generic definitions for IEEE 802.11 frames - */ -struct ieee80211_frame -{ - u_int8_t i_fc[2]; - u_int8_t i_dur[2]; - u_int8_t i_addr1[IEEE80211_ADDR_LEN]; - u_int8_t i_addr2[IEEE80211_ADDR_LEN]; - u_int8_t i_addr3[IEEE80211_ADDR_LEN]; - u_int8_t i_seq[2]; - /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ - /* see below */ -} GNUNET_PACKED; - -struct ieee80211_qosframe -{ - u_int8_t i_fc[2]; - u_int8_t i_dur[2]; - u_int8_t i_addr1[IEEE80211_ADDR_LEN]; - u_int8_t i_addr2[IEEE80211_ADDR_LEN]; - u_int8_t i_addr3[IEEE80211_ADDR_LEN]; - u_int8_t i_seq[2]; - u_int8_t i_qos[2]; - /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ - /* see below */ -} GNUNET_PACKED; - -struct ieee80211_qoscntl -{ - u_int8_t i_qos[2]; -}; - -struct ieee80211_frame_addr4 -{ - u_int8_t i_fc[2]; - u_int8_t i_dur[2]; - u_int8_t i_addr1[IEEE80211_ADDR_LEN]; - u_int8_t i_addr2[IEEE80211_ADDR_LEN]; - u_int8_t i_addr3[IEEE80211_ADDR_LEN]; - u_int8_t i_seq[2]; - u_int8_t i_addr4[IEEE80211_ADDR_LEN]; -} GNUNET_PACKED; - - -struct ieee80211_qosframe_addr4 -{ - u_int8_t i_fc[2]; - u_int8_t i_dur[2]; - u_int8_t i_addr1[IEEE80211_ADDR_LEN]; - u_int8_t i_addr2[IEEE80211_ADDR_LEN]; - u_int8_t i_addr3[IEEE80211_ADDR_LEN]; - u_int8_t i_seq[2]; - u_int8_t i_addr4[IEEE80211_ADDR_LEN]; - u_int8_t i_qos[2]; -} GNUNET_PACKED; - -#define IEEE80211_FC0_VERSION_MASK 0x03 -#define IEEE80211_FC0_VERSION_SHIFT 0 -#define IEEE80211_FC0_VERSION_0 0x00 -#define IEEE80211_FC0_TYPE_MASK 0x0c -#define IEEE80211_FC0_TYPE_SHIFT 2 -#define IEEE80211_FC0_TYPE_MGT 0x00 -#define IEEE80211_FC0_TYPE_CTL 0x04 -#define IEEE80211_FC0_TYPE_DATA 0x08 - -#define IEEE80211_FC0_SUBTYPE_MASK 0xf0 -#define IEEE80211_FC0_SUBTYPE_SHIFT 4 -/* for TYPE_MGT */ -#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00 -#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10 -#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20 -#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30 -#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40 -#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50 -#define IEEE80211_FC0_SUBTYPE_BEACON 0x80 -#define IEEE80211_FC0_SUBTYPE_ATIM 0x90 -#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0 -#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0 -#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0 -/* for TYPE_CTL */ -#define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0 -#define IEEE80211_FC0_SUBTYPE_RTS 0xb0 -#define IEEE80211_FC0_SUBTYPE_CTS 0xc0 -#define IEEE80211_FC0_SUBTYPE_ACK 0xd0 -#define IEEE80211_FC0_SUBTYPE_CF_END 0xe0 -#define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0 -/* for TYPE_DATA (bit combination) */ -#define IEEE80211_FC0_SUBTYPE_DATA 0x00 -#define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10 -#define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20 -#define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30 -#define IEEE80211_FC0_SUBTYPE_NODATA 0x40 -#define IEEE80211_FC0_SUBTYPE_CFACK 0x50 -#define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60 -#define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70 -#define IEEE80211_FC0_SUBTYPE_QOS 0x80 -#define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0 - -#define IEEE80211_FC1_DIR_MASK 0x03 -#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ -#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ -#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ -#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ - -#define IEEE80211_FC1_MORE_FRAG 0x04 -#define IEEE80211_FC1_RETRY 0x08 -#define IEEE80211_FC1_PWR_MGT 0x10 -#define IEEE80211_FC1_MORE_DATA 0x20 -#define IEEE80211_FC1_WEP 0x40 -#define IEEE80211_FC1_ORDER 0x80 - -#define IEEE80211_SEQ_FRAG_MASK 0x000f -#define IEEE80211_SEQ_FRAG_SHIFT 0 -#define IEEE80211_SEQ_SEQ_MASK 0xfff0 -#define IEEE80211_SEQ_SEQ_SHIFT 4 - -#define IEEE80211_NWID_LEN 32 - -#define IEEE80211_QOS_TXOP 0x00ff -/* bit 8 is reserved */ -#define IEEE80211_QOS_ACKPOLICY 0x60 -#define IEEE80211_QOS_ACKPOLICY_S 5 -#define IEEE80211_QOS_ESOP 0x10 -#define IEEE80211_QOS_ESOP_S 4 -#define IEEE80211_QOS_TID 0x0f - -/* does frame have QoS sequence control data */ -#define IEEE80211_QOS_HAS_SEQ(wh) \ - (((wh)->i_fc[0] & \ - (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \ - (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS)) - -/* - * WME/802.11e information element. - */ -struct ieee80211_wme_info -{ - u_int8_t wme_id; /* IEEE80211_ELEMID_VENDOR */ - u_int8_t wme_len; /* length in bytes */ - u_int8_t wme_oui[3]; /* 0x00, 0x50, 0xf2 */ - u_int8_t wme_type; /* OUI type */ - u_int8_t wme_subtype; /* OUI subtype */ - u_int8_t wme_version; /* spec revision */ - u_int8_t wme_info; /* QoS info */ -} GNUNET_PACKED; - -/* - * WME/802.11e Tspec Element - */ -struct ieee80211_wme_tspec -{ - u_int8_t ts_id; - u_int8_t ts_len; - u_int8_t ts_oui[3]; - u_int8_t ts_oui_type; - u_int8_t ts_oui_subtype; - u_int8_t ts_version; - u_int8_t ts_tsinfo[3]; - u_int8_t ts_nom_msdu[2]; - u_int8_t ts_max_msdu[2]; - u_int8_t ts_min_svc[4]; - u_int8_t ts_max_svc[4]; - u_int8_t ts_inactv_intv[4]; - u_int8_t ts_susp_intv[4]; - u_int8_t ts_start_svc[4]; - u_int8_t ts_min_rate[4]; - u_int8_t ts_mean_rate[4]; - u_int8_t ts_max_burst[4]; - u_int8_t ts_min_phy[4]; - u_int8_t ts_peak_rate[4]; - u_int8_t ts_delay[4]; - u_int8_t ts_surplus[2]; - u_int8_t ts_medium_time[2]; -} GNUNET_PACKED; - -/* - * WME AC parameter field - */ -struct ieee80211_wme_acparams -{ - u_int8_t acp_aci_aifsn; - u_int8_t acp_logcwminmax; - u_int16_t acp_txop; -} GNUNET_PACKED; - -#define WME_NUM_AC 4 /* 4 AC categories */ - -#define WME_PARAM_ACI 0x60 /* Mask for ACI field */ -#define WME_PARAM_ACI_S 5 /* Shift for ACI field */ -#define WME_PARAM_ACM 0x10 /* Mask for ACM bit */ -#define WME_PARAM_ACM_S 4 /* Shift for ACM bit */ -#define WME_PARAM_AIFSN 0x0f /* Mask for aifsn field */ -#define WME_PARAM_AIFSN_S 0 /* Shift for aifsn field */ -#define WME_PARAM_LOGCWMIN 0x0f /* Mask for CwMin field (in log) */ -#define WME_PARAM_LOGCWMIN_S 0 /* Shift for CwMin field */ -#define WME_PARAM_LOGCWMAX 0xf0 /* Mask for CwMax field (in log) */ -#define WME_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */ - -#define WME_AC_TO_TID(_ac) ( \ - ((_ac) == WME_AC_VO) ? 6 : \ - ((_ac) == WME_AC_VI) ? 5 : \ - ((_ac) == WME_AC_BK) ? 1 : \ - 0) - -#define TID_TO_WME_AC(_tid) ( \ - ((_tid) < 1) ? WME_AC_BE : \ - ((_tid) < 3) ? WME_AC_BK : \ - ((_tid) < 6) ? WME_AC_VI : \ - WME_AC_VO) - -/* - * WME Parameter Element - */ -struct ieee80211_wme_param -{ - u_int8_t param_id; - u_int8_t param_len; - u_int8_t param_oui[3]; - u_int8_t param_oui_type; - u_int8_t param_oui_sybtype; - u_int8_t param_version; - u_int8_t param_qosInfo; -#define WME_QOSINFO_COUNT 0x0f /* Mask for param count field */ - u_int8_t param_reserved; - struct ieee80211_wme_acparams params_acParams[WME_NUM_AC]; -} GNUNET_PACKED; - -/* - * Management Notification Frame - */ -struct ieee80211_mnf -{ - u_int8_t mnf_category; - u_int8_t mnf_action; - u_int8_t mnf_dialog; - u_int8_t mnf_status; -} GNUNET_PACKED; - -#define MNF_SETUP_REQ 0 -#define MNF_SETUP_RESP 1 -#define MNF_TEARDOWN 2 - -/* - * Control frames. - */ -struct ieee80211_frame_min -{ - u_int8_t i_fc[2]; - u_int8_t i_dur[2]; - u_int8_t i_addr1[IEEE80211_ADDR_LEN]; - u_int8_t i_addr2[IEEE80211_ADDR_LEN]; - /* FCS */ -} GNUNET_PACKED; - -struct ieee80211_frame_rts -{ - u_int8_t i_fc[2]; - u_int8_t i_dur[2]; - u_int8_t i_ra[IEEE80211_ADDR_LEN]; - u_int8_t i_ta[IEEE80211_ADDR_LEN]; - /* FCS */ -} GNUNET_PACKED; - -struct ieee80211_frame_cts -{ - u_int8_t i_fc[2]; - u_int8_t i_dur[2]; - u_int8_t i_ra[IEEE80211_ADDR_LEN]; - /* FCS */ -} GNUNET_PACKED; - -struct ieee80211_frame_ack -{ - u_int8_t i_fc[2]; - u_int8_t i_dur[2]; - u_int8_t i_ra[IEEE80211_ADDR_LEN]; - /* FCS */ -} GNUNET_PACKED; - -struct ieee80211_frame_pspoll -{ - u_int8_t i_fc[2]; - u_int8_t i_aid[2]; - u_int8_t i_bssid[IEEE80211_ADDR_LEN]; - u_int8_t i_ta[IEEE80211_ADDR_LEN]; - /* FCS */ -} GNUNET_PACKED; - -struct ieee80211_frame_cfend -{ /* NB: also CF-End+CF-Ack */ - u_int8_t i_fc[2]; - u_int8_t i_dur[2]; /* should be zero */ - u_int8_t i_ra[IEEE80211_ADDR_LEN]; - u_int8_t i_bssid[IEEE80211_ADDR_LEN]; - /* FCS */ -} GNUNET_PACKED; - -/* - * BEACON management packets - * - * octet timestamp[8] - * octet beacon interval[2] - * octet capability information[2] - * information element - * octet elemid - * octet length - * octet information[length] - */ - -typedef u_int8_t *ieee80211_mgt_beacon_t; - -#define IEEE80211_BEACON_INTERVAL(beacon) \ - ((beacon)[8] | ((beacon)[9] << 8)) -#define IEEE80211_BEACON_CAPABILITY(beacon) \ - ((beacon)[10] | ((beacon)[11] << 8)) - -#define IEEE80211_CAPINFO_ESS 0x0001 -#define IEEE80211_CAPINFO_IBSS 0x0002 -#define IEEE80211_CAPINFO_CF_POLLABLE 0x0004 -#define IEEE80211_CAPINFO_CF_POLLREQ 0x0008 -#define IEEE80211_CAPINFO_PRIVACY 0x0010 -#define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020 -#define IEEE80211_CAPINFO_PBCC 0x0040 -#define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080 -/* bits 8-9 are reserved */ -#define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400 -#define IEEE80211_CAPINFO_RSN 0x0800 -/* bit 12 is reserved */ -#define IEEE80211_CAPINFO_DSSSOFDM 0x2000 -/* bits 14-15 are reserved */ - -/* - * 802.11i/WPA information element (maximally sized). - */ -struct ieee80211_ie_wpa -{ - u_int8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */ - u_int8_t wpa_len; /* length in bytes */ - u_int8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */ - u_int8_t wpa_type; /* OUI type */ - u_int16_t wpa_version; /* spec revision */ - u_int32_t wpa_mcipher[1]; /* multicast/group key cipher */ - u_int16_t wpa_uciphercnt; /* # pairwise key ciphers */ - u_int32_t wpa_uciphers[8]; /* ciphers */ - u_int16_t wpa_authselcnt; /* authentication selector cnt */ - u_int32_t wpa_authsels[8]; /* selectors */ - u_int16_t wpa_caps; /* 802.11i capabilities */ - u_int16_t wpa_pmkidcnt; /* 802.11i pmkid count */ - u_int16_t wpa_pmkids[8]; /* 802.11i pmkids */ -} GNUNET_PACKED; - -/* - * Management information element payloads. - */ - -enum -{ - IEEE80211_ELEMID_SSID = 0, - IEEE80211_ELEMID_RATES = 1, - IEEE80211_ELEMID_FHPARMS = 2, - IEEE80211_ELEMID_DSPARMS = 3, - IEEE80211_ELEMID_CFPARMS = 4, - IEEE80211_ELEMID_TIM = 5, - IEEE80211_ELEMID_IBSSPARMS = 6, - IEEE80211_ELEMID_COUNTRY = 7, - IEEE80211_ELEMID_CHALLENGE = 16, - /* 17-31 reserved for challenge text extension */ - IEEE80211_ELEMID_ERP = 42, - IEEE80211_ELEMID_RSN = 48, - IEEE80211_ELEMID_XRATES = 50, - IEEE80211_ELEMID_TPC = 150, - IEEE80211_ELEMID_CCKM = 156, - IEEE80211_ELEMID_VENDOR = 221, /* vendor private */ -}; - -struct ieee80211_tim_ie -{ - u_int8_t tim_ie; /* IEEE80211_ELEMID_TIM */ - u_int8_t tim_len; - u_int8_t tim_count; /* DTIM count */ - u_int8_t tim_period; /* DTIM period */ - u_int8_t tim_bitctl; /* bitmap control */ - u_int8_t tim_bitmap[1]; /* variable-length bitmap */ -} GNUNET_PACKED; - -struct ieee80211_country_ie -{ - u_int8_t ie; /* IEEE80211_ELEMID_COUNTRY */ - u_int8_t len; - u_int8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */ - struct - { - u_int8_t schan; /* starting channel */ - u_int8_t nchan; /* number channels */ - u_int8_t maxtxpwr; /* tx power cap */ - } GNUNET_PACKED band[4]; /* up to 4 sub bands */ -} GNUNET_PACKED; - -#define IEEE80211_CHALLENGE_LEN 128 - -#define IEEE80211_RATE_BASIC 0x80 -#define IEEE80211_RATE_VAL 0x7f - -/* EPR information element flags */ -#define IEEE80211_ERP_NON_ERP_PRESENT 0x01 -#define IEEE80211_ERP_USE_PROTECTION 0x02 -#define IEEE80211_ERP_LONG_PREAMBLE 0x04 - -/* Atheros private advanced capabilities info */ -#define ATHEROS_CAP_TURBO_PRIME 0x01 -#define ATHEROS_CAP_COMPRESSION 0x02 -#define ATHEROS_CAP_FAST_FRAME 0x04 -/* bits 3-6 reserved */ -#define ATHEROS_CAP_BOOST 0x80 - -#define ATH_OUI 0x7f0300 /* Atheros OUI */ -#define ATH_OUI_TYPE 0x01 -#define ATH_OUI_VERSION 0x01 - -#define WPA_OUI 0xf25000 -#define WPA_OUI_TYPE 0x01 -#define WPA_VERSION 1 /* current supported version */ - -#define WPA_CSE_NULL 0x00 -#define WPA_CSE_WEP40 0x01 -#define WPA_CSE_TKIP 0x02 -#define WPA_CSE_CCMP 0x04 -#define WPA_CSE_WEP104 0x05 - -#define WPA_ASE_NONE 0x00 -#define WPA_ASE_8021X_UNSPEC 0x01 -#define WPA_ASE_8021X_PSK 0x02 - -#define RSN_OUI 0xac0f00 -#define RSN_VERSION 1 /* current supported version */ - -#define RSN_CSE_NULL 0x00 -#define RSN_CSE_WEP40 0x01 -#define RSN_CSE_TKIP 0x02 -#define RSN_CSE_WRAP 0x03 -#define RSN_CSE_CCMP 0x04 -#define RSN_CSE_WEP104 0x05 - -#define RSN_ASE_NONE 0x00 -#define RSN_ASE_8021X_UNSPEC 0x01 -#define RSN_ASE_8021X_PSK 0x02 - -#define RSN_CAP_PREAUTH 0x01 - -#define WME_OUI 0xf25000 -#define WME_OUI_TYPE 0x02 -#define WME_INFO_OUI_SUBTYPE 0x00 -#define WME_PARAM_OUI_SUBTYPE 0x01 -#define WME_VERSION 1 - -/* WME stream classes */ -#define WME_AC_BE 0 /* best effort */ -#define WME_AC_BK 1 /* background */ -#define WME_AC_VI 2 /* video */ -#define WME_AC_VO 3 /* voice */ - -/* - * AUTH management packets - * - * octet algo[2] - * octet seq[2] - * octet status[2] - * octet chal.id - * octet chal.length - * octet chal.text[253] - */ - -typedef u_int8_t *ieee80211_mgt_auth_t; - -#define IEEE80211_AUTH_ALGORITHM(auth) \ - ((auth)[0] | ((auth)[1] << 8)) -#define IEEE80211_AUTH_TRANSACTION(auth) \ - ((auth)[2] | ((auth)[3] << 8)) -#define IEEE80211_AUTH_STATUS(auth) \ - ((auth)[4] | ((auth)[5] << 8)) - -#define IEEE80211_AUTH_ALG_OPEN 0x0000 -#define IEEE80211_AUTH_ALG_SHARED 0x0001 -#define IEEE80211_AUTH_ALG_LEAP 0x0080 - -enum -{ - IEEE80211_AUTH_OPEN_REQUEST = 1, - IEEE80211_AUTH_OPEN_RESPONSE = 2, -}; - -enum -{ - IEEE80211_AUTH_SHARED_REQUEST = 1, - IEEE80211_AUTH_SHARED_CHALLENGE = 2, - IEEE80211_AUTH_SHARED_RESPONSE = 3, - IEEE80211_AUTH_SHARED_PASS = 4, -}; - -/* - * Reason codes - * - * Unlisted codes are reserved - */ - -enum -{ - IEEE80211_REASON_UNSPECIFIED = 1, - IEEE80211_REASON_AUTH_EXPIRE = 2, - IEEE80211_REASON_AUTH_LEAVE = 3, - IEEE80211_REASON_ASSOC_EXPIRE = 4, - IEEE80211_REASON_ASSOC_TOOMANY = 5, - IEEE80211_REASON_NOT_AUTHED = 6, - IEEE80211_REASON_NOT_ASSOCED = 7, - IEEE80211_REASON_ASSOC_LEAVE = 8, - IEEE80211_REASON_ASSOC_NOT_AUTHED = 9, - - IEEE80211_REASON_RSN_REQUIRED = 11, - IEEE80211_REASON_RSN_INCONSISTENT = 12, - IEEE80211_REASON_IE_INVALID = 13, - IEEE80211_REASON_MIC_FAILURE = 14, - - IEEE80211_STATUS_SUCCESS = 0, - IEEE80211_STATUS_UNSPECIFIED = 1, - IEEE80211_STATUS_CAPINFO = 10, - IEEE80211_STATUS_NOT_ASSOCED = 11, - IEEE80211_STATUS_OTHER = 12, - IEEE80211_STATUS_ALG = 13, - IEEE80211_STATUS_SEQUENCE = 14, - IEEE80211_STATUS_CHALLENGE = 15, - IEEE80211_STATUS_TIMEOUT = 16, - IEEE80211_STATUS_TOOMANY = 17, - IEEE80211_STATUS_BASIC_RATE = 18, - IEEE80211_STATUS_SP_REQUIRED = 19, - IEEE80211_STATUS_PBCC_REQUIRED = 20, - IEEE80211_STATUS_CA_REQUIRED = 21, - IEEE80211_STATUS_TOO_MANY_STATIONS = 22, - IEEE80211_STATUS_RATES = 23, - IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25, - IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26, -}; - -#define IEEE80211_WEP_KEYLEN 5 /* 40bit */ -#define IEEE80211_WEP_IVLEN 3 /* 24bit */ -#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ -#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ -#define IEEE80211_WEP_NKID 4 /* number of key ids */ - -/* - * 802.11i defines an extended IV for use with non-WEP ciphers. - * When the EXTIV bit is set in the key id byte an additional - * 4 bytes immediately follow the IV for TKIP. For CCMP the - * EXTIV bit is likewise set but the 8 bytes represent the - * CCMP header rather than IV+extended-IV. - */ -#define IEEE80211_WEP_EXTIV 0x20 -#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */ -#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */ - -#define IEEE80211_CRC_LEN 4 - -/* - * Maximum acceptable MTU is: - * IEEE80211_MAX_LEN - WEP overhead - CRC - - * QoS overhead - RSN/WPA overhead - * Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default - * mtu is Ethernet-compatible; it's set by ether_ifattach. - */ -#define IEEE80211_MTU_MAX 2290 -#define IEEE80211_MTU_MIN 32 - -#define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \ - (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN)) -#define IEEE80211_ACK_LEN \ - (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN) -#define IEEE80211_MIN_LEN \ - (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN) - -/* - * The 802.11 spec says at most 2007 stations may be - * associated at once. For most AP's this is way more - * than is feasible so we use a default of 128. This - * number may be overridden by the driver and/or by - * user configuration. - */ -#define IEEE80211_AID_MAX 2007 -#define IEEE80211_AID_DEF 128 - -#define IEEE80211_AID(b) ((b) &~ 0xc000) - -/* - * RTS frame length parameters. The default is specified in - * the 802.11 spec as 512; we treat it as implementation-dependent - * so it's defined in ieee80211_var.h. The max may be wrong - * for jumbo frames. - */ -#define IEEE80211_RTS_MIN 1 -#define IEEE80211_RTS_MAX 2346 - -/* - * TX fragmentation parameters. As above for RTS, we treat - * default as implementation-dependent so define it elsewhere. - */ -#define IEEE80211_FRAG_MIN 256 -#define IEEE80211_FRAG_MAX 2346 - -/* - * Beacon interval (TU's). Min+max come from WiFi requirements. - * As above, we treat default as implementation-dependent so - * define it elsewhere. - */ -#define IEEE80211_BINTVAL_MAX 1000 /* max beacon interval (TU's) */ -#define IEEE80211_BINTVAL_MIN 25 /* min beacon interval (TU's) */ - -/* - * DTIM period (beacons). Min+max are not really defined - * by the protocol but we want them publicly visible so - * define them here. - */ -#define IEEE80211_DTIM_MAX 15 /* max DTIM period */ -#define IEEE80211_DTIM_MIN 1 /* min DTIM period */ - -/* - * Beacon miss threshold (beacons). As for DTIM, we define - * them here to be publicly visible. Note the max may be - * clamped depending on device capabilities. - */ -#define IEEE80211_HWBMISS_MIN 1 -#define IEEE80211_HWBMISS_MAX 255 - -#endif /* _NET80211_IEEE80211_H_ */ diff --git a/src/transport/wlan/ieee80211_radiotap.h b/src/transport/wlan/ieee80211_radiotap.h deleted file mode 100644 index f3afbecce..000000000 --- a/src/transport/wlan/ieee80211_radiotap.h +++ /dev/null @@ -1,262 +0,0 @@ -/* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.5 2005/01/22 20:12:05 sam Exp $ */ -/* $NetBSD: ieee80211_radiotap.h,v 1.11 2005/06/22 06:16:02 dyoung Exp $ */ - -/*- - * Copyright (c) 2003, 2004 David Young. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of David Young may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID - * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - */ - -/* - * Modifications to fit into the linux IEEE 802.11 stack, - * Mike Kershaw (dragorn@kismetwireless.net) - */ - -#ifndef IEEE80211RADIOTAP_H -#define IEEE80211RADIOTAP_H - -/* Radiotap header version (from official NetBSD feed) */ -#define IEEE80211RADIOTAP_VERSION "1.5" -/* Base version of the radiotap packet header data */ -#define PKTHDR_RADIOTAP_VERSION 0 - -/* A generic radio capture format is desirable. There is one for - * Linux, but it is neither rigidly defined (there were not even - * units given for some fields) nor easily extensible. - * - * I suggest the following extensible radio capture format. It is - * based on a bitmap indicating which fields are present. - * - * I am trying to describe precisely what the application programmer - * should expect in the following, and for that reason I tell the - * units and origin of each measurement (where it applies), or else I - * use sufficiently weaselly language ("is a monotonically nondecreasing - * function of...") that I cannot set false expectations for lawyerly - * readers. - */ - -/* XXX tcpdump/libpcap do not tolerate variable-length headers, - * yet, so we pad every radiotap header to 64 bytes. Ugh. - */ -#define IEEE80211_RADIOTAP_HDRLEN 64 - -/* The radio capture header precedes the 802.11 header. - * All data in the header is little endian on all platforms. - */ -struct ieee80211_radiotap_header -{ - u8 it_version; /* Version 0. Only increases - * for drastic changes, - * introduction of compatible - * new fields does not count. - */ - u8 it_pad; - u16 it_len; /* length of the whole - * header in bytes, including - * it_version, it_pad, - * it_len, and data fields. - */ - u32 it_present; /* A bitmap telling which - * fields are present. Set bit 31 - * (0x80000000) to extend the - * bitmap by another 32 bits. - * Additional extensions are made - * by setting bit 31. - */ -}; - -#define IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK 0x80000000 - -/* Name Data type Units - * ---- --------- ----- - * - * IEEE80211_RADIOTAP_TSFT __le64 microseconds - * - * Value in microseconds of the MAC's 64-bit 802.11 Time - * Synchronization Function timer when the first bit of the - * MPDU arrived at the MAC. For received frames, only. - * - * IEEE80211_RADIOTAP_CHANNEL 2 x __le16 MHz, bitmap - * - * Tx/Rx frequency in MHz, followed by flags (see below). - * - * IEEE80211_RADIOTAP_FHSS __le16 see below - * - * For frequency-hopping radios, the hop set (first byte) - * and pattern (second byte). - * - * IEEE80211_RADIOTAP_RATE u8 500kb/s - * - * Tx/Rx data rate - * - * IEEE80211_RADIOTAP_DBM_ANTSIGNAL s8 decibels from - * one milliwatt (dBm) - * - * RF signal power at the antenna, decibel difference from - * one milliwatt. - * - * IEEE80211_RADIOTAP_DBM_ANTNOISE s8 decibels from - * one milliwatt (dBm) - * - * RF noise power at the antenna, decibel difference from one - * milliwatt. - * - * IEEE80211_RADIOTAP_DB_ANTSIGNAL u8 decibel (dB) - * - * RF signal power at the antenna, decibel difference from an - * arbitrary, fixed reference. - * - * IEEE80211_RADIOTAP_DB_ANTNOISE u8 decibel (dB) - * - * RF noise power at the antenna, decibel difference from an - * arbitrary, fixed reference point. - * - * IEEE80211_RADIOTAP_LOCK_QUALITY __le16 unitless - * - * Quality of Barker code lock. Unitless. Monotonically - * nondecreasing with "better" lock strength. Called "Signal - * Quality" in datasheets. (Is there a standard way to measure - * this?) - * - * IEEE80211_RADIOTAP_TX_ATTENUATION __le16 unitless - * - * Transmit power expressed as unitless distance from max - * power set at factory calibration. 0 is max power. - * Monotonically nondecreasing with lower power levels. - * - * IEEE80211_RADIOTAP_DB_TX_ATTENUATION __le16 decibels (dB) - * - * Transmit power expressed as decibel distance from max power - * set at factory calibration. 0 is max power. Monotonically - * nondecreasing with lower power levels. - * - * IEEE80211_RADIOTAP_DBM_TX_POWER s8 decibels from - * one milliwatt (dBm) - * - * Transmit power expressed as dBm (decibels from a 1 milliwatt - * reference). This is the absolute power level measured at - * the antenna port. - * - * IEEE80211_RADIOTAP_FLAGS u8 bitmap - * - * Properties of transmitted and received frames. See flags - * defined below. - * - * IEEE80211_RADIOTAP_ANTENNA u8 antenna index - * - * Unitless indication of the Rx/Tx antenna for this packet. - * The first antenna is antenna 0. - * - * IEEE80211_RADIOTAP_RX_FLAGS __le16 bitmap - * - * Properties of received frames. See flags defined below. - * - * IEEE80211_RADIOTAP_TX_FLAGS __le16 bitmap - * - * Properties of transmitted frames. See flags defined below. - * - * IEEE80211_RADIOTAP_RTS_RETRIES u8 data - * - * Number of rts retries a transmitted frame used. - * - * IEEE80211_RADIOTAP_DATA_RETRIES u8 data - * - * Number of unicast retries a transmitted frame used. - * - */ -enum ieee80211_radiotap_type -{ - IEEE80211_RADIOTAP_TSFT = 0, - IEEE80211_RADIOTAP_FLAGS = 1, - IEEE80211_RADIOTAP_RATE = 2, - IEEE80211_RADIOTAP_CHANNEL = 3, - IEEE80211_RADIOTAP_FHSS = 4, - IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, - IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, - IEEE80211_RADIOTAP_LOCK_QUALITY = 7, - IEEE80211_RADIOTAP_TX_ATTENUATION = 8, - IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, - IEEE80211_RADIOTAP_DBM_TX_POWER = 10, - IEEE80211_RADIOTAP_ANTENNA = 11, - IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, - IEEE80211_RADIOTAP_DB_ANTNOISE = 13, - IEEE80211_RADIOTAP_RX_FLAGS = 14, - IEEE80211_RADIOTAP_TX_FLAGS = 15, - IEEE80211_RADIOTAP_RTS_RETRIES = 16, - IEEE80211_RADIOTAP_DATA_RETRIES = 17, - IEEE80211_RADIOTAP_EXT = 31 -}; - -/* Channel flags. */ -#define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ -#define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ -#define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ -#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ -#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ -#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ -#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ -#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ - -/* For IEEE80211_RADIOTAP_FLAGS */ -#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received - * during CFP - */ -#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received - * with short - * preamble - */ -#define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received - * with WEP encryption - */ -#define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received - * with fragmentation - */ -#define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */ -#define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between - * 802.11 header and payload - * (to 32-bit boundary) - */ -/* For IEEE80211_RADIOTAP_RX_FLAGS */ -#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /* frame failed crc check */ - -/* For IEEE80211_RADIOTAP_TX_FLAGS */ -#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive - * retries */ -#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */ -#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */ -#define IEEE80211_RADIOTAP_F_TX_NOACK 0x0008 /* frame should not be ACKed */ -#define IEEE80211_RADIOTAP_F_TX_NOSEQ 0x0010 /* sequence number handled - * by userspace */ - -/* Ugly macro to convert literal channel numbers into their mhz equivalents - * There are certianly some conditions that will break this (like feeding it '30') - * but they shouldn't arise since nothing talks on channel 30. */ -#define ieee80211chan2mhz(x) \ - (((x) <= 14) ? \ - (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \ - ((x) + 1000) * 5) - -#endif /* IEEE80211_RADIOTAP_H */ diff --git a/src/transport/wlan/radiotap-parser.c b/src/transport/wlan/radiotap-parser.c deleted file mode 100644 index 9cc992728..000000000 --- a/src/transport/wlan/radiotap-parser.c +++ /dev/null @@ -1,260 +0,0 @@ - /* - * Copyright (c) 2007, 2008, Andy Green - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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 - */ - -#include -#include -#include - -#include "radiotap-parser.h" - - -/* - * Radiotap header iteration - * implemented in src/radiotap-parser.c - * - * call __ieee80211_radiotap_iterator_init() to init a semi-opaque iterator - * struct ieee80211_radiotap_iterator (no need to init the struct beforehand) - * then loop calling __ieee80211_radiotap_iterator_next()... it returns -1 - * if there are no more args in the header, or the next argument type index - * that is present. The iterator's this_arg member points to the start of the - * argument associated with the current argument index that is present, - * which can be found in the iterator's this_arg_index member. This arg - * index corresponds to the IEEE80211_RADIOTAP_... defines. - */ - - -int -ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator *iterator, - struct ieee80211_radiotap_header - *radiotap_header, int max_length) -{ - if (iterator == NULL) - return (-EINVAL); - - if (radiotap_header == NULL) - return (-EINVAL); - /* Linux only supports version 0 radiotap format */ - - if (radiotap_header->it_version) - return (-EINVAL); - - /* sanity check for allowed length and radiotap length field */ - - if (max_length < (le16_to_cpu (radiotap_header->it_len))) - return (-EINVAL); - - iterator->rtheader = radiotap_header; - iterator->max_length = le16_to_cpu (radiotap_header->it_len); - iterator->arg_index = 0; - iterator->bitmap_shifter = le32_to_cpu (radiotap_header->it_present); - iterator->arg = - ((u8 *) radiotap_header) + sizeof (struct ieee80211_radiotap_header); - iterator->this_arg = 0; - - /* find payload start allowing for extended bitmap(s) */ - - if (unlikely - (iterator->bitmap_shifter & IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK)) - { - while (le32_to_cpu (*((u32 *) iterator->arg)) & - IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK) - { - iterator->arg += sizeof (u32); - - /* - * check for insanity where the present bitmaps - * keep claiming to extend up to or even beyond the - * stated radiotap header length - */ - - if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) > - iterator->max_length) - return (-EINVAL); - - } - - iterator->arg += sizeof (u32); - - /* - * no need to check again for blowing past stated radiotap - * header length, becuase ieee80211_radiotap_iterator_next - * checks it before it is dereferenced - */ - - } - - /* we are all initialized happily */ - - return (0); -} - - -/** - * ieee80211_radiotap_iterator_next - return next radiotap parser iterator arg - * @iterator: radiotap_iterator to move to next arg (if any) - * - * Returns: next present arg index on success or negative if no more or error - * - * This function returns the next radiotap arg index (IEEE80211_RADIOTAP_...) - * and sets iterator->this_arg to point to the payload for the arg. It takes - * care of alignment handling and extended present fields. interator->this_arg - * can be changed by the caller. The args pointed to are in little-endian - * format. - */ - -int -ieee80211_radiotap_iterator_next (struct ieee80211_radiotap_iterator *iterator) -{ - - /* - * small length lookup table for all radiotap types we heard of - * starting from b0 in the bitmap, so we can walk the payload - * area of the radiotap header - * - * There is a requirement to pad args, so that args - * of a given length must begin at a boundary of that length - * -- but note that compound args are allowed (eg, 2 x u16 - * for IEEE80211_RADIOTAP_CHANNEL) so total arg length is not - * a reliable indicator of alignment requirement. - * - * upper nybble: content alignment for arg - * lower nybble: content length for arg - */ - - static const u8 rt_sizes[] = { - [IEEE80211_RADIOTAP_TSFT] = 0x88, - [IEEE80211_RADIOTAP_FLAGS] = 0x11, - [IEEE80211_RADIOTAP_RATE] = 0x11, - [IEEE80211_RADIOTAP_CHANNEL] = 0x24, - [IEEE80211_RADIOTAP_FHSS] = 0x22, - [IEEE80211_RADIOTAP_DBM_ANTSIGNAL] = 0x11, - [IEEE80211_RADIOTAP_DBM_ANTNOISE] = 0x11, - [IEEE80211_RADIOTAP_LOCK_QUALITY] = 0x22, - [IEEE80211_RADIOTAP_TX_ATTENUATION] = 0x22, - [IEEE80211_RADIOTAP_DB_TX_ATTENUATION] = 0x22, - [IEEE80211_RADIOTAP_DBM_TX_POWER] = 0x11, - [IEEE80211_RADIOTAP_ANTENNA] = 0x11, - [IEEE80211_RADIOTAP_DB_ANTSIGNAL] = 0x11, - [IEEE80211_RADIOTAP_DB_ANTNOISE] = 0x11, - [IEEE80211_RADIOTAP_TX_FLAGS] = 0x22, - [IEEE80211_RADIOTAP_RX_FLAGS] = 0x22, - [IEEE80211_RADIOTAP_RTS_RETRIES] = 0x11, - [IEEE80211_RADIOTAP_DATA_RETRIES] = 0x11 - /* - * add more here as they are defined in - * include/net/ieee80211_radiotap.h - */ - }; - - /* - * for every radiotap entry we can at - * least skip (by knowing the length)... - */ - - while (iterator->arg_index < (int) sizeof (rt_sizes)) - { - int hit = 0; - - if (!(iterator->bitmap_shifter & 1)) - goto next_entry; /* arg not present */ - - /* - * arg is present, account for alignment padding - * 8-bit args can be at any alignment - * 16-bit args must start on 16-bit boundary - * 32-bit args must start on 32-bit boundary - * 64-bit args must start on 64-bit boundary - * - * note that total arg size can differ from alignment of - * elements inside arg, so we use upper nybble of length - * table to base alignment on - * - * also note: these alignments are ** relative to the - * start of the radiotap header **. There is no guarantee - * that the radiotap header itself is aligned on any - * kind of boundary. - */ - - if ((((void *) iterator->arg) - - ((void *) iterator->rtheader)) & ((rt_sizes[iterator->arg_index] >> 4) - - 1)) - iterator->arg_index += - (rt_sizes[iterator->arg_index] >> 4) - - ((((void *) iterator->arg) - - ((void *) iterator->rtheader)) & ((rt_sizes[iterator->arg_index] >> - 4) - 1)); - - /* - * this is what we will return to user, but we need to - * move on first so next call has something fresh to test - */ - - iterator->this_arg_index = iterator->arg_index; - iterator->this_arg = iterator->arg; - hit = 1; - - /* internally move on the size of this arg */ - - iterator->arg += rt_sizes[iterator->arg_index] & 0x0f; - - /* - * check for insanity where we are given a bitmap that - * claims to have more arg content than the length of the - * radiotap section. We will normally end up equalling this - * max_length on the last arg, never exceeding it. - */ - - if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) > - iterator->max_length) - return (-EINVAL); - -next_entry: - - iterator->arg_index++; - if (unlikely ((iterator->arg_index & 31) == 0)) - { - /* completed current u32 bitmap */ - if (iterator->bitmap_shifter & 1) - { - /* b31 was set, there is more */ - /* move to next u32 bitmap */ - iterator->bitmap_shifter = le32_to_cpu (*iterator->next_bitmap); - iterator->next_bitmap++; - } - else - { - /* no more bitmaps: end */ - iterator->arg_index = sizeof (rt_sizes); - } - } - else - { /* just try the next bit */ - iterator->bitmap_shifter >>= 1; - } - - /* if we found a valid arg earlier, return it now */ - - if (hit) - return (iterator->this_arg_index); - - } - - /* we don't know how to handle any more args, we're done */ - - return (-1); -} diff --git a/src/transport/wlan/radiotap-parser.h b/src/transport/wlan/radiotap-parser.h deleted file mode 100644 index 6c88175ec..000000000 --- a/src/transport/wlan/radiotap-parser.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2007, 2008, Andy Green - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - - -#define __user -#include "byteorder.h" -#include - -typedef uint64_t u64; -typedef uint32_t u32; -typedef uint16_t u16; -typedef uint8_t u8; - -#ifndef unlikely -#define unlikely(x) (x) -#endif - -#include "ieee80211_radiotap.h" - - -/* - * Radiotap header iteration - * implemented in src/radiotap-parser.c - * - * call __ieee80211_radiotap_iterator_init() to init a semi-opaque iterator - * struct ieee80211_radiotap_iterator (no need to init the struct beforehand) - * then loop calling __ieee80211_radiotap_iterator_next()... it returns -1 - * if there are no more args in the header, or the next argument type index - * that is present. The iterator's this_arg member points to the start of the - * argument associated with the current argument index that is present, - * which can be found in the iterator's this_arg_index member. This arg - * index corresponds to the IEEE80211_RADIOTAP_... defines. - */ -/** - * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args - * @rtheader: pointer to the radiotap header we are walking through - * @max_length: length of radiotap header in cpu byte ordering - * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg - * @this_arg: pointer to current radiotap arg - * @arg_index: internal next argument index - * @arg: internal next argument pointer - * @next_bitmap: internal pointer to next present u32 - * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present - */ - -struct ieee80211_radiotap_iterator -{ - struct ieee80211_radiotap_header *rtheader; - int max_length; - int this_arg_index; - u8 *this_arg; - - int arg_index; - u8 *arg; - u32 *next_bitmap; - u32 bitmap_shifter; -}; - -int -ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator *iterator, - struct ieee80211_radiotap_header - *radiotap_header, int max_length); - -int -ieee80211_radiotap_iterator_next (struct ieee80211_radiotap_iterator *iterator); -- 2.25.1