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 #define IEEE802_11_HLEN			30
13 #define IEEE802_11_FRAME_LEN		(IEEE802_11_DATA_LEN + IEEE802_11_HLEN)
14 
15 struct ieee802_11_hdr {
16 	u16 frame_ctl;
17 	u16 duration_id;
18 	u8 addr1[ETH_ALEN];
19 	u8 addr2[ETH_ALEN];
20 	u8 addr3[ETH_ALEN];
21 	u16 seq_ctl;
22 	u8 addr4[ETH_ALEN];
23 } __attribute__ ((packed));
24 
25 /* Frame control field constants */
26 #define IEEE802_11_FCTL_VERS		0x0002
27 #define IEEE802_11_FCTL_FTYPE		0x000c
28 #define IEEE802_11_FCTL_STYPE		0x00f0
29 #define IEEE802_11_FCTL_TODS		0x0100
30 #define IEEE802_11_FCTL_FROMDS		0x0200
31 #define IEEE802_11_FCTL_MOREFRAGS	0x0400
32 #define IEEE802_11_FCTL_RETRY		0x0800
33 #define IEEE802_11_FCTL_PM		0x1000
34 #define IEEE802_11_FCTL_MOREDATA	0x2000
35 #define IEEE802_11_FCTL_WEP		0x4000
36 #define IEEE802_11_FCTL_ORDER		0x8000
37 
38 #define IEEE802_11_FTYPE_MGMT		0x0000
39 #define IEEE802_11_FTYPE_CTL		0x0004
40 #define IEEE802_11_FTYPE_DATA		0x0008
41 
42 /* management */
43 #define IEEE802_11_STYPE_ASSOC_REQ	0x0000
44 #define IEEE802_11_STYPE_ASSOC_RESP 	0x0010
45 #define IEEE802_11_STYPE_REASSOC_REQ	0x0020
46 #define IEEE802_11_STYPE_REASSOC_RESP	0x0030
47 #define IEEE802_11_STYPE_PROBE_REQ	0x0040
48 #define IEEE802_11_STYPE_PROBE_RESP	0x0050
49 #define IEEE802_11_STYPE_BEACON		0x0080
50 #define IEEE802_11_STYPE_ATIM		0x0090
51 #define IEEE802_11_STYPE_DISASSOC	0x00A0
52 #define IEEE802_11_STYPE_AUTH		0x00B0
53 #define IEEE802_11_STYPE_DEAUTH		0x00C0
54 
55 /* control */
56 #define IEEE802_11_STYPE_PSPOLL		0x00A0
57 #define IEEE802_11_STYPE_RTS		0x00B0
58 #define IEEE802_11_STYPE_CTS		0x00C0
59 #define IEEE802_11_STYPE_ACK		0x00D0
60 #define IEEE802_11_STYPE_CFEND		0x00E0
61 #define IEEE802_11_STYPE_CFENDACK	0x00F0
62 
63 /* data */
64 #define IEEE802_11_STYPE_DATA		0x0000
65 #define IEEE802_11_STYPE_DATA_CFACK	0x0010
66 #define IEEE802_11_STYPE_DATA_CFPOLL	0x0020
67 #define IEEE802_11_STYPE_DATA_CFACKPOLL	0x0030
68 #define IEEE802_11_STYPE_NULLFUNC	0x0040
69 #define IEEE802_11_STYPE_CFACK		0x0050
70 #define IEEE802_11_STYPE_CFPOLL		0x0060
71 #define IEEE802_11_STYPE_CFACKPOLL	0x0070
72 
73 #define IEEE802_11_SCTL_FRAG		0x000F
74 #define IEEE802_11_SCTL_SEQ		0xFFF0
75 
76 #endif /* _IEEE802_11_H */
77 
78