dunno - ;)
[my-code/hdw-sniff.git] / ieee802_11.h
1 #ifndef _IEEE802_11_H
2 #define _IEEE802_11_H
3
4 #define IEEE802_11_DATA_LEN             2304
5 /* Actually, the standard seems to be inconsistent about what the
6    maximum frame size really is.  S6.2.1.1.2 says 2304 octets, but the
7    figure in section 7.1.2 says 2312 octects. */
8 #define IEEE802_11_HLEN                 30
9 #define IEEE802_11_FRAME_LEN            (IEEE802_11_DATA_LEN + IEEE802_11_HLEN)
10
11 struct ieee802_11_hdr {
12         u16 frame_ctl;
13         u16 duration_id;
14         u8 addr1[ETH_ALEN];
15         u8 addr2[ETH_ALEN];
16         u8 addr3[ETH_ALEN];
17         u16 seq_ctl;
18         u8 addr4[ETH_ALEN];
19 } __attribute__ ((packed));
20
21 /* Frame control field constants */
22 #define IEEE802_11_FCTL_VERS            0x0002
23 #define IEEE802_11_FCTL_FTYPE           0x000c
24 #define IEEE802_11_FCTL_STYPE           0x00f0
25 #define IEEE802_11_FCTL_TODS            0x0100
26 #define IEEE802_11_FCTL_FROMDS          0x0200
27 #define IEEE802_11_FCTL_MOREFRAGS       0x0400
28 #define IEEE802_11_FCTL_RETRY           0x0800
29 #define IEEE802_11_FCTL_PM              0x1000
30 #define IEEE802_11_FCTL_MOREDATA        0x2000
31 #define IEEE802_11_FCTL_WEP             0x4000
32 #define IEEE802_11_FCTL_ORDER           0x8000
33
34 #define IEEE802_11_FTYPE_MGMT           0x0000
35 #define IEEE802_11_FTYPE_CTL            0x0004
36 #define IEEE802_11_FTYPE_DATA           0x0008
37
38 /* management */
39 #define IEEE802_11_STYPE_ASSOC_REQ      0x0000
40 #define IEEE802_11_STYPE_ASSOC_RESP     0x0010
41 #define IEEE802_11_STYPE_REASSOC_REQ    0x0020
42 #define IEEE802_11_STYPE_REASSOC_RESP   0x0030
43 #define IEEE802_11_STYPE_PROBE_REQ      0x0040
44 #define IEEE802_11_STYPE_PROBE_RESP     0x0050
45 #define IEEE802_11_STYPE_BEACON         0x0080
46 #define IEEE802_11_STYPE_ATIM           0x0090
47 #define IEEE802_11_STYPE_DISASSOC       0x00A0
48 #define IEEE802_11_STYPE_AUTH           0x00B0
49 #define IEEE802_11_STYPE_DEAUTH         0x00C0
50
51 /* control */
52 #define IEEE802_11_STYPE_PSPOLL         0x00A0
53 #define IEEE802_11_STYPE_RTS            0x00B0
54 #define IEEE802_11_STYPE_CTS            0x00C0
55 #define IEEE802_11_STYPE_ACK            0x00D0
56 #define IEEE802_11_STYPE_CFEND          0x00E0
57 #define IEEE802_11_STYPE_CFENDACK       0x00F0
58
59 /* data */
60 #define IEEE802_11_STYPE_DATA           0x0000
61 #define IEEE802_11_STYPE_DATA_CFACK     0x0010
62 #define IEEE802_11_STYPE_DATA_CFPOLL    0x0020
63 #define IEEE802_11_STYPE_DATA_CFACKPOLL 0x0030
64 #define IEEE802_11_STYPE_NULLFUNC       0x0040
65 #define IEEE802_11_STYPE_CFACK          0x0050
66 #define IEEE802_11_STYPE_CFPOLL         0x0060
67 #define IEEE802_11_STYPE_CFACKPOLL      0x0070
68
69 #define IEEE802_11_SCTL_FRAG            0x000F
70 #define IEEE802_11_SCTL_SEQ             0xFFF0
71
72 #endif /* _IEEE802_11_H */
73