📄 dot11lib.h
字号:
/* Max number of associations to an AP */#define DOT11_MAX_ASSOC 59 /* These definitions are used with WIOCSDOT1XPORTSTATE */#define DOT11_DOT1XPORT_UNCONTROLLED 0#define DOT11_DOT1XPORT_CLOSED 1#define DOT11_DOT1XPORT_OPEN 2/* The maximum association ID is limited by the fact that there are only 14bits available in the field to use */#define DOT11_MAX_AID ((1 << 14) - 1) /* The time that a STA waits for a response on each channel when doing an active scan */#define DOT11_SCAN_ACTIVE_DWELL_TIME ((sysClkRateGet() / 50) + 1) /* The time that a STA listens for beacons on each channel when doing a passive scan */#define DOT11_SCAN_PASSIVE_DWELL_TIME (sysClkRateGet() * 2 / 5) /* 400 ms *//* The beacon response time is the amount of time it takes the beacon to gofrom the tranmitter to the beacon receive routine. This time is measured in 802.11 time units. */#define DOT11_BEACON_RESP_TIME 1/* The default DTIM time is the default number of beacons between DTIMS */#define DOT11_DEFAULT_DTIM_PERIOD 2/* The following definitions control the behaviour of the transmit queue */#define DOT11_TX_SEM_WAIT 30 /* ticks */#define DOT11_TX_QUEUE_LIFETIME 90 /* ticks *//* A magic number used to represent the "ANY" SSID */#define DOT11_SSID_NONE ((char)-1)/* The size of an OUI = 3 bytes */#define DOT11_OUI_SIZE 3/* A macro to convert between timestamps and times in 802.11 timeunits (1024 us). This macro assumes the parameter is a DOT11_TIMESTAMP. */#define DOT11_TSF_TO_TU(tsf) ((tsf.low >> 10) | (tsf.high << 22))/***************************************************************************//* IEEE 802.11 Header Information *//***************************************************************************//* This is the header for a standard packet (no WDS). What follows depends onthe specific type of the packet, as detailed in the frame control header */typedef struct { UINT16 frameCtrl; UINT16 duration; UINT8 addr1[DOT11_ADDR_LEN]; UINT8 addr2[DOT11_ADDR_LEN]; UINT8 addr3[DOT11_ADDR_LEN]; UINT16 seqCtrl; } _WRS_PACK_ALIGN(1) DOT11_HEADER;/* Fields in the Frame Control Header */#define DOT11_FCTL_VERSION_MASK 0x0003#define DOT11_FCTL_VERSION_SHIFT _BIT(0)#define DOT11_FCTL_TYPE_MASK 0x000C#define DOT11_FCTL_TYPE_SHIFT _BIT(2)#define DOT11_FCTL_SUBTYPE_MASK 0x00F0#define DOT11_FCTL_SUBTYPE_SHIFT _BIT(4)#define DOT11_FCTL_TO_DS _BIT(8)#define DOT11_FCTL_FROM_DS _BIT(9)#define DOT11_FCTL_MORE_FRAG _BIT(10)#define DOT11_FCTL_RETRY _BIT(11)#define DOT11_FCTL_PM _BIT(12)#define DOT11_FCTL_MORE_DATA _BIT(13)#define DOT11_FCTL_WEP _BIT(14)#define DOT11_FCTL_ORDER _BIT(15)/* Frame types */#define DOT11_FTYPE_DATA 0x8#define DOT11_FTYPE_MGMT 0x0#define DOT11_FTYPE_CTRL 0x4/* Frame subtypes */#define DOT11_STYPE_ASSOC_REQ 0x00#define DOT11_STYPE_ASSOC_RESP 0x10#define DOT11_STYPE_REASSOC_REQ 0x20#define DOT11_STYPE_REASSOC_RESP 0x30#define DOT11_STYPE_PROBE_REQ 0x40#define DOT11_STYPE_PROBE_RESP 0x50#define DOT11_STYPE_BEACON 0x80#define DOT11_STYPE_ATIM 0x90#define DOT11_STYPE_DISASSOC 0xa0#define DOT11_STYPE_AUTH 0xb0#define DOT11_STYPE_DEAUTH 0xc0#define DOT11_STYPE_PS_POLL 0xa0#define DOT11_STYPE_RTS 0xb0#define DOT11_STYPE_CTS 0xc0#define DOT11_STYPE_ACK 0xd0#define DOT11_STYPE_DATA 0x00#define DOT11_STYPE_DATA_NULL 0x40/* The DOT11_FTYPE macro masks off the frame type and subtype portions of theframe control header, which is passed in */#define DOT11_FTYPE(frameCtrl) ((frameCtrl) & (DOT11_FCTL_TYPE_MASK | \ DOT11_FCTL_SUBTYPE_MASK))/* Merged subtypes and types used with DOT11_FTYPE macro */#define DOT11_TYPE_ASSOC_REQ 0x00#define DOT11_TYPE_ASSOC_RESP 0x10#define DOT11_TYPE_REASSOC_REQ 0x20#define DOT11_TYPE_REASSOC_RESP 0x30#define DOT11_TYPE_PROBE_REQ 0x40#define DOT11_TYPE_PROBE_RESP 0x50#define DOT11_TYPE_BEACON 0x80#define DOT11_TYPE_ATIM 0x90#define DOT11_TYPE_DISASSOC 0xa0#define DOT11_TYPE_AUTH 0xb0#define DOT11_TYPE_DEAUTH 0xc0#define DOT11_TYPE_PS_POLL 0xa4#define DOT11_TYPE_RTS 0xb4#define DOT11_TYPE_CTS 0xc4#define DOT11_TYPE_ACK 0xd4#define DOT11_TYPE_DATA 0x08#define DOT11_TYPE_DATA_NULL 0x48/* The RX MAP is passed to the HDD as an array of 64 function pointers. */#define DOT11_RX_MAP_NUM 64/* This is a macro that gives an RX MAP index given the frame control header*/#define DOT11_FCTL_TO_RXMAP_INDEX(x) (((x) & 0xfc) >> 2)#define DOT11_RXMAP_ASSOC_REQ DOT11_FCTL_TO_RXMAP_INDEX(0x00)#define DOT11_RXMAP_ASSOC_RESP DOT11_FCTL_TO_RXMAP_INDEX(0x10)#define DOT11_RXMAP_REASSOC_REQ DOT11_FCTL_TO_RXMAP_INDEX(0x20)#define DOT11_RXMAP_REASSOC_RESP DOT11_FCTL_TO_RXMAP_INDEX(0x30)#define DOT11_RXMAP_PROBE_REQ DOT11_FCTL_TO_RXMAP_INDEX(0x40)#define DOT11_RXMAP_PROBE_RESP DOT11_FCTL_TO_RXMAP_INDEX(0x50)#define DOT11_RXMAP_BEACON DOT11_FCTL_TO_RXMAP_INDEX(0x80)#define DOT11_RXMAP_ATIM DOT11_FCTL_TO_RXMAP_INDEX(0x90)#define DOT11_RXMAP_DISASSOC DOT11_FCTL_TO_RXMAP_INDEX(0xa0)#define DOT11_RXMAP_AUTH DOT11_FCTL_TO_RXMAP_INDEX(0xb0)#define DOT11_RXMAP_DEAUTH DOT11_FCTL_TO_RXMAP_INDEX(0xc0)#define DOT11_RXMAP_PSPOLL DOT11_FCTL_TO_RXMAP_INDEX(0xa4)#define DOT11_RXMAP_RTS DOT11_FCTL_TO_RXMAP_INDEX(0xb4)#define DOT11_RXMAP_CTS DOT11_FCTL_TO_RXMAP_INDEX(0xc4)#define DOT11_RXMAP_ACK DOT11_FCTL_TO_RXMAP_INDEX(0xd4)#define DOT11_RXMAP_CFEND DOT11_FCTL_TO_RXMAP_INDEX(0xe4)#define DOT11_RXMAP_CFENDACK DOT11_FCTL_TO_RXMAP_INDEX(0xf4)#define DOT11_RXMAP_DATA DOT11_FCTL_TO_RXMAP_INDEX(0x08)#define DOT11_RXMAP_DATA_CFACK DOT11_FCTL_TO_RXMAP_INDEX(0x18)#define DOT11_RXMAP_DATA_CFPOLL DOT11_FCTL_TO_RXMAP_INDEX(0x28)#define DOT11_RXMAP_DATA_CFACKPOLL DOT11_FCTL_TO_RXMAP_INDEX(0x38)#define DOT11_RXMAP_DATA_NULL DOT11_FCTL_TO_RXMAP_INDEX(0x48)#define DOT11_RXMAP_CF_ACK DOT11_FCTL_TO_RXMAP_INDEX(0x58)#define DOT11_RXMAP_CF_POLL DOT11_FCTL_TO_RXMAP_INDEX(0x68)#define DOT11_RXMAP_CF_ACK_POLL DOT11_FCTL_TO_RXMAP_INDEX(0x78)/* The mask to get fragment number from the seqctl field */#define DOT11_SEQCTL_FRAGNUM 0x000f#define DOT11_SEQCTL_SEQ 0xfff0#define DOT11_WEP_IV_SIZE 4#define DOT11_WEP_EXT_IV_SIZE 4#define DOT11_EXT_IV _BIT(5)#define DOT11_WEP_ICV_SIZE 4#define DOT11_MIC_LEN 8typedef struct { UINT32 low; UINT32 high; } DOT11_TIMESTAMP;typedef UINT16 DOT11_FCTL;typedef UINT16 DOT11_DURATION;typedef UINT16 DOT11_BEACON_RATE;typedef UINT16 DOT11_LISTEN_INT;typedef UINT16 DOT11_STATUS;typedef UINT16 DOT11_AID;/* Mask to get the AID out of the AID field - bits 14 and 15 are always set */#define DOT11_AID_MASK 0x3fff#define DOT11_AID_MASK_POS 0xc000/* These are definitions for the element IDs found in Information Elementfields in Management Frames as per 7.3.2 of IEEE 802.11(2003) */#define DOT11_ELEMID_SSID 0#define DOT11_ELEMID_SUPP_RATES 1#define DOT11_ELEMID_FH_PARAM 2#define DOT11_ELEMID_DS_PARAM 3#define DOT11_ELEMID_CF_PARAM 4#define DOT11_ELEMID_TIM 5#define DOT11_ELEMID_IBSS 6#define DOT11_ELEMID_COUNTRY 7#define DOT11_ELEMID_HOP_PARAM 8#define DOT11_ELEMID_HOP_TABLE 9#define DOT11_ELEMID_REQUEST 10#define DOT11_ELEMID_CHALLENGE 16#define DOT11_ELEMID_CHALLENGE_EXT 17#define DOT11_ELEMID_ERP 42#define DOT11_ELEMID_RSN 48#define DOT11_ELEMID_EXT_RATES 50#define DOT11_ELEMID_WPA 221#define DOT11_ELEMID_KDE 221 /* Yes - the same as WPA *//* These are the possible STATUS codes that can be returned in an Auth or Assoc Rsp frame */#define DOT11_STATUS_OK 0#define DOT11_STATUS_FAIL 1#define DOT11_STATUS_CAP_UNSUPPORT 10#define DOT11_STATUS_NO_ASSOC 11#define DOT11_STATUS_ASSOC_DENIED 12#define DOT11_STATUS_AUTH_UNSUPPORT 13#define DOT11_STATUS_BAD_SEQ 14#define DOT11_STATUS_CHAL_FAIL 15#define DOT11_STATUS_TIMEOUT 16#define DOT11_STATUS_NO_MORE_ASSOC 17 #define DOT11_STATUS_RATE_UNSUPPORT 18#define DOT11_STATUS_INVALID_IE 40#define DOT11_STATUS_POLICY_REJECT 46/* These are the possible reason codes that can be used in a deauth / disassoc*/#define DOT11_REASON_UNSPECIFIED 1#define DOT11_REASON_NO_LONGER_VALID 2#define DOT11_REASON_DEAUTH_LEAVING 3#define DOT11_REASON_INACTIVITY 4#define DOT11_REASON_AP_FULL 5#define DOT11_REASON_NOT_AUTH 6#define DOT11_REASON_NOT_ASSOC 7#define DOT11_REASON_DISASSOC_LEAVING 8#define DOT11_REASON_ASSOC_NOT_AUTH 9#define DOT11_REASON_MIC_FAILURE 14#define DOT11_REASON_FOURWAY_TIMEOUT 15#define DOT11_AUTH_CHAL_MAX 253#define DOT11_AUTH_CHAL_SIZE 128#define DOT11_IE_HEADER_SIZE 2 /* size of the length and elementId */#define DOT11_IE_MAX_SIZE 255/*************************************************************************** DOT11_IE_GENERIC - A structure holding an information element of * indeterminate type***************************************************************************/typedef struct { UINT8 elementId; UINT8 length; UINT8 data[DOT11_IE_MAX_SIZE]; /* Arbitary amount of data - use ptr once typed */ } _WRS_PACK_ALIGN(1) DOT11_IE_GENERIC;/*************************************************************************** DOT11_IE_SSID - A structure holding the SSID Information Element. Note* that the ssid field may be up to 32 bytes long.***************************************************************************/typedef struct { UINT8 elementId; UINT8 length; char ssid[DOT11_SSID_LEN]; } _WRS_PACK_ALIGN(1) DOT11_IE_SSID;/*************************************************************************** DOT11_IE_CFP - PCF information element***************************************************************************/typedef struct { UINT8 elementId; UINT8 length; /* Should always be 6 */ UINT8 cfpCount; UINT8 cfpPeriod; UINT16 cfpMaxDuration; /* Maximum duration of CFP */ UINT16 cfpRemDuration; /* Duration left in current CFP */ } _WRS_PACK_ALIGN(1) DOT11_IE_CFP;/*************************************************************************** DOT11_IE_SUPP_RATES - The Supported Rates Information Element***************************************************************************/#define DOT11_IE_SUPP_RATES_MAX 8#define DOT11_RATE_MAX 8typedef struct { UINT8 elementId; UINT8 length; UINT8 rates[DOT11_IE_SUPP_RATES_MAX]; } _WRS_PACK_ALIGN(1) DOT11_IE_SUPP_RATES;/*************************************************************************** DOT11_IE_CHAL_TEXT - Challenge text for shared key authentication***************************************************************************/typedef struct { UINT8 elementId; UINT8 length; char chalText[DOT11_AUTH_CHAL_MAX]; } _WRS_PACK_ALIGN(1) DOT11_IE_CHAL_TEXT;/*************************************************************************** DOT11_IE_EXT_RATES - The Extended Rates Information Element***************************************************************************/#define DOT11_IE_EXT_RATES_MAX 253typedef struct { UINT8 elementId; UINT8 length; UINT8 rates[DOT11_IE_EXT_RATES_MAX]; } _WRS_PACK_ALIGN(1) DOT11_IE_EXT_RATES;/*************************************************************************** DOT11_IE_TIM - Traffic Indication Message IE***************************************************************************/#define DOT11_MAX_PVB 251 /* Maximum size of Partial Virtual Bm*/#define DOT11_TIM_TI 0x1 /* Traffic ind. bit in bmControl */#define DOT11_TIM_MIN_LEN 4 /* Length of empty TIM */#define DOT11_TIM_HDR_LEN 5 /* Length of TIM header */typedef struct { UINT8 elementId; UINT8 length; UINT8 dtimCount; UINT8 dtimPeriod; UINT8 bitmapCtrl; UINT8 pvb[DOT11_MAX_PVB]; } _WRS_PACK_ALIGN(1) DOT11_IE_TIM;/*************************************************************************** DOT11_IE_IBSS - IBSS parameters.***************************************************************************/typedef struct { UINT8 elementId; UINT8 length; UINT16 atimWindow; } _WRS_PACK_ALIGN(1) DOT11_IE_IBSS;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -