Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _IEEE802_11_H |
| 2 | #define _IEEE802_11_H |
| 3 | |
| 4 | #define IEEE802_11_DATA_LEN 2304 |
| 5 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section |
| 6 | 6.2.1.1.2. |
| 7 | |
| 8 | The figure in section 7.1.2 suggests a body size of up to 2312 |
| 9 | bytes is allowed, which is a bit confusing, I suspect this |
| 10 | represents the 2304 bytes of real data, plus a possible 8 bytes of |
| 11 | WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ |
| 12 | |
| 13 | |
| 14 | #define IEEE802_11_HLEN 30 |
| 15 | #define IEEE802_11_FRAME_LEN (IEEE802_11_DATA_LEN + IEEE802_11_HLEN) |
| 16 | |
| 17 | struct ieee802_11_hdr { |
| 18 | u16 frame_ctl; |
| 19 | u16 duration_id; |
| 20 | u8 addr1[ETH_ALEN]; |
| 21 | u8 addr2[ETH_ALEN]; |
| 22 | u8 addr3[ETH_ALEN]; |
| 23 | u16 seq_ctl; |
| 24 | u8 addr4[ETH_ALEN]; |
| 25 | } __attribute__ ((packed)); |
| 26 | |
| 27 | /* Frame control field constants */ |
| 28 | #define IEEE802_11_FCTL_VERS 0x0002 |
| 29 | #define IEEE802_11_FCTL_FTYPE 0x000c |
| 30 | #define IEEE802_11_FCTL_STYPE 0x00f0 |
| 31 | #define IEEE802_11_FCTL_TODS 0x0100 |
| 32 | #define IEEE802_11_FCTL_FROMDS 0x0200 |
| 33 | #define IEEE802_11_FCTL_MOREFRAGS 0x0400 |
| 34 | #define IEEE802_11_FCTL_RETRY 0x0800 |
| 35 | #define IEEE802_11_FCTL_PM 0x1000 |
| 36 | #define IEEE802_11_FCTL_MOREDATA 0x2000 |
| 37 | #define IEEE802_11_FCTL_WEP 0x4000 |
| 38 | #define IEEE802_11_FCTL_ORDER 0x8000 |
| 39 | |
| 40 | #define IEEE802_11_FTYPE_MGMT 0x0000 |
| 41 | #define IEEE802_11_FTYPE_CTL 0x0004 |
| 42 | #define IEEE802_11_FTYPE_DATA 0x0008 |
| 43 | |
| 44 | /* management */ |
| 45 | #define IEEE802_11_STYPE_ASSOC_REQ 0x0000 |
| 46 | #define IEEE802_11_STYPE_ASSOC_RESP 0x0010 |
| 47 | #define IEEE802_11_STYPE_REASSOC_REQ 0x0020 |
| 48 | #define IEEE802_11_STYPE_REASSOC_RESP 0x0030 |
| 49 | #define IEEE802_11_STYPE_PROBE_REQ 0x0040 |
| 50 | #define IEEE802_11_STYPE_PROBE_RESP 0x0050 |
| 51 | #define IEEE802_11_STYPE_BEACON 0x0080 |
| 52 | #define IEEE802_11_STYPE_ATIM 0x0090 |
| 53 | #define IEEE802_11_STYPE_DISASSOC 0x00A0 |
| 54 | #define IEEE802_11_STYPE_AUTH 0x00B0 |
| 55 | #define IEEE802_11_STYPE_DEAUTH 0x00C0 |
| 56 | |
| 57 | /* control */ |
| 58 | #define IEEE802_11_STYPE_PSPOLL 0x00A0 |
| 59 | #define IEEE802_11_STYPE_RTS 0x00B0 |
| 60 | #define IEEE802_11_STYPE_CTS 0x00C0 |
| 61 | #define IEEE802_11_STYPE_ACK 0x00D0 |
| 62 | #define IEEE802_11_STYPE_CFEND 0x00E0 |
| 63 | #define IEEE802_11_STYPE_CFENDACK 0x00F0 |
| 64 | |
| 65 | /* data */ |
| 66 | #define IEEE802_11_STYPE_DATA 0x0000 |
| 67 | #define IEEE802_11_STYPE_DATA_CFACK 0x0010 |
| 68 | #define IEEE802_11_STYPE_DATA_CFPOLL 0x0020 |
| 69 | #define IEEE802_11_STYPE_DATA_CFACKPOLL 0x0030 |
| 70 | #define IEEE802_11_STYPE_NULLFUNC 0x0040 |
| 71 | #define IEEE802_11_STYPE_CFACK 0x0050 |
| 72 | #define IEEE802_11_STYPE_CFPOLL 0x0060 |
| 73 | #define IEEE802_11_STYPE_CFACKPOLL 0x0070 |
| 74 | |
| 75 | #define IEEE802_11_SCTL_FRAG 0x000F |
| 76 | #define IEEE802_11_SCTL_SEQ 0xFFF0 |
| 77 | |
| 78 | #endif /* _IEEE802_11_H */ |