Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 284 lines (242 sloc) 8.219 kb
346a883 @sbourdeauducq Import
authored
1 /*
2 Ralink RT2501 driver for Violet embedded platforms
3 (c) 2006 Sebastien Bourdeauducq
4 */
5
6 #ifndef _IEEE80211_H_
7 #define _IEEE80211_H_
8
9 #pragma pack(1)
10
11 #define IEEE80211_ADDR_LEN 6
12 #define IEEE80211_OUI_LEN 4
13 #define IEEE80211_SSID_MAXLEN 32
14
15 #define IEEE80211_IS_MULTICAST(addr) (((char *)(addr))[0] & 0x01)
16
17 struct ieee80211_frame {
18 unsigned char i_fc[2];
19 unsigned char i_dur[2];
20 unsigned char i_addr1[IEEE80211_ADDR_LEN];
21 unsigned char i_addr2[IEEE80211_ADDR_LEN];
22 unsigned char i_addr3[IEEE80211_ADDR_LEN];
23 unsigned char i_seq[2];
24 /* possibly followed by addr4 */
25 };
26
27 struct ieee80211_frame_addr4 {
28 unsigned char i_fc[2];
29 unsigned char i_dur[2];
30 unsigned char i_addr1[IEEE80211_ADDR_LEN];
31 unsigned char i_addr2[IEEE80211_ADDR_LEN];
32 unsigned char i_addr3[IEEE80211_ADDR_LEN];
33 unsigned char i_seq[2];
34 unsigned char i_addr4[IEEE80211_ADDR_LEN];
35 };
36
37 #define IEEE80211_FC0_VERSION_MASK 0x03
38 #define IEEE80211_FC0_VERSION_SHIFT 0
39 #define IEEE80211_FC0_VERSION_0 0x00
40 #define IEEE80211_FC0_TYPE_MASK 0x0c
41 #define IEEE80211_FC0_TYPE_SHIFT 2
42 #define IEEE80211_FC0_TYPE_MGT 0x00
43 #define IEEE80211_FC0_TYPE_CTL 0x04
44 #define IEEE80211_FC0_TYPE_DATA 0x08
45
46 #define IEEE80211_FC0_SUBTYPE_MASK 0xf0
47 #define IEEE80211_FC0_SUBTYPE_SHIFT 4
48 /* for TYPE_MGT */
49 #define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00
50 #define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10
51 #define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20
52 #define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30
53 #define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40
54 #define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50
55 #define IEEE80211_FC0_SUBTYPE_BEACON 0x80
56 #define IEEE80211_FC0_SUBTYPE_ATIM 0x90
57 #define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0
58 #define IEEE80211_FC0_SUBTYPE_AUTH 0xb0
59 #define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0
60 /* for TYPE_CTL */
61 #define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0
62 #define IEEE80211_FC0_SUBTYPE_RTS 0xb0
63 #define IEEE80211_FC0_SUBTYPE_CTS 0xc0
64 #define IEEE80211_FC0_SUBTYPE_ACK 0xd0
65 #define IEEE80211_FC0_SUBTYPE_CF_END 0xe0
66 #define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0
67 /* for TYPE_DATA (bit combination) */
68 #define IEEE80211_FC0_SUBTYPE_DATA 0x00
69 #define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10
70 #define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20
71 #define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30
72 #define IEEE80211_FC0_SUBTYPE_NODATA 0x40
73 #define IEEE80211_FC0_SUBTYPE_CFACK 0x50
74 #define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60
75 #define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70
76 #define IEEE80211_FC0_SUBTYPE_QOS 0x80
77 #define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0
78
79 #define IEEE80211_FC1_DIR_MASK 0x03
80 #define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */
81 #define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */
82 #define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */
83 #define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP (WDS) */
84
85 #define IEEE80211_FC1_MORE_FRAG 0x04
86 #define IEEE80211_FC1_RETRY 0x08
87 #define IEEE80211_FC1_PWR_MGT 0x10
88 #define IEEE80211_FC1_MORE_DATA 0x20
89 #define IEEE80211_FC1_PROTECTED 0x40
90 #define IEEE80211_FC1_ORDER 0x80
91
92 #define IEEE80211_SEQ_FRAG_MASK 0x000f
93 #define IEEE80211_SEQ_FRAG_SHIFT 0
94 #define IEEE80211_SEQ_SEQ_MASK 0xfff0
95 #define IEEE80211_SEQ_SEQ_SHIFT 4
96
97 #define IEEE80211_NWID_LEN 32
98
99 #define IEEE80211_QOS_TXOP 0x00ff
100 /* bit 8 is reserved */
101 #define IEEE80211_QOS_ACKPOLICY 0x60
102 #define IEEE80211_QOS_ACKPOLICY_S 5
103 #define IEEE80211_QOS_ESOP 0x10
104 #define IEEE80211_QOS_ESOP_S 4
105 #define IEEE80211_QOS_TID 0x0f
106
107 /* Control frames */
108
109 struct ieee80211_frame_min {
110 unsigned char i_fc[2];
111 unsigned char i_dur[2];
112 unsigned char i_addr1[IEEE80211_ADDR_LEN];
113 unsigned char i_addr2[IEEE80211_ADDR_LEN];
114 };
115
116 struct ieee80211_frame_rts {
117 unsigned char i_fc[2];
118 unsigned char i_dur[2];
119 unsigned char i_ra[IEEE80211_ADDR_LEN];
120 unsigned char i_ta[IEEE80211_ADDR_LEN];
121 };
122
123 struct ieee80211_frame_cts {
124 unsigned char i_fc[2];
125 unsigned char i_dur[2];
126 unsigned char i_ra[IEEE80211_ADDR_LEN];
127 };
128
129 struct ieee80211_frame_ack {
130 unsigned char i_fc[2];
131 unsigned char i_dur[2];
132 unsigned char i_ra[IEEE80211_ADDR_LEN];
133 };
134
135 struct ieee80211_frame_pspoll {
136 unsigned char i_fc[2];
137 unsigned char i_aid[2];
138 unsigned char i_bssid[IEEE80211_ADDR_LEN];
139 unsigned char i_ta[IEEE80211_ADDR_LEN];
140 };
141
142 struct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */
143 unsigned char i_fc[2];
144 unsigned char i_dur[2]; /* should be zero */
145 unsigned char i_ra[IEEE80211_ADDR_LEN];
146 unsigned char i_bssid[IEEE80211_ADDR_LEN];
147 };
148
149 #define IEEE80211_CAPINFO_ESS 0x0001
150 #define IEEE80211_CAPINFO_IBSS 0x0002
151 #define IEEE80211_CAPINFO_CF_POLLABLE 0x0004
152 #define IEEE80211_CAPINFO_CF_POLLREQ 0x0008
153 #define IEEE80211_CAPINFO_PRIVACY 0x0010
154 #define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020
155 #define IEEE80211_CAPINFO_PBCC 0x0040
156 #define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080
157 /* bits 8-9 are reserved */
158 #define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400
159 #define IEEE80211_CAPINFO_RSN 0x0800
160 /* bit 12 is reserved */
161 #define IEEE80211_CAPINFO_DSSSOFDM 0x2000
162 /* bits 14-15 are reserved */
163
164 /* Management information elements */
165
166 enum {
167 IEEE80211_ELEMID_SSID = 0,
168 IEEE80211_ELEMID_RATES = 1,
169 IEEE80211_ELEMID_FHPARMS = 2,
170 IEEE80211_ELEMID_DSPARMS = 3,
171 IEEE80211_ELEMID_CFPARMS = 4,
172 IEEE80211_ELEMID_TIM = 5,
173 IEEE80211_ELEMID_IBSSPARMS = 6,
174 IEEE80211_ELEMID_COUNTRY = 7,
175 IEEE80211_ELEMID_CHALLENGE = 16,
176 /* 17-31 reserved for challenge text extension */
177 IEEE80211_ELEMID_ERP = 42,
178 IEEE80211_ELEMID_RSN = 48,
179 IEEE80211_ELEMID_XRATES = 50,
180 IEEE80211_ELEMID_TPC = 150,
181 IEEE80211_ELEMID_CCKM = 156,
182 IEEE80211_ELEMID_VENDOR = 221, /* vendor private */
183 };
184
185 /* Auth */
186
187 #define IEEE80211_AUTH_ALG_OPEN 0x0000
188 #define IEEE80211_AUTH_ALG_SHARED 0x0001
189
190 enum {
191 IEEE80211_AUTH_OPEN_REQUEST = 1,
192 IEEE80211_AUTH_OPEN_RESPONSE = 2,
193 };
194
195 enum {
196 IEEE80211_AUTH_SHARED_REQUEST = 1,
197 IEEE80211_AUTH_SHARED_CHALLENGE = 2,
198 IEEE80211_AUTH_SHARED_RESPONSE = 3,
199 IEEE80211_AUTH_SHARED_PASS = 4,
200 };
201
202 #define IEEE80211_CHALLENGE_LEN 128
203
204 /* Reason codes */
205
206 enum {
207 IEEE80211_REASON_UNSPECIFIED = 1,
208 IEEE80211_REASON_AUTH_EXPIRE = 2,
209 IEEE80211_REASON_AUTH_LEAVE = 3,
210 IEEE80211_REASON_ASSOC_EXPIRE = 4,
211 IEEE80211_REASON_ASSOC_TOOMANY = 5,
212 IEEE80211_REASON_NOT_AUTHED = 6,
213 IEEE80211_REASON_NOT_ASSOCED = 7,
214 IEEE80211_REASON_ASSOC_LEAVE = 8,
215 IEEE80211_REASON_ASSOC_NOT_AUTHED = 9,
216
217 IEEE80211_REASON_RSN_REQUIRED = 11,
218 IEEE80211_REASON_RSN_INCONSISTENT = 12,
219 IEEE80211_REASON_IE_INVALID = 13,
220 IEEE80211_REASON_MIC_FAILURE = 14,
221
222 IEEE80211_STATUS_SUCCESS = 0,
223 IEEE80211_STATUS_UNSPECIFIED = 1,
224 IEEE80211_STATUS_CAPINFO = 10,
225 IEEE80211_STATUS_NOT_ASSOCED = 11,
226 IEEE80211_STATUS_OTHER = 12,
227 IEEE80211_STATUS_ALG = 13,
228 IEEE80211_STATUS_SEQUENCE = 14,
229 IEEE80211_STATUS_CHALLENGE = 15,
230 IEEE80211_STATUS_TIMEOUT = 16,
231 IEEE80211_STATUS_TOOMANY = 17,
232 IEEE80211_STATUS_BASIC_RATE = 18,
233 IEEE80211_STATUS_SP_REQUIRED = 19,
234 IEEE80211_STATUS_PBCC_REQUIRED = 20,
235 IEEE80211_STATUS_CA_REQUIRED = 21,
236 IEEE80211_STATUS_TOO_MANY_STATIONS = 22,
237 IEEE80211_STATUS_RATES = 23,
238 IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25,
239 IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26,
240 };
241
242 #define IEEE80211_WEP64_KEYLEN 5
243 #define IEEE80211_WEP128_KEYLEN 13
244 #define IEEE80211_WEP_IVLEN 3
245
246 #define IEEE80211_MAX_KEYLEN 64
247
248 #define IEEE80211_MTU_MAX 2290
249 #define IEEE80211_MTU_MIN 32
250
251 #define IEEE80211_AUTH_TIMEOUT 10
252 #define IEEE80211_ASSOC_TIMEOUT 10
253 #define IEEE80211_RUN_TIMEOUT 600
254 #define IEEE80211_EAPOL_TIMEOUT 600
255 #define IEEE80211_STA_ASSOC_TIMEOUT 200
256 #define IEEE80211_STA_MAX_IDLE 3000
257
258 #define IEEE80211_SIFS 10
259
260 struct ieee80211_tkip_iv {
261 union {
262 struct {
263 unsigned char rc0;
264 unsigned char rc1;
265 unsigned char rc2;
266 union {
267 struct {
268 unsigned char reserved:5;
269 unsigned char ext_iv:1;
270 unsigned char key_id:2;
271 } field;
272 unsigned char byte;
273 } control;
274 } field;
275 unsigned int word;
276 } iv16;
277 unsigned int iv32;
278 };
279
280 #pragma pack()
281
282 #endif /* _IEEE80211_H_ */
283
Something went wrong with that request. Please try again.