nrelease - fix/improve livecd
[dragonfly.git] / sys / dev / netif / wi / if_wavelan_ieee.h
1 /*-
2  * Copyright (c) 1997, 1998, 1999
3  *      Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *      This product includes software developed by Bill Paul.
16  * 4. Neither the name of the author nor the names of any co-contributors
17  *    may be used to endorse or promote products derived from this software
18  *    without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30  * THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * $FreeBSD: head/sys/dev/wi/if_wavelan_ieee.h 298955 2016-05-03 03:41:25Z pfg $
33  */
34
35 #ifndef _IF_WAVELAN_IEEE_H
36 #define _IF_WAVELAN_IEEE_H
37
38 /*
39  * This header defines a simple command interface to the FreeBSD
40  * WaveLAN/IEEE driver (wi) driver, which is used to set certain
41  * device-specific parameters which can't be easily managed through
42  * ifconfig(8). No, sysctl(2) is not the answer. I said a _simple_
43  * interface, didn't I.
44  */
45
46 #ifndef SIOCSWAVELAN
47 #define SIOCSWAVELAN    SIOCSIFGENERIC
48 #endif
49
50 #ifndef SIOCGWAVELAN
51 #define SIOCGWAVELAN    SIOCGIFGENERIC
52 #endif
53
54 /*
55  * Technically I don't think there's a limit to a record
56  * length. The largest record is the one that contains the CIS
57  * data, which is 240 words long, so 256 should be a safe
58  * value.
59  */
60 #define WI_MAX_DATALEN  512
61
62 #if 0
63 struct wi_req {
64         u_int16_t       wi_len;
65         u_int16_t       wi_type;
66         u_int16_t       wi_val[WI_MAX_DATALEN];
67 };
68 #endif
69
70 /*
71  * Private LTV records (interpreted only by the driver). This is
72  * a minor kludge to allow reading the interface statistics from
73  * the driver.
74  */
75 #define WI_RID_IFACE_STATS      0x0100
76 #define WI_RID_MGMT_XMIT        0x0200
77 #define WI_RID_ZERO_CACHE       0x0300
78 #define WI_RID_READ_CACHE       0x0400
79 #define WI_RID_FWDOWNLOAD       0x0500
80 #define WI_RID_MONITOR_MODE     0x0600
81 #define WI_RID_MIF              0x0700
82 #define WI_RID_SCAN_APS         0x0800
83 #define WI_RID_READ_APS         0x0900
84
85 struct wi_80211_hdr {
86         u_int16_t               frame_ctl;
87         u_int16_t               dur_id;
88         u_int8_t                addr1[6];
89         u_int8_t                addr2[6];
90         u_int8_t                addr3[6];
91         u_int16_t               seq_ctl;
92         u_int8_t                addr4[6];
93 };
94
95 #define WI_FCTL_VERS            0x0002
96 #define WI_FCTL_FTYPE           0x000C
97 #define WI_FCTL_STYPE           0x00F0
98 #define WI_FCTL_TODS            0x0100
99 #define WI_FCTL_FROMDS          0x0200
100 #define WI_FCTL_MOREFRAGS       0x0400
101 #define WI_FCTL_RETRY           0x0800
102 #define WI_FCTL_PM              0x1000
103 #define WI_FCTL_MOREDATA        0x2000
104 #define WI_FCTL_WEP             0x4000
105 #define WI_FCTL_ORDER           0x8000
106
107 #define WI_FTYPE_MGMT           0x0000
108 #define WI_FTYPE_CTL            0x0004
109 #define WI_FTYPE_DATA           0x0008
110
111 #define WI_STYPE_MGMT_ASREQ     0x0000  /* association request */
112 #define WI_STYPE_MGMT_ASRESP    0x0010  /* association response */
113 #define WI_STYPE_MGMT_REASREQ   0x0020  /* reassociation request */
114 #define WI_STYPE_MGMT_REASRESP  0x0030  /* reassociation response */
115 #define WI_STYPE_MGMT_PROBEREQ  0x0040  /* probe request */
116 #define WI_STYPE_MGMT_PROBERESP 0x0050  /* probe response */
117 #define WI_STYPE_MGMT_BEACON    0x0080  /* beacon */
118 #define WI_STYPE_MGMT_ATIM      0x0090  /* announcement traffic ind msg */
119 #define WI_STYPE_MGMT_DISAS     0x00A0  /* disassociation */
120 #define WI_STYPE_MGMT_AUTH      0x00B0  /* authentication */
121 #define WI_STYPE_MGMT_DEAUTH    0x00C0  /* deauthentication */
122
123 #define WI_STYPE_CTL_PSPOLL     0x00A0
124 #define WI_STYPE_CTL_RTS        0x00B0
125 #define WI_STYPE_CTL_CTS        0x00C0
126 #define WI_STYPE_CTL_ACK        0x00D0
127 #define WI_STYPE_CTL_CFEND      0x00E0
128 #define WI_STYPE_CTL_CFENDACK   0x00F0
129
130 struct wi_mgmt_hdr {
131         u_int16_t               frame_ctl;
132         u_int16_t               duration;
133         u_int8_t                dst_addr[6];
134         u_int8_t                src_addr[6];
135         u_int8_t                bssid[6];
136         u_int16_t               seq_ctl;
137 };
138
139 /* 
140  * Lucent/wavelan IEEE signal strength cache
141  *
142  * driver keeps cache of last
143  * MAXWICACHE packets to arrive including signal strength info.
144  * daemons may read this via ioctl
145  *
146  * Each entry in the wi_sigcache has a unique macsrc.
147  */
148 struct wi_sigcache {
149         char    macsrc[6];      /* unique MAC address for entry */
150         int     ipsrc;          /* ip address associated with packet */
151         int     signal;         /* signal strength of the packet */
152         int     noise;          /* noise value */
153         int     quality;        /* quality of the packet */
154 };
155
156 /*
157  * Firmware downloading API.  We support downloading into RAM and into
158  * flash.  We copy the entire .hex file for both the primary and secondary
159  * firmware into the kernel, which is minorly gross, but matches the
160  * format of the compiled in firmware.
161  */
162 struct wi_fwdownload {
163         int     type;           /* What type of download. */
164 #define WI_FW_RAM       1
165 #define WI_FW_FLASH     2
166         size_t  pri_len;        /* Primary firmware length */
167         size_t  sec_len;        /* Secondary firmware length */
168         caddr_t pri_data;       /* Pointer (user) to primary data */
169         caddr_t sec_data;       /* Pointer (user) to secondary data */
170 };
171
172 struct wi_counters {
173         u_int32_t               wi_tx_unicast_frames;
174         u_int32_t               wi_tx_multicast_frames;
175         u_int32_t               wi_tx_fragments;
176         u_int32_t               wi_tx_unicast_octets;
177         u_int32_t               wi_tx_multicast_octets;
178         u_int32_t               wi_tx_deferred_xmits;
179         u_int32_t               wi_tx_single_retries;
180         u_int32_t               wi_tx_multi_retries;
181         u_int32_t               wi_tx_retry_limit;
182         u_int32_t               wi_tx_discards;
183         u_int32_t               wi_rx_unicast_frames;
184         u_int32_t               wi_rx_multicast_frames;
185         u_int32_t               wi_rx_fragments;
186         u_int32_t               wi_rx_unicast_octets;
187         u_int32_t               wi_rx_multicast_octets;
188         u_int32_t               wi_rx_fcs_errors;
189         u_int32_t               wi_rx_discards_nobuf;
190         u_int32_t               wi_tx_discards_wrong_sa;
191         u_int32_t               wi_rx_WEP_cant_decrypt;
192         u_int32_t               wi_rx_msg_in_msg_frags;
193         u_int32_t               wi_rx_msg_in_bad_msg_frags;
194 };
195
196 /*
197  * Network parameters, static configuration entities.
198  */
199 #define WI_RID_PORTTYPE         0xFC00 /* Connection control characteristics */
200 #define WI_RID_MAC_NODE         0xFC01 /* MAC address of this station */
201 #define WI_RID_DESIRED_SSID     0xFC02 /* Service Set ID for connection */
202 #define WI_RID_OWN_CHNL         0xFC03 /* Comm channel for BSS creation */
203 #define WI_RID_OWN_SSID         0xFC04 /* IBSS creation ID */
204 #define WI_RID_OWN_ATIM_WIN     0xFC05 /* ATIM window time for IBSS creation */
205 #define WI_RID_SYSTEM_SCALE     0xFC06 /* scale that specifies AP density */
206 #define WI_RID_MAX_DATALEN      0xFC07 /* Max len of MAC frame body data */
207 #define WI_RID_MAC_WDS          0xFC08 /* MAC addr of corresponding WDS node */
208 #define WI_RID_PM_ENABLED       0xFC09 /* ESS power management enable */
209 #define WI_RID_PM_EPS           0xFC0A /* PM EPS/PS mode */
210 #define WI_RID_MCAST_RX         0xFC0B /* ESS PM mcast reception */
211 #define WI_RID_MAX_SLEEP        0xFC0C /* max sleep time for ESS PM */
212 #define WI_RID_HOLDOVER         0xFC0D /* holdover time for ESS PM */
213 #define WI_RID_NODENAME         0xFC0E /* ID name of this node for diag */
214 #define WI_RID_DTIM_PERIOD      0xFC10 /* beacon interval between DTIMs */
215 #define WI_RID_WDS_ADDR1        0xFC11 /* port 1 MAC of WDS link node */
216 #define WI_RID_WDS_ADDR2        0xFC12 /* port 1 MAC of WDS link node */
217 #define WI_RID_WDS_ADDR3        0xFC13 /* port 1 MAC of WDS link node */
218 #define WI_RID_WDS_ADDR4        0xFC14 /* port 1 MAC of WDS link node */
219 #define WI_RID_WDS_ADDR5        0xFC15 /* port 1 MAC of WDS link node */
220 #define WI_RID_WDS_ADDR6        0xFC16 /* port 1 MAC of WDS link node */
221 #define WI_RID_MCAST_PM_BUF     0xFC17 /* PM buffering of mcast */
222 #define WI_RID_ENCRYPTION       0xFC20 /* enable/disable WEP */
223 #define WI_RID_AUTHTYPE         0xFC21 /* specify authentication type */
224 #define WI_RID_P2_TX_CRYPT_KEY  0xFC23
225 #define WI_RID_P2_CRYPT_KEY0    0xFC24
226 #define WI_RID_P2_CRYPT_KEY1    0xFC25
227 #define WI_RID_MICROWAVE_OVEN   0xFC25
228 #define WI_RID_P2_CRYPT_KEY2    0xFC26
229 #define WI_RID_P2_CRYPT_KEY3    0xFC27
230 #define WI_RID_P2_ENCRYPTION    0xFC28
231 #define WI_RID_ALT_RETRY_CNT    0xFC32
232 #define  PRIVACY_INVOKED        0x01
233 #define  EXCLUDE_UNENCRYPTED    0x02
234 #define  HOST_ENCRYPT           0x10
235 #define  IV_EVERY_FRAME         0x00    /* IV = Initialization Vector */
236 #define  IV_EVERY10_FRAME       0x20    /* every 10 frame IV reuse */
237 #define  IV_EVERY50_FRAME       0x40    /* every 50 frame IV reuse */
238 #define  IV_EVERY100_FRAME      0x60    /* every 100 frame IV reuse */
239 #define  HOST_DECRYPT           0x80
240 #define WI_RID_WEP_MAPTABLE     0xFC29
241 #define WI_RID_CNFAUTHMODE      0xFC2A
242 #define WI_RID_ROAMING_MODE     0xFC2D
243 #define WI_RID_OWN_BEACON_INT   0xFC33 /* beacon xmit time for BSS creation */
244 #define WI_RID_ENH_SECURITY     0xFC43 /* enhanced security (AP mode) */
245 #define WI_RID_CNF_DBM_ADJUST   0xFC46
246 #define WI_RID_DBM_ADJUST       0xFC46 /* RSSI - WI_RID_DBM_ADJUST ~ dBm */
247 #define WI_RID_WPA_DATA         0xFC48 /* WPA IE */
248 #define WI_RID_BASIC_RATE       0xFCB3
249 #define WI_RID_SUPPORT_RATE     0xFCB4
250 #define WI_RID_WPA_HANDLING     0xFCBB /* WPA handling procedures */
251
252 /*
253  * Network parameters, dynamic configuration entities
254  */
255 #define WI_RID_MCAST_LIST       0xFC80 /* list of multicast addrs */
256 #define WI_RID_CREATE_IBSS      0xFC81 /* create IBSS */
257 #define WI_RID_FRAG_THRESH      0xFC82 /* frag len, unicast msg xmit */
258 #define WI_RID_RTS_THRESH       0xFC83 /* frame len for RTS/CTS handshake */
259 #define WI_RID_TX_RATE          0xFC84 /* data rate for message xmit
260                                         * 0 == Fixed 1mbps
261                                         * 1 == Fixed 2mbps
262                                         * 2 == auto fallback
263                                         */
264 #define WI_RID_PROMISC          0xFC85 /* enable promisc mode */
265 #define WI_RID_FRAG_THRESH0     0xFC90
266 #define WI_RID_FRAG_THRESH1     0xFC91
267 #define WI_RID_FRAG_THRESH2     0xFC92
268 #define WI_RID_FRAG_THRESH3     0xFC93
269 #define WI_RID_FRAG_THRESH4     0xFC94
270 #define WI_RID_FRAG_THRESH5     0xFC95
271 #define WI_RID_FRAG_THRESH6     0xFC96
272 #define WI_RID_RTS_THRESH0      0xFC97
273 #define WI_RID_RTS_THRESH1      0xFC98
274 #define WI_RID_RTS_THRESH2      0xFC99
275 #define WI_RID_RTS_THRESH3      0xFC9A
276 #define WI_RID_RTS_THRESH4      0xFC9B
277 #define WI_RID_RTS_THRESH5      0xFC9C
278 #define WI_RID_RTS_THRESH6      0xFC9D
279 #define WI_RID_TX_RATE0         0xFC9E
280 #define WI_RID_TX_RATE1         0xFC9F
281 #define WI_RID_TX_RATE2         0xFCA0
282 #define WI_RID_TX_RATE3         0xFCA1
283 #define WI_RID_TX_RATE4         0xFCA2
284 #define WI_RID_TX_RATE5         0xFCA3
285 #define WI_RID_TX_RATE6         0xFCA4
286 #define WI_RID_DEFLT_CRYPT_KEYS 0xFCB0
287 #define WI_RID_TX_CRYPT_KEY     0xFCB1
288 #define WI_RID_TICK_TIME        0xFCE0
289
290 struct wi_key {
291         u_int16_t               wi_keylen;
292         u_int8_t                wi_keydat[14];
293 };
294
295 #define WI_NLTV_KEYS 4
296 struct wi_ltv_keys {
297         u_int16_t               wi_len;
298         u_int16_t               wi_type;
299         struct wi_key           wi_keys[WI_NLTV_KEYS];
300 };
301
302 /*
303  * NIC information
304  */
305 #define WI_RID_DNLD_BUF         0xFD01
306 #define WI_RID_MEMSZ            0xFD02 /* memory size info (XXX Lucent) */
307                                         /* Looks like on lucnet pri firm too */
308 #define WI_RID_PRI_IDENTITY     0xFD02 /* primary funcs firmware ident (PRISM2) */
309 #define WI_RID_PRI_SUP_RANGE    0xFD03 /* primary supplier compatibility */
310 #define WI_RID_CIF_ACT_RANGE    0xFD04 /* controller sup. compatibility */
311 #define WI_RID_SERIALNO         0xFD0A /* card serial number */
312 #define WI_RID_CARD_ID          0xFD0B /* card identification */
313 #define WI_RID_MFI_SUP_RANGE    0xFD0C /* modem supplier compatibility */
314 #define WI_RID_CFI_SUP_RANGE    0xFD0D /* controller sup. compatibility */
315 #define WI_RID_CHANNEL_LIST     0xFD10 /* allowd comm. frequencies. */
316 #define WI_RID_REG_DOMAINS      0xFD11 /* list of intendted regulatory doms */
317 #define WI_RID_TEMP_TYPE        0xFD12 /* hw temp range code */
318 #define WI_RID_CIS              0xFD13 /* PC card info struct */
319 #define WI_RID_STA_IDENTITY     0xFD20 /* station funcs firmware ident */
320 #define WI_RID_STA_SUP_RANGE    0xFD21 /* station supplier compat */
321 #define WI_RID_MFI_ACT_RANGE    0xFD22
322 #define WI_RID_SYMBOL_IDENTITY  0xFD24
323 #define WI_RID_CFI_ACT_RANGE    0xFD33
324 #define WI_RID_COMMQUAL         0xFD43
325 #define WI_RID_SCALETHRESH      0xFD46
326 #define WI_RID_PCF              0xFD87
327
328 /*
329  * MAC information
330  */
331 #define WI_RID_PORT_STAT        0xFD40 /* actual MAC port con control stat */
332 #define WI_RID_CURRENT_SSID     0xFD41 /* ID of actually connected SS */
333 #define WI_RID_CURRENT_BSSID    0xFD42 /* ID of actually connected BSS */
334 #define WI_RID_COMMS_QUALITY    0xFD43 /* quality of BSS connection */
335 #define WI_RID_CUR_TX_RATE      0xFD44 /* current TX rate */
336 #define WI_RID_CUR_BEACON_INT   0xFD45 /* current beacon interval */
337 #define WI_RID_CUR_SCALE_THRESH 0xFD46 /* actual system scane thresh setting */
338 #define WI_RID_PROT_RESP_TIME   0xFD47 /* time to wait for resp to req msg */
339 #define WI_RID_SHORT_RTR_LIM    0xFD48 /* max tx attempts for short frames */
340 #define WI_RID_LONG_RTS_LIM     0xFD49 /* max tx attempts for long frames */
341 #define WI_RID_MAX_TX_LIFE      0xFD4A /* max tx frame handling duration */
342 #define WI_RID_MAX_RX_LIFE      0xFD4B /* max rx frame handling duration */
343 #define WI_RID_CF_POLL          0xFD4C /* contention free pollable ind */
344 #define WI_RID_AUTH_ALGS        0xFD4D /* auth algorithms available */
345 #define WI_RID_AUTH_TYPE        0xFD4E /* availanle auth types */
346 #define WI_RID_WEP_AVAIL        0xFD4F /* WEP privacy option available */
347 #define WI_RID_DBM_COMMS_QUAL   0xFD51 /* CommQuality normalized to dBm */
348 #define WI_RID_CUR_TX_RATE1     0xFD80
349 #define WI_RID_CUR_TX_RATE2     0xFD81
350 #define WI_RID_CUR_TX_RATE3     0xFD82
351 #define WI_RID_CUR_TX_RATE4     0xFD83
352 #define WI_RID_CUR_TX_RATE5     0xFD84
353 #define WI_RID_CUR_TX_RATE6     0xFD85
354 #define WI_RID_OWN_MAC          0xFD86 /* unique local MAC addr */
355 #define WI_RID_PCI_INFO         0xFD87 /* point coordination func cap */
356
357 /*
358  * Scan Information
359  */
360 #define WI_RID_BCAST_SCAN_REQ   0xFCAB /* Broadcast Scan request (Symbol) */
361 #define  BSCAN_5SEC             0x01
362 #define  BSCAN_ONETIME          0x02
363 #define  BSCAN_PASSIVE          0x40
364 #define  BSCAN_BCAST            0x80
365 #define WI_RID_SCAN_REQ         0xFCE1 /* Scan request (STA only) */
366 #define WI_RID_JOIN_REQ         0xFCE2 /* Join request (STA only) */
367 #define WI_RID_AUTH_STATION     0xFCE3 /* Authenticates Station (AP) */
368 #define WI_RID_CHANNEL_REQ      0xFCE4 /* Channel Information Request (AP) */
369 #define WI_RID_SCAN_RESULTS     0xFD88 /* Scan Results Table */
370
371 struct wi_apinfo {
372         int                     scanreason;     /* ScanReason */
373         char                    bssid[6];       /* BSSID (mac address) */
374         int                     channel;        /* Channel */
375         int                     signal;         /* Signal level */
376         int                     noise;          /* Average Noise Level*/
377         int                     quality;        /* Quality */
378         int                     namelen;        /* Length of SSID string */
379         char                    name[32];       /* SSID string */
380         int                     capinfo;        /* Capability info. */ 
381         int                     interval;       /* BSS Beacon Interval */
382         int                     rate;           /* Data Rate */
383 };
384
385 /*
386  * Modem information
387  */
388 #define WI_RID_PHY_TYPE         0xFDC0 /* phys layer type indication */
389 #define WI_RID_CURRENT_CHAN     0xFDC1 /* current frequency */
390 #define WI_RID_PWR_STATE        0xFDC2 /* pwr consumption status */
391 #define WI_RID_CCA_MODE         0xFDC3 /* clear chan assess mode indication */
392 #define WI_RID_CCA_TIME         0xFDC4 /* clear chan assess time */
393 #define WI_RID_MAC_PROC_DELAY   0xFDC5 /* MAC processing delay time */
394 #define WI_RID_DATA_RATES       0xFDC6 /* supported data rates */
395
396 /*
397  * bsd-airtools v0.2 - source-mods v0.2 [common.h]
398  * by h1kari - (c) Dachb0den Labs 2001
399  */
400
401 /*
402  * Copyright (c) 2001 Dachb0den Labs.
403  *      David Hulton <h1kari@dachb0den.com>.  All rights reserved.
404  *
405  * Redistribution and use in source and binary forms, with or without
406  * modification, are permitted provided that the following conditions
407  * are met:
408  * 1. Redistributions of source code must retain the above copyright
409  *    notice, this list of conditions and the following disclaimer.
410  * 2. Redistributions in binary form must reproduce the above copyright
411  *    notice, this list of conditions and the following disclaimer in the
412  *    documentation and/or other materials provided with the distribution.
413  * 3. All advertising materials mentioning features or use of this software
414  *    must display the following acknowledgement:
415  *      This product includes software developed by David Hulton.
416  * 4. Neither the name of the author nor the names of any co-contributors
417  *    may be used to endorse or promote products derived from this software
418  *    without specific prior written permission.
419  *
420  * THIS SOFTWARE IS PROVIDED BY David Hulton AND CONTRIBUTORS ``AS IS'' AND
421  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
422  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
423  * ARE DISCLAIMED.  IN NO EVENT SHALL David Hulton OR THE VOICES IN HIS HEAD
424  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
425  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
426  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
427  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
428  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
429  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
430  * THE POSSIBILITY OF SUCH DAMAGE.
431  */
432
433 /*
434  * standard hermes receive frame used by wavelan/prism2 cards
435  */
436 struct wi_rx_frame {
437         /*
438          * hermes prefix header. supplies information on the current status of
439          * the network and various other statistics gathered from the
440          * management/control frames as used internally.
441          */
442         u_int16_t       wi_status;
443         u_int16_t       wi_ts0;
444         u_int16_t       wi_ts1;
445         u_int8_t        wi_silence;
446         u_int8_t        wi_signal;
447         u_int8_t        wi_rate;
448         u_int8_t        wi_rx_flow;
449         u_int16_t       wi_rsvd0;
450         u_int16_t       wi_rsvd1;
451         /*
452          * standard 80211 frame header. all packets have to use this header as
453          * per the AN9900 from intersil, even management/control. for
454          * management packets, they just threw the header into the data field,
455          * but for control packets the headers are lost in translation and
456          * therefore not all control packet info can be displayed.
457          */
458         u_int16_t       wi_frame_ctl;
459         u_int16_t       wi_id;
460         u_int8_t        wi_addr1[6];
461         u_int8_t        wi_addr2[6];
462         u_int8_t        wi_addr3[6];
463         u_int16_t       wi_seq_ctl;
464         u_int8_t        wi_addr4[6];
465         u_int16_t       wi_dat_len;
466         /*
467          * another wierdity with the drivers. they append a 802.3 header which
468          * is somewhat redundant, since all the same data is provided in the
469          * 802.11 header.
470          */
471         u_int8_t        wi_dst_addr[6];
472         u_int8_t        wi_src_addr[6];
473         u_int16_t       wi_len;
474 };
475 #define WI_DATA_HDRLEN          0x3C
476 #define WI_MGMT_HDRLEN          0x3C
477 #define WI_CTL_HDRLEN           0x3C
478
479
480 /*
481  * all data packets have a snap (sub-network access protocol) header that
482  * isn't entirely definied, but added for ethernet compatibility.
483  */
484 struct wi_snap_frame {
485         u_int16_t       wi_dat[3];
486         u_int16_t       wi_type;
487 };
488
489
490 /*
491  * management frame headers
492  * note: all management frames consist of a static header and variable length
493  * fields.
494  */
495
496 /*
497  * variable length field structure
498  */
499 struct wi_mgmt_var_hdr {
500         u_int8_t        wi_code;
501         u_int8_t        wi_len;
502         u_int8_t        wi_data[256];
503 };
504
505 /*
506  * management beacon frame prefix
507  */
508 struct wi_mgmt_beacon_hdr {
509         u_int32_t       wi_ts0;
510         u_int32_t       wi_ts1;
511         u_int16_t       wi_interval;
512         u_int16_t       wi_capinfo;
513 };
514
515 /*
516  * ibss announcement traffic indication message (atim) frame
517  * note: no parameters
518  */
519
520 /*
521  * management disassociation frame
522  */
523 struct wi_mgmt_disas_hdr {
524         u_int16_t       wi_reason;
525 };
526
527 /*
528  * management association request frame prefix
529  */
530 struct wi_mgmt_asreq_hdr {
531         u_int16_t       wi_capinfo;
532         u_int16_t       wi_interval;
533 };
534
535 /*
536  * management association response frame prefix
537  */
538 struct wi_mgmt_asresp_hdr {
539         u_int16_t       wi_capinfo;
540         u_int16_t       wi_status;
541         u_int16_t       wi_aid;
542 };
543
544 /*
545  * management reassociation request frame prefix
546  */
547 struct wi_mgmt_reasreq_hdr {
548         u_int16_t       wi_capinfo;
549         u_int16_t       wi_interval;
550         u_int8_t        wi_currap[6];
551 };
552
553 /*
554  * management reassociation response frame prefix
555  */
556 struct wi_mgmt_reasresp_hdr {
557         u_int16_t       wi_capinfo;
558         u_int16_t       wi_status;
559         u_int16_t       wi_aid;
560 };
561
562 /*
563  * management probe request frame prefix
564  * note: no static parameters, only variable length
565  */
566
567 /*
568  * management probe response frame prefix
569  */
570 struct wi_mgmt_proberesp_hdr {
571         u_int32_t       wi_ts0;
572         u_int32_t       wi_ts1;
573         u_int16_t       wi_interval;
574         u_int16_t       wi_capinfo;
575 };
576
577 /*
578  * management authentication frame prefix
579  */
580 struct wi_mgmt_auth_hdr {
581         u_int16_t       wi_algo;
582         u_int16_t       wi_seq;
583         u_int16_t       wi_status;
584 };
585
586 /*
587  * management deauthentication frame
588  */
589 struct wi_mgmt_deauth_hdr {
590         u_int16_t       wi_reason;
591 };
592
593
594 /*
595  * rid configuration register definitions
596  */
597 #define WI_RID_SCAN_REQ         0xFCE1 /* scan request information */
598 #define WI_RID_SCAN_RES         0xFD88 /* scan result information */
599
600 #define WI_RID_PROCFRAME        0x3137 /* Return full frame information */
601 #define WI_RID_PRISM2           0x3138 /* tell if we're a prism2 card or not */
602
603
604 /*
605  * 802.11 definitions
606  */
607 #define WI_STAT_BADCRC          0x0001
608 #define WI_STAT_UNDECRYPTABLE   0x0002
609 #define WI_STAT_ERRSTAT         0x0003
610 #define WI_STAT_MAC_PORT        0x0700
611 #define WI_STAT_1042            0x2000
612 #define WI_STAT_TUNNEL          0x4000
613 #define WI_STAT_WMP_MSG         0x6000
614 #define WI_RXSTAT_MSG_TYPE      0xE000
615
616 #define WI_FCTL_OPT_MASK        0xFF00
617 #define WI_AID_SET              0xC000
618 #define WI_AID_MASK             0x3FFF
619 #define WI_SCTL_FRAGNUM_MASK    0x000F
620 #define WI_SCTL_SEQNUM_MASK     0xFFF0
621
622 #define WI_STAT_UNSPEC_FAIL     1
623 #define WI_STAT_CAPINFO_FAIL    10
624 #define WI_STAT_REAS_DENY       11
625 #define WI_STAT_ASSOC_DENY      12
626 #define WI_STAT_ALGO_FAIL       13
627 #define WI_STAT_SEQ_FAIL        14
628 #define WI_STAT_CHAL_FAIL       15
629 #define WI_STAT_TOUT_FAIL       16
630 #define WI_STAT_OVERL_DENY      17
631 #define WI_STAT_RATE_DENY       18
632
633 #define WI_FTYPE_MGMT           0x0000
634 #define WI_FTYPE_CTL            0x0004
635 #define WI_FTYPE_DATA           0x0008
636
637 #define WI_FCTL_VERS            0x0002
638 #define WI_FCTL_FTYPE           0x000C
639 #define WI_FCTL_STYPE           0x00F0
640 #define WI_FCTL_TODS            0x0100
641 #define WI_FCTL_FROMDS          0x0200
642 #define WI_FCTL_MOREFRAGS       0x0400
643 #define WI_FCTL_RETRY           0x0800
644 #define WI_FCTL_PM              0x1000
645 #define WI_FCTL_MOREDATA        0x2000
646 #define WI_FCTL_WEP             0x4000
647 #define WI_FCTL_ORDER           0x8000
648
649 #define WI_FCS_LEN              0x4 /* checksum length */
650
651
652 /*
653  * management definitions
654  */
655 #define WI_STYPE_MGMT_ASREQ     0x0000
656 #define WI_STYPE_MGMT_ASRESP    0x0010
657 #define WI_STYPE_MGMT_REASREQ   0x0020
658 #define WI_STYPE_MGMT_REASRESP  0x0030
659 #define WI_STYPE_MGMT_PROBEREQ  0x0040
660 #define WI_STYPE_MGMT_PROBERESP 0x0050
661 #define WI_STYPE_MGMT_BEACON    0x0080
662 #define WI_STYPE_MGMT_ATIM      0x0090
663 #define WI_STYPE_MGMT_DISAS     0x00A0
664 #define WI_STYPE_MGMT_AUTH      0x00B0
665 #define WI_STYPE_MGMT_DEAUTH    0x00C0
666
667 #define WI_CAPINFO_ESS          0x01
668 #define WI_CAPINFO_IBSS         0x02
669 #define WI_CAPINFO_CFPOLL       0x04
670 #define WI_CAPINFO_CFPOLLREQ    0x08
671 #define WI_CAPINFO_PRIV         0x10
672
673 #define WI_REASON_UNSPEC        1
674 #define WI_REASON_AUTH_INVALID  2
675 #define WI_REASON_DEAUTH_LEAVE  3
676 #define WI_REASON_DISAS_INACT   4
677 #define WI_REASON_DISAS_OVERL   5
678 #define WI_REASON_CLASS2        6
679 #define WI_REASON_CLASS3        7
680 #define WI_REASON_DISAS_LEAVE   8
681 #define WI_REASON_NOAUTH        9
682
683 #define WI_VAR_SSID             0
684 #define WI_VAR_SRATES           1
685 #define WI_VAR_FH               2
686 #define WI_VAR_DS               3
687 #define WI_VAR_CF               4
688 #define WI_VAR_TIM              5
689 #define WI_VAR_IBSS             6
690 #define WI_VAR_CHAL             16
691
692 #define WI_VAR_SRATES_MASK      0x7F
693
694
695 /*
696  * control definitions
697  */
698 #define WI_STYPE_CTL_PSPOLL     0x00A0
699 #define WI_STYPE_CTL_RTS        0x00B0
700 #define WI_STYPE_CTL_CTS        0x00C0
701 #define WI_STYPE_CTL_ACK        0x00D0
702 #define WI_STYPE_CTL_CFEND      0x00E0
703 #define WI_STYPE_CTL_CFENDCFACK 0x00F0
704
705
706 /*
707  * ap scanning structures
708  */
709 struct wi_scan_res {
710         u_int16_t       wi_chan;
711         u_int16_t       wi_noise;
712         u_int16_t       wi_signal;
713         u_int8_t        wi_bssid[6];
714         u_int16_t       wi_interval;
715         u_int16_t       wi_capinfo;
716         u_int16_t       wi_ssid_len;
717         u_int8_t        wi_ssid[32];
718         u_int8_t        wi_srates[10];
719         u_int8_t        wi_rate;
720         u_int8_t        wi_rsvd;
721 };
722 #define WI_WAVELAN_RES_SIZE     50
723
724 struct wi_scan_p2_hdr {
725         u_int16_t       wi_rsvd;
726         u_int16_t       wi_reason;
727 };
728 #define WI_PRISM2_RES_SIZE      62
729
730
731 #if 0 /* unimplemented */
732 /*
733  * prism2 debug mode definitions
734  */
735 #define SIOCSPRISM2DEBUG        _IOW('i', 137, struct ifreq)
736 #define SIOCGPRISM2DEBUG        _IOWR('i', 138, struct ifreq)
737 #endif
738
739 #define WI_DEBUG_RESET          0x00
740 #define WI_DEBUG_INIT           0x01
741 #define WI_DEBUG_SLEEP          0x02
742 #define WI_DEBUG_WAKE           0x03
743 #define WI_DEBUG_CHAN           0x08
744 #define WI_DEBUG_DELAYSUPP      0x09
745 #define WI_DEBUG_TXSUPP         0x0A
746 #define WI_DEBUG_MONITOR        0x0B
747 #define WI_DEBUG_LEDTEST        0x0C
748 #define WI_DEBUG_CONTTX         0x0E
749 #define WI_DEBUG_STOPTEST       0x0F
750 #define WI_DEBUG_CONTRX         0x10
751 #define WI_DEBUG_SIGSTATE       0x11
752 #define WI_DEBUG_CALENABLE      0x13
753 #define WI_DEBUG_CONFBITS       0x15
754
755 #endif