hwmon: applesmc: prolong status wait
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / wlan-ng / p80211mgmt.h
blobbd4c1629eabfd1e970fc56d58fe58fb39bb80564
1 /* p80211mgmt.h
3 * Macros, types, and functions to handle 802.11 mgmt frames
5 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
6 * --------------------------------------------------------------------
8 * linux-wlan
10 * The contents of this file are subject to the Mozilla Public
11 * License Version 1.1 (the "License"); you may not use this file
12 * except in compliance with the License. You may obtain a copy of
13 * the License at http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS
16 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
17 * implied. See the License for the specific language governing
18 * rights and limitations under the License.
20 * Alternatively, the contents of this file may be used under the
21 * terms of the GNU Public License version 2 (the "GPL"), in which
22 * case the provisions of the GPL are applicable instead of the
23 * above. If you wish to allow the use of your version of this file
24 * only under the terms of the GPL and not to allow others to use
25 * your version of this file under the MPL, indicate your decision
26 * by deleting the provisions above and replace them with the notice
27 * and other provisions required by the GPL. If you do not delete
28 * the provisions above, a recipient may use your version of this
29 * file under either the MPL or the GPL.
31 * --------------------------------------------------------------------
33 * Inquiries regarding the linux-wlan Open Source project can be
34 * made directly to:
36 * AbsoluteValue Systems Inc.
37 * info@linux-wlan.com
38 * http://www.linux-wlan.com
40 * --------------------------------------------------------------------
42 * Portions of the development of this software were funded by
43 * Intersil Corporation as part of PRISM(R) chipset product development.
45 * --------------------------------------------------------------------
47 * This file declares the constants and types used in the interface
48 * between a wlan driver and the user mode utilities.
50 * Notes:
51 * - Constant values are always in HOST byte order. To assign
52 * values to multi-byte fields they _must_ be converted to
53 * ieee byte order. To retrieve multi-byte values from incoming
54 * frames, they must be converted to host order.
56 * - The len member of the frame structure does NOT!!! include
57 * the MAC CRC. Therefore, the len field on rx'd frames should
58 * have 4 subtracted from it.
60 * All functions declared here are implemented in p80211.c
62 * The types, macros, and functions defined here are primarily
63 * used for encoding and decoding management frames. They are
64 * designed to follow these patterns of use:
66 * DECODE:
67 * 1) a frame of length len is received into buffer b
68 * 2) using the hdr structure and macros, we determine the type
69 * 3) an appropriate mgmt frame structure, mf, is allocated and zeroed
70 * 4) mf.hdr = b
71 * mf.buf = b
72 * mf.len = len
73 * 5) call mgmt_decode( mf )
74 * 6) the frame field pointers in mf are now set. Note that any
75 * multi-byte frame field values accessed using the frame field
76 * pointers are in ieee byte order and will have to be converted
77 * to host order.
79 * ENCODE:
80 * 1) Library client allocates buffer space for maximum length
81 * frame of the desired type
82 * 2) Library client allocates a mgmt frame structure, called mf,
83 * of the desired type
84 * 3) Set the following:
85 * mf.type = <desired type>
86 * mf.buf = <allocated buffer address>
87 * 4) call mgmt_encode( mf )
88 * 5) all of the fixed field pointers and fixed length information element
89 * pointers in mf are now set to their respective locations in the
90 * allocated space (fortunately, all variable length information elements
91 * fall at the end of their respective frames).
92 * 5a) The length field is set to include the last of the fixed and fixed
93 * length fields. It may have to be updated for optional or variable
94 * length information elements.
95 * 6) Optional and variable length information elements are special cases
96 * and must be handled individually by the client code.
97 * --------------------------------------------------------------------
100 #ifndef _P80211MGMT_H
101 #define _P80211MGMT_H
103 /*================================================================*/
104 /* System Includes */
106 /*================================================================*/
107 /* Project Includes */
109 #ifndef _WLAN_COMPAT_H
110 #include "wlan_compat.h"
111 #endif
113 #ifndef _P80211HDR_H
114 #include "p80211hdr.h"
115 #endif
118 /*================================================================*/
119 /* Constants */
121 /*-- Information Element IDs --------------------*/
122 #define WLAN_EID_SSID 0
123 #define WLAN_EID_SUPP_RATES 1
124 #define WLAN_EID_FH_PARMS 2
125 #define WLAN_EID_DS_PARMS 3
126 #define WLAN_EID_CF_PARMS 4
127 #define WLAN_EID_TIM 5
128 #define WLAN_EID_IBSS_PARMS 6
129 /*-- values 7-15 reserved --*/
130 #define WLAN_EID_CHALLENGE 16
131 /*-- values 17-31 reserved for challenge text extension --*/
132 /*-- values 32-255 reserved --*/
134 /*-- Reason Codes -------------------------------*/
135 #define WLAN_MGMT_REASON_RSVD 0
136 #define WLAN_MGMT_REASON_UNSPEC 1
137 #define WLAN_MGMT_REASON_PRIOR_AUTH_INVALID 2
138 #define WLAN_MGMT_REASON_DEAUTH_LEAVING 3
139 #define WLAN_MGMT_REASON_DISASSOC_INACTIVE 4
140 #define WLAN_MGMT_REASON_DISASSOC_AP_BUSY 5
141 #define WLAN_MGMT_REASON_CLASS2_NONAUTH 6
142 #define WLAN_MGMT_REASON_CLASS3_NONASSOC 7
143 #define WLAN_MGMT_REASON_DISASSOC_STA_HASLEFT 8
144 #define WLAN_MGMT_REASON_CANT_ASSOC_NONAUTH 9
146 /*-- Status Codes -------------------------------*/
147 #define WLAN_MGMT_STATUS_SUCCESS 0
148 #define WLAN_MGMT_STATUS_UNSPEC_FAILURE 1
149 #define WLAN_MGMT_STATUS_CAPS_UNSUPPORTED 10
150 #define WLAN_MGMT_STATUS_REASSOC_NO_ASSOC 11
151 #define WLAN_MGMT_STATUS_ASSOC_DENIED_UNSPEC 12
152 #define WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG 13
153 #define WLAN_MGMT_STATUS_RX_AUTH_NOSEQ 14
154 #define WLAN_MGMT_STATUS_CHALLENGE_FAIL 15
155 #define WLAN_MGMT_STATUS_AUTH_TIMEOUT 16
156 #define WLAN_MGMT_STATUS_ASSOC_DENIED_BUSY 17
157 #define WLAN_MGMT_STATUS_ASSOC_DENIED_RATES 18
158 /* p80211b additions */
159 #define WLAN_MGMT_STATUS_ASSOC_DENIED_NOSHORT 19
160 #define WLAN_MGMT_STATUS_ASSOC_DENIED_NOPBCC 20
161 #define WLAN_MGMT_STATUS_ASSOC_DENIED_NOAGILITY 21
165 /*-- Auth Algorithm Field ---------------------------*/
166 #define WLAN_AUTH_ALG_OPENSYSTEM 0
167 #define WLAN_AUTH_ALG_SHAREDKEY 1
169 /*-- Management Frame Field Offsets -------------*/
170 /* Note: Not all fields are listed because of variable lengths, */
171 /* see the code in p80211.c to see how we search for fields */
172 /* Note: These offsets are from the start of the frame data */
174 #define WLAN_BEACON_OFF_TS 0
175 #define WLAN_BEACON_OFF_BCN_INT 8
176 #define WLAN_BEACON_OFF_CAPINFO 10
177 #define WLAN_BEACON_OFF_SSID 12
179 #define WLAN_DISASSOC_OFF_REASON 0
181 #define WLAN_ASSOCREQ_OFF_CAP_INFO 0
182 #define WLAN_ASSOCREQ_OFF_LISTEN_INT 2
183 #define WLAN_ASSOCREQ_OFF_SSID 4
185 #define WLAN_ASSOCRESP_OFF_CAP_INFO 0
186 #define WLAN_ASSOCRESP_OFF_STATUS 2
187 #define WLAN_ASSOCRESP_OFF_AID 4
188 #define WLAN_ASSOCRESP_OFF_SUPP_RATES 6
190 #define WLAN_REASSOCREQ_OFF_CAP_INFO 0
191 #define WLAN_REASSOCREQ_OFF_LISTEN_INT 2
192 #define WLAN_REASSOCREQ_OFF_CURR_AP 4
193 #define WLAN_REASSOCREQ_OFF_SSID 10
195 #define WLAN_REASSOCRESP_OFF_CAP_INFO 0
196 #define WLAN_REASSOCRESP_OFF_STATUS 2
197 #define WLAN_REASSOCRESP_OFF_AID 4
198 #define WLAN_REASSOCRESP_OFF_SUPP_RATES 6
200 #define WLAN_PROBEREQ_OFF_SSID 0
202 #define WLAN_PROBERESP_OFF_TS 0
203 #define WLAN_PROBERESP_OFF_BCN_INT 8
204 #define WLAN_PROBERESP_OFF_CAP_INFO 10
205 #define WLAN_PROBERESP_OFF_SSID 12
207 #define WLAN_AUTHEN_OFF_AUTH_ALG 0
208 #define WLAN_AUTHEN_OFF_AUTH_SEQ 2
209 #define WLAN_AUTHEN_OFF_STATUS 4
210 #define WLAN_AUTHEN_OFF_CHALLENGE 6
212 #define WLAN_DEAUTHEN_OFF_REASON 0
215 /*================================================================*/
216 /* Macros */
218 /*-- Capability Field ---------------------------*/
219 #define WLAN_GET_MGMT_CAP_INFO_ESS(n) ((n) & BIT0)
220 #define WLAN_GET_MGMT_CAP_INFO_IBSS(n) (((n) & BIT1) >> 1)
221 #define WLAN_GET_MGMT_CAP_INFO_CFPOLLABLE(n) (((n) & BIT2) >> 2)
222 #define WLAN_GET_MGMT_CAP_INFO_CFPOLLREQ(n) (((n) & BIT3) >> 3)
223 #define WLAN_GET_MGMT_CAP_INFO_PRIVACY(n) (((n) & BIT4) >> 4)
224 /* p80211b additions */
225 #define WLAN_GET_MGMT_CAP_INFO_SHORT(n) (((n) & BIT5) >> 5)
226 #define WLAN_GET_MGMT_CAP_INFO_PBCC(n) (((n) & BIT6) >> 6)
227 #define WLAN_GET_MGMT_CAP_INFO_AGILITY(n) (((n) & BIT7) >> 7)
229 #define WLAN_SET_MGMT_CAP_INFO_ESS(n) (n)
230 #define WLAN_SET_MGMT_CAP_INFO_IBSS(n) ((n) << 1)
231 #define WLAN_SET_MGMT_CAP_INFO_CFPOLLABLE(n) ((n) << 2)
232 #define WLAN_SET_MGMT_CAP_INFO_CFPOLLREQ(n) ((n) << 3)
233 #define WLAN_SET_MGMT_CAP_INFO_PRIVACY(n) ((n) << 4)
234 /* p80211b additions */
235 #define WLAN_SET_MGMT_CAP_INFO_SHORT(n) ((n) << 5)
236 #define WLAN_SET_MGMT_CAP_INFO_PBCC(n) ((n) << 6)
237 #define WLAN_SET_MGMT_CAP_INFO_AGILITY(n) ((n) << 7)
240 /*================================================================*/
241 /* Types */
243 /*-- Information Element Types --------------------*/
244 /* prototype structure, all IEs start with these members */
246 typedef struct wlan_ie
248 UINT8 eid;
249 UINT8 len;
250 } __WLAN_ATTRIB_PACK__ wlan_ie_t;
252 /*-- Service Set Identity (SSID) -----------------*/
253 typedef struct wlan_ie_ssid
255 UINT8 eid;
256 UINT8 len;
257 UINT8 ssid[1]; /* may be zero, ptrs may overlap */
258 } __WLAN_ATTRIB_PACK__ wlan_ie_ssid_t;
260 /*-- Supported Rates -----------------------------*/
261 typedef struct wlan_ie_supp_rates
263 UINT8 eid;
264 UINT8 len;
265 UINT8 rates[1]; /* had better be at LEAST one! */
266 } __WLAN_ATTRIB_PACK__ wlan_ie_supp_rates_t;
268 /*-- FH Parameter Set ----------------------------*/
269 typedef struct wlan_ie_fh_parms
271 UINT8 eid;
272 UINT8 len;
273 UINT16 dwell;
274 UINT8 hopset;
275 UINT8 hoppattern;
276 UINT8 hopindex;
277 } __WLAN_ATTRIB_PACK__ wlan_ie_fh_parms_t;
279 /*-- DS Parameter Set ----------------------------*/
280 typedef struct wlan_ie_ds_parms
282 UINT8 eid;
283 UINT8 len;
284 UINT8 curr_ch;
285 } __WLAN_ATTRIB_PACK__ wlan_ie_ds_parms_t;
287 /*-- CF Parameter Set ----------------------------*/
289 typedef struct wlan_ie_cf_parms
291 UINT8 eid;
292 UINT8 len;
293 UINT8 cfp_cnt;
294 UINT8 cfp_period;
295 UINT16 cfp_maxdur;
296 UINT16 cfp_durremaining;
297 } __WLAN_ATTRIB_PACK__ wlan_ie_cf_parms_t;
299 /*-- TIM ------------------------------------------*/
300 typedef struct wlan_ie_tim
302 UINT8 eid;
303 UINT8 len;
304 UINT8 dtim_cnt;
305 UINT8 dtim_period;
306 UINT8 bitmap_ctl;
307 UINT8 virt_bm[1];
308 } __WLAN_ATTRIB_PACK__ wlan_ie_tim_t;
310 /*-- IBSS Parameter Set ---------------------------*/
311 typedef struct wlan_ie_ibss_parms
313 UINT8 eid;
314 UINT8 len;
315 UINT16 atim_win;
316 } __WLAN_ATTRIB_PACK__ wlan_ie_ibss_parms_t;
318 /*-- Challenge Text ------------------------------*/
319 typedef struct wlan_ie_challenge
321 UINT8 eid;
322 UINT8 len;
323 UINT8 challenge[1];
324 } __WLAN_ATTRIB_PACK__ wlan_ie_challenge_t;
326 /*-------------------------------------------------*/
327 /* Frame Types */
329 /* prototype structure, all mgmt frame types will start with these members */
330 typedef struct wlan_fr_mgmt
332 UINT16 type;
333 UINT16 len; /* DOES NOT include CRC !!!!*/
334 UINT8 *buf;
335 p80211_hdr_t *hdr;
336 /* used for target specific data, skb in Linux */
337 void *priv;
338 /*-- fixed fields -----------*/
339 /*-- info elements ----------*/
340 } wlan_fr_mgmt_t;
342 /*-- Beacon ---------------------------------------*/
343 typedef struct wlan_fr_beacon
345 UINT16 type;
346 UINT16 len;
347 UINT8 *buf;
348 p80211_hdr_t *hdr;
349 /* used for target specific data, skb in Linux */
350 void *priv;
351 /*-- fixed fields -----------*/
352 UINT64 *ts;
353 UINT16 *bcn_int;
354 UINT16 *cap_info;
355 /*-- info elements ----------*/
356 wlan_ie_ssid_t *ssid;
357 wlan_ie_supp_rates_t *supp_rates;
358 wlan_ie_fh_parms_t *fh_parms;
359 wlan_ie_ds_parms_t *ds_parms;
360 wlan_ie_cf_parms_t *cf_parms;
361 wlan_ie_ibss_parms_t *ibss_parms;
362 wlan_ie_tim_t *tim;
364 } wlan_fr_beacon_t;
367 /*-- IBSS ATIM ------------------------------------*/
368 typedef struct wlan_fr_ibssatim
370 UINT16 type;
371 UINT16 len;
372 UINT8* buf;
373 p80211_hdr_t *hdr;
374 /* used for target specific data, skb in Linux */
375 void *priv;
377 /*-- fixed fields -----------*/
378 /*-- info elements ----------*/
380 /* this frame type has a null body */
382 } wlan_fr_ibssatim_t;
384 /*-- Disassociation -------------------------------*/
385 typedef struct wlan_fr_disassoc
387 UINT16 type;
388 UINT16 len;
389 UINT8 *buf;
390 p80211_hdr_t *hdr;
391 /* used for target specific data, skb in Linux */
392 void *priv;
393 /*-- fixed fields -----------*/
394 UINT16 *reason;
396 /*-- info elements ----------*/
398 } wlan_fr_disassoc_t;
400 /*-- Association Request --------------------------*/
401 typedef struct wlan_fr_assocreq
403 UINT16 type;
404 UINT16 len;
405 UINT8* buf;
406 p80211_hdr_t *hdr;
407 /* used for target specific data, skb in Linux */
408 void *priv;
409 /*-- fixed fields -----------*/
410 UINT16 *cap_info;
411 UINT16 *listen_int;
412 /*-- info elements ----------*/
413 wlan_ie_ssid_t *ssid;
414 wlan_ie_supp_rates_t *supp_rates;
416 } wlan_fr_assocreq_t;
418 /*-- Association Response -------------------------*/
419 typedef struct wlan_fr_assocresp
421 UINT16 type;
422 UINT16 len;
423 UINT8 *buf;
424 p80211_hdr_t *hdr;
425 /* used for target specific data, skb in Linux */
426 void *priv;
427 /*-- fixed fields -----------*/
428 UINT16 *cap_info;
429 UINT16 *status;
430 UINT16 *aid;
431 /*-- info elements ----------*/
432 wlan_ie_supp_rates_t *supp_rates;
434 } wlan_fr_assocresp_t;
436 /*-- Reassociation Request ------------------------*/
437 typedef struct wlan_fr_reassocreq
439 UINT16 type;
440 UINT16 len;
441 UINT8 *buf;
442 p80211_hdr_t *hdr;
443 /* used for target specific data, skb in Linux */
444 void *priv;
445 /*-- fixed fields -----------*/
446 UINT16 *cap_info;
447 UINT16 *listen_int;
448 UINT8 *curr_ap;
449 /*-- info elements ----------*/
450 wlan_ie_ssid_t *ssid;
451 wlan_ie_supp_rates_t *supp_rates;
453 } wlan_fr_reassocreq_t;
455 /*-- Reassociation Response -----------------------*/
456 typedef struct wlan_fr_reassocresp
458 UINT16 type;
459 UINT16 len;
460 UINT8 *buf;
461 p80211_hdr_t *hdr;
462 /* used for target specific data, skb in Linux */
463 void *priv;
464 /*-- fixed fields -----------*/
465 UINT16 *cap_info;
466 UINT16 *status;
467 UINT16 *aid;
468 /*-- info elements ----------*/
469 wlan_ie_supp_rates_t *supp_rates;
471 } wlan_fr_reassocresp_t;
473 /*-- Probe Request --------------------------------*/
474 typedef struct wlan_fr_probereq
476 UINT16 type;
477 UINT16 len;
478 UINT8 *buf;
479 p80211_hdr_t *hdr;
480 /* used for target specific data, skb in Linux */
481 void *priv;
482 /*-- fixed fields -----------*/
483 /*-- info elements ----------*/
484 wlan_ie_ssid_t *ssid;
485 wlan_ie_supp_rates_t *supp_rates;
487 } wlan_fr_probereq_t;
489 /*-- Probe Response -------------------------------*/
490 typedef struct wlan_fr_proberesp
492 UINT16 type;
493 UINT16 len;
494 UINT8 *buf;
495 p80211_hdr_t *hdr;
496 /* used for target specific data, skb in Linux */
497 void *priv;
498 /*-- fixed fields -----------*/
499 UINT64 *ts;
500 UINT16 *bcn_int;
501 UINT16 *cap_info;
502 /*-- info elements ----------*/
503 wlan_ie_ssid_t *ssid;
504 wlan_ie_supp_rates_t *supp_rates;
505 wlan_ie_fh_parms_t *fh_parms;
506 wlan_ie_ds_parms_t *ds_parms;
507 wlan_ie_cf_parms_t *cf_parms;
508 wlan_ie_ibss_parms_t *ibss_parms;
509 } wlan_fr_proberesp_t;
511 /*-- Authentication -------------------------------*/
512 typedef struct wlan_fr_authen
514 UINT16 type;
515 UINT16 len;
516 UINT8 *buf;
517 p80211_hdr_t *hdr;
518 /* used for target specific data, skb in Linux */
519 void *priv;
520 /*-- fixed fields -----------*/
521 UINT16 *auth_alg;
522 UINT16 *auth_seq;
523 UINT16 *status;
524 /*-- info elements ----------*/
525 wlan_ie_challenge_t *challenge;
527 } wlan_fr_authen_t;
529 /*-- Deauthenication -----------------------------*/
530 typedef struct wlan_fr_deauthen
532 UINT16 type;
533 UINT16 len;
534 UINT8 *buf;
535 p80211_hdr_t *hdr;
536 /* used for target specific data, skb in Linux */
537 void *priv;
538 /*-- fixed fields -----------*/
539 UINT16 *reason;
541 /*-- info elements ----------*/
543 } wlan_fr_deauthen_t;
546 /*================================================================*/
547 /* Extern Declarations */
550 /*================================================================*/
551 /* Function Declarations */
553 void wlan_mgmt_encode_beacon( wlan_fr_beacon_t *f );
554 void wlan_mgmt_decode_beacon( wlan_fr_beacon_t *f );
555 void wlan_mgmt_encode_disassoc( wlan_fr_disassoc_t *f );
556 void wlan_mgmt_decode_disassoc( wlan_fr_disassoc_t *f );
557 void wlan_mgmt_encode_assocreq( wlan_fr_assocreq_t *f );
558 void wlan_mgmt_decode_assocreq( wlan_fr_assocreq_t *f );
559 void wlan_mgmt_encode_assocresp( wlan_fr_assocresp_t *f );
560 void wlan_mgmt_decode_assocresp( wlan_fr_assocresp_t *f );
561 void wlan_mgmt_encode_reassocreq( wlan_fr_reassocreq_t *f );
562 void wlan_mgmt_decode_reassocreq( wlan_fr_reassocreq_t *f );
563 void wlan_mgmt_encode_reassocresp( wlan_fr_reassocresp_t *f );
564 void wlan_mgmt_decode_reassocresp( wlan_fr_reassocresp_t *f );
565 void wlan_mgmt_encode_probereq( wlan_fr_probereq_t *f );
566 void wlan_mgmt_decode_probereq( wlan_fr_probereq_t *f );
567 void wlan_mgmt_encode_proberesp( wlan_fr_proberesp_t *f );
568 void wlan_mgmt_decode_proberesp( wlan_fr_proberesp_t *f );
569 void wlan_mgmt_encode_authen( wlan_fr_authen_t *f );
570 void wlan_mgmt_decode_authen( wlan_fr_authen_t *f );
571 void wlan_mgmt_encode_deauthen( wlan_fr_deauthen_t *f );
572 void wlan_mgmt_decode_deauthen( wlan_fr_deauthen_t *f );
575 #endif /* _P80211MGMT_H */