📄 ieee80211.h
字号:
/* * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11 * remains copyright by the original authors * * Portions of the merged code are based on Host AP (software wireless * LAN access point) driver for Intersil Prism2/2.5/3. * * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen * <jkmaline@cc.hut.fi> * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> * * Adaption to a generic IEEE 802.11 stack by James Ketrenos * <jketreno@linux.intel.com> * Copyright (c) 2004-2005, Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. See README and COPYING for * more details. * * API Version History * 1.0.x -- Initial version * 1.1.x -- Added radiotap, QoS, TIM, ieee80211_geo APIs, * various structure changes, and crypto API init method */#ifndef IEEE80211_H#define IEEE80211_H#include <linux/if_ether.h> /* ETH_ALEN */#include <linux/kernel.h> /* ARRAY_SIZE */#include <linux/wireless.h>#if WIRELESS_EXT < 17#define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */#define IW_QUAL_LEVEL_UPDATED 0x02#define IW_QUAL_NOISE_UPDATED 0x04#define IW_QUAL_ALL_UPDATED 0x07#define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */#define IW_QUAL_LEVEL_INVALID 0x20#define IW_QUAL_NOISE_INVALID 0x40#define IW_QUAL_ALL_INVALID 0x70#endif#if WIRELESS_EXT < 19#define IW_QUAL_DBM 0x08 /* Level + Noise are dBm */#endif#define IEEE80211_VERSION "1.1.6"#define IEEE80211_DATA_LEN 2304/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 6.2.1.1.2. The figure in section 7.1.2 suggests a body size of up to 2312 bytes is allowed, which is a bit confusing, I suspect this represents the 2304 bytes of real data, plus a possible 8 bytes of WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */#define IEEE80211_1ADDR_LEN 10#define IEEE80211_2ADDR_LEN 16#define IEEE80211_3ADDR_LEN 24#define IEEE80211_4ADDR_LEN 30#define IEEE80211_FCS_LEN 4#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)#define MIN_FRAG_THRESHOLD 256U#define MAX_FRAG_THRESHOLD 2346U/* Frame control field constants */#define IEEE80211_FCTL_VERS 0x0003#define IEEE80211_FCTL_FTYPE 0x000c#define IEEE80211_FCTL_STYPE 0x00f0#define IEEE80211_FCTL_TODS 0x0100#define IEEE80211_FCTL_FROMDS 0x0200#define IEEE80211_FCTL_MOREFRAGS 0x0400#define IEEE80211_FCTL_RETRY 0x0800#define IEEE80211_FCTL_PM 0x1000#define IEEE80211_FCTL_MOREDATA 0x2000#define IEEE80211_FCTL_PROTECTED 0x4000#define IEEE80211_FCTL_ORDER 0x8000#define IEEE80211_FTYPE_MGMT 0x0000#define IEEE80211_FTYPE_CTL 0x0004#define IEEE80211_FTYPE_DATA 0x0008/* management */#define IEEE80211_STYPE_ASSOC_REQ 0x0000#define IEEE80211_STYPE_ASSOC_RESP 0x0010#define IEEE80211_STYPE_REASSOC_REQ 0x0020#define IEEE80211_STYPE_REASSOC_RESP 0x0030#define IEEE80211_STYPE_PROBE_REQ 0x0040#define IEEE80211_STYPE_PROBE_RESP 0x0050#define IEEE80211_STYPE_BEACON 0x0080#define IEEE80211_STYPE_ATIM 0x0090#define IEEE80211_STYPE_DISASSOC 0x00A0#define IEEE80211_STYPE_AUTH 0x00B0#define IEEE80211_STYPE_DEAUTH 0x00C0#define IEEE80211_STYPE_ACTION 0x00D0/* control */#define IEEE80211_STYPE_PSPOLL 0x00A0#define IEEE80211_STYPE_RTS 0x00B0#define IEEE80211_STYPE_CTS 0x00C0#define IEEE80211_STYPE_ACK 0x00D0#define IEEE80211_STYPE_CFEND 0x00E0#define IEEE80211_STYPE_CFENDACK 0x00F0/* data */#define IEEE80211_STYPE_DATA 0x0000#define IEEE80211_STYPE_DATA_CFACK 0x0010#define IEEE80211_STYPE_DATA_CFPOLL 0x0020#define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030#define IEEE80211_STYPE_NULLFUNC 0x0040#define IEEE80211_STYPE_CFACK 0x0050#define IEEE80211_STYPE_CFPOLL 0x0060#define IEEE80211_STYPE_CFACKPOLL 0x0070#define IEEE80211_STYPE_QOS_DATA 0x0080#define IEEE80211_SCTL_FRAG 0x000F#define IEEE80211_SCTL_SEQ 0xFFF0/* debug macros */#ifdef CONFIG_IEEE80211_DEBUGextern u32 ieee80211_debug_level;#define IEEE80211_DEBUG(level, fmt, args...) \do { if (ieee80211_debug_level & (level)) \ printk(KERN_DEBUG "ieee80211: %c %s " fmt, \ in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)#else#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)#endif /* CONFIG_IEEE80211_DEBUG *//* debug macros not dependent on CONFIG_IEEE80211_DEBUG */#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]/* escape_essid() is intended to be used in debug (and possibly error) * messages. It should never be used for passing essid to user space. */const char *escape_essid(const char *essid, u8 essid_len);/* * To use the debug system: * * If you are defining a new debug classification, simply add it to the #define * list here in the form of: * * #define IEEE80211_DL_xxxx VALUE * * shifting value to the left one bit from the previous entry. xxxx should be * the name of the classification (for example, WEP) * * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want * to send output to that classification. * * To add your debug level to the list of levels seen when you perform * * % cat /proc/net/ieee80211/debug_level * * you simply need to add your entry to the ieee80211_debug_level array. * * If you do not see debug_level in /proc/net/ieee80211 then you do not have * CONFIG_IEEE80211_DEBUG defined in your kernel configuration * */#define IEEE80211_DL_INFO (1<<0)#define IEEE80211_DL_WX (1<<1)#define IEEE80211_DL_SCAN (1<<2)#define IEEE80211_DL_STATE (1<<3)#define IEEE80211_DL_MGMT (1<<4)#define IEEE80211_DL_FRAG (1<<5)#define IEEE80211_DL_DROP (1<<7)#define IEEE80211_DL_TX (1<<8)#define IEEE80211_DL_RX (1<<9)#define IEEE80211_DL_QOS (1<<31)#define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a)#define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a)#define IEEE80211_DEBUG_INFO(f, a...) IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a)#define IEEE80211_DEBUG_WX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a)#define IEEE80211_DEBUG_SCAN(f, a...) IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a)#define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a)#define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a)#define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a)#define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a)#define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a)#define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a)#define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a)#include <linux/netdevice.h>#include <linux/wireless.h>#include <linux/if_arp.h> /* ARPHRD_ETHER */#ifndef WIRELESS_SPY#define WIRELESS_SPY /* enable iwspy support */#endif#include <net/iw_handler.h> /* new driver API */#ifndef ETH_P_PAE#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */#endif /* ETH_P_PAE */#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */#ifndef ETH_P_80211_RAW#define ETH_P_80211_RAW (ETH_P_ECONET + 1)#endif/* IEEE 802.11 defines */#define P80211_OUI_LEN 3struct ieee80211_snap_hdr { u8 dsap; /* always 0xAA */ u8 ssap; /* always 0xAA */ u8 ctrl; /* always 0x03 */ u8 oui[P80211_OUI_LEN]; /* organizational universal id */} __attribute__ ((packed));#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)#define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS)#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)#define WLAN_GET_SEQ_SEQ(seq) ((seq) & IEEE80211_SCTL_SEQ)/* Authentication algorithms */#define WLAN_AUTH_OPEN 0#define WLAN_AUTH_SHARED_KEY 1#define WLAN_AUTH_CHALLENGE_LEN 128#define WLAN_CAPABILITY_ESS (1<<0)#define WLAN_CAPABILITY_IBSS (1<<1)#define WLAN_CAPABILITY_CF_POLLABLE (1<<2)#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)#define WLAN_CAPABILITY_PRIVACY (1<<4)#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)#define WLAN_CAPABILITY_PBCC (1<<6)#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)#define WLAN_CAPABILITY_QOS (1<<9)#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)/* Status codes */enum ieee80211_statuscode { WLAN_STATUS_SUCCESS = 0, WLAN_STATUS_UNSPECIFIED_FAILURE = 1, WLAN_STATUS_CAPS_UNSUPPORTED = 10, WLAN_STATUS_REASSOC_NO_ASSOC = 11, WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12, WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13, WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14, WLAN_STATUS_CHALLENGE_FAIL = 15, WLAN_STATUS_AUTH_TIMEOUT = 16, WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17, WLAN_STATUS_ASSOC_DENIED_RATES = 18, /* 802.11b */ WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19, WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20, WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21, /* 802.11h */ WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22, WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23, WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24, /* 802.11g */ WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, /* 802.11i */ WLAN_STATUS_INVALID_IE = 40, WLAN_STATUS_INVALID_GROUP_CIPHER = 41, WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42, WLAN_STATUS_INVALID_AKMP = 43, WLAN_STATUS_UNSUPP_RSN_VERSION = 44, WLAN_STATUS_INVALID_RSN_IE_CAP = 45, WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,};/* Reason codes */enum ieee80211_reasoncode { WLAN_REASON_UNSPECIFIED = 1, WLAN_REASON_PREV_AUTH_NOT_VALID = 2, WLAN_REASON_DEAUTH_LEAVING = 3, WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4, WLAN_REASON_DISASSOC_AP_BUSY = 5, WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7, WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8, WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9, /* 802.11h */ WLAN_REASON_DISASSOC_BAD_POWER = 10, WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11, /* 802.11i */ WLAN_REASON_INVALID_IE = 13, WLAN_REASON_MIC_FAILURE = 14, WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16, WLAN_REASON_IE_DIFFERENT = 17, WLAN_REASON_INVALID_GROUP_CIPHER = 18, WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19, WLAN_REASON_INVALID_AKMP = 20, WLAN_REASON_UNSUPP_RSN_VERSION = 21, WLAN_REASON_INVALID_RSN_IE_CAP = 22, WLAN_REASON_IEEE8021X_FAILED = 23, WLAN_REASON_CIPHER_SUITE_REJECTED = 24,};#define IEEE80211_STATMASK_SIGNAL (1<<0)#define IEEE80211_STATMASK_RSSI (1<<1)#define IEEE80211_STATMASK_NOISE (1<<2)#define IEEE80211_STATMASK_RATE (1<<3)#define IEEE80211_STATMASK_WEMASK 0x7#define IEEE80211_CCK_MODULATION (1<<0)#define IEEE80211_OFDM_MODULATION (1<<1)#define IEEE80211_24GHZ_BAND (1<<0)#define IEEE80211_52GHZ_BAND (1<<1)#define IEEE80211_CCK_RATE_1MB 0x02#define IEEE80211_CCK_RATE_2MB 0x04#define IEEE80211_CCK_RATE_5MB 0x0B#define IEEE80211_CCK_RATE_11MB 0x16#define IEEE80211_OFDM_RATE_6MB 0x0C#define IEEE80211_OFDM_RATE_9MB 0x12#define IEEE80211_OFDM_RATE_12MB 0x18#define IEEE80211_OFDM_RATE_18MB 0x24#define IEEE80211_OFDM_RATE_24MB 0x30#define IEEE80211_OFDM_RATE_36MB 0x48#define IEEE80211_OFDM_RATE_48MB 0x60#define IEEE80211_OFDM_RATE_54MB 0x6C#define IEEE80211_BASIC_RATE_MASK 0x80#define IEEE80211_CCK_RATE_1MB_MASK (1<<0)#define IEEE80211_CCK_RATE_2MB_MASK (1<<1)#define IEEE80211_CCK_RATE_5MB_MASK (1<<2)#define IEEE80211_CCK_RATE_11MB_MASK (1<<3)#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)#define IEEE80211_CCK_RATES_MASK 0x0000000F#define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ IEEE80211_CCK_RATE_2MB_MASK)#define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ IEEE80211_CCK_RATE_5MB_MASK | \ IEEE80211_CCK_RATE_11MB_MASK)#define IEEE80211_OFDM_RATES_MASK 0x00000FF0#define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ IEEE80211_OFDM_RATE_12MB_MASK | \ IEEE80211_OFDM_RATE_24MB_MASK)#define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \ IEEE80211_OFDM_RATE_9MB_MASK | \ IEEE80211_OFDM_RATE_18MB_MASK | \ IEEE80211_OFDM_RATE_36MB_MASK | \ IEEE80211_OFDM_RATE_48MB_MASK | \ IEEE80211_OFDM_RATE_54MB_MASK)#define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ IEEE80211_CCK_DEFAULT_RATES_MASK)#define IEEE80211_NUM_OFDM_RATES 8#define IEEE80211_NUM_CCK_RATES 4#define IEEE80211_OFDM_SHIFT_MASK_A 4/* NOTE: This data is for statistical purposes; not all hardware provides this * information for frames received. Not setting these will not cause * any adverse affects. */struct ieee80211_rx_stats { u32 mac_time; s8 rssi; u8 signal; u8 noise; u16 rate; /* in 100 kbps */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -