#ifndef _IEEE802_11_H #define _IEEE802_11_H #define IEEE802_11_DATA_LEN 2304 /* Actually, the standard seems to be inconsistent about what the maximum frame size really is. Section 6.2.1.1.2 says 2304 octets, but the figure in Section 7.1.2 says 2312 octects. */ #define IEEE802_11_HLEN 30 #define IEEE802_11_FRAME_LEN (IEEE802_11_DATA_LEN + IEEE802_11_HLEN) struct ieee802_11_hdr { u16 frame_ctl; u16 duration_id; u8 addr1[ETH_ALEN]; u8 addr2[ETH_ALEN]; u8 addr3[ETH_ALEN]; u16 seq_ctl; u8 addr4[ETH_ALEN]; } __attribute__ ((packed)); /* defines for information element coding: 1 byte ID, 1 byte length of information field, n bytes information field (see 7.3.2 in [1]) */ #define IE_ID_SSID 0 /* length 0 - 32 */ #define IE_ID_SUPPORTED_RATES 1 #define IE_ID_DS_PARAM_SET 3 #define IE_ID_CF_PARAM_SET 4 #define IE_ID_TIM 5 #define IE_ID_IBSS_PARAM_SET 6 #define IE_ID_CHALLENGE_TEXT 16 #if defined(__LITTLE_ENDIAN) /* Frame control field constants */ #define IEEE802_11_FCTL_VERS 0x0002 #define IEEE802_11_FCTL_FTYPE 0x000c #define IEEE802_11_FCTL_STYPE 0x00f0 #define IEEE802_11_FCTL_TODS 0x0100 #define IEEE802_11_FCTL_FROMDS 0x0200 #define IEEE802_11_FCTL_MOREFRAGS 0x0400 #define IEEE802_11_FCTL_RETRY 0x0800 #define IEEE802_11_FCTL_PM 0x1000 #define IEEE802_11_FCTL_MOREDATA 0x2000 #define IEEE802_11_FCTL_WEP 0x4000 #define IEEE802_11_FCTL_ORDER 0x8000 #define IEEE802_11_FTYPE_MGMT 0x0000 #define IEEE802_11_FTYPE_CTL 0x0004 #define IEEE802_11_FTYPE_DATA 0x0008 /* management */ #define IEEE802_11_STYPE_ASSOC_REQ 0x0000 #define IEEE802_11_STYPE_ASSOC_RESP 0x0010 #define IEEE802_11_STYPE_REASSOC_REQ 0x0020 #define IEEE802_11_STYPE_REASSOC_RESP 0x0030 #define IEEE802_11_STYPE_PROBE_REQ 0x0040 #define IEEE802_11_STYPE_PROBE_RESP 0x0050 #define IEEE802_11_STYPE_BEACON 0x0080 #define IEEE802_11_STYPE_ATIM 0x0090 #define IEEE802_11_STYPE_DISASSOC 0x00A0 #define IEEE802_11_STYPE_AUTH 0x00B0 #define IEEE802_11_STYPE_DEAUTH 0x00C0 /* control */ #define IEEE802_11_STYPE_PSPOLL 0x00A0 #define IEEE802_11_STYPE_RTS 0x00B0 #define IEEE802_11_STYPE_CTS 0x00C0 #define IEEE802_11_STYPE_ACK 0x00D0 #define IEEE802_11_STYPE_CFEND 0x00E0 #define IEEE802_11_STYPE_CFENDACK 0x00F0 /* data */ #define IEEE802_11_STYPE_DATA 0x0000 #define IEEE802_11_STYPE_DATA_CFACK 0x0010 #define IEEE802_11_STYPE_DATA_CFPOLL 0x0020 #define IEEE802_11_STYPE_DATA_CFACKPOLL 0x0030 #define IEEE802_11_STYPE_NULLFUNC 0x0040 #define IEEE802_11_STYPE_CFACK 0x0050 #define IEEE802_11_STYPE_CFPOLL 0x0060 #define IEEE802_11_STYPE_CFACKPOLL 0x0070 #define IEEE802_11_SCTL_FRAG 0x000F #define IEEE802_11_SCTL_SEQ 0xFFF0 /* capability field in beacon, (re)assocReq */ #define IEEE802_11_CAPA_ESS 0x0001 #define IEEE802_11_CAPA_IBSS 0x0002 #define IEEE802_11_CAPA_CF_POLLABLE 0x0004 #define IEEE802_11_CAPA_POLL_REQ 0x0008 #define IEEE802_11_CAPA_PRIVACY 0x0010 #define IEEE802_11_CAPA_SHORT_PREAMBLE 0x0020 /* auth frame: algorithm type */ #define IEEE802_11_AUTH_ALG_OPEN_SYSTEM 0x0000 #define IEEE802_11_AUTH_ALG_SHARED_SECRET 0x0001 /* disassoc/deauth frame: reason codes (see 802.11, ch. 7.3.1.7, table 18) */ #define IEEE802_11_REASON_UNSPECIFIED 0x0001 #define IEEE802_11_REASON_PREV_AUTH_INVALID 0x0002 #define IEEE802_11_REASON_DEAUTH_LEAVING 0x0003 #define IEEE802_11_REASON_DISASS_INACTIVITY 0x0004 #define IEEE802_11_REASON_DISASS_TOO_MANY_STA 0x0005 #define IEEE802_11_REASON_CL2_FROM_NONAUTH 0x0006 #define IEEE802_11_REASON_CL3_FROM_NONASSOC 0x0007 #define IEEE802_11_REASON_DISASS_LEAVING 0x0008 #define IEEE802_11_REASON_NOT_AUTH 0x0009 /* status in some response frames (802.11, ch. 7.3.1.9, table 19) */ #define IEEE802_11_STATUS_SUCCESS 0x0000 #define IEEE802_11_STATUS_UNSPECIFIED 0x0001 #define IEEE802_11_STATUS_UNSUPP_CAPABILITIES 0x000a #define IEEE802_11_STATUS_NO_PREV_ASSOC 0x000b #define IEEE802_11_STATUS_ASSOC_FAILED 0x000c #define IEEE802_11_STATUS_UNSUPP_AUTH_ALG 0x000d #define IEEE802_11_STATUS_AUTH_INV_TRANS_SEQ 0x000e #define IEEE802_11_STATUS_AUTH_CHALLENGE_FAIL 0x000f #define IEEE802_11_STATUS_AUTH_TIMEOUT 0x0010 #define IEEE802_11_STATUS_ASSOC_TOO_MANY_STA 0x0011 #define IEEE802_11_STATUS_BASIC_RATE_SET 0x0012 #else /* defined(__LITTLE_ENDIAN) */ /* Frame control field constants */ #define IEEE802_11_FCTL_VERS 0x0200 #define IEEE802_11_FCTL_FTYPE 0x0c00 #define IEEE802_11_FCTL_STYPE 0xf000 #define IEEE802_11_FCTL_TODS 0x0001 #define IEEE802_11_FCTL_FROMDS 0x0002 #define IEEE802_11_FCTL_MOREFRAGS 0x0004 #define IEEE802_11_FCTL_RETRY 0x0008 #define IEEE802_11_FCTL_PM 0x0010 #define IEEE802_11_FCTL_MOREDATA 0x0020 #define IEEE802_11_FCTL_WEP 0x0040 #define IEEE802_11_FCTL_ORDER 0x0080 #define IEEE802_11_FTYPE_MGMT 0x0000 #define IEEE802_11_FTYPE_CTL 0x0400 #define IEEE802_11_FTYPE_DATA 0x0800 /* management */ #define IEEE802_11_STYPE_ASSOC_REQ 0x0000 #define IEEE802_11_STYPE_ASSOC_RESP 0x1000 #define IEEE802_11_STYPE_REASSOC_REQ 0x2000 #define IEEE802_11_STYPE_REASSOC_RESP 0x3000 #define IEEE802_11_STYPE_PROBE_REQ 0x4000 #define IEEE802_11_STYPE_PROBE_RESP 0x5000 #define IEEE802_11_STYPE_BEACON 0x8000 #define IEEE802_11_STYPE_ATIM 0x9000 #define IEEE802_11_STYPE_DISASSOC 0xA000 #define IEEE802_11_STYPE_AUTH 0xB000 #define IEEE802_11_STYPE_DEAUTH 0xC000 /* control */ #define IEEE802_11_STYPE_PSPOLL 0xA000 #define IEEE802_11_STYPE_RTS 0xB000 #define IEEE802_11_STYPE_CTS 0xC000 #define IEEE802_11_STYPE_ACK 0xD000 #define IEEE802_11_STYPE_CFEND 0xE000 #define IEEE802_11_STYPE_CFENDACK 0xF000 /* data */ #define IEEE802_11_STYPE_DATA 0x0000 #define IEEE802_11_STYPE_DATA_CFACK 0x1000 #define IEEE802_11_STYPE_DATA_CFPOLL 0x2000 #define IEEE802_11_STYPE_DATA_CFACKPOLL 0x3000 #define IEEE802_11_STYPE_NULLFUNC 0x4000 #define IEEE802_11_STYPE_CFACK 0x5000 #define IEEE802_11_STYPE_CFPOLL 0x6000 #define IEEE802_11_STYPE_CFACKPOLL 0x7000 #define IEEE802_11_SCTL_FRAG 0x0F00 #define IEEE802_11_SCTL_SEQ 0xF0FF /* capability field in beacon, (re)assocReq */ #define IEEE802_11_CAPA_ESS 0x0100 #define IEEE802_11_CAPA_IBSS 0x0200 #define IEEE802_11_CAPA_CF_POLLABLE 0x0400 #define IEEE802_11_CAPA_POLL_REQ 0x0800 #define IEEE802_11_CAPA_PRIVACY 0x1000 #define IEEE802_11_CAPA_SHORT_PREAMBLE 0x2000 /* auth frame: algorithm type */ #define IEEE802_11_AUTH_ALG_OPEN_SYSTEM 0x0000 #define IEEE802_11_AUTH_ALG_SHARED_SECRET 0x0100 /* disassoc/deauth frame: reason codes (see 802.11, ch. 7.3.1.7, table 18) */ #define IEEE802_11_REASON_UNSPECIFIED 0x0100 #define IEEE802_11_REASON_PREV_AUTH_INVALID 0x0200 #define IEEE802_11_REASON_DEAUTH_LEAVING 0x0300 #define IEEE802_11_REASON_DISASS_INACTIVITY 0x0400 #define IEEE802_11_REASON_DISASS_TOO_MANY_STA 0x0500 #define IEEE802_11_REASON_CL2_FROM_NONAUTH 0x0600 #define IEEE802_11_REASON_CL3_FROM_NONASSOC 0x0700 #define IEEE802_11_REASON_DISASS_LEAVING 0x0800 #define IEEE802_11_REASON_NOT_AUTH 0x0900 /* status in some response frames (802.11, ch. 7.3.1.9, table 19) */ #define IEEE802_11_STATUS_SUCCESS 0x0000 #define IEEE802_11_STATUS_UNSPECIFIED 0x0100 #define IEEE802_11_STATUS_UNSUPP_CAPABILITIES 0x0a00 #define IEEE802_11_STATUS_NO_PREV_ASSOC 0x0b00 #define IEEE802_11_STATUS_ASSOC_FAILED 0x0c00 #define IEEE802_11_STATUS_UNSUPP_AUTH_ALG 0x0d00 #define IEEE802_11_STATUS_AUTH_INV_TRANS_SEQ 0x0e00 #define IEEE802_11_STATUS_AUTH_CHALLENGE_FAIL 0x0f00 #define IEEE802_11_STATUS_AUTH_TIMEOUT 0x1000 #define IEEE802_11_STATUS_ASSOC_TOO_MANY_STA 0x1100 #define IEEE802_11_STATUS_BASIC_RATE_SET 0x1200 #endif #endif /* _IEEE802_11_H */