1 /*	$OpenBSD: if_wi_ieee.h,v 1.22 2004/03/18 16:16:10 millert Exp $	*/
2 
3 /*
4  * Copyright (c) 1997, 1998, 1999
5  *	Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *	This product includes software developed by Bill Paul.
18  * 4. Neither the name of the author nor the names of any co-contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
26  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32  * THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  *	From: if_wavelan_ieee.h,v 1.5.2.1 2001/07/04 00:12:34 brooks Exp $
35  */
36 
37 #ifndef _IF_WI_IEEE_H
38 #define _IF_WI_IEEE_H
39 
40 /*
41  * This header defines a simple command interface to the FreeBSD
42  * WaveLAN/IEEE driver (wi) driver, which is used to set certain
43  * device-specific parameters which can't be easily managed through
44  * ifconfig(8). No, sysctl(2) is not the answer. I said a _simple_
45  * interface, didn't I.
46  */
47 
48 #ifndef SIOCSWAVELAN
49 #ifdef __FreeBSD__
50 #define SIOCSWAVELAN	SIOCSIFGENERIC
51 #else	/* !__FreeBSD__ */
52 #define SIOCSWAVELAN	SIOCSIFASYNCMAP
53 #endif	/* __FreeBSD__ */
54 #endif
55 
56 #ifndef SIOCGWAVELAN
57 #ifdef __FreeBSD__
58 #define SIOCGWAVELAN	SIOCGIFGENERIC
59 #else	/* !__FreeBSD__ */
60 #define SIOCGWAVELAN	SIOCGIFASYNCMAP
61 #endif	/* __FreeBSD__ */
62 #endif
63 
64 /*
65  * Technically I don't think there's a limit to a record
66  * length. The largest record is the one that contains the CIS
67  * data, which is 240 words long, so 256 should be a safe
68  * value.
69  */
70 #define WI_MAX_DATALEN	512
71 
72 struct wi_req {
73 	u_int16_t	wi_len;
74 	u_int16_t	wi_type;
75 	u_int16_t	wi_val[WI_MAX_DATALEN];
76 };
77 
78 /*
79  * Private LTV records (interpreted only by the driver). This is
80  * a minor kludge to allow reading the interface statistics from
81  * the driver.
82  */
83 #define WI_RID_IFACE_STATS	0x0100
84 #define WI_RID_MGMT_XMIT	0x0200
85 #define	WI_RID_MONITOR_MODE	0x0500
86 #define WI_RID_SCAN_APS		0x0600
87 #define WI_RID_READ_APS		0x0700
88 
89 struct wi_80211_hdr {
90 	u_int16_t		frame_ctl;
91 	u_int16_t		dur_id;
92 	u_int8_t		addr1[6];
93 	u_int8_t		addr2[6];
94 	u_int8_t		addr3[6];
95 	u_int16_t		seq_ctl;
96 	u_int8_t		addr4[6];
97 };
98 
99 #define WI_FCTL_VERS		0x0002
100 #define WI_FCTL_FTYPE		0x000C
101 #define WI_FCTL_STYPE		0x00F0
102 #define WI_FCTL_TODS		0x0100
103 #define WI_FCTL_FROMDS		0x0200
104 #define WI_FCTL_MOREFRAGS	0x0400
105 #define WI_FCTL_RETRY		0x0800
106 #define WI_FCTL_PM		0x1000
107 #define WI_FCTL_MOREDATA	0x2000
108 #define WI_FCTL_WEP		0x4000
109 #define WI_FCTL_ORDER		0x8000
110 
111 #define WI_FTYPE_MGMT		0x0000
112 #define WI_FTYPE_CTL		0x0004
113 #define WI_FTYPE_DATA		0x0008
114 
115 #define WI_STYPE_MGMT_ASREQ	0x0000	/* association request */
116 #define WI_STYPE_MGMT_ASRESP	0x0010	/* association response */
117 #define WI_STYPE_MGMT_REASREQ	0x0020	/* reassociation request */
118 #define WI_STYPE_MGMT_REASRESP	0x0030	/* reassociation response */
119 #define WI_STYPE_MGMT_PROBEREQ	0x0040	/* probe request */
120 #define WI_STYPE_MGMT_PROBERESP	0x0050	/* probe response */
121 #define WI_STYPE_MGMT_BEACON	0x0080	/* beacon */
122 #define WI_STYPE_MGMT_ATIM	0x0090	/* announcement traffic ind msg */
123 #define WI_STYPE_MGMT_DISAS	0x00A0	/* disassociation */
124 #define WI_STYPE_MGMT_AUTH	0x00B0	/* authentication */
125 #define WI_STYPE_MGMT_DEAUTH	0x00C0	/* deauthentication */
126 
127 #define WI_STYPE_CTL_PSPOLL	0x00A0
128 #define WI_STYPE_CTL_RTS	0x00B0
129 #define WI_STYPE_CTL_CTS	0x00C0
130 #define WI_STYPE_CTL_ACK	0x00D0
131 #define WI_STYPE_CTL_CFEND	0x00E0
132 #define WI_STYPE_CTL_CFENDACK	0x00F0
133 #define WI_STYPE_CTL_CFENDCFACK	WI_STYPE_CTL_CFENDACK
134 
135 #define WI_STYPE_DATA		0x0000
136 #define WI_STYPE_DATA_CFACK	0x0010
137 #define WI_STYPE_DATA_CFPOLL	0x0020
138 #define WI_STYPE_DATA_CFACKPOLL	0x0030
139 #define WI_STYPE_NULLFUNC	0x0040
140 #define WI_STYPE_CFACK		0x0050
141 #define WI_STYPE_CFPOLL		0x0060
142 #define WI_STYPE_CFACKPOLL	0x0070
143 
144 struct wi_mgmt_hdr {
145 	u_int16_t		frame_ctl;
146 	u_int16_t		duration;
147 	u_int8_t		dst_addr[6];
148 	u_int8_t		src_addr[6];
149 	u_int8_t		bssid[6];
150 	u_int16_t		seq_ctl;
151 };
152 
153 struct wi_counters {
154 	u_int32_t		wi_tx_unicast_frames;
155 	u_int32_t		wi_tx_multicast_frames;
156 	u_int32_t		wi_tx_fragments;
157 	u_int32_t		wi_tx_unicast_octets;
158 	u_int32_t		wi_tx_multicast_octets;
159 	u_int32_t		wi_tx_deferred_xmits;
160 	u_int32_t		wi_tx_single_retries;
161 	u_int32_t		wi_tx_multi_retries;
162 	u_int32_t		wi_tx_retry_limit;
163 	u_int32_t		wi_tx_discards;
164 	u_int32_t		wi_rx_unicast_frames;
165 	u_int32_t		wi_rx_multicast_frames;
166 	u_int32_t		wi_rx_fragments;
167 	u_int32_t		wi_rx_unicast_octets;
168 	u_int32_t		wi_rx_multicast_octets;
169 	u_int32_t		wi_rx_fcs_errors;
170 	u_int32_t		wi_rx_discards_nobuf;
171 	u_int32_t		wi_tx_discards_wrong_sa;
172 	u_int32_t		wi_rx_WEP_cant_decrypt;
173 	u_int32_t		wi_rx_msg_in_msg_frags;
174 	u_int32_t		wi_rx_msg_in_bad_msg_frags;
175 };
176 
177 /*
178  * These are all the LTV record types that we can read or write
179  * from the WaveLAN. Not all of them are tremendously useful, but I
180  * list as many as I know about here for completeness.
181  */
182 
183 #define WI_RID_DNLD_BUF		0xFD01
184 #define WI_RID_MEMSZ		0xFD02 /* memory size info (Lucent) */
185 #define WI_RID_PRI_IDENTITY	0xFD02 /* primary firmware ident (PRISM2) */
186 #define WI_RID_DOMAINS		0xFD11 /* List of intended regulatory domains */
187 #define WI_RID_CIS		0xFD13 /* CIS info */
188 #define WI_RID_COMMQUAL		0xFD43 /* Communications quality */
189 #define WI_RID_SCALETHRESH	0xFD46 /* Actual system scale thresholds */
190 #define WI_RID_PCF		0xFD87 /* PCF info */
191 
192 /*
193  * Network parameters, static configuration entities.
194  */
195 #define	WI_RID_PORTTYPE		0xFC00 /* Connection control characteristics */
196 #define	WI_RID_MAC_NODE		0xFC01 /* MAC address of this station */
197 #define	WI_RID_DESIRED_SSID	0xFC02 /* Service Set ID for connection */
198 #define	WI_RID_OWN_CHNL		0xFC03 /* Comm channel for BSS creation */
199 #define	WI_RID_OWN_SSID		0xFC04 /* IBSS creation ID */
200 #define	WI_RID_OWN_ATIM_WIN	0xFC05 /* ATIM window time for IBSS creation */
201 #define	WI_RID_SYSTEM_SCALE	0xFC06 /* scale that specifies AP density */
202 #define	WI_RID_MAX_DATALEN	0xFC07 /* Max len of MAC frame body data */
203 #define	WI_RID_MAC_WDS		0xFC08 /* MAC addr of corresponding WDS node */
204 #define	WI_RID_PM_ENABLED	0xFC09 /* ESS power management enable */
205 #define	WI_RID_PM_EPS		0xFC0A /* PM EPS/PS mode */
206 #define	WI_RID_MCAST_RX		0xFC0B /* ESS PM mcast reception */
207 #define	WI_RID_MAX_SLEEP	0xFC0C /* max sleep time for ESS PM */
208 #define	WI_RID_HOLDOVER		0xFC0D /* holdover time for ESS PM */
209 #define	WI_RID_NODENAME		0xFC0E /* ID name of this node for diag */
210 #define	WI_RID_DTIM_PERIOD	0xFC10 /* beacon interval between DTIMs */
211 #define	WI_RID_WDS_ADDR1	0xFC11 /* port 1 MAC of WDS link node */
212 #define	WI_RID_WDS_ADDR2	0xFC12 /* port 1 MAC of WDS link node */
213 #define	WI_RID_WDS_ADDR3	0xFC13 /* port 1 MAC of WDS link node */
214 #define	WI_RID_WDS_ADDR4	0xFC14 /* port 1 MAC of WDS link node */
215 #define	WI_RID_WDS_ADDR5	0xFC15 /* port 1 MAC of WDS link node */
216 #define	WI_RID_WDS_ADDR6	0xFC16 /* port 1 MAC of WDS link node */
217 #define	WI_RID_MCAST_PM_BUF	0xFC17 /* PM buffering of mcast */
218 #define	WI_RID_ENCRYPTION	0xFC20 /* enable/disable WEP */
219 #define	WI_RID_AUTHTYPE		0xFC21 /* specify authentication type */
220 #define	WI_RID_SYMBOL_MANDATORYBSSID 0xFC21
221 #define	WI_RID_P2_TX_CRYPT_KEY	0xFC23
222 #define	WI_RID_P2_CRYPT_KEY0	0xFC24
223 #define	WI_RID_P2_CRYPT_KEY1	0xFC25
224 #define	WI_RID_MICROWAVE_OVEN	0xFC25 /* Microwave oven robustness */
225 #define	WI_RID_P2_CRYPT_KEY2	0xFC26
226 #define	WI_RID_P2_CRYPT_KEY3	0xFC27
227 #define	WI_RID_P2_ENCRYPTION	0xFC28
228 #define PRIVACY_INVOKED		0x01
229 #define EXCLUDE_UNENCRYPTED	0x02
230 #define HOST_ENCRYPT		0x10
231 #define IV_EVERY_FRAME		0x00
232 #define IV_EVERY10_FRAME	0x20
233 #define IV_EVERY50_FRAME	0x40
234 #define IV_EVERY100_FRAME	0x60
235 #define HOST_DECRYPT		0x80
236 #define	WI_RID_WEP_MAPTABLE	0xFC29
237 #define	WI_RID_CNFAUTHMODE	0xFC2A
238 #define	WI_RID_SYMBOL_KEYLENGTH	0xFC2B
239 #define	WI_RID_ROAMING_MODE	0xFC2D /* Roaming mode (1:firm,3:disable) */
240 #define WI_RID_CUR_BEACON_INT	0xFC33 /* beacon xmit time for BSS creation */
241 #define	WI_RID_CNF_ENH_SECURITY	0xFC43 /* hide SSID name (prism fw >= 1.6.3) */
242 #define	WI_RID_CNF_DBM_ADJUST	0xFC46 /* Get DBM adjustment factor */
243 #define	WI_RID_SYMBOL_PREAMBLE	0xFC8C /* Enable/disable short preamble */
244 #define	WI_RID_P2_SHORT_PREAMBLE	0xFCB0 /* Short preamble support */
245 #define	WI_RID_P2_EXCLUDE_LONG_PREAMBLE	0xFCB1 /* Don't send long preamble */
246 #define	WI_RID_BASIC_RATE	0xFCB3
247 #define	WI_RID_SUPPORT_RATE	0xFCB4
248 #define WI_RID_SYMBOL_DIVERSITY	0xFC87 /* Symbol antenna diversity */
249 #define WI_RID_SYMBOL_BASIC_RATE 0xFC90
250 
251 /*
252  * Network parameters, dynamic configuration entities
253  */
254 #define WI_RID_MCAST_LIST	0xFC80 /* list of multicast addrs (up to 16) */
255 #define WI_RID_CREATE_IBSS	0xFC81 /* create IBSS */
256 #define WI_RID_FRAG_THRESH	0xFC82 /* frag len, unicast msg xmit */
257 #define WI_RID_RTS_THRESH	0xFC83 /* frame len for RTS/CTS handshake */
258 #define WI_RID_TX_RATE		0xFC84 /* data rate for message xmit */
259 #define WI_RID_PROMISC		0xFC85 /* enable promisc mode */
260 #define WI_RID_FRAG_THRESH0	0xFC90
261 #define WI_RID_FRAG_THRESH1	0xFC91
262 #define WI_RID_FRAG_THRESH2	0xFC92
263 #define WI_RID_FRAG_THRESH3	0xFC93
264 #define WI_RID_FRAG_THRESH4	0xFC94
265 #define WI_RID_FRAG_THRESH5	0xFC95
266 #define WI_RID_FRAG_THRESH6	0xFC96
267 #define WI_RID_RTS_THRESH0	0xFC97
268 #define WI_RID_RTS_THRESH1	0xFC98
269 #define WI_RID_RTS_THRESH2	0xFC99
270 #define WI_RID_RTS_THRESH3	0xFC9A
271 #define WI_RID_RTS_THRESH4	0xFC9B
272 #define WI_RID_RTS_THRESH5	0xFC9C
273 #define WI_RID_RTS_THRESH6	0xFC9D
274 #define WI_RID_TX_RATE0		0xFC9E
275 #define WI_RID_TX_RATE1		0xFC9F
276 #define WI_RID_TX_RATE2		0xFCA0
277 #define WI_RID_TX_RATE3		0xFCA1
278 #define WI_RID_TX_RATE4		0xFCA2
279 #define WI_RID_TX_RATE5		0xFCA3
280 #define WI_RID_TX_RATE6		0xFCA4
281 #define WI_RID_DEFLT_CRYPT_KEYS	0xFCB0
282 #define WI_RID_TX_CRYPT_KEY	0xFCB1
283 #define WI_RID_TICK_TIME	0xFCE0 /* Auxiliary Timer tick interval */
284 
285 struct wi_key {
286 	u_int16_t		wi_keylen;
287 	u_int8_t		wi_keydat[13];
288 };
289 
290 #define	WI_NLTV_KEYS	4
291 struct wi_ltv_keys {
292 	u_int16_t		wi_len;
293 	u_int16_t		wi_type;
294 	struct wi_key		wi_keys[WI_NLTV_KEYS];
295 };
296 
297 /*
298  * NIC information
299  */
300 #define WI_RID_FIRM_ID		0xFD02 /* Primary func firmware ID. */
301 #define WI_RID_PRI_SUP_RANGE	0xFD03 /* primary supplier compatibility */
302 #define WI_RID_CIF_ACT_RANGE	0xFD04 /* controller sup. compatibility */
303 #define WI_RID_SERIALNO		0xFD0A /* card serial number */
304 #define WI_RID_CARD_ID		0xFD0B /* card identification */
305 #define WI_RID_MFI_SUP_RANGE	0xFD0C /* modem supplier compatibility */
306 #define WI_RID_CFI_SUP_RANGE	0xFD0D /* controller sup. compatibility */
307 #define WI_RID_CHANNEL_LIST	0xFD10 /* allowed comm. frequencies. */
308 #define WI_RID_REG_DOMAINS	0xFD11 /* list of intendted regulatory doms */
309 #define WI_RID_TEMP_TYPE	0xFD12 /* hw temp range code */
310 #define WI_RID_CIS		0xFD13 /* PC card info struct */
311 #define WI_RID_STA_IDENTITY	0xFD20 /* station funcs firmware ident */
312 #define WI_RID_STA_SUP_RANGE	0xFD21 /* station supplier compat */
313 #define WI_RID_MFI_ACT_RANGE	0xFD22
314 #define WI_RID_SYMBOL_IDENTITY	0xFD24 /* Symbol station firmware ident */
315 #define WI_RID_CFI_ACT_RANGE	0xFD33
316 
317 /*
318  * MAC information
319  */
320 #define WI_RID_PORT_STAT	0xFD40 /* actual MAC port con control stat */
321 #define WI_RID_CURRENT_SSID	0xFD41 /* ID of actually connected SS */
322 #define WI_RID_CURRENT_BSSID	0xFD42 /* ID of actually connected BSS */
323 #define WI_RID_COMMS_QUALITY	0xFD43 /* quality of BSS connection */
324 #define WI_RID_CUR_TX_RATE	0xFD44 /* current TX rate */
325 #define WI_RID_OWN_BEACON_INT	0xFD45 /* beacon xmit time for BSS creation */
326 #define WI_RID_CUR_SCALE_THRESH	0xFD46 /* actual system scane thresh setting */
327 #define WI_RID_PROT_RESP_TIME	0xFD47 /* time to wait for resp to req msg */
328 #define WI_RID_SHORT_RTR_LIM	0xFD48 /* max tx attempts for short frames */
329 #define WI_RID_LONG_RTS_LIM	0xFD49 /* max tx attempts for long frames */
330 #define WI_RID_MAX_TX_LIFE	0xFD4A /* max tx frame handling duration */
331 #define WI_RID_MAX_RX_LIFE	0xFD4B /* max rx frame handling duration */
332 #define WI_RID_CF_POLL		0xFD4C /* contention free pollable ind */
333 #define WI_RID_AUTH_ALGS	0xFD4D /* auth algorithms available */
334 #define WI_RID_AUTH_TYPE	0xFD4E /* available auth types */
335 #define WI_RID_WEP_AVAIL	0xFD4F /* WEP privacy option available */
336 #define WI_RID_CUR_TX_RATE1	0xFD80
337 #define WI_RID_CUR_TX_RATE2	0xFD81
338 #define WI_RID_CUR_TX_RATE3	0xFD82
339 #define WI_RID_CUR_TX_RATE4	0xFD83
340 #define WI_RID_CUR_TX_RATE5	0xFD84
341 #define WI_RID_CUR_TX_RATE6	0xFD85
342 #define WI_RID_OWN_MAC		0xFD86 /* unique local MAC addr */
343 #define WI_RID_PCI_INFO		0xFD87 /* point coordination func cap */
344 
345 /*
346  * Scan Information
347  */
348 #define WI_RID_BCAST_SCAN_REQ	0xFCAB /* Broadcast Scan request (Symbol) */
349 #define BSCAN_5SEC		0x01
350 #define BSCAN_ONETIME		0x02
351 #define BSCAN_PASSIVE		0x40
352 #define BSCAN_BCAST		0x80
353 #define WI_RID_SCAN_REQ		0xFCE1 /* Scan request (STA only) */
354 #define WI_RID_JOIN_REQ		0xFCE2 /* Join request (STA only) */
355 #define WI_RID_AUTH_STATION	0xFCE3 /* Authenticates Station (AP) */
356 #define WI_RID_CHANNEL_REQ	0xFCE4 /* Channel Information Request (AP) */
357 #define WI_RID_SCAN_RES		0xFD88 /* Scan Results Table */
358 
359 struct wi_apinfo {
360 	int			scanreason;	/* ScanReason */
361 	char			bssid[6];	/* BSSID (mac address) */
362 	int			channel;	/* Channel */
363 	int			signal;		/* Signal level */
364 	int			noise;		/* Average Noise Level*/
365 	int			quality;	/* Quality */
366 	int			namelen;	/* Length of SSID string */
367 	char			name[32];	/* SSID string */
368 	int			capinfo;	/* Capability info. */
369 	int			interval;	/* BSS Beacon Interval */
370 	int			rate;		/* Data Rate */
371 };
372 
373 /*
374  * The following do not get passed down to the card, they are used
375  * by wicontrol to modify the behavior of the driver (use WEP in software or
376  * firmware, use alternate cryptographic algorithms, etc.)  I'm calling them
377  * "fake record IDs."
378  */
379 #define	WI_FRID_CRYPTO_ALG	0xFCE3
380 #define	WI_FRID_DEBUGGING	0xFCE4
381 
382 /*
383  * bsd-airtools v0.2 - source-mods v0.2 [common.h]
384  * by h1kari - (c) Dachb0den Labs 2001
385  */
386 
387 /*
388  * Copyright (c) 2001 Dachb0den Labs.
389  *      David Hulton <h1kari@dachb0den.com>.  All rights reserved.
390  *
391  * Redistribution and use in source and binary forms, with or without
392  * modification, are permitted provided that the following conditions
393  * are met:
394  * 1. Redistributions of source code must retain the above copyright
395  *    notice, this list of conditions and the following disclaimer.
396  * 2. Redistributions in binary form must reproduce the above copyright
397  *    notice, this list of conditions and the following disclaimer in the
398  *    documentation and/or other materials provided with the distribution.
399  * 3. All advertising materials mentioning features or use of this software
400  *    must display the following acknowledgement:
401  *      This product includes software developed by David Hulton.
402  * 4. Neither the name of the author nor the names of any co-contributors
403  *    may be used to endorse or promote products derived from this software
404  *    without specific prior written permission.
405  *
406  * THIS SOFTWARE IS PROVIDED BY David Hulton AND CONTRIBUTORS ``AS IS'' AND
407  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
408  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
409  * ARE DISCLAIMED.  IN NO EVENT SHALL David Hulton OR THE VOICES IN HIS HEAD
410  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
411  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
412  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
413  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
414  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
415  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
416  * THE POSSIBILITY OF SUCH DAMAGE.
417  */
418 
419 /*
420  * standard hermes receive frame used by wavelan/prism2 cards
421  */
422 struct wi_rx_frame {
423 	/*
424 	 * hermes prefix header. supplies information on the current status of
425 	 * the network and various other statistics gathered from the
426 	 * management/control frames as used internally.
427 	 */
428 	u_int16_t	wi_status;
429 	u_int16_t	wi_ts0;
430 	u_int16_t	wi_ts1;
431 	u_int8_t	wi_silence;
432 	u_int8_t	wi_signal;
433 	u_int8_t	wi_rate;
434 	u_int8_t	wi_rx_flow;
435 	u_int16_t	wi_rsvd0;
436 	u_int16_t	wi_rsvd1;
437 	/*
438 	 * standard 80211 frame header. all packets have to use this header as
439 	 * per the AN9900 from intersil, even management/control. for
440 	 * management packets, they just threw the header into the data field,
441 	 * but for control packets the headers are lost in translation and
442 	 * therefore not all control packet info can be displayed.
443 	 */
444 	u_int16_t	wi_frame_ctl;
445 	u_int16_t	wi_id;
446 	u_int8_t	wi_addr1[6];
447 	u_int8_t	wi_addr2[6];
448 	u_int8_t	wi_addr3[6];
449 	u_int16_t	wi_seq_ctl;
450 	u_int8_t	wi_addr4[6];
451 	u_int16_t	wi_dat_len;
452 	/*
453 	 * another wierdity with the drivers. they append a 802.3 header which
454 	 * is somewhat redundant, since all the same data is provided in the
455 	 * 802.11 header.
456 	 */
457 	u_int8_t	wi_dst_addr[6];
458 	u_int8_t	wi_src_addr[6];
459 	u_int16_t	wi_len;
460 };
461 #define WI_DATA_HDRLEN		WI_802_11_OFFSET
462 #define WI_MGMT_HDRLEN		WI_802_11_OFFSET_RAW
463 #define WI_CTL_HDRLEN		WI_802_11_OFFSET_RAW
464 
465 
466 /*
467  * all data packets have a snap (sub-network access protocol) header that
468  * isn't entirely defined, but added for ethernet compatibility.
469  */
470 struct wi_snap_frame {
471 	u_int16_t	wi_dat[3];
472 	u_int16_t	wi_type;
473 };
474 
475 
476 /*
477  * management frame headers
478  * note: all management frames consist of a static header and variable length
479  * fields.
480  */
481 
482 /*
483  * variable length field structure
484  */
485 struct wi_mgmt_var_hdr {
486 	u_int8_t	wi_code;
487 	u_int8_t	wi_len;
488 	u_int8_t	wi_data[256];
489 };
490 
491 /*
492  * management beacon frame prefix
493  */
494 struct wi_mgmt_beacon_hdr {
495 	u_int32_t	wi_ts0;
496 	u_int32_t	wi_ts1;
497 	u_int16_t	wi_interval;
498 	u_int16_t	wi_capinfo;
499 };
500 
501 /*
502  * ibss announcement traffic indication message (atim) frame
503  * note: no parameters
504  */
505 
506 /*
507  * management disassociation frame
508  */
509 struct wi_mgmt_disas_hdr {
510 	u_int16_t	wi_reason;
511 };
512 
513 /*
514  * management association request frame prefix
515  */
516 struct wi_mgmt_asreq_hdr {
517 	u_int16_t	wi_capinfo;
518 	u_int16_t	wi_interval;
519 };
520 
521 /*
522  * management association response frame prefix
523  */
524 struct wi_mgmt_asresp_hdr {
525 	u_int16_t	wi_capinfo;
526 	u_int16_t	wi_status;
527 	u_int16_t	wi_aid;
528 };
529 
530 /*
531  * management reassociation request frame prefix
532  */
533 struct wi_mgmt_reasreq_hdr {
534 	u_int16_t	wi_capinfo;
535 	u_int16_t	wi_interval;
536 	u_int8_t	wi_currap[6];
537 };
538 
539 /*
540  * management reassociation response frame prefix
541  */
542 struct wi_mgmt_reasresp_hdr {
543 	u_int16_t	wi_capinfo;
544 	u_int16_t	wi_status;
545 	u_int16_t	wi_aid;
546 };
547 
548 /*
549  * management probe request frame prefix
550  * note: no static parameters, only variable length
551  */
552 
553 /*
554  * management probe response frame prefix
555  */
556 struct wi_mgmt_proberesp_hdr {
557 	u_int32_t	wi_ts0;
558 	u_int32_t	wi_ts1;
559 	u_int16_t	wi_interval;
560 	u_int16_t	wi_capinfo;
561 };
562 
563 /*
564  * management authentication frame prefix
565  */
566 struct wi_mgmt_auth_hdr {
567 	u_int16_t	wi_algo;
568 	u_int16_t	wi_seq;
569 	u_int16_t	wi_status;
570 };
571 
572 /*
573  * management deauthentication frame
574  */
575 struct wi_mgmt_deauth_hdr {
576 	u_int16_t	wi_reason;
577 };
578 
579 
580 /*
581  * rid configuration register definitions
582  */
583 #define WI_RID_PROCFRAME	0x3137 /* Return full frame information */
584 #define WI_RID_PRISM2		0x3138 /* tell if we're a prism2 card or not */
585 
586 
587 /*
588  * 802.11 definitions
589  */
590 #define WI_STAT_BADCRC		0x0001
591 #define WI_STAT_UNDECRYPTABLE	0x0002
592 #define WI_STAT_ERRSTAT		0x0003
593 #define WI_STAT_MAC_PORT	0x0700
594 #define WI_STAT_1042		0x2000
595 #define WI_STAT_TUNNEL		0x4000
596 #define WI_STAT_WMP_MSG		0x6000
597 #define WI_RXSTAT_MSG_TYPE	0xE000
598 
599 #define WI_FCTL_OPT_MASK	0xFF00
600 #define WI_AID_SET		0xC000
601 #define WI_AID_MASK		0x3FFF
602 #define WI_SCTL_FRAGNUM_MASK	0x000F
603 #define WI_SCTL_SEQNUM_MASK	0xFFF0
604 
605 #define WI_STAT_UNSPEC_FAIL	1
606 #define WI_STAT_CAPINFO_FAIL	10
607 #define WI_STAT_REAS_DENY	11
608 #define WI_STAT_ASSOC_DENY	12
609 #define WI_STAT_ALGO_FAIL	13
610 #define WI_STAT_SEQ_FAIL	14
611 #define WI_STAT_CHAL_FAIL	15
612 #define WI_STAT_TOUT_FAIL	16
613 #define WI_STAT_OVERL_DENY	17
614 #define WI_STAT_RATE_DENY	18
615 
616 #define WI_FTYPE_MGMT		0x0000
617 #define WI_FTYPE_CTL		0x0004
618 #define WI_FTYPE_DATA		0x0008
619 
620 #define WI_FCTL_VERS		0x0002
621 #define WI_FCTL_FTYPE		0x000C
622 #define WI_FCTL_STYPE		0x00F0
623 #define WI_FCTL_TODS		0x0100
624 #define WI_FCTL_FROMDS		0x0200
625 #define WI_FCTL_MOREFRAGS	0x0400
626 #define WI_FCTL_RETRY		0x0800
627 #define WI_FCTL_PM		0x1000
628 #define WI_FCTL_MOREDATA	0x2000
629 #define WI_FCTL_WEP		0x4000
630 #define WI_FCTL_ORDER		0x8000
631 
632 #define WI_FCS_LEN		0x4 /* checksum length */
633 
634 
635 /*
636  * management definitions
637  */
638 #define WI_CAPINFO_ESS		0x01
639 #define WI_CAPINFO_IBSS		0x02
640 #define WI_CAPINFO_CFPOLL	0x04
641 #define WI_CAPINFO_CFPOLLREQ	0x08
642 #define WI_CAPINFO_PRIV		0x10
643 
644 #define WI_REASON_UNSPEC	1
645 #define WI_REASON_AUTH_INVALID	2
646 #define WI_REASON_DEAUTH_LEAVE	3
647 #define WI_REASON_DISAS_INACT	4
648 #define WI_REASON_DISAS_OVERL	5
649 #define WI_REASON_CLASS2	6
650 #define WI_REASON_CLASS3	7
651 #define WI_REASON_DISAS_LEAVE	8
652 #define WI_REASON_NOAUTH	9
653 
654 #define WI_VAR_SSID		0
655 #define WI_VAR_SRATES		1
656 #define WI_VAR_FH		2
657 #define WI_VAR_DS		3
658 #define WI_VAR_CF		4
659 #define WI_VAR_TIM		5
660 #define WI_VAR_IBSS		6
661 #define WI_VAR_CHAL		16
662 
663 #define WI_VAR_SRATES_MASK	0x7F
664 
665 /*
666  * ap scanning structures
667  */
668 struct wi_scan_res {
669 	u_int16_t	wi_chan;
670 	u_int16_t	wi_noise;
671 	u_int16_t	wi_signal;
672 	u_int8_t	wi_bssid[6];
673 	u_int16_t	wi_interval;
674 	u_int16_t	wi_capinfo;
675 	u_int16_t	wi_ssid_len;
676 	u_int8_t	wi_ssid[32];
677 	u_int8_t	wi_srates[10];
678 	u_int8_t	wi_rate;
679 	u_int8_t	wi_rsvd;
680 };
681 #define WI_WAVELAN_RES_SIZE	50
682 
683 struct wi_scan_p2_hdr {
684 	u_int16_t	wi_rsvd;
685 	u_int16_t	wi_reason;
686 };
687 #define WI_PRISM2_RES_SIZE	62
688 
689 
690 /*
691  * prism2 debug mode definitions
692  */
693 #define SIOCSPRISM2DEBUG	_IOW('i', 137, struct ifreq)
694 #define SIOCGPRISM2DEBUG	_IOWR('i', 138, struct ifreq)
695 
696 #define WI_CMD_DEBUG		0x0038 /* prism2 debug */
697 
698 #define WI_DEBUG_RESET		0x00
699 #define WI_DEBUG_INIT		0x01
700 #define WI_DEBUG_SLEEP		0x02
701 #define WI_DEBUG_WAKE		0x03
702 #define WI_DEBUG_CHAN		0x08
703 #define WI_DEBUG_DELAYSUPP	0x09
704 #define WI_DEBUG_TXSUPP		0x0A
705 #define WI_DEBUG_MONITOR	0x0B
706 #define WI_DEBUG_LEDTEST	0x0C
707 #define WI_DEBUG_CONTTX		0x0E
708 #define WI_DEBUG_STOPTEST	0x0F
709 #define WI_DEBUG_CONTRX		0x10
710 #define WI_DEBUG_SIGSTATE	0x11
711 #define WI_DEBUG_CALENABLE	0x13
712 #define WI_DEBUG_CONFBITS	0x15
713 
714 /*
715  * Modem information
716  */
717 #define WI_RID_PHY_TYPE		0xFDC0 /* phys layer type indication */
718 #define WI_RID_CURRENT_CHAN	0xFDC1 /* current frequency */
719 #define WI_RID_PWR_STATE	0xFDC2 /* pwr consumption status */
720 #define WI_RID_CCA_MODE		0xFDC3 /* clear chan assess mode indication */
721 #define WI_RID_CCA_TIME		0xFDC4 /* clear chan assess time */
722 #define WI_RID_MAC_PROC_DELAY	0xFDC5 /* MAC processing delay time */
723 #define WI_RID_DATA_RATES	0xFDC6 /* supported data rates */
724 
725 /*
726  * Values for supported crypto algorithms:
727  */
728 #define	WI_CRYPTO_FIRMWARE_WEP		0x00 /* default */
729 #define	WI_CRYPTO_SOFTWARE_WEP		0x01
730 
731 /* Firmware types */
732 #define	WI_NOTYPE	0
733 #define	WI_LUCENT	1
734 #define	WI_INTERSIL	2
735 #define	WI_SYMBOL	3
736 
737 /* Card identities */
738 #define	WI_NIC_LUCENT		0x0001
739 
740 #define	WI_NIC_SONY		0x0002
741 
742 #define	WI_NIC_LUCENT_EMB	0x0005
743 
744 #define	WI_NIC_EVB2		0x8000
745 
746 #define	WI_NIC_HWB3763		0x8001
747 
748 #define	WI_NIC_HWB3163		0x8002
749 
750 #define	WI_NIC_HWB3163B		0x8003
751 
752 #define	WI_NIC_EVB3		0x8004
753 
754 #define	WI_NIC_HWB1153		0x8007
755 
756 #define	WI_NIC_P2_SST		0x8008	/* Prism2 with SST flush */
757 
758 #define	WI_NIC_EVB2_SST		0x8009
759 
760 #define	WI_NIC_3842_EVA		0x800A	/* 3842 Evaluation Board */
761 
762 #define	WI_NIC_3842_PCMCIA_AMD	0x800B	/* Prism2.5 PCMCIA */
763 #define	WI_NIC_3842_PCMCIA_SST	0x800C
764 #define	WI_NIC_3842_PCMCIA_ATL	0x800D
765 #define	WI_NIC_3842_PCMCIA_ATS	0x800E
766 
767 #define	WI_NIC_3842_MINI_AMD	0x8012	/* Prism2.5 Mini-PCI */
768 #define	WI_NIC_3842_MINI_SST	0x8013
769 #define	WI_NIC_3842_MINI_ATL	0x8014
770 #define	WI_NIC_3842_MINI_ATS	0x8015
771 
772 #define	WI_NIC_3842_PCI_AMD	0x8016	/* Prism2.5 PCI-bridge */
773 #define	WI_NIC_3842_PCI_SST	0x8017
774 #define	WI_NIC_3842_PCI_ATL	0x8018
775 #define	WI_NIC_3842_PCI_ATS	0x8019
776 
777 #define	WI_NIC_P3_PCMCIA_AMD	0x801A	/* Prism3 PCMCIA */
778 #define	WI_NIC_P3_PCMCIA_SST	0x801B
779 #define	WI_NIC_P3_PCMCIA_ATL	0x801C
780 #define	WI_NIC_P3_PCMCIA_ATS	0x801D
781 
782 #define	WI_NIC_P3_MINI_AMD	0x8021	/* Prism3 Mini-PCI */
783 #define	WI_NIC_P3_MINI_SST	0x8022
784 #define	WI_NIC_P3_MINI_ATL	0x8023
785 #define	WI_NIC_P3_MINI_ATS	0x8024
786 
787 #define	WI_NIC_P3_USB_NETGEAR	0x8026 	/* Prism3 USB */
788 
789 struct wi_card_ident {
790 	const u_int16_t	card_id;
791 	const char	*card_name;
792 	const u_int8_t	firm_type;
793 };
794 
795 #define WI_CARD_IDS							\
796 	{								\
797 		WI_NIC_LUCENT,						\
798 		"Lucent WaveLAN/IEEE",					\
799 		WI_LUCENT						\
800 	}, {								\
801 		WI_NIC_SONY,						\
802 		"Sony WaveLAN/IEEE",					\
803 		WI_LUCENT						\
804 	}, {								\
805 		WI_NIC_LUCENT_EMB,					\
806 		"Lucent Embedded WaveLAN/IEEE",				\
807 		WI_LUCENT						\
808 	}, {								\
809 		WI_NIC_EVB2,						\
810 		"PRISM2 HFA3841(EVB2)",					\
811 		WI_INTERSIL						\
812 	}, {								\
813 		WI_NIC_HWB3763,						\
814 		"PRISM2 HWB3763 rev.B",					\
815 		WI_INTERSIL						\
816 	}, {								\
817 		WI_NIC_HWB3163,						\
818 		"PRISM2 HWB3163 rev.A",					\
819 		WI_INTERSIL						\
820 	}, {								\
821 		WI_NIC_HWB3163B,					\
822 		"PRISM2 HWB3163 rev.B",					\
823 		WI_INTERSIL						\
824 	}, {								\
825 		WI_NIC_EVB3,						\
826 		"PRISM2 HFA3842(EVB3)",					\
827 		WI_INTERSIL						\
828 	}, {								\
829 		WI_NIC_HWB1153,						\
830 		"PRISM1 HWB1153",					\
831 		WI_INTERSIL						\
832 	}, {								\
833 		WI_NIC_P2_SST,						\
834 		"PRISM2 HWB3163 SST-flash",				\
835 		WI_INTERSIL						\
836 	}, {								\
837 		WI_NIC_EVB2_SST,					\
838 		"PRISM2 HWB3163(EVB2) SST-flash",			\
839 		WI_INTERSIL						\
840 	}, {								\
841 		WI_NIC_3842_EVA,					\
842 		"PRISM2 HFA3842(EVAL)",					\
843 		WI_INTERSIL						\
844 	}, {								\
845 		WI_NIC_3842_PCMCIA_AMD,					\
846 		"PRISM2.5 ISL3873",					\
847 		WI_INTERSIL						\
848 	}, {								\
849 		WI_NIC_3842_PCMCIA_SST,					\
850 		"PRISM2.5 ISL3873",					\
851 		WI_INTERSIL						\
852 	}, {								\
853 		WI_NIC_3842_PCMCIA_ATL,					\
854 		"PRISM2.5 ISL3873",					\
855 		WI_INTERSIL						\
856 	}, {								\
857 		WI_NIC_3842_PCMCIA_ATS,					\
858 		"PRISM2.5 ISL3873",					\
859 		WI_INTERSIL						\
860 	}, {								\
861 		WI_NIC_3842_MINI_AMD,					\
862 		"PRISM2.5 ISL3874A(Mini-PCI)",				\
863 		WI_INTERSIL						\
864 	}, {								\
865 		WI_NIC_3842_MINI_SST,					\
866 		"PRISM2.5 ISL3874A(Mini-PCI)",				\
867 		WI_INTERSIL						\
868 	}, {								\
869 		WI_NIC_3842_MINI_ATL,					\
870 		"PRISM2.5 ISL3874A(Mini-PCI)",				\
871 		WI_INTERSIL						\
872 	}, {								\
873 		WI_NIC_3842_MINI_ATS,					\
874 		"PRISM2.5 ISL3874A(Mini-PCI)",				\
875 		WI_INTERSIL						\
876 	}, {								\
877 		WI_NIC_3842_PCI_AMD,					\
878 		"PRISM2.5 ISL3874A(PCI-bridge)",			\
879 		WI_INTERSIL						\
880 	}, {								\
881 		WI_NIC_3842_PCI_SST,					\
882 		"PRISM2.5 ISL3874A(PCI-bridge)",			\
883 		WI_INTERSIL						\
884 	}, {								\
885 		WI_NIC_3842_PCI_ATS,					\
886 		"PRISM2.5 ISL3874A(PCI-bridge)",			\
887 		WI_INTERSIL						\
888 	}, {								\
889 		WI_NIC_3842_PCI_ATL,					\
890 		"PRISM2.5 ISL3874A(PCI-bridge)",			\
891 		WI_INTERSIL						\
892 	}, {								\
893 		WI_NIC_P3_PCMCIA_AMD,					\
894 		"PRISM3 ISL37300P",					\
895 		WI_INTERSIL						\
896 	}, {								\
897 		WI_NIC_P3_PCMCIA_SST,					\
898 		"PRISM3 ISL37300P",					\
899 		WI_INTERSIL						\
900 	}, {								\
901 		WI_NIC_P3_PCMCIA_ATL,					\
902 		"PRISM3 ISL37300P",					\
903 		WI_INTERSIL						\
904 	}, {								\
905 		WI_NIC_P3_PCMCIA_ATS,					\
906 		"PRISM3 ISL37300P",					\
907 		WI_INTERSIL						\
908 	}, {								\
909 		WI_NIC_P3_MINI_AMD,					\
910 		"PRISM3 ISL37300P(PCI)",				\
911 		WI_INTERSIL						\
912 	}, {								\
913 		WI_NIC_P3_MINI_SST,					\
914 		"PRISM3 ISL37300P(PCI)",				\
915 		WI_INTERSIL						\
916 	}, {								\
917 		WI_NIC_P3_MINI_ATL,					\
918 		"PRISM3 ISL37300P(PCI)",				\
919 		WI_INTERSIL						\
920 	}, {								\
921 		WI_NIC_P3_MINI_ATS,					\
922 		"PRISM3 ISL37300P(PCI)",				\
923 		WI_INTERSIL						\
924 	}, {								\
925 		WI_NIC_P3_USB_NETGEAR,					\
926 		"PRISM3 (USB)",						\
927 		WI_INTERSIL						\
928 	}, {								\
929 		0,							\
930 		NULL,							\
931 		WI_NOTYPE						\
932 	}
933 
934 #endif /* _IF_WI_IEEE_H */
935