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