]> Pileus Git - ~andy/linux/blob - include/net/ieee80211.h
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[~andy/linux] / include / net / ieee80211.h
1 /*
2  * Merged with mainline ieee80211.h in Aug 2004.  Original ieee802_11
3  * remains copyright by the original authors
4  *
5  * Portions of the merged code are based on Host AP (software wireless
6  * LAN access point) driver for Intersil Prism2/2.5/3.
7  *
8  * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
9  * <j@w1.fi>
10  * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi>
11  *
12  * Adaption to a generic IEEE 802.11 stack by James Ketrenos
13  * <jketreno@linux.intel.com>
14  * Copyright (c) 2004-2005, Intel Corporation
15  *
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License version 2 as
18  * published by the Free Software Foundation. See README and COPYING for
19  * more details.
20  *
21  * API Version History
22  * 1.0.x -- Initial version
23  * 1.1.x -- Added radiotap, QoS, TIM, ieee80211_geo APIs,
24  *          various structure changes, and crypto API init method
25  */
26 #ifndef IEEE80211_H
27 #define IEEE80211_H
28 #include <linux/if_ether.h>     /* ETH_ALEN */
29 #include <linux/kernel.h>       /* ARRAY_SIZE */
30 #include <linux/wireless.h>
31 #include <linux/ieee80211.h>
32
33 #define IEEE80211_VERSION "git-1.1.13"
34
35 #define IEEE80211_DATA_LEN              2304
36 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
37    6.2.1.1.2.
38
39    The figure in section 7.1.2 suggests a body size of up to 2312
40    bytes is allowed, which is a bit confusing, I suspect this
41    represents the 2304 bytes of real data, plus a possible 8 bytes of
42    WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
43
44 #define IEEE80211_1ADDR_LEN 10
45 #define IEEE80211_2ADDR_LEN 16
46 #define IEEE80211_3ADDR_LEN 24
47 #define IEEE80211_4ADDR_LEN 30
48 #define IEEE80211_FCS_LEN    4
49 #define IEEE80211_HLEN                  (IEEE80211_4ADDR_LEN)
50 #define IEEE80211_FRAME_LEN             (IEEE80211_DATA_LEN + IEEE80211_HLEN)
51
52 #define MIN_FRAG_THRESHOLD     256U
53 #define MAX_FRAG_THRESHOLD     2346U
54
55 /* Frame control field constants */
56 #define IEEE80211_FCTL_VERS             0x0003
57 #define IEEE80211_FCTL_FTYPE            0x000c
58 #define IEEE80211_FCTL_STYPE            0x00f0
59 #define IEEE80211_FCTL_TODS             0x0100
60 #define IEEE80211_FCTL_FROMDS           0x0200
61 #define IEEE80211_FCTL_MOREFRAGS        0x0400
62 #define IEEE80211_FCTL_RETRY            0x0800
63 #define IEEE80211_FCTL_PM               0x1000
64 #define IEEE80211_FCTL_MOREDATA         0x2000
65 #define IEEE80211_FCTL_PROTECTED        0x4000
66 #define IEEE80211_FCTL_ORDER            0x8000
67
68 #define IEEE80211_FTYPE_MGMT            0x0000
69 #define IEEE80211_FTYPE_CTL             0x0004
70 #define IEEE80211_FTYPE_DATA            0x0008
71
72 /* management */
73 #define IEEE80211_STYPE_ASSOC_REQ       0x0000
74 #define IEEE80211_STYPE_ASSOC_RESP      0x0010
75 #define IEEE80211_STYPE_REASSOC_REQ     0x0020
76 #define IEEE80211_STYPE_REASSOC_RESP    0x0030
77 #define IEEE80211_STYPE_PROBE_REQ       0x0040
78 #define IEEE80211_STYPE_PROBE_RESP      0x0050
79 #define IEEE80211_STYPE_BEACON          0x0080
80 #define IEEE80211_STYPE_ATIM            0x0090
81 #define IEEE80211_STYPE_DISASSOC        0x00A0
82 #define IEEE80211_STYPE_AUTH            0x00B0
83 #define IEEE80211_STYPE_DEAUTH          0x00C0
84 #define IEEE80211_STYPE_ACTION          0x00D0
85
86 /* control */
87 #define IEEE80211_STYPE_PSPOLL          0x00A0
88 #define IEEE80211_STYPE_RTS             0x00B0
89 #define IEEE80211_STYPE_CTS             0x00C0
90 #define IEEE80211_STYPE_ACK             0x00D0
91 #define IEEE80211_STYPE_CFEND           0x00E0
92 #define IEEE80211_STYPE_CFENDACK        0x00F0
93
94 /* data */
95 #define IEEE80211_STYPE_DATA            0x0000
96 #define IEEE80211_STYPE_DATA_CFACK      0x0010
97 #define IEEE80211_STYPE_DATA_CFPOLL     0x0020
98 #define IEEE80211_STYPE_DATA_CFACKPOLL  0x0030
99 #define IEEE80211_STYPE_NULLFUNC        0x0040
100 #define IEEE80211_STYPE_CFACK           0x0050
101 #define IEEE80211_STYPE_CFPOLL          0x0060
102 #define IEEE80211_STYPE_CFACKPOLL       0x0070
103 #define IEEE80211_STYPE_QOS_DATA        0x0080
104
105 #define IEEE80211_SCTL_FRAG             0x000F
106 #define IEEE80211_SCTL_SEQ              0xFFF0
107
108 /* QOS control */
109 #define IEEE80211_QCTL_TID              0x000F
110
111 /* debug macros */
112
113 #ifdef CONFIG_IEEE80211_DEBUG
114 extern u32 ieee80211_debug_level;
115 #define IEEE80211_DEBUG(level, fmt, args...) \
116 do { if (ieee80211_debug_level & (level)) \
117   printk(KERN_DEBUG "ieee80211: %c %s " fmt, \
118          in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
119 static inline bool ieee80211_ratelimit_debug(u32 level)
120 {
121         return (ieee80211_debug_level & level) && net_ratelimit();
122 }
123 #else
124 #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
125 static inline bool ieee80211_ratelimit_debug(u32 level)
126 {
127         return false;
128 }
129 #endif                          /* CONFIG_IEEE80211_DEBUG */
130
131 /*
132  * To use the debug system:
133  *
134  * If you are defining a new debug classification, simply add it to the #define
135  * list here in the form of:
136  *
137  * #define IEEE80211_DL_xxxx VALUE
138  *
139  * shifting value to the left one bit from the previous entry.  xxxx should be
140  * the name of the classification (for example, WEP)
141  *
142  * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your
143  * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want
144  * to send output to that classification.
145  *
146  * To add your debug level to the list of levels seen when you perform
147  *
148  * % cat /proc/net/ieee80211/debug_level
149  *
150  * you simply need to add your entry to the ieee80211_debug_level array.
151  *
152  * If you do not see debug_level in /proc/net/ieee80211 then you do not have
153  * CONFIG_IEEE80211_DEBUG defined in your kernel configuration
154  *
155  */
156
157 #define IEEE80211_DL_INFO          (1<<0)
158 #define IEEE80211_DL_WX            (1<<1)
159 #define IEEE80211_DL_SCAN          (1<<2)
160 #define IEEE80211_DL_STATE         (1<<3)
161 #define IEEE80211_DL_MGMT          (1<<4)
162 #define IEEE80211_DL_FRAG          (1<<5)
163 #define IEEE80211_DL_DROP          (1<<7)
164
165 #define IEEE80211_DL_TX            (1<<8)
166 #define IEEE80211_DL_RX            (1<<9)
167 #define IEEE80211_DL_QOS           (1<<31)
168
169 #define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a)
170 #define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a)
171 #define IEEE80211_DEBUG_INFO(f, a...)   IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a)
172
173 #define IEEE80211_DEBUG_WX(f, a...)     IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a)
174 #define IEEE80211_DEBUG_SCAN(f, a...)   IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a)
175 #define IEEE80211_DEBUG_STATE(f, a...)  IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a)
176 #define IEEE80211_DEBUG_MGMT(f, a...)  IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a)
177 #define IEEE80211_DEBUG_FRAG(f, a...)  IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a)
178 #define IEEE80211_DEBUG_DROP(f, a...)  IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a)
179 #define IEEE80211_DEBUG_TX(f, a...)  IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a)
180 #define IEEE80211_DEBUG_RX(f, a...)  IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a)
181 #define IEEE80211_DEBUG_QOS(f, a...)  IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a)
182 #include <linux/netdevice.h>
183 #include <linux/if_arp.h>       /* ARPHRD_ETHER */
184
185 #ifndef WIRELESS_SPY
186 #define WIRELESS_SPY            /* enable iwspy support */
187 #endif
188 #include <net/iw_handler.h>     /* new driver API */
189
190 #define ETH_P_PREAUTH 0x88C7    /* IEEE 802.11i pre-authentication */
191
192 #ifndef ETH_P_80211_RAW
193 #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
194 #endif
195
196 /* IEEE 802.11 defines */
197
198 #define P80211_OUI_LEN 3
199
200 struct ieee80211_snap_hdr {
201
202         u8 dsap;                /* always 0xAA */
203         u8 ssap;                /* always 0xAA */
204         u8 ctrl;                /* always 0x03 */
205         u8 oui[P80211_OUI_LEN]; /* organizational universal id */
206
207 } __attribute__ ((packed));
208
209 #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
210
211 #define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS)
212 #define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
213 #define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
214
215 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
216 #define WLAN_GET_SEQ_SEQ(seq)  (((seq) & IEEE80211_SCTL_SEQ) >> 4)
217
218 /* Action categories - 802.11h */
219 enum ieee80211_actioncategories {
220         WLAN_ACTION_SPECTRUM_MGMT = 0,
221         /* Reserved 1-127  */
222         /* Error    128-255 */
223 };
224
225 /* Action details - 802.11h */
226 enum ieee80211_actiondetails {
227         WLAN_ACTION_CATEGORY_MEASURE_REQUEST = 0,
228         WLAN_ACTION_CATEGORY_MEASURE_REPORT = 1,
229         WLAN_ACTION_CATEGORY_TPC_REQUEST = 2,
230         WLAN_ACTION_CATEGORY_TPC_REPORT = 3,
231         WLAN_ACTION_CATEGORY_CHANNEL_SWITCH = 4,
232         /* 5 - 255 Reserved */
233 };
234
235 #define IEEE80211_STATMASK_SIGNAL (1<<0)
236 #define IEEE80211_STATMASK_RSSI (1<<1)
237 #define IEEE80211_STATMASK_NOISE (1<<2)
238 #define IEEE80211_STATMASK_RATE (1<<3)
239 #define IEEE80211_STATMASK_WEMASK 0x7
240
241 #define IEEE80211_CCK_MODULATION    (1<<0)
242 #define IEEE80211_OFDM_MODULATION   (1<<1)
243
244 #define IEEE80211_24GHZ_BAND     (1<<0)
245 #define IEEE80211_52GHZ_BAND     (1<<1)
246
247 #define IEEE80211_CCK_RATE_1MB                  0x02
248 #define IEEE80211_CCK_RATE_2MB                  0x04
249 #define IEEE80211_CCK_RATE_5MB                  0x0B
250 #define IEEE80211_CCK_RATE_11MB                 0x16
251 #define IEEE80211_OFDM_RATE_6MB                 0x0C
252 #define IEEE80211_OFDM_RATE_9MB                 0x12
253 #define IEEE80211_OFDM_RATE_12MB                0x18
254 #define IEEE80211_OFDM_RATE_18MB                0x24
255 #define IEEE80211_OFDM_RATE_24MB                0x30
256 #define IEEE80211_OFDM_RATE_36MB                0x48
257 #define IEEE80211_OFDM_RATE_48MB                0x60
258 #define IEEE80211_OFDM_RATE_54MB                0x6C
259 #define IEEE80211_BASIC_RATE_MASK               0x80
260
261 #define IEEE80211_CCK_RATE_1MB_MASK             (1<<0)
262 #define IEEE80211_CCK_RATE_2MB_MASK             (1<<1)
263 #define IEEE80211_CCK_RATE_5MB_MASK             (1<<2)
264 #define IEEE80211_CCK_RATE_11MB_MASK            (1<<3)
265 #define IEEE80211_OFDM_RATE_6MB_MASK            (1<<4)
266 #define IEEE80211_OFDM_RATE_9MB_MASK            (1<<5)
267 #define IEEE80211_OFDM_RATE_12MB_MASK           (1<<6)
268 #define IEEE80211_OFDM_RATE_18MB_MASK           (1<<7)
269 #define IEEE80211_OFDM_RATE_24MB_MASK           (1<<8)
270 #define IEEE80211_OFDM_RATE_36MB_MASK           (1<<9)
271 #define IEEE80211_OFDM_RATE_48MB_MASK           (1<<10)
272 #define IEEE80211_OFDM_RATE_54MB_MASK           (1<<11)
273
274 #define IEEE80211_CCK_RATES_MASK                0x0000000F
275 #define IEEE80211_CCK_BASIC_RATES_MASK  (IEEE80211_CCK_RATE_1MB_MASK | \
276         IEEE80211_CCK_RATE_2MB_MASK)
277 #define IEEE80211_CCK_DEFAULT_RATES_MASK        (IEEE80211_CCK_BASIC_RATES_MASK | \
278         IEEE80211_CCK_RATE_5MB_MASK | \
279         IEEE80211_CCK_RATE_11MB_MASK)
280
281 #define IEEE80211_OFDM_RATES_MASK               0x00000FF0
282 #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
283         IEEE80211_OFDM_RATE_12MB_MASK | \
284         IEEE80211_OFDM_RATE_24MB_MASK)
285 #define IEEE80211_OFDM_DEFAULT_RATES_MASK       (IEEE80211_OFDM_BASIC_RATES_MASK | \
286         IEEE80211_OFDM_RATE_9MB_MASK  | \
287         IEEE80211_OFDM_RATE_18MB_MASK | \
288         IEEE80211_OFDM_RATE_36MB_MASK | \
289         IEEE80211_OFDM_RATE_48MB_MASK | \
290         IEEE80211_OFDM_RATE_54MB_MASK)
291 #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
292                                 IEEE80211_CCK_DEFAULT_RATES_MASK)
293
294 #define IEEE80211_NUM_OFDM_RATES            8
295 #define IEEE80211_NUM_CCK_RATES             4
296 #define IEEE80211_OFDM_SHIFT_MASK_A         4
297
298 /* NOTE: This data is for statistical purposes; not all hardware provides this
299  *       information for frames received.
300  *       For ieee80211_rx_mgt, you need to set at least the 'len' parameter.
301  */
302 struct ieee80211_rx_stats {
303         u32 mac_time;
304         s8 rssi;
305         u8 signal;
306         u8 noise;
307         u16 rate;               /* in 100 kbps */
308         u8 received_channel;
309         u8 control;
310         u8 mask;
311         u8 freq;
312         u16 len;
313         u64 tsf;
314         u32 beacon_time;
315 };
316
317 /* IEEE 802.11 requires that STA supports concurrent reception of at least
318  * three fragmented frames. This define can be increased to support more
319  * concurrent frames, but it should be noted that each entry can consume about
320  * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
321 #define IEEE80211_FRAG_CACHE_LEN 4
322
323 struct ieee80211_frag_entry {
324         unsigned long first_frag_time;
325         unsigned int seq;
326         unsigned int last_frag;
327         struct sk_buff *skb;
328         u8 src_addr[ETH_ALEN];
329         u8 dst_addr[ETH_ALEN];
330 };
331
332 struct ieee80211_stats {
333         unsigned int tx_unicast_frames;
334         unsigned int tx_multicast_frames;
335         unsigned int tx_fragments;
336         unsigned int tx_unicast_octets;
337         unsigned int tx_multicast_octets;
338         unsigned int tx_deferred_transmissions;
339         unsigned int tx_single_retry_frames;
340         unsigned int tx_multiple_retry_frames;
341         unsigned int tx_retry_limit_exceeded;
342         unsigned int tx_discards;
343         unsigned int rx_unicast_frames;
344         unsigned int rx_multicast_frames;
345         unsigned int rx_fragments;
346         unsigned int rx_unicast_octets;
347         unsigned int rx_multicast_octets;
348         unsigned int rx_fcs_errors;
349         unsigned int rx_discards_no_buffer;
350         unsigned int tx_discards_wrong_sa;
351         unsigned int rx_discards_undecryptable;
352         unsigned int rx_message_in_msg_fragments;
353         unsigned int rx_message_in_bad_msg_fragments;
354 };
355
356 struct ieee80211_device;
357
358 #include "ieee80211_crypt.h"
359
360 #define SEC_KEY_1               (1<<0)
361 #define SEC_KEY_2               (1<<1)
362 #define SEC_KEY_3               (1<<2)
363 #define SEC_KEY_4               (1<<3)
364 #define SEC_ACTIVE_KEY          (1<<4)
365 #define SEC_AUTH_MODE           (1<<5)
366 #define SEC_UNICAST_GROUP       (1<<6)
367 #define SEC_LEVEL               (1<<7)
368 #define SEC_ENABLED             (1<<8)
369 #define SEC_ENCRYPT             (1<<9)
370
371 #define SEC_LEVEL_0             0       /* None */
372 #define SEC_LEVEL_1             1       /* WEP 40 and 104 bit */
373 #define SEC_LEVEL_2             2       /* Level 1 + TKIP */
374 #define SEC_LEVEL_2_CKIP        3       /* Level 1 + CKIP */
375 #define SEC_LEVEL_3             4       /* Level 2 + CCMP */
376
377 #define SEC_ALG_NONE            0
378 #define SEC_ALG_WEP             1
379 #define SEC_ALG_TKIP            2
380 #define SEC_ALG_CCMP            3
381
382 #define WEP_KEYS                4
383 #define WEP_KEY_LEN             13
384 #define SCM_KEY_LEN             32
385 #define SCM_TEMPORAL_KEY_LENGTH 16
386
387 struct ieee80211_security {
388         u16 active_key:2,
389             enabled:1,
390             auth_mode:2, auth_algo:4, unicast_uses_group:1, encrypt:1;
391         u8 encode_alg[WEP_KEYS];
392         u8 key_sizes[WEP_KEYS];
393         u8 keys[WEP_KEYS][SCM_KEY_LEN];
394         u8 level;
395         u16 flags;
396 } __attribute__ ((packed));
397
398 /*
399
400  802.11 data frame from AP
401
402       ,-------------------------------------------------------------------.
403 Bytes |  2   |  2   |    6    |    6    |    6    |  2   | 0..2312 |   4  |
404       |------|------|---------|---------|---------|------|---------|------|
405 Desc. | ctrl | dura |  DA/RA  |   TA    |    SA   | Sequ |  frame  |  fcs |
406       |      | tion | (BSSID) |         |         | ence |  data   |      |
407       `-------------------------------------------------------------------'
408
409 Total: 28-2340 bytes
410
411 */
412
413 #define BEACON_PROBE_SSID_ID_POSITION 12
414
415 /* Management Frame Information Element Types */
416 enum ieee80211_mfie {
417         MFIE_TYPE_SSID = 0,
418         MFIE_TYPE_RATES = 1,
419         MFIE_TYPE_FH_SET = 2,
420         MFIE_TYPE_DS_SET = 3,
421         MFIE_TYPE_CF_SET = 4,
422         MFIE_TYPE_TIM = 5,
423         MFIE_TYPE_IBSS_SET = 6,
424         MFIE_TYPE_COUNTRY = 7,
425         MFIE_TYPE_HOP_PARAMS = 8,
426         MFIE_TYPE_HOP_TABLE = 9,
427         MFIE_TYPE_REQUEST = 10,
428         MFIE_TYPE_CHALLENGE = 16,
429         MFIE_TYPE_POWER_CONSTRAINT = 32,
430         MFIE_TYPE_POWER_CAPABILITY = 33,
431         MFIE_TYPE_TPC_REQUEST = 34,
432         MFIE_TYPE_TPC_REPORT = 35,
433         MFIE_TYPE_SUPP_CHANNELS = 36,
434         MFIE_TYPE_CSA = 37,
435         MFIE_TYPE_MEASURE_REQUEST = 38,
436         MFIE_TYPE_MEASURE_REPORT = 39,
437         MFIE_TYPE_QUIET = 40,
438         MFIE_TYPE_IBSS_DFS = 41,
439         MFIE_TYPE_ERP_INFO = 42,
440         MFIE_TYPE_RSN = 48,
441         MFIE_TYPE_RATES_EX = 50,
442         MFIE_TYPE_GENERIC = 221,
443         MFIE_TYPE_QOS_PARAMETER = 222,
444 };
445
446 struct ieee80211_hdr_1addr {
447         __le16 frame_ctl;
448         __le16 duration_id;
449         u8 addr1[ETH_ALEN];
450         u8 payload[0];
451 } __attribute__ ((packed));
452
453 struct ieee80211_hdr_2addr {
454         __le16 frame_ctl;
455         __le16 duration_id;
456         u8 addr1[ETH_ALEN];
457         u8 addr2[ETH_ALEN];
458         u8 payload[0];
459 } __attribute__ ((packed));
460
461 struct ieee80211_hdr_3addr {
462         __le16 frame_ctl;
463         __le16 duration_id;
464         u8 addr1[ETH_ALEN];
465         u8 addr2[ETH_ALEN];
466         u8 addr3[ETH_ALEN];
467         __le16 seq_ctl;
468         u8 payload[0];
469 } __attribute__ ((packed));
470
471 struct ieee80211_hdr_4addr {
472         __le16 frame_ctl;
473         __le16 duration_id;
474         u8 addr1[ETH_ALEN];
475         u8 addr2[ETH_ALEN];
476         u8 addr3[ETH_ALEN];
477         __le16 seq_ctl;
478         u8 addr4[ETH_ALEN];
479         u8 payload[0];
480 } __attribute__ ((packed));
481
482 struct ieee80211_hdr_3addrqos {
483         __le16 frame_ctl;
484         __le16 duration_id;
485         u8 addr1[ETH_ALEN];
486         u8 addr2[ETH_ALEN];
487         u8 addr3[ETH_ALEN];
488         __le16 seq_ctl;
489         u8 payload[0];
490         __le16 qos_ctl;
491 } __attribute__ ((packed));
492
493 struct ieee80211_info_element {
494         u8 id;
495         u8 len;
496         u8 data[0];
497 } __attribute__ ((packed));
498
499 /*
500  * These are the data types that can make up management packets
501  *
502         u16 auth_algorithm;
503         u16 auth_sequence;
504         u16 beacon_interval;
505         u16 capability;
506         u8 current_ap[ETH_ALEN];
507         u16 listen_interval;
508         struct {
509                 u16 association_id:14, reserved:2;
510         } __attribute__ ((packed));
511         u32 time_stamp[2];
512         u16 reason;
513         u16 status;
514 */
515
516 struct ieee80211_auth {
517         struct ieee80211_hdr_3addr header;
518         __le16 algorithm;
519         __le16 transaction;
520         __le16 status;
521         /* challenge */
522         struct ieee80211_info_element info_element[0];
523 } __attribute__ ((packed));
524
525 struct ieee80211_channel_switch {
526         u8 id;
527         u8 len;
528         u8 mode;
529         u8 channel;
530         u8 count;
531 } __attribute__ ((packed));
532
533 struct ieee80211_action {
534         struct ieee80211_hdr_3addr header;
535         u8 category;
536         u8 action;
537         union {
538                 struct ieee80211_action_exchange {
539                         u8 token;
540                         struct ieee80211_info_element info_element[0];
541                 } exchange;
542                 struct ieee80211_channel_switch channel_switch;
543
544         } format;
545 } __attribute__ ((packed));
546
547 struct ieee80211_disassoc {
548         struct ieee80211_hdr_3addr header;
549         __le16 reason;
550 } __attribute__ ((packed));
551
552 /* Alias deauth for disassoc */
553 #define ieee80211_deauth ieee80211_disassoc
554
555 struct ieee80211_probe_request {
556         struct ieee80211_hdr_3addr header;
557         /* SSID, supported rates */
558         struct ieee80211_info_element info_element[0];
559 } __attribute__ ((packed));
560
561 struct ieee80211_probe_response {
562         struct ieee80211_hdr_3addr header;
563         __le32 time_stamp[2];
564         __le16 beacon_interval;
565         __le16 capability;
566         /* SSID, supported rates, FH params, DS params,
567          * CF params, IBSS params, TIM (if beacon), RSN */
568         struct ieee80211_info_element info_element[0];
569 } __attribute__ ((packed));
570
571 /* Alias beacon for probe_response */
572 #define ieee80211_beacon ieee80211_probe_response
573
574 struct ieee80211_assoc_request {
575         struct ieee80211_hdr_3addr header;
576         __le16 capability;
577         __le16 listen_interval;
578         /* SSID, supported rates, RSN */
579         struct ieee80211_info_element info_element[0];
580 } __attribute__ ((packed));
581
582 struct ieee80211_reassoc_request {
583         struct ieee80211_hdr_3addr header;
584         __le16 capability;
585         __le16 listen_interval;
586         u8 current_ap[ETH_ALEN];
587         struct ieee80211_info_element info_element[0];
588 } __attribute__ ((packed));
589
590 struct ieee80211_assoc_response {
591         struct ieee80211_hdr_3addr header;
592         __le16 capability;
593         __le16 status;
594         __le16 aid;
595         /* supported rates */
596         struct ieee80211_info_element info_element[0];
597 } __attribute__ ((packed));
598
599 struct ieee80211_txb {
600         u8 nr_frags;
601         u8 encrypted;
602         u8 rts_included;
603         u8 reserved;
604         u16 frag_size;
605         u16 payload_size;
606         struct sk_buff *fragments[0];
607 };
608
609 /* SWEEP TABLE ENTRIES NUMBER */
610 #define MAX_SWEEP_TAB_ENTRIES             42
611 #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET  7
612 /* MAX_RATES_LENGTH needs to be 12.  The spec says 8, and many APs
613  * only use 8, and then use extended rates for the remaining supported
614  * rates.  Other APs, however, stick all of their supported rates on the
615  * main rates information element... */
616 #define MAX_RATES_LENGTH                  ((u8)12)
617 #define MAX_RATES_EX_LENGTH               ((u8)16)
618 #define MAX_NETWORK_COUNT                  128
619
620 #define CRC_LENGTH                 4U
621
622 #define MAX_WPA_IE_LEN 64
623
624 #define NETWORK_HAS_OFDM       (1<<1)
625 #define NETWORK_HAS_CCK        (1<<2)
626
627 /* QoS structure */
628 #define NETWORK_HAS_QOS_PARAMETERS      (1<<3)
629 #define NETWORK_HAS_QOS_INFORMATION     (1<<4)
630 #define NETWORK_HAS_QOS_MASK            (NETWORK_HAS_QOS_PARAMETERS | \
631                                          NETWORK_HAS_QOS_INFORMATION)
632
633 /* 802.11h */
634 #define NETWORK_HAS_POWER_CONSTRAINT    (1<<5)
635 #define NETWORK_HAS_CSA                 (1<<6)
636 #define NETWORK_HAS_QUIET               (1<<7)
637 #define NETWORK_HAS_IBSS_DFS            (1<<8)
638 #define NETWORK_HAS_TPC_REPORT          (1<<9)
639
640 #define NETWORK_HAS_ERP_VALUE           (1<<10)
641
642 #define QOS_QUEUE_NUM                   4
643 #define QOS_OUI_LEN                     3
644 #define QOS_OUI_TYPE                    2
645 #define QOS_ELEMENT_ID                  221
646 #define QOS_OUI_INFO_SUB_TYPE           0
647 #define QOS_OUI_PARAM_SUB_TYPE          1
648 #define QOS_VERSION_1                   1
649 #define QOS_AIFSN_MIN_VALUE             2
650
651 struct ieee80211_qos_information_element {
652         u8 elementID;
653         u8 length;
654         u8 qui[QOS_OUI_LEN];
655         u8 qui_type;
656         u8 qui_subtype;
657         u8 version;
658         u8 ac_info;
659 } __attribute__ ((packed));
660
661 struct ieee80211_qos_ac_parameter {
662         u8 aci_aifsn;
663         u8 ecw_min_max;
664         __le16 tx_op_limit;
665 } __attribute__ ((packed));
666
667 struct ieee80211_qos_parameter_info {
668         struct ieee80211_qos_information_element info_element;
669         u8 reserved;
670         struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
671 } __attribute__ ((packed));
672
673 struct ieee80211_qos_parameters {
674         __le16 cw_min[QOS_QUEUE_NUM];
675         __le16 cw_max[QOS_QUEUE_NUM];
676         u8 aifs[QOS_QUEUE_NUM];
677         u8 flag[QOS_QUEUE_NUM];
678         __le16 tx_op_limit[QOS_QUEUE_NUM];
679 } __attribute__ ((packed));
680
681 struct ieee80211_qos_data {
682         struct ieee80211_qos_parameters parameters;
683         int active;
684         int supported;
685         u8 param_count;
686         u8 old_param_count;
687 };
688
689 struct ieee80211_tim_parameters {
690         u8 tim_count;
691         u8 tim_period;
692 } __attribute__ ((packed));
693
694 /*******************************************************/
695
696 enum {                          /* ieee80211_basic_report.map */
697         IEEE80211_BASIC_MAP_BSS = (1 << 0),
698         IEEE80211_BASIC_MAP_OFDM = (1 << 1),
699         IEEE80211_BASIC_MAP_UNIDENTIFIED = (1 << 2),
700         IEEE80211_BASIC_MAP_RADAR = (1 << 3),
701         IEEE80211_BASIC_MAP_UNMEASURED = (1 << 4),
702         /* Bits 5-7 are reserved */
703
704 };
705 struct ieee80211_basic_report {
706         u8 channel;
707         __le64 start_time;
708         __le16 duration;
709         u8 map;
710 } __attribute__ ((packed));
711
712 enum {                          /* ieee80211_measurement_request.mode */
713         /* Bit 0 is reserved */
714         IEEE80211_MEASUREMENT_ENABLE = (1 << 1),
715         IEEE80211_MEASUREMENT_REQUEST = (1 << 2),
716         IEEE80211_MEASUREMENT_REPORT = (1 << 3),
717         /* Bits 4-7 are reserved */
718 };
719
720 enum {
721         IEEE80211_REPORT_BASIC = 0,     /* required */
722         IEEE80211_REPORT_CCA = 1,       /* optional */
723         IEEE80211_REPORT_RPI = 2,       /* optional */
724         /* 3-255 reserved */
725 };
726
727 struct ieee80211_measurement_params {
728         u8 channel;
729         __le64 start_time;
730         __le16 duration;
731 } __attribute__ ((packed));
732
733 struct ieee80211_measurement_request {
734         struct ieee80211_info_element ie;
735         u8 token;
736         u8 mode;
737         u8 type;
738         struct ieee80211_measurement_params params[0];
739 } __attribute__ ((packed));
740
741 struct ieee80211_measurement_report {
742         struct ieee80211_info_element ie;
743         u8 token;
744         u8 mode;
745         u8 type;
746         union {
747                 struct ieee80211_basic_report basic[0];
748         } u;
749 } __attribute__ ((packed));
750
751 struct ieee80211_tpc_report {
752         u8 transmit_power;
753         u8 link_margin;
754 } __attribute__ ((packed));
755
756 struct ieee80211_channel_map {
757         u8 channel;
758         u8 map;
759 } __attribute__ ((packed));
760
761 struct ieee80211_ibss_dfs {
762         struct ieee80211_info_element ie;
763         u8 owner[ETH_ALEN];
764         u8 recovery_interval;
765         struct ieee80211_channel_map channel_map[0];
766 };
767
768 struct ieee80211_csa {
769         u8 mode;
770         u8 channel;
771         u8 count;
772 } __attribute__ ((packed));
773
774 struct ieee80211_quiet {
775         u8 count;
776         u8 period;
777         u8 duration;
778         u8 offset;
779 } __attribute__ ((packed));
780
781 struct ieee80211_network {
782         /* These entries are used to identify a unique network */
783         u8 bssid[ETH_ALEN];
784         u8 channel;
785         /* Ensure null-terminated for any debug msgs */
786         u8 ssid[IW_ESSID_MAX_SIZE + 1];
787         u8 ssid_len;
788
789         struct ieee80211_qos_data qos_data;
790
791         /* These are network statistics */
792         struct ieee80211_rx_stats stats;
793         u16 capability;
794         u8 rates[MAX_RATES_LENGTH];
795         u8 rates_len;
796         u8 rates_ex[MAX_RATES_EX_LENGTH];
797         u8 rates_ex_len;
798         unsigned long last_scanned;
799         u8 mode;
800         u32 flags;
801         u32 last_associate;
802         u32 time_stamp[2];
803         u16 beacon_interval;
804         u16 listen_interval;
805         u16 atim_window;
806         u8 erp_value;
807         u8 wpa_ie[MAX_WPA_IE_LEN];
808         size_t wpa_ie_len;
809         u8 rsn_ie[MAX_WPA_IE_LEN];
810         size_t rsn_ie_len;
811         struct ieee80211_tim_parameters tim;
812
813         /* 802.11h info */
814
815         /* Power Constraint - mandatory if spctrm mgmt required */
816         u8 power_constraint;
817
818         /* TPC Report - mandatory if spctrm mgmt required */
819         struct ieee80211_tpc_report tpc_report;
820
821         /* IBSS DFS - mandatory if spctrm mgmt required and IBSS
822          * NOTE: This is variable length and so must be allocated dynamically */
823         struct ieee80211_ibss_dfs *ibss_dfs;
824
825         /* Channel Switch Announcement - optional if spctrm mgmt required */
826         struct ieee80211_csa csa;
827
828         /* Quiet - optional if spctrm mgmt required */
829         struct ieee80211_quiet quiet;
830
831         struct list_head list;
832 };
833
834 enum ieee80211_state {
835         IEEE80211_UNINITIALIZED = 0,
836         IEEE80211_INITIALIZED,
837         IEEE80211_ASSOCIATING,
838         IEEE80211_ASSOCIATED,
839         IEEE80211_AUTHENTICATING,
840         IEEE80211_AUTHENTICATED,
841         IEEE80211_SHUTDOWN
842 };
843
844 #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
845 #define DEFAULT_FTS 2346
846
847 #define CFG_IEEE80211_RESERVE_FCS (1<<0)
848 #define CFG_IEEE80211_COMPUTE_FCS (1<<1)
849 #define CFG_IEEE80211_RTS (1<<2)
850
851 #define IEEE80211_24GHZ_MIN_CHANNEL 1
852 #define IEEE80211_24GHZ_MAX_CHANNEL 14
853 #define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \
854                                   IEEE80211_24GHZ_MIN_CHANNEL + 1)
855
856 #define IEEE80211_52GHZ_MIN_CHANNEL 34
857 #define IEEE80211_52GHZ_MAX_CHANNEL 165
858 #define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
859                                   IEEE80211_52GHZ_MIN_CHANNEL + 1)
860
861 enum {
862         IEEE80211_CH_PASSIVE_ONLY = (1 << 0),
863         IEEE80211_CH_80211H_RULES = (1 << 1),
864         IEEE80211_CH_B_ONLY = (1 << 2),
865         IEEE80211_CH_NO_IBSS = (1 << 3),
866         IEEE80211_CH_UNIFORM_SPREADING = (1 << 4),
867         IEEE80211_CH_RADAR_DETECT = (1 << 5),
868         IEEE80211_CH_INVALID = (1 << 6),
869 };
870
871 struct ieee80211_channel {
872         u32 freq;       /* in MHz */
873         u8 channel;
874         u8 flags;
875         u8 max_power;   /* in dBm */
876 };
877
878 struct ieee80211_geo {
879         u8 name[4];
880         u8 bg_channels;
881         u8 a_channels;
882         struct ieee80211_channel bg[IEEE80211_24GHZ_CHANNELS];
883         struct ieee80211_channel a[IEEE80211_52GHZ_CHANNELS];
884 };
885
886 struct ieee80211_device {
887         struct net_device *dev;
888         struct ieee80211_security sec;
889
890         /* Bookkeeping structures */
891         struct net_device_stats stats;
892         struct ieee80211_stats ieee_stats;
893
894         struct ieee80211_geo geo;
895
896         /* Probe / Beacon management */
897         struct list_head network_free_list;
898         struct list_head network_list;
899         struct ieee80211_network *networks;
900         int scans;
901         int scan_age;
902
903         int iw_mode;            /* operating mode (IW_MODE_*) */
904         struct iw_spy_data spy_data;    /* iwspy support */
905
906         spinlock_t lock;
907
908         int tx_headroom;        /* Set to size of any additional room needed at front
909                                  * of allocated Tx SKBs */
910         u32 config;
911
912         /* WEP and other encryption related settings at the device level */
913         int open_wep;           /* Set to 1 to allow unencrypted frames */
914
915         int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
916                                  * WEP key changes */
917
918         /* If the host performs {en,de}cryption, then set to 1 */
919         int host_encrypt;
920         int host_encrypt_msdu;
921         int host_decrypt;
922         /* host performs multicast decryption */
923         int host_mc_decrypt;
924
925         /* host should strip IV and ICV from protected frames */
926         /* meaningful only when hardware decryption is being used */
927         int host_strip_iv_icv;
928
929         int host_open_frag;
930         int host_build_iv;
931         int ieee802_1x;         /* is IEEE 802.1X used */
932
933         /* WPA data */
934         int wpa_enabled;
935         int drop_unencrypted;
936         int privacy_invoked;
937         size_t wpa_ie_len;
938         u8 *wpa_ie;
939
940         struct list_head crypt_deinit_list;
941         struct ieee80211_crypt_data *crypt[WEP_KEYS];
942         int tx_keyidx;          /* default TX key index (crypt[tx_keyidx]) */
943         struct timer_list crypt_deinit_timer;
944         int crypt_quiesced;
945
946         int bcrx_sta_key;       /* use individual keys to override default keys even
947                                  * with RX of broad/multicast frames */
948
949         /* Fragmentation structures */
950         struct ieee80211_frag_entry frag_cache[IEEE80211_FRAG_CACHE_LEN];
951         unsigned int frag_next_idx;
952         u16 fts;                /* Fragmentation Threshold */
953         u16 rts;                /* RTS threshold */
954
955         /* Association info */
956         u8 bssid[ETH_ALEN];
957
958         enum ieee80211_state state;
959
960         int mode;               /* A, B, G */
961         int modulation;         /* CCK, OFDM */
962         int freq_band;          /* 2.4Ghz, 5.2Ghz, Mixed */
963         int abg_true;           /* ABG flag              */
964
965         int perfect_rssi;
966         int worst_rssi;
967
968         u16 prev_seq_ctl;       /* used to drop duplicate frames */
969
970         /* Callback functions */
971         void (*set_security) (struct net_device * dev,
972                               struct ieee80211_security * sec);
973         int (*hard_start_xmit) (struct ieee80211_txb * txb,
974                                 struct net_device * dev, int pri);
975         int (*reset_port) (struct net_device * dev);
976         int (*is_queue_full) (struct net_device * dev, int pri);
977
978         int (*handle_management) (struct net_device * dev,
979                                   struct ieee80211_network * network, u16 type);
980         int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb);
981
982         /* Typical STA methods */
983         int (*handle_auth) (struct net_device * dev,
984                             struct ieee80211_auth * auth);
985         int (*handle_deauth) (struct net_device * dev,
986                               struct ieee80211_deauth * auth);
987         int (*handle_action) (struct net_device * dev,
988                               struct ieee80211_action * action,
989                               struct ieee80211_rx_stats * stats);
990         int (*handle_disassoc) (struct net_device * dev,
991                                 struct ieee80211_disassoc * assoc);
992         int (*handle_beacon) (struct net_device * dev,
993                               struct ieee80211_beacon * beacon,
994                               struct ieee80211_network * network);
995         int (*handle_probe_response) (struct net_device * dev,
996                                       struct ieee80211_probe_response * resp,
997                                       struct ieee80211_network * network);
998         int (*handle_probe_request) (struct net_device * dev,
999                                      struct ieee80211_probe_request * req,
1000                                      struct ieee80211_rx_stats * stats);
1001         int (*handle_assoc_response) (struct net_device * dev,
1002                                       struct ieee80211_assoc_response * resp,
1003                                       struct ieee80211_network * network);
1004
1005         /* Typical AP methods */
1006         int (*handle_assoc_request) (struct net_device * dev);
1007         int (*handle_reassoc_request) (struct net_device * dev,
1008                                        struct ieee80211_reassoc_request * req);
1009
1010         /* This must be the last item so that it points to the data
1011          * allocated beyond this structure by alloc_ieee80211 */
1012         u8 priv[0];
1013 };
1014
1015 #define IEEE_A            (1<<0)
1016 #define IEEE_B            (1<<1)
1017 #define IEEE_G            (1<<2)
1018 #define IEEE_MODE_MASK    (IEEE_A|IEEE_B|IEEE_G)
1019
1020 static inline void *ieee80211_priv(struct net_device *dev)
1021 {
1022         return ((struct ieee80211_device *)netdev_priv(dev))->priv;
1023 }
1024
1025 static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee,
1026                                           int mode)
1027 {
1028         /*
1029          * It is possible for both access points and our device to support
1030          * combinations of modes, so as long as there is one valid combination
1031          * of ap/device supported modes, then return success
1032          *
1033          */
1034         if ((mode & IEEE_A) &&
1035             (ieee->modulation & IEEE80211_OFDM_MODULATION) &&
1036             (ieee->freq_band & IEEE80211_52GHZ_BAND))
1037                 return 1;
1038
1039         if ((mode & IEEE_G) &&
1040             (ieee->modulation & IEEE80211_OFDM_MODULATION) &&
1041             (ieee->freq_band & IEEE80211_24GHZ_BAND))
1042                 return 1;
1043
1044         if ((mode & IEEE_B) &&
1045             (ieee->modulation & IEEE80211_CCK_MODULATION) &&
1046             (ieee->freq_band & IEEE80211_24GHZ_BAND))
1047                 return 1;
1048
1049         return 0;
1050 }
1051
1052 static inline int ieee80211_get_hdrlen(u16 fc)
1053 {
1054         int hdrlen = IEEE80211_3ADDR_LEN;
1055         u16 stype = WLAN_FC_GET_STYPE(fc);
1056
1057         switch (WLAN_FC_GET_TYPE(fc)) {
1058         case IEEE80211_FTYPE_DATA:
1059                 if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
1060                         hdrlen = IEEE80211_4ADDR_LEN;
1061                 if (stype & IEEE80211_STYPE_QOS_DATA)
1062                         hdrlen += 2;
1063                 break;
1064         case IEEE80211_FTYPE_CTL:
1065                 switch (WLAN_FC_GET_STYPE(fc)) {
1066                 case IEEE80211_STYPE_CTS:
1067                 case IEEE80211_STYPE_ACK:
1068                         hdrlen = IEEE80211_1ADDR_LEN;
1069                         break;
1070                 default:
1071                         hdrlen = IEEE80211_2ADDR_LEN;
1072                         break;
1073                 }
1074                 break;
1075         }
1076
1077         return hdrlen;
1078 }
1079
1080 static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr)
1081 {
1082         switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control))) {
1083         case IEEE80211_1ADDR_LEN:
1084                 return ((struct ieee80211_hdr_1addr *)hdr)->payload;
1085         case IEEE80211_2ADDR_LEN:
1086                 return ((struct ieee80211_hdr_2addr *)hdr)->payload;
1087         case IEEE80211_3ADDR_LEN:
1088                 return ((struct ieee80211_hdr_3addr *)hdr)->payload;
1089         case IEEE80211_4ADDR_LEN:
1090                 return ((struct ieee80211_hdr_4addr *)hdr)->payload;
1091         }
1092         return NULL;
1093 }
1094
1095 static inline int ieee80211_is_ofdm_rate(u8 rate)
1096 {
1097         switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
1098         case IEEE80211_OFDM_RATE_6MB:
1099         case IEEE80211_OFDM_RATE_9MB:
1100         case IEEE80211_OFDM_RATE_12MB:
1101         case IEEE80211_OFDM_RATE_18MB:
1102         case IEEE80211_OFDM_RATE_24MB:
1103         case IEEE80211_OFDM_RATE_36MB:
1104         case IEEE80211_OFDM_RATE_48MB:
1105         case IEEE80211_OFDM_RATE_54MB:
1106                 return 1;
1107         }
1108         return 0;
1109 }
1110
1111 static inline int ieee80211_is_cck_rate(u8 rate)
1112 {
1113         switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
1114         case IEEE80211_CCK_RATE_1MB:
1115         case IEEE80211_CCK_RATE_2MB:
1116         case IEEE80211_CCK_RATE_5MB:
1117         case IEEE80211_CCK_RATE_11MB:
1118                 return 1;
1119         }
1120         return 0;
1121 }
1122
1123 /* ieee80211.c */
1124 extern void free_ieee80211(struct net_device *dev);
1125 extern struct net_device *alloc_ieee80211(int sizeof_priv);
1126
1127 extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
1128
1129 /* ieee80211_tx.c */
1130 extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev);
1131 extern void ieee80211_txb_free(struct ieee80211_txb *);
1132
1133 /* ieee80211_rx.c */
1134 extern void ieee80211_rx_any(struct ieee80211_device *ieee,
1135                      struct sk_buff *skb, struct ieee80211_rx_stats *stats);
1136 extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
1137                         struct ieee80211_rx_stats *rx_stats);
1138 /* make sure to set stats->len */
1139 extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
1140                              struct ieee80211_hdr_4addr *header,
1141                              struct ieee80211_rx_stats *stats);
1142 extern void ieee80211_network_reset(struct ieee80211_network *network);
1143
1144 /* ieee80211_geo.c */
1145 extern const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device
1146                                                      *ieee);
1147 extern int ieee80211_set_geo(struct ieee80211_device *ieee,
1148                              const struct ieee80211_geo *geo);
1149
1150 extern int ieee80211_is_valid_channel(struct ieee80211_device *ieee,
1151                                       u8 channel);
1152 extern int ieee80211_channel_to_index(struct ieee80211_device *ieee,
1153                                       u8 channel);
1154 extern u8 ieee80211_freq_to_channel(struct ieee80211_device *ieee, u32 freq);
1155 extern u8 ieee80211_get_channel_flags(struct ieee80211_device *ieee,
1156                                       u8 channel);
1157 extern const struct ieee80211_channel *ieee80211_get_channel(struct
1158                                                              ieee80211_device
1159                                                              *ieee, u8 channel);
1160 extern u32 ieee80211_channel_to_freq(struct ieee80211_device * ieee,
1161                                       u8 channel);
1162
1163 /* ieee80211_wx.c */
1164 extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
1165                                  struct iw_request_info *info,
1166                                  union iwreq_data *wrqu, char *key);
1167 extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
1168                                    struct iw_request_info *info,
1169                                    union iwreq_data *wrqu, char *key);
1170 extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
1171                                    struct iw_request_info *info,
1172                                    union iwreq_data *wrqu, char *key);
1173 extern int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee,
1174                                       struct iw_request_info *info,
1175                                       union iwreq_data *wrqu, char *extra);
1176 extern int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee,
1177                                       struct iw_request_info *info,
1178                                       union iwreq_data *wrqu, char *extra);
1179
1180 static inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
1181 {
1182         ieee->scans++;
1183 }
1184
1185 static inline int ieee80211_get_scans(struct ieee80211_device *ieee)
1186 {
1187         return ieee->scans;
1188 }
1189
1190 #endif                          /* IEEE80211_H */