1 /* $NetBSD: if_ieee80211.h,v 1.5 2000/07/21 04:47:40 onoe Exp $ */
4 #ifndef _NET_IF_IEEE80211_H_
5 #define _NET_IF_IEEE80211_H_
8 * generic definitions for IEEE 802.11 frames
10 struct ieee80211_frame {
13 u_int8_t i_addr1[ETHER_ADDR_LEN];
14 u_int8_t i_addr2[ETHER_ADDR_LEN];
15 u_int8_t i_addr3[ETHER_ADDR_LEN];
17 /* possibly followed by addr4[ETHER_ADDR_LEN]; */
20 #define IEEE80211_FC0_VERSION_MASK 0x03
21 #define IEEE80211_FC0_VERSION_0 0x00
22 #define IEEE80211_FC0_TYPE_MASK 0x0c
23 #define IEEE80211_FC0_TYPE_MGT 0x00
24 #define IEEE80211_FC0_TYPE_CTL 0x04
25 #define IEEE80211_FC0_TYPE_DATA 0x08
27 #define IEEE80211_FC0_SUBTYPE_MASK 0xf0
29 #define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00
30 #define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10
31 #define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20
32 #define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30
33 #define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40
34 #define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50
35 #define IEEE80211_FC0_SUBTYPE_BEACON 0x80
36 #define IEEE80211_FC0_SUBTYPE_ATIM 0x90
37 #define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0
38 #define IEEE80211_FC0_SUBTYPE_AUTH 0xb0
39 #define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0
41 #define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0
42 #define IEEE80211_FC0_SUBTYPE_RTS 0xb0
43 #define IEEE80211_FC0_SUBTYPE_CTS 0xc0
44 #define IEEE80211_FC0_SUBTYPE_ACK 0xd0
45 #define IEEE80211_FC0_SUBTYPE_CF_END 0xe0
46 #define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0
47 /* for TYPE_DATA (bit combination) */
48 #define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10
49 #define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20
50 #define IEEE80211_FC0_SUBTYPE_NODATA 0x40
52 #define IEEE80211_FC1_DIR_MASK 0x03
53 #define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */
54 #define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */
55 #define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */
56 #define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */
58 #define IEEE80211_FC1_MORE_FRAG 0x04
59 #define IEEE80211_FC1_RETRY 0x08
60 #define IEEE80211_FC1_PWR_MGT 0x10
61 #define IEEE80211_FC1_MORE_DATA 0x20
62 #define IEEE80211_FC1_WEP 0x40
63 #define IEEE80211_FC1_ORDER 0x80
69 #define IEEE80211_ELEMID_SSID 0
70 #define IEEE80211_ELEMID_RATES 1
71 #define IEEE80211_ELEMID_FHPARMS 2
72 #define IEEE80211_ELEMID_DSPARMS 3
73 #define IEEE80211_ELEMID_CFPARMS 4
74 #define IEEE80211_ELEMID_TIM 5
75 #define IEEE80211_ELEMID_IBSSPARMS 6
76 #define IEEE80211_ELEMID_CHALLENGE 16
78 #define IEEE80211_AUTH_ALG_OPEN 0x0000
79 #define IEEE80211_AUTH_ALG_SHARED 0x0001
81 #define IEEE80211_CAPINFO_ESS 0x01
82 #define IEEE80211_CAPINFO_IBSS 0x02
83 #define IEEE80211_CAPINFO_CF_POLLABLE 0x04
84 #define IEEE80211_CAPINFO_CF_POLLREQ 0x08
85 #define IEEE80211_CAPINFO_PRIVACY 0x10
87 #define IEEE80211_REASON_UNSPECIFIED 1
88 #define IEEE80211_REASON_AUTH_EXPIRE 2
89 #define IEEE80211_REASON_AUTH_LEAVE 3
90 #define IEEE80211_REASON_ASSOC_EXPIRE 4
91 #define IEEE80211_REASON_ASSOC_TOOMANY 5
92 #define IEEE80211_REASON_NOT_AUTHED 6
93 #define IEEE80211_REASON_NOT_ASSOCED 7
94 #define IEEE80211_REASON_ASSOC_LEAVE 8
95 #define IEEE80211_REASON_ASSOC_NOT_AUTHED 9
97 #define IEEE80211_STATUS_UNSPECIFIED 1
98 #define IEEE80211_STATUS_CAPINFO 10
99 #define IEEE80211_STATUS_NOT_ASSOCED 11
100 #define IEEE80211_STATUS_OTHER 12
101 #define IEEE80211_STATUS_ALG 13
102 #define IEEE80211_STATUS_SEQUENCE 14
103 #define IEEE80211_STATUS_CHALLENGE 15
104 #define IEEE80211_STATUS_TIMEOUT 16
106 #define IEEE80211_WEP_KEYLEN 5 /* 40bit */
107 #define IEEE80211_WEP_IVLEN 3 /* 24bit */
108 #define IEEE80211_WEP_KIDLEN 1 /* 1 octet */
109 #define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */
110 #define IEEE80211_WEP_NKID 4 /* number of key ids */
112 #define IEEE80211_NWID_LEN 32
114 /* nwid is pointed at by ifr.ifr_data */
115 struct ieee80211_nwid {
117 u_int8_t i_nwid[IEEE80211_NWID_LEN];
120 #define SIOCS80211NWID _IOWR('i', 230, struct ifreq)
121 #define SIOCG80211NWID _IOWR('i', 231, struct ifreq)
123 /* the first member must be matched with struct ifreq */
124 struct ieee80211_nwkey {
125 char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
126 int i_wepon; /* wep enabled flag */
127 int i_defkid; /* default encrypt key id */
131 } i_key[IEEE80211_WEP_NKID];
133 #define SIOCS80211NWKEY _IOW('i', 232, struct ieee80211_nwkey)
134 #define SIOCG80211NWKEY _IOWR('i', 233, struct ieee80211_nwkey)
136 #endif /* !_NET_IF_IEEE80211_H_ */