1 /*	$OpenBSD: anvar.h,v 1.15 2003/10/21 18:58:48 jmc 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  * $FreeBSD: src/sys/dev/an/if_aironet_ieee.h,v 1.1 2000/01/14 20:40:55 wpaul Exp $
35  */
36 
37 #ifndef _IF_AIRONET_IEEE_H
38 #define _IF_AIRONET_IEEE_H
39 
40 #pragma pack(1)
41 
42 /*
43  * This header defines a simple command interface to the FreeBSD
44  * Aironet driver (an) driver, which is used to set certain
45  * device-specific parameters which can't be easily managed through
46  * ifconfig(8). No, sysctl(2) is not the answer. I said a _simple_
47  * interface, didn't I.
48  */
49 
50 #ifndef SIOCSAIRONET
51 #ifdef __FreeBSD__
52 #define SIOCSAIRONET	SIOCSIFGENERIC
53 #else   /* !__FreeBSD__ */
54 #define SIOCSAIRONET	SIOCSIFASYNCMAP
55 #endif
56 #endif
57 
58 #ifndef SIOCGAIRONET
59 #ifdef __FreeBSD__
60 #define SIOCGAIRONET	SIOCGIFGENERIC
61 #else   /* !__FreeBSD__ */
62 #define SIOCGAIRONET	SIOCGIFASYNCMAP
63 #endif
64 #endif
65 
66 /*
67  * This is a make-predend RID value used only by the driver
68  * to allow the user to set the speed.
69  */
70 #define AN_RID_TX_SPEED		0x1234
71 
72 /*
73  * Technically I don't think there's a limit to a record
74  * length. The largest record is the one that contains the CIS
75  * data, which is 240 words long, so 256 should be a safe
76  * value.
77  */
78 #define AN_MAX_DATALEN	512
79 
80 struct an_req {
81 	u_int16_t	an_len;
82 	u_int16_t	an_type;
83 	u_int16_t	an_val[AN_MAX_DATALEN];
84 };
85 
86 /*
87  * Private LTV records (interpreted only by the driver). This is
88  * a minor kludge to allow reading the interface statistics from
89  * the driver.
90  */
91 #define AN_RID_IFACE_STATS	0x0100
92 #define AN_RID_MGMT_XMIT	0x0200
93 #define AN_RID_ZERO_CACHE	0x0300
94 #define AN_RID_READ_CACHE	0x0400
95 
96 struct an_80211_hdr {
97 	u_int16_t		frame_ctl;
98 	u_int16_t		dur_id;
99 	u_int8_t		addr1[6];
100 	u_int8_t		addr2[6];
101 	u_int8_t		addr3[6];
102 	u_int16_t		seq_ctl;
103 	u_int8_t		addr4[6];
104 };
105 
106 #define AN_FCTL_VERS		0x0002
107 #define AN_FCTL_FTYPE		0x000C
108 #define AN_FCTL_STYPE		0x00F0
109 #define AN_FCTL_TODS		0x0100
110 #define AN_FCTL_FROMDS		0x0200
111 #define AN_FCTL_MOREFRAGS	0x0400
112 #define AN_FCTL_RETRY		0x0800
113 #define AN_FCTL_PM		0x1000
114 #define AN_FCTL_MOREDATA	0x2000
115 #define AN_FCTL_WEP		0x4000
116 #define AN_FCTL_ORDER		0x8000
117 
118 #define AN_FTYPE_MGMT		0x0000
119 #define AN_FTYPE_CTL		0x0004
120 #define AN_FTYPE_DATA		0x0008
121 
122 #define AN_STYPE_MGMT_ASREQ	0x0000	/* association request */
123 #define AN_STYPE_MGMT_ASRESP	0x0010	/* association response */
124 #define AN_STYPE_MGMT_REASREQ	0x0020	/* reassociation request */
125 #define AN_STYPE_MGMT_REASRESP	0x0030	/* reassociation response */
126 #define AN_STYPE_MGMT_PROBEREQ	0x0040	/* probe request */
127 #define AN_STYPE_MGMT_PROBERESP	0x0050	/* probe response */
128 #define AN_STYPE_MGMT_BEACON	0x0080	/* beacon */
129 #define AN_STYPE_MGMT_ATIM	0x0090	/* announcement traffic ind msg */
130 #define AN_STYPE_MGMT_DISAS	0x00A0	/* disassociation */
131 #define AN_STYPE_MGMT_AUTH	0x00B0	/* authentication */
132 #define AN_STYPE_MGMT_DEAUTH	0x00C0	/* deauthentication */
133 
134 struct an_mgmt_hdr {
135 	u_int16_t		frame_ctl;
136 	u_int16_t		duration;
137 	u_int8_t		dst_addr[6];
138 	u_int8_t		src_addr[6];
139 	u_int8_t		bssid[6];
140 	u_int16_t		seq_ctl;
141 };
142 
143 /*
144  * Aironet IEEE signal strength cache
145  *
146  * driver keeps cache of last
147  * MAXANCACHE packets to arrive including signal strength info.
148  * daemons may read this via ioctl
149  *
150  * Each entry in the wi_sigcache has a unique macsrc.
151  */
152 #define MAXANCACHE      10
153 
154 struct an_sigcache {
155 	char	macsrc[6];	/* unique MAC address for entry */
156 	int	ipsrc;		/* ip address associated with packet */
157 	int	signal;		/* signal strength of the packet */
158 	int	noise;		/* noise value */
159 	int	quality;	/* quality of the packet */
160 };
161 
162 struct an_ltv_key {
163 	u_int16_t		an_len;
164 	u_int16_t		an_type;
165 	u_int16_t		kindex;
166 	u_int8_t		mac[6];
167 	u_int16_t		klen;
168 	u_int8_t		key[16];
169 };
170 
171 /*
172  * Grrr. The manual says the statistics record is 384 bytes in length,
173  * but the card says the record is 404 bytes. There's some padding left
174  * at the end of this structure to account for any discrepancies.
175  */
176 struct an_ltv_stats {
177 	u_int16_t		an_fudge;
178 	u_int16_t		an_len;			/* 0x00 */
179 	u_int16_t		an_type;		/* 0xXX */
180 	u_int16_t		an_spacer;		/* 0x02 */
181 	u_int32_t		an_rx_overruns;		/* 0x04 */
182 	u_int32_t		an_rx_plcp_csum_errs;	/* 0x08 */
183 	u_int32_t		an_rx_plcp_format_errs;	/* 0x0C */
184 	u_int32_t		an_rx_plcp_len_errs;	/* 0x10 */
185 	u_int32_t		an_rx_mac_crc_errs;	/* 0x14 */
186 	u_int32_t		an_rx_mac_crc_ok;	/* 0x18 */
187 	u_int32_t		an_rx_wep_errs;		/* 0x1C */
188 	u_int32_t		an_rx_wep_ok;		/* 0x20 */
189 	u_int32_t		an_retry_long;		/* 0x24 */
190 	u_int32_t		an_retry_short;		/* 0x28 */
191 	u_int32_t		an_retry_max;		/* 0x2C */
192 	u_int32_t		an_no_ack;		/* 0x30 */
193 	u_int32_t		an_no_cts;		/* 0x34 */
194 	u_int32_t		an_rx_ack_ok;		/* 0x38 */
195 	u_int32_t		an_rx_cts_ok;		/* 0x3C */
196 	u_int32_t		an_tx_ack_ok;		/* 0x40 */
197 	u_int32_t		an_tx_rts_ok;		/* 0x44 */
198 	u_int32_t		an_tx_cts_ok;		/* 0x48 */
199 	u_int32_t		an_tx_lmac_mcasts;	/* 0x4C */
200 	u_int32_t		an_tx_lmac_bcasts;	/* 0x50 */
201 	u_int32_t		an_tx_lmac_ucast_frags;	/* 0x54 */
202 	u_int32_t		an_tx_lmac_ucasts;	/* 0x58 */
203 	u_int32_t		an_tx_beacons;		/* 0x5C */
204 	u_int32_t		an_rx_beacons;		/* 0x60 */
205 	u_int32_t		an_tx_single_cols;	/* 0x64 */
206 	u_int32_t		an_tx_multi_cols;	/* 0x68 */
207 	u_int32_t		an_tx_defers_no;	/* 0x6C */
208 	u_int32_t		an_tx_defers_prot;	/* 0x70 */
209 	u_int32_t		an_tx_defers_energy;	/* 0x74 */
210 	u_int32_t		an_rx_dups;		/* 0x78 */
211 	u_int32_t		an_rx_partial;		/* 0x7C */
212 	u_int32_t		an_tx_too_old;		/* 0x80 */
213 	u_int32_t		an_rx_too_old;		/* 0x84 */
214 	u_int32_t		an_lostsync_max_retries;/* 0x88 */
215 	u_int32_t		an_lostsync_missed_beacons;/* 0x8C */
216 	u_int32_t		an_lostsync_arl_exceeded;/*0x90 */
217 	u_int32_t		an_lostsync_deauthed;	/* 0x94 */
218 	u_int32_t		an_lostsync_disassociated;/*0x98 */
219 	u_int32_t		an_lostsync_tsf_timing;	/* 0x9C */
220 	u_int32_t		an_tx_host_mcasts;	/* 0xA0 */
221 	u_int32_t		an_tx_host_bcasts;	/* 0xA4 */
222 	u_int32_t		an_tx_host_ucasts;	/* 0xA8 */
223 	u_int32_t		an_tx_host_failed;	/* 0xAC */
224 	u_int32_t		an_rx_host_mcasts;	/* 0xB0 */
225 	u_int32_t		an_rx_host_bcasts;	/* 0xB4 */
226 	u_int32_t		an_rx_host_ucasts;	/* 0xB8 */
227 	u_int32_t		an_rx_host_discarded;	/* 0xBC */
228 	u_int32_t		an_tx_hmac_mcasts;	/* 0xC0 */
229 	u_int32_t		an_tx_hmac_bcasts;	/* 0xC4 */
230 	u_int32_t		an_tx_hmac_ucasts;	/* 0xC8 */
231 	u_int32_t		an_tx_hmac_failed;	/* 0xCC */
232 	u_int32_t		an_rx_hmac_mcasts;	/* 0xD0 */
233 	u_int32_t		an_rx_hmac_bcasts;	/* 0xD4 */
234 	u_int32_t		an_rx_hmac_ucasts;	/* 0xD8 */
235 	u_int32_t		an_rx_hmac_discarded;	/* 0xDC */
236 	u_int32_t		an_tx_hmac_accepted;	/* 0xE0 */
237 	u_int32_t		an_ssid_mismatches;	/* 0xE4 */
238 	u_int32_t		an_ap_mismatches;	/* 0xE8 */
239 	u_int32_t		an_rates_mismatches;	/* 0xEC */
240 	u_int32_t		an_auth_rejects;	/* 0xF0 */
241 	u_int32_t		an_auth_timeouts;	/* 0xF4 */
242 	u_int32_t		an_assoc_rejects;	/* 0xF8 */
243 	u_int32_t		an_assoc_timeouts;	/* 0xFC */
244 	u_int32_t		an_reason_outside_table;/* 0x100 */
245 	u_int32_t		an_reason1;		/* 0x104 */
246 	u_int32_t		an_reason2;		/* 0x108 */
247 	u_int32_t		an_reason3;		/* 0x10C */
248 	u_int32_t		an_reason4;		/* 0x110 */
249 	u_int32_t		an_reason5;		/* 0x114 */
250 	u_int32_t		an_reason6;		/* 0x118 */
251 	u_int32_t		an_reason7;		/* 0x11C */
252 	u_int32_t		an_reason8;		/* 0x120 */
253 	u_int32_t		an_reason9;		/* 0x124 */
254 	u_int32_t		an_reason10;		/* 0x128 */
255 	u_int32_t		an_reason11;		/* 0x12C */
256 	u_int32_t		an_reason12;		/* 0x130 */
257 	u_int32_t		an_reason13;		/* 0x134 */
258 	u_int32_t		an_reason14;		/* 0x138 */
259 	u_int32_t		an_reason15;		/* 0x13C */
260 	u_int32_t		an_reason16;		/* 0x140 */
261 	u_int32_t		an_reason17;		/* 0x144 */
262 	u_int32_t		an_reason18;		/* 0x148 */
263 	u_int32_t		an_reason19;		/* 0x14C */
264 	u_int32_t		an_rx_mgmt_pkts;	/* 0x150 */
265 	u_int32_t		an_tx_mgmt_pkts;	/* 0x154 */
266 	u_int32_t		an_rx_refresh_pkts;	/* 0x158 */
267 	u_int32_t		an_tx_refresh_pkts;	/* 0x15C */
268 	u_int32_t		an_rx_poll_pkts;	/* 0x160 */
269 	u_int32_t		an_tx_poll_pkts;	/* 0x164 */
270 	u_int32_t		an_host_retries;	/* 0x168 */
271 	u_int32_t		an_lostsync_hostreq;	/* 0x16C */
272 	u_int32_t		an_host_tx_bytes;	/* 0x170 */
273 	u_int32_t		an_host_rx_bytes;	/* 0x174 */
274 	u_int32_t		an_uptime_usecs;	/* 0x178 */
275 	u_int32_t		an_uptime_secs;		/* 0x17C */
276 	u_int32_t		an_lostsync_better_ap;	/* 0x180 */
277 };
278 
279 struct an_ltv_genconfig {
280 	/* General configuration. */
281 	u_int16_t		an_len;			/* 0x00 */
282 	u_int16_t		an_type;		/* XXXX */
283 	u_int16_t		an_opmode;		/* 0x02 */
284 	u_int16_t		an_rxmode;		/* 0x04 */
285 	u_int16_t		an_fragthresh;		/* 0x06 */
286 	u_int16_t		an_rtsthresh;		/* 0x08 */
287 	u_int8_t		an_macaddr[6];		/* 0x0A */
288 	u_int8_t		an_rates[8];		/* 0x10 */
289 	u_int16_t		an_shortretry_limit;	/* 0x18 */
290 	u_int16_t		an_longretry_limit;	/* 0x1A */
291 	u_int16_t		an_tx_msdu_lifetime;	/* 0x1C */
292 	u_int16_t		an_rx_msdu_lifetime;	/* 0x1E */
293 	u_int16_t		an_stationary;		/* 0x20 */
294 	u_int16_t		an_ordering;		/* 0x22 */
295 	u_int16_t		an_devtype;		/* 0x24 */
296 	u_int16_t		an_rsvd0[5];		/* 0x26 */
297 	/* Scanning associating. */
298 	u_int16_t		an_scanmode;		/* 0x30 */
299 	u_int16_t		an_probedelay;		/* 0x32 */
300 	u_int16_t		an_probe_energy_timeout;/* 0x34 */
301 	u_int16_t		an_probe_response_timeout;/*0x36 */
302 	u_int16_t		an_beacon_listen_timeout;/*0x38 */
303 	u_int16_t		an_ibss_join_net_timeout;/*0x3A */
304 	u_int16_t		an_auth_timeout;	/* 0x3C */
305 	u_int16_t		an_authtype;		/* 0x3E */
306 	u_int16_t		an_assoc_timeout;	/* 0x40 */
307 	u_int16_t		an_specified_ap_timeout;/* 0x42 */
308 	u_int16_t		an_offline_scan_interval;/*0x44 */
309 	u_int16_t		an_offline_scan_duration;/*0x46 */
310 	u_int16_t		an_link_loss_delay;	/* 0x48 */
311 	u_int16_t		an_max_beacon_lost_time;/* 0x4A */
312 	u_int16_t		an_refresh_interval;	/* 0x4C */
313 	u_int16_t		an_rsvd1;		/* 0x4E */
314 	/* Power save operation */
315 	u_int16_t		an_psave_mode;		/* 0x50 */
316 	u_int16_t		an_sleep_for_dtims;	/* 0x52 */
317 	u_int16_t		an_listen_interval;	/* 0x54 */
318 	u_int16_t		an_fast_listen_interval;/* 0x56 */
319 	u_int16_t		an_listen_decay;	/* 0x58 */
320 	u_int16_t		an_fast_listen_decay;	/* 0x5A */
321 	u_int16_t		an_rsvd2[2];		/* 0x5C */
322 	/* Ad-hoc (or AP) operation. */
323 	u_int16_t		an_beacon_period;	/* 0x60 */
324 	u_int16_t		an_atim_duration;	/* 0x62 */
325 	u_int16_t		an_rsvd3;		/* 0x64 */
326 	u_int16_t		an_ds_channel;		/* 0x66 */
327 	u_int16_t		an_rsvd4;		/* 0x68 */
328 	u_int16_t		an_dtim_period;		/* 0x6A */
329 	u_int16_t		an_rsvd5[2];		/* 0x6C */
330 	/* Radio operation. */
331 	u_int16_t		an_radiotype;		/* 0x70 */
332 	u_int16_t		an_diversity;		/* 0x72 */
333 	u_int16_t		an_tx_power;		/* 0x74 */
334 	u_int16_t		an_rss_thresh;		/* 0x76 */
335 	u_int16_t		an_modulation_type;	/* 0x78 */
336 	u_int16_t		an_short_preamble;	/* 0x7A */
337 	u_int16_t		an_home_product;	/* 0x7C */
338 	u_int16_t		an_rsvd6;		/* 0x7E */
339 	/* Aironet extensions. */
340 	u_int8_t		an_nodename[16];	/* 0x80 */
341 	u_int16_t		an_arl_thresh;		/* 0x90 */
342 	u_int16_t		an_arl_decay;		/* 0x92 */
343 	u_int16_t		an_arl_delay;		/* 0x94 */
344 	u_int8_t		an_rsvd7;		/* 0x96 */
345 	u_int8_t		an_rsvd8;		/* 0x97 */
346 	u_int8_t		an_magic_packet_action;	/* 0x98 */
347 	u_int8_t		an_magic_packet_ctl;	/* 0x99 */
348 	u_int16_t		an_rsvd9[2];		/* 0x9a */
349 };
350 
351 #define AN_OPMODE_IBSS_ADHOC			0x0000
352 #define AN_OPMODE_INFRASTRUCTURE_STATION	0x0001
353 #define AN_OPMODE_AP				0x0002
354 #define AN_OPMODE_AP_REPEATER			0x0003
355 #define AN_OPMODE_UNMODIFIED_PAYLOAD		0x0100
356 #define AN_OPMODE_AIRONET_EXTENSIONS		0x0200
357 #define AN_OPMODE_AP_EXTENSIONS			0x0400
358 
359 #define AN_RXMODE_BC_MC_ADDR			0x0000
360 #define AN_RXMODE_BC_ADDR			0x0001
361 #define AN_RXMODE_ADDR				0x0002
362 #define AN_RXMODE_80211_MONITOR_CURBSS		0x0003
363 #define AN_RXMODE_80211_MONITOR_ANYBSS		0x0004
364 #define AN_RXMODE_LAN_MONITOR_CURBSS		0x0005
365 #define AN_RXMODE_NO_8023_HEADER		0x0100
366 
367 #define AN_RATE_1MBPS				0x0002
368 #define AN_RATE_2MBPS				0x0004
369 #define AN_RATE_5_5MBPS				0x000B
370 #define AN_RATE_11MBPS				0x0016
371 
372 #define AN_DEVTYPE_PC4500			0x0065
373 #define AN_DEVTYPE_PC4800			0x006D
374 
375 #define AN_SCANMODE_ACTIVE			0x0000
376 #define AN_SCANMODE_PASSIVE			0x0001
377 #define AN_SCANMODE_AIRONET_ACTIVE		0x0002
378 
379 #define AN_AUTHTYPE_NONE			0x0000
380 #define AN_AUTHTYPE_OPEN			0x0001
381 #define AN_AUTHTYPE_SHAREDKEY			0x0002
382 #define AN_AUTHTYPE_MASK			0x00FF
383 #define AN_AUTHTYPE_PRIVACY_IN_USE		0x0100
384 #define AN_AUTHTYPE_ALLOW_UNENCRYPTED		0x0200
385 
386 #define AN_PSAVE_NONE				0x0000
387 #define AN_PSAVE_CAM				0x0001
388 #define AN_PSAVE_PSP				0x0002
389 #define AN_PSAVE_PSP_CAM			0x0003
390 
391 #define AN_RADIOTYPE_80211_FH			0x0001
392 #define AN_RADIOTYPE_80211_DS			0x0002
393 #define AN_RADIOTYPE_LM2000_DS			0x0004
394 
395 #define AN_DIVERSITY_FACTORY_DEFAULT		0x0000
396 #define AN_DIVERSITY_ANTENNA_1_ONLY		0x0001
397 #define AN_DIVERSITY_ANTENNA_2_ONLY		0x0002
398 #define AN_DIVERSITY_ANTENNA_1_AND_2		0x0003
399 
400 #define AN_TXPOWER_FACTORY_DEFAULT		0x0000
401 #define AN_TXPOWER_50MW				50
402 #define AN_TXPOWER_100MW			100
403 #define AN_TXPOWER_250MW			250
404 
405 /*
406  * Valid SSID list. You can specify up to three SSIDs denoting
407  * the service sets that you want to join. The first SSID always
408  * defaults to "tsunami" which is a handy way to detect the
409  * card.
410  */
411 struct an_ltv_ssidlist {
412 	u_int16_t		an_len;
413 	u_int16_t		an_type;
414 	u_int16_t		an_ssid1_len;
415 	char			an_ssid1[32];
416 	u_int16_t		an_ssid2_len;
417 	char			an_ssid2[32];
418 	u_int16_t		an_ssid3_len;
419 	char			an_ssid3[32];
420 };
421 
422 /*
423  * Valid AP list.
424  */
425 struct an_ltv_aplist {
426 	u_int16_t		an_len;
427 	u_int16_t		an_type;
428 	u_int8_t		an_ap1[8];
429 	u_int8_t		an_ap2[8];
430 	u_int8_t		an_ap3[8];
431 	u_int8_t		an_ap4[8];
432 };
433 
434 /*
435  * Driver name.
436  */
437 struct an_ltv_drvname {
438 	u_int16_t		an_len;
439 	u_int16_t		an_type;
440 	u_int8_t		an_drvname[16];
441 };
442 
443 /*
444  * Frame encapsulation.
445  */
446 struct an_rid_encap {
447 	u_int16_t		an_len;
448 	u_int16_t		an_type;
449 	u_int16_t		an_ethertype_default;
450 	u_int16_t		an_action_default;
451 	u_int16_t		an_ethertype0;
452 	u_int16_t		an_action0;
453 	u_int16_t		an_ethertype1;
454 	u_int16_t		an_action1;
455 	u_int16_t		an_ethertype2;
456 	u_int16_t		an_action2;
457 	u_int16_t		an_ethertype3;
458 	u_int16_t		an_action3;
459 	u_int16_t		an_ethertype4;
460 	u_int16_t		an_action4;
461 	u_int16_t		an_ethertype5;
462 	u_int16_t		an_action5;
463 	u_int16_t		an_ethertype6;
464 	u_int16_t		an_action6;
465 };
466 
467 #define AN_ENCAP_ACTION_RX	0x0001
468 #define AN_ENCAP_ACTION_TX	0x0002
469 
470 #define AN_RXENCAP_NONE		0x0000
471 #define AN_RXENCAP_RFC1024	0x0001
472 
473 #define AN_TXENCAP_RFC1024	0x0000
474 #define AN_TXENCAP_80211	0x0002
475 
476 /*
477  * Card capabilities (read only).
478  */
479 struct an_ltv_caps {
480 	u_int16_t		an_len;			/* 0x00 */
481 	u_int16_t		an_type;		/* XXXX */
482 	u_int8_t		an_oui[3];		/* 0x02 */
483 	u_int8_t		an_rsvd0;		/* 0x05 */
484 	u_int16_t		an_prodnum;		/* 0x06 */
485 	u_int8_t		an_manufname[32];	/* 0x08 */
486 	u_int8_t		an_prodname[16];	/* 0x28 */
487 	u_int8_t		an_prodvers[8];		/* 0x38 */
488 	u_int8_t		an_oemaddr[6];		/* 0x40 */
489 	u_int8_t		an_aironetaddr[6];	/* 0x46 */
490 	u_int16_t		an_radiotype;		/* 0x4C */
491 	u_int16_t		an_regdomain;		/* 0x4E */
492 	u_int8_t		an_callid[6];		/* 0x50 */
493 	u_int8_t		an_rates[8];		/* 0x56 */
494 	u_int8_t		an_rx_diversity;	/* 0x5E */
495 	u_int8_t		an_tx_diversity;	/* 0x5F */
496 	u_int16_t		an_tx_powerlevels[8];	/* 0x60 */
497 	u_int16_t		an_hwrev;		/* 0x70 */
498 	u_int16_t		an_hwcaps;		/* 0x72 */
499 	u_int16_t		an_temprange;		/* 0x74 */
500 	u_int16_t		an_fwrev;		/* 0x76 */
501 	u_int16_t		an_fwsubrev;		/* 0x78 */
502 	u_int16_t		an_ifacerev;		/* 0x7A */
503 	u_int16_t		an_softcaps;		/* 0x7C */
504 	u_int16_t		an_bootblockrev;	/* 0x7E */
505 	u_int16_t		an_req_hw_support;	/* 0x80 */
506 };
507 
508 /*
509  * Access point (read only)
510  */
511 struct an_ltv_apinfo {
512 	u_int16_t		an_len;
513 	u_int16_t		an_type;
514 	u_int16_t		an_tim_addr;
515 	u_int16_t		an_airo_addr;
516 };
517 
518 /*
519  * Radio info (read only).
520  */
521 struct an_ltv_radioinfo {
522 	u_int16_t		an_len;
523 	u_int16_t		an_type;
524 	/* ??? */
525 };
526 
527 /*
528  * Status (read only). Note: the manual claims this RID is 108 bytes
529  * long (0x6A is the last datum, which is 2 bytes long) however when
530  * this RID is read from the NIC, it returns a length of 110. To be
531  * on the safe side, this structure is padded with an extra 16-bit
532  * word. (There is a misprint in the manual which says the macaddr
533  * field is 8 bytes long.)
534  *
535  * Also, the channel_set and current_channel fields appear to be
536  * reversed. Either that, or the hop_period field is unused.
537  */
538 struct an_ltv_status {
539 	u_int16_t		an_len;			/* 0x00 */
540 	u_int16_t		an_type;		/* 0xXX */
541 	u_int8_t		an_macaddr[6];		/* 0x02 */
542 	u_int16_t		an_opmode;		/* 0x08 */
543 	u_int16_t		an_errcode;		/* 0x0A */
544 	u_int16_t		an_cur_signal_strength;	/* 0x0C */
545 	u_int16_t		an_ssidlen;		/* 0x0E */
546 	u_int8_t		an_ssid[32];		/* 0x10 */
547 	u_int8_t		an_ap_name[16];		/* 0x30 */
548 	u_int8_t		an_cur_bssid[6];	/* 0x40 */
549 	u_int8_t		an_prev_bssid1[6];	/* 0x46 */
550 	u_int8_t		an_prev_bssid2[6];	/* 0x4C */
551 	u_int8_t		an_prev_bssid3[6];	/* 0x52 */
552 	u_int16_t		an_beacon_period;	/* 0x58 */
553 	u_int16_t		an_dtim_period;		/* 0x5A */
554 	u_int16_t		an_atim_duration;	/* 0x5C */
555 	u_int16_t		an_hop_period;		/* 0x5E */
556 	u_int16_t		an_cur_channel;		/* 0x62 */
557 	u_int16_t		an_channel_set;		/* 0x60 */
558 	u_int16_t		an_hops_to_backbone;	/* 0x64 */
559 	u_int16_t		an_ap_total_load;	/* 0x66 */
560 	u_int16_t		an_our_generated_load;	/* 0x68 */
561 	u_int16_t		an_accumulated_arl;	/* 0x6A */
562 	u_int16_t		an_cur_signal_quality;	/* 0x6C */
563 	u_int16_t		an_current_tx_rate;	/* 0x6E */
564 	u_int16_t		an_ap_device;		/* 0x70 */
565 	u_int16_t		an_normalized_rssi;	/* 0x72 */
566 	u_int16_t		an_short_pre_in_use;	/* 0x74 */
567 	u_int8_t		an_ap_ip_addr[4];	/* 0x76 */
568 	u_int16_t		an_max_noise_prev_sec;	/* 0x7A */
569 	u_int16_t		an_avg_noise_prev_min;	/* 0x7C */
570 	u_int16_t		an_max_noise_prev_min;	/* 0x7E */
571 	u_int16_t		an_spare[5];		/* 0x80 */
572 };
573 
574 #define AN_STATUS_OPMODE_CONFIGURED		0x0001
575 #define AN_STATUS_OPMODE_MAC_ENABLED		0x0002
576 #define AN_STATUS_OPMODE_RX_ENABLED		0x0004
577 #define AN_STATUS_OPMODE_IN_SYNC		0x0010
578 #define AN_STATUS_OPMODE_ASSOCIATED		0x0020
579 #define AN_STATUS_OPMODE_ERROR			0x8000
580 
581 /*
582  * WEP config
583  */
584 struct an_ltv_wepkey {
585 	u_int16_t		an_len;			/* 0x00 */
586 	u_int16_t		an_type;		/* 0xXX */
587 	u_int16_t		an_key_index;		/* 0x02 */
588 	u_int8_t		an_mac_addr[6];		/* 0x04 */
589 	u_int16_t		an_key_len;		/* 0x0A */
590 	u_int8_t		an_key[13];		/* 0x0C */
591 };
592 
593 /*
594  * These are all the LTV record types that we can read or write
595  * from the Aironet. Not all of them are tremendously useful, but I
596  * list as many as I know about here for completeness.
597  */
598 
599 #pragma pack()
600 
601 /*
602  * Configuration (read/write)
603  */
604 #define AN_RID_GENCONFIG	0xFF10	/* General configuration info */
605 #define AN_RID_SSIDLIST		0xFF11	/* Valid SSID list */
606 #define AN_RID_APLIST		0xFF12	/* Valid AP list */
607 #define AN_RID_DRVNAME		0xFF13	/* ID name of this node for diag */
608 #define AN_RID_ENCAP		0xFF14	/* Payload encapsulation type */
609 #define AN_RID_WEP_VOLATILE	0xFF15	/* Temporary WEP key configuration */
610 #define AN_RID_WEP_PERMANENT	0xFF16	/* Permanent WEP key configuration */
611 #define AN_RID_ACTUALCFG	0xFF20	/* Current configuration settings */
612 
613 /*
614  * Reporting (read only)
615  */
616 #define AN_RID_CAPABILITIES	0xFF00	/* PC 4500/4800 capabilities */
617 #define AN_RID_APINFO		0xFF01	/* Access point info */
618 #define AN_RID_RADIOINFO	0xFF02	/* Radio info */
619 #define AN_RID_STATUS		0xFF50	/* Current status info */
620 
621 /*
622  * Statistics
623  */
624 #define AN_RID_16BITS_CUM	0xFF60	/* Cumulative 16-bit stats counters */
625 #define AN_RID_16BITS_DELTA	0xFF61	/* 16-bit stats (since last clear) */
626 #define AN_RID_16BITS_DELTACLR	0xFF62	/* 16-bit stats, clear on read */
627 #define AN_RID_32BITS_CUM	0xFF68	/* Cumulative 32-bit stats counters */
628 #define AN_RID_32BITS_DELTA	0xFF69	/* 32-bit stats (since last clear) */
629 #define AN_RID_32BITS_DELTACLR	0xFF6A	/* 32-bit stats, clear on read */
630 
631 #ifdef _KERNEL
632 #define AN_TX_RING_CNT	4
633 struct an_tx_ring_data {
634 	u_int16_t	an_tx_fids[AN_TX_RING_CNT];
635 	u_int16_t	an_tx_ring[AN_TX_RING_CNT];
636 	int		an_tx_prod;
637 	int		an_tx_cons;
638 };
639 
640 struct an_softc	{
641 	struct device	sc_dev;
642 	struct arpcom	sc_arpcom;
643 	struct ifmedia	an_ifmedia;
644 	void		*sc_ih;
645 	struct timeout	an_stat_ch;
646 
647 	bus_space_tag_t		an_btag;
648 	bus_space_handle_t	an_bhandle;
649 
650 	struct an_ltv_genconfig	an_config;
651 	struct an_ltv_caps	an_caps;
652 	struct an_ltv_ssidlist	an_ssidlist;
653 	struct an_ltv_aplist	an_aplist;
654 	int			an_tx_rate;
655 	int			an_rxmode;
656 	int			an_gone;
657 	int			an_if_flags;
658 	u_int8_t		an_txbuf[1536];
659 	struct an_tx_ring_data	an_rdata;
660 	struct an_ltv_stats	an_stats;
661 	struct an_ltv_status	an_status;
662 	u_int8_t		an_associated;
663 
664 	/* ANCACHE stuff */
665 	int			an_cache_iponly;
666 	int			an_cache_mcastonly;
667 	int			an_sigitems;
668 	struct an_sigcache	an_sigcache[MAXANCACHE];
669 	int			an_nextitem;
670 };
671 
672 void	an_release_resources(struct device *);
673 int	an_alloc_port(struct device *, int, int);
674 int	an_alloc_memory(struct device *, int, int);
675 int	an_alloc_irq(struct device *, int, int);
676 int	an_probe(struct device *);
677 void	an_shutdown(void *);
678 int	an_attach(struct an_softc *);
679 void	an_init(struct an_softc *);
680 void	an_stop(struct an_softc *);
681 int	an_intr(void *);
682 #endif
683 
684 #endif
685