xref: /haiku/src/add-ons/kernel/drivers/network/wlan/aironetwifi/dev/an/if_aironet_ieee.h (revision 5a39afd3522fcf12c1c898ea391e9d86d4ab463c)
1 /*-
2  * SPDX-License-Identifier: BSD-4-Clause
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$
35  */
36 
37 #ifndef _IF_AIRONET_IEEE_H
38 #define _IF_AIRONET_IEEE_H
39 
40 /*
41  * This header defines a simple command interface to the FreeBSD
42  * Aironet driver (an) 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 SIOCSAIRONET
49 #define SIOCSAIRONET	SIOCSIFGENERIC
50 #endif
51 
52 #ifndef SIOCGAIRONET
53 #define SIOCGAIRONET	SIOCGIFGENERIC
54 #endif
55 
56 /*
57  * This is a make-predend RID value used only by the driver
58  * to allow the user to set the speed.
59  */
60 #define AN_RID_TX_SPEED		0x1234
61 
62 /*
63  * Technically I don't think there's a limit to a record
64  * length. The largest record is the one that contains the CIS
65  * data, which is 240 words long, so 256 should be a safe
66  * value.
67  */
68 #define AN_MAX_DATALEN	4096
69 
70 struct an_req {
71 	u_int16_t	an_len;
72 	u_int16_t	an_type;
73 	u_int16_t	an_val[AN_MAX_DATALEN];
74 };
75 
76 /*
77  * Private LTV records (interpreted only by the driver). This is
78  * a minor kludge to allow reading the interface statistics from
79  * the driver.
80  */
81 #define AN_RID_IFACE_STATS	0x0100
82 #define AN_RID_MGMT_XMIT	0x0200
83 #ifdef ANCACHE
84 #define AN_RID_ZERO_CACHE	0x0300
85 #define AN_RID_READ_CACHE	0x0400
86 #endif
87 
88 #define AN_FCTL_VERS		0x0002
89 #define AN_FCTL_FTYPE		0x000C
90 #define AN_FCTL_STYPE		0x00F0
91 #define AN_FCTL_TODS		0x0100
92 #define AN_FCTL_FROMDS		0x0200
93 #define AN_FCTL_MOREFRAGS	0x0400
94 #define AN_FCTL_RETRY		0x0800
95 #define AN_FCTL_PM		0x1000
96 #define AN_FCTL_MOREDATA	0x2000
97 #define AN_FCTL_WEP		0x4000
98 #define AN_FCTL_ORDER		0x8000
99 
100 #define AN_FTYPE_MGMT		0x0000
101 #define AN_FTYPE_CTL		0x0004
102 #define AN_FTYPE_DATA		0x0008
103 
104 #define AN_STYPE_MGMT_ASREQ	0x0000	/* association request */
105 #define AN_STYPE_MGMT_ASRESP	0x0010	/* association response */
106 #define AN_STYPE_MGMT_REASREQ	0x0020	/* reassociation request */
107 #define AN_STYPE_MGMT_REASRESP	0x0030	/* reassociation response */
108 #define AN_STYPE_MGMT_PROBEREQ	0x0040	/* probe request */
109 #define AN_STYPE_MGMT_PROBERESP	0x0050	/* probe response */
110 #define AN_STYPE_MGMT_BEACON	0x0080	/* beacon */
111 #define AN_STYPE_MGMT_ATIM	0x0090	/* announcement traffic ind msg */
112 #define AN_STYPE_MGMT_DISAS	0x00A0	/* disassociation */
113 #define AN_STYPE_MGMT_AUTH	0x00B0	/* authentication */
114 #define AN_STYPE_MGMT_DEAUTH	0x00C0	/* deauthentication */
115 
116 /*
117  * Aironet IEEE signal strength cache
118  *
119  * driver keeps cache of last
120  * MAXANCACHE packets to arrive including signal strength info.
121  * daemons may read this via ioctl
122  *
123  * Each entry in the wi_sigcache has a unique macsrc.
124  */
125 #ifdef ANCACHE
126 #define MAXANCACHE      10
127 
128 struct an_sigcache {
129 	char	macsrc[6];	/* unique MAC address for entry */
130 	int	ipsrc;		/* ip address associated with packet */
131 	int	signal;		/* signal strength of the packet */
132 	int	noise;		/* noise value */
133 	int	quality;	/* quality of the packet */
134 };
135 #endif
136 
137 /*
138  * The card provides an 8-bit signal strength value (RSSI), which can
139  * be converted to a dBm power value (or a percent) using a table in
140  * the card's firmware (when available).  The tables are slightly
141  * different in individual cards, even of the same model.  If the
142  * table is not available, the mapping can be approximated by dBm =
143  * RSSI - 100.  This approximation can be seen by plotting a few
144  * tables, and also matches some info on the Intersil web site (I
145  * think they make the RF front end for the cards.  However, the linux
146  * driver uses the approximation dBm = RSSI/2 - 95.  I think that is
147  * just wrong.
148  */
149 
150 struct an_rssi_entry {
151 	u_int8_t	an_rss_pct;
152 	u_int8_t	an_rss_dbm;
153 };
154 
155 struct an_ltv_key {
156 	u_int16_t	an_len;
157 	u_int16_t	an_type;
158 	u_int16_t       kindex;
159 	u_int8_t        mac[6];
160 	u_int16_t       klen;
161 	u_int8_t        key[16];  /* 128-bit keys */
162 };
163 
164 struct an_ltv_stats {
165 	u_int16_t		an_fudge;
166 	u_int16_t		an_len;			/* 0x00 */
167 	u_int16_t		an_type;		/* 0xXX */
168 	u_int16_t		an_spacer;		/* 0x02 */
169 	u_int32_t		an_rx_overruns;		/* 0x04 */
170 	u_int32_t		an_rx_plcp_csum_errs;	/* 0x08 */
171 	u_int32_t		an_rx_plcp_format_errs;	/* 0x0C */
172 	u_int32_t		an_rx_plcp_len_errs;	/* 0x10 */
173 	u_int32_t		an_rx_mac_crc_errs;	/* 0x14 */
174 	u_int32_t		an_rx_mac_crc_ok;	/* 0x18 */
175 	u_int32_t		an_rx_wep_errs;		/* 0x1C */
176 	u_int32_t		an_rx_wep_ok;		/* 0x20 */
177 	u_int32_t		an_retry_long;		/* 0x24 */
178 	u_int32_t		an_retry_short;		/* 0x28 */
179 	u_int32_t		an_retry_max;		/* 0x2C */
180 	u_int32_t		an_no_ack;		/* 0x30 */
181 	u_int32_t		an_no_cts;		/* 0x34 */
182 	u_int32_t		an_rx_ack_ok;		/* 0x38 */
183 	u_int32_t		an_rx_cts_ok;		/* 0x3C */
184 	u_int32_t		an_tx_ack_ok;		/* 0x40 */
185 	u_int32_t		an_tx_rts_ok;		/* 0x44 */
186 	u_int32_t		an_tx_cts_ok;		/* 0x48 */
187 	u_int32_t		an_tx_lmac_mcasts;	/* 0x4C */
188 	u_int32_t		an_tx_lmac_bcasts;	/* 0x50 */
189 	u_int32_t		an_tx_lmac_ucast_frags;	/* 0x54 */
190 	u_int32_t		an_tx_lmac_ucasts;	/* 0x58 */
191 	u_int32_t		an_tx_beacons;		/* 0x5C */
192 	u_int32_t		an_rx_beacons;		/* 0x60 */
193 	u_int32_t		an_tx_single_cols;	/* 0x64 */
194 	u_int32_t		an_tx_multi_cols;	/* 0x68 */
195 	u_int32_t		an_tx_defers_no;	/* 0x6C */
196 	u_int32_t		an_tx_defers_prot;	/* 0x70 */
197 	u_int32_t		an_tx_defers_energy;	/* 0x74 */
198 	u_int32_t		an_rx_dups;		/* 0x78 */
199 	u_int32_t		an_rx_partial;		/* 0x7C */
200 	u_int32_t		an_tx_too_old;		/* 0x80 */
201 	u_int32_t		an_rx_too_old;		/* 0x84 */
202 	u_int32_t		an_lostsync_max_retries;/* 0x88 */
203 	u_int32_t		an_lostsync_missed_beacons;/* 0x8C */
204 	u_int32_t		an_lostsync_arl_exceeded;/*0x90 */
205 	u_int32_t		an_lostsync_deauthed;	/* 0x94 */
206 	u_int32_t		an_lostsync_disassociated;/*0x98 */
207 	u_int32_t		an_lostsync_tsf_timing;	/* 0x9C */
208 	u_int32_t		an_tx_host_mcasts;	/* 0xA0 */
209 	u_int32_t		an_tx_host_bcasts;	/* 0xA4 */
210 	u_int32_t		an_tx_host_ucasts;	/* 0xA8 */
211 	u_int32_t		an_tx_host_failed;	/* 0xAC */
212 	u_int32_t		an_rx_host_mcasts;	/* 0xB0 */
213 	u_int32_t		an_rx_host_bcasts;	/* 0xB4 */
214 	u_int32_t		an_rx_host_ucasts;	/* 0xB8 */
215 	u_int32_t		an_rx_host_discarded;	/* 0xBC */
216 	u_int32_t		an_tx_hmac_mcasts;	/* 0xC0 */
217 	u_int32_t		an_tx_hmac_bcasts;	/* 0xC4 */
218 	u_int32_t		an_tx_hmac_ucasts;	/* 0xC8 */
219 	u_int32_t		an_tx_hmac_failed;	/* 0xCC */
220 	u_int32_t		an_rx_hmac_mcasts;	/* 0xD0 */
221 	u_int32_t		an_rx_hmac_bcasts;	/* 0xD4 */
222 	u_int32_t		an_rx_hmac_ucasts;	/* 0xD8 */
223 	u_int32_t		an_rx_hmac_discarded;	/* 0xDC */
224 	u_int32_t		an_tx_hmac_accepted;	/* 0xE0 */
225 	u_int32_t		an_ssid_mismatches;	/* 0xE4 */
226 	u_int32_t		an_ap_mismatches;	/* 0xE8 */
227 	u_int32_t		an_rates_mismatches;	/* 0xEC */
228 	u_int32_t		an_auth_rejects;	/* 0xF0 */
229 	u_int32_t		an_auth_timeouts;	/* 0xF4 */
230 	u_int32_t		an_assoc_rejects;	/* 0xF8 */
231 	u_int32_t		an_assoc_timeouts;	/* 0xFC */
232 	u_int32_t		an_reason_outside_table;/* 0x100 */
233 	u_int32_t		an_reason1;		/* 0x104 */
234 	u_int32_t		an_reason2;		/* 0x108 */
235 	u_int32_t		an_reason3;		/* 0x10C */
236 	u_int32_t		an_reason4;		/* 0x110 */
237 	u_int32_t		an_reason5;		/* 0x114 */
238 	u_int32_t		an_reason6;		/* 0x118 */
239 	u_int32_t		an_reason7;		/* 0x11C */
240 	u_int32_t		an_reason8;		/* 0x120 */
241 	u_int32_t		an_reason9;		/* 0x124 */
242 	u_int32_t		an_reason10;		/* 0x128 */
243 	u_int32_t		an_reason11;		/* 0x12C */
244 	u_int32_t		an_reason12;		/* 0x130 */
245 	u_int32_t		an_reason13;		/* 0x134 */
246 	u_int32_t		an_reason14;		/* 0x138 */
247 	u_int32_t		an_reason15;		/* 0x13C */
248 	u_int32_t		an_reason16;		/* 0x140 */
249 	u_int32_t		an_reason17;		/* 0x144 */
250 	u_int32_t		an_reason18;		/* 0x148 */
251 	u_int32_t		an_reason19;		/* 0x14C */
252 	u_int32_t		an_rx_mgmt_pkts;	/* 0x150 */
253 	u_int32_t		an_tx_mgmt_pkts;	/* 0x154 */
254 	u_int32_t		an_rx_refresh_pkts;	/* 0x158 */
255 	u_int32_t		an_tx_refresh_pkts;	/* 0x15C */
256 	u_int32_t		an_rx_poll_pkts;	/* 0x160 */
257 	u_int32_t		an_tx_poll_pkts;	/* 0x164 */
258 	u_int32_t		an_host_retries;	/* 0x168 */
259 	u_int32_t		an_lostsync_hostreq;	/* 0x16C */
260 	u_int32_t		an_host_tx_bytes;	/* 0x170 */
261 	u_int32_t		an_host_rx_bytes;	/* 0x174 */
262 	u_int32_t		an_uptime_usecs;	/* 0x178 */
263 	u_int32_t		an_uptime_secs;		/* 0x17C */
264 	u_int32_t		an_lostsync_better_ap;	/* 0x180 */
265 	u_int32_t		an_rsvd[15];
266 };
267 
268 /*
269  * General configuration information.
270  */
271 struct an_ltv_genconfig {
272 	/* General configuration. */
273 	u_int16_t		an_len;			/* 0x00 */
274 	u_int16_t		an_type;		/* XXXX */
275 	u_int16_t		an_opmode;		/* 0x02 */
276 	u_int16_t		an_rxmode;		/* 0x04 */
277 	u_int16_t		an_fragthresh;		/* 0x06 */
278 	u_int16_t		an_rtsthresh;		/* 0x08 */
279 	u_int8_t		an_macaddr[6];		/* 0x0A */
280 	u_int8_t		an_rates[8];		/* 0x10 */
281 	u_int16_t		an_shortretry_limit;	/* 0x18 */
282 	u_int16_t		an_longretry_limit;	/* 0x1A */
283 	u_int16_t		an_tx_msdu_lifetime;	/* 0x1C */
284 	u_int16_t		an_rx_msdu_lifetime;	/* 0x1E */
285 	u_int16_t		an_stationary;		/* 0x20 */
286 	u_int16_t		an_ordering;		/* 0x22 */
287 	u_int16_t		an_devtype;		/* 0x24 */
288 	u_int16_t		an_rsvd0[5];		/* 0x26 */
289 	/* Scanning associating. */
290 	u_int16_t		an_scanmode;		/* 0x30 */
291 	u_int16_t		an_probedelay;		/* 0x32 */
292 	u_int16_t		an_probe_energy_timeout;/* 0x34 */
293 	u_int16_t		an_probe_response_timeout;/*0x36 */
294 	u_int16_t		an_beacon_listen_timeout;/*0x38 */
295 	u_int16_t		an_ibss_join_net_timeout;/*0x3A */
296 	u_int16_t		an_auth_timeout;	/* 0x3C */
297 	u_int16_t		an_authtype;		/* 0x3E */
298 	u_int16_t		an_assoc_timeout;	/* 0x40 */
299 	u_int16_t		an_specified_ap_timeout;/* 0x42 */
300 	u_int16_t		an_offline_scan_interval;/*0x44 */
301 	u_int16_t		an_offline_scan_duration;/*0x46 */
302 	u_int16_t		an_link_loss_delay;	/* 0x48 */
303 	u_int16_t		an_max_beacon_lost_time;/* 0x4A */
304 	u_int16_t		an_refresh_interval;	/* 0x4C */
305 	u_int16_t		an_rsvd1;		/* 0x4E */
306 	/* Power save operation */
307 	u_int16_t		an_psave_mode;		/* 0x50 */
308 	u_int16_t		an_sleep_for_dtims;	/* 0x52 */
309 	u_int16_t		an_listen_interval;	/* 0x54 */
310 	u_int16_t		an_fast_listen_interval;/* 0x56 */
311 	u_int16_t		an_listen_decay;	/* 0x58 */
312 	u_int16_t		an_fast_listen_decay;	/* 0x5A */
313 	u_int16_t		an_rsvd2[2];		/* 0x5C */
314 	/* Ad-hoc (or AP) operation. */
315 	u_int16_t		an_beacon_period;	/* 0x60 */
316 	u_int16_t		an_atim_duration;	/* 0x62 */
317 	u_int16_t		an_rsvd3;		/* 0x64 */
318 	u_int16_t		an_ds_channel;		/* 0x66 */
319 	u_int16_t		an_rsvd4;		/* 0x68 */
320 	u_int16_t		an_dtim_period;		/* 0x6A */
321 	u_int16_t		an_rsvd5[2];		/* 0x6C */
322 	/* Radio operation. */
323 	u_int16_t		an_radiotype;		/* 0x70 */
324 	u_int16_t		an_diversity;		/* 0x72 */
325 	u_int16_t		an_tx_power;		/* 0x74 */
326 	u_int16_t		an_rss_thresh;		/* 0x76 */
327 	u_int16_t		an_modulation_type;	/* 0x78 */
328 	u_int16_t		an_short_preamble;	/* 0x7A */
329 	u_int16_t		an_home_product;	/* 0x7C */
330 	u_int16_t		an_rsvd6;		/* 0x7E */
331 	/* Aironet extensions. */
332 	u_int8_t		an_nodename[16];	/* 0x80 */
333 	u_int16_t		an_arl_thresh;		/* 0x90 */
334 	u_int16_t		an_arl_decay;		/* 0x92 */
335 	u_int16_t		an_arl_delay;		/* 0x94 */
336 	u_int8_t		an_rsvd7;		/* 0x96 */
337 	u_int8_t		an_rsvd8;		/* 0x97 */
338 	u_int8_t		an_magic_packet_action;	/* 0x98 */
339 	u_int8_t		an_magic_packet_ctl;	/* 0x99 */
340 	u_int16_t		an_rsvd9;
341 	u_int16_t		an_spare[19];
342 };
343 
344 #define AN_OPMODE_IBSS_ADHOC			0x0000
345 #define AN_OPMODE_INFRASTRUCTURE_STATION	0x0001
346 #define AN_OPMODE_AP				0x0002
347 #define AN_OPMODE_AP_REPEATER			0x0003
348 #define AN_OPMODE_UNMODIFIED_PAYLOAD		0x0100
349 #define AN_OPMODE_AIRONET_EXTENSIONS		0x0200
350 #define AN_OPMODE_AP_EXTENSIONS			0x0400
351 
352 #define AN_RXMODE_BC_MC_ADDR			0x0000
353 #define AN_RXMODE_BC_ADDR			0x0001
354 #define AN_RXMODE_ADDR				0x0002
355 #define AN_RXMODE_80211_MONITOR_CURBSS		0x0003
356 #define AN_RXMODE_80211_MONITOR_ANYBSS		0x0004
357 #define AN_RXMODE_LAN_MONITOR_CURBSS		0x0005
358 #define AN_RXMODE_NO_8023_HEADER		0x0100
359 #define AN_RXMODE_NORMALIZED_RSSI		0x0200
360 
361 #define AN_RATE_1MBPS				0x0002
362 #define AN_RATE_2MBPS				0x0004
363 #define AN_RATE_5_5MBPS				0x000B
364 #define AN_RATE_11MBPS				0x0016
365 
366 #define AN_DEVTYPE_PC4500			0x0065
367 #define AN_DEVTYPE_PC4800			0x006D
368 
369 #define AN_SCANMODE_ACTIVE			0x0000
370 #define AN_SCANMODE_PASSIVE			0x0001
371 #define AN_SCANMODE_AIRONET_ACTIVE		0x0002
372 
373 #define AN_AUTHTYPE_NONE			0x0000
374 #define AN_AUTHTYPE_OPEN			0x0001
375 #define AN_AUTHTYPE_SHAREDKEY			0x0002
376 #define AN_AUTHTYPE_MASK                        0x00ff
377 #define AN_AUTHTYPE_ENABLE			0x0100
378 #define AN_AUTHTYPE_PRIVACY_IN_USE		0x0100
379 #define AN_AUTHTYPE_ALLOW_UNENCRYPTED		0x0200
380 #define AN_AUTHTYPE_LEAP			0x1000
381 
382 #define AN_PSAVE_NONE				0x0000
383 #define AN_PSAVE_CAM				0x0001
384 #define AN_PSAVE_PSP				0x0002
385 #define AN_PSAVE_PSP_CAM			0x0003
386 
387 #define AN_RADIOTYPE_80211_FH			0x0001
388 #define AN_RADIOTYPE_80211_DS			0x0002
389 #define AN_RADIOTYPE_LM2000_DS			0x0004
390 
391 #define AN_DIVERSITY_FACTORY_DEFAULT		0x0000
392 #define AN_DIVERSITY_ANTENNA_1_ONLY		0x0001
393 #define AN_DIVERSITY_ANTENNA_2_ONLY		0x0002
394 #define AN_DIVERSITY_ANTENNA_1_AND_2		0x0003
395 
396 #define AN_TXPOWER_FACTORY_DEFAULT		0x0000
397 #define AN_TXPOWER_50MW				50
398 #define AN_TXPOWER_100MW			100
399 #define AN_TXPOWER_250MW			250
400 
401 #define AN_HOME_NETWORK				0x0001
402 #define AN_HOME_INSTALL_AP			0x0002
403 
404 /*
405  * Valid SSID list. You can specify up to three SSIDs denoting
406  * the service sets that you want to join. The first SSID always
407  * defaults to "tsunami" which is a handy way to detect the
408  * card.
409  */
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 struct an_ltv_ssid_entry{
423 	u_int16_t		an_len;
424 	char			an_ssid[32];
425 };
426 
427 #define MAX_SSIDS 25
428 struct an_ltv_ssidlist_new {
429 	u_int16_t		an_len;
430 	u_int16_t		an_type;
431 	struct an_ltv_ssid_entry an_entry[MAX_SSIDS];
432 };
433 
434 /*
435  * Valid AP list.
436  */
437 struct an_ltv_aplist {
438 	u_int16_t		an_len;
439 	u_int16_t		an_type;
440 	u_int8_t		an_ap1[8];
441 	u_int8_t		an_ap2[8];
442 	u_int8_t		an_ap3[8];
443 	u_int8_t		an_ap4[8];
444 };
445 
446 /*
447  * Driver name.
448  */
449 struct an_ltv_drvname {
450 	u_int16_t		an_len;
451 	u_int16_t		an_type;
452 	u_int8_t		an_drvname[16];
453 };
454 
455 /*
456  * Frame encapsulation.
457  */
458 struct an_rid_encap {
459 	u_int16_t		an_len;
460 	u_int16_t		an_type;
461 	u_int16_t		an_ethertype_default;
462 	u_int16_t		an_action_default;
463 	u_int16_t		an_ethertype0;
464 	u_int16_t		an_action0;
465 	u_int16_t		an_ethertype1;
466 	u_int16_t		an_action1;
467 	u_int16_t		an_ethertype2;
468 	u_int16_t		an_action2;
469 	u_int16_t		an_ethertype3;
470 	u_int16_t		an_action3;
471 	u_int16_t		an_ethertype4;
472 	u_int16_t		an_action4;
473 	u_int16_t		an_ethertype5;
474 	u_int16_t		an_action5;
475 	u_int16_t		an_ethertype6;
476 	u_int16_t		an_action6;
477 };
478 
479 #define AN_ENCAP_ACTION_RX	0x0001
480 #define AN_ENCAP_ACTION_TX	0x0002
481 
482 #define AN_RXENCAP_NONE		0x0000
483 #define AN_RXENCAP_RFC1024	0x0001
484 
485 #define AN_TXENCAP_RFC1024	0x0000
486 #define AN_TXENCAP_80211	0x0002
487 
488 /*
489  * Card capabilities (read only).
490  */
491 struct an_ltv_caps {
492 	u_int16_t		an_len;			/* 0x00 */
493 	u_int16_t		an_type;		/* XXXX */
494 	u_int8_t		an_oui[3];		/* 0x02 */
495 	u_int8_t		an_rsvd0;		/* 0x05 */
496 	u_int16_t		an_prodnum;		/* 0x06 */
497 	u_int8_t		an_manufname[32];	/* 0x08 */
498 	u_int8_t		an_prodname[16];	/* 0x28 */
499 	u_int8_t		an_prodvers[8];		/* 0x38 */
500 	u_int8_t		an_oemaddr[6];		/* 0x40 */
501 	u_int8_t		an_aironetaddr[6];	/* 0x46 */
502 	u_int16_t		an_radiotype;		/* 0x4C */
503 	u_int16_t		an_regdomain;		/* 0x4E */
504 	u_int8_t		an_callid[6];		/* 0x50 */
505 	u_int8_t		an_rates[8];		/* 0x56 */
506 	u_int8_t		an_rx_diversity;	/* 0x5E */
507 	u_int8_t		an_tx_diversity;	/* 0x5F */
508 	u_int16_t		an_tx_powerlevels[8];	/* 0x60 */
509 	u_int16_t		an_hwrev;		/* 0x70 */
510 	u_int16_t		an_hwcaps;		/* 0x72 */
511 	u_int16_t		an_temprange;		/* 0x74 */
512 	u_int16_t		an_fwrev;		/* 0x76 */
513 	u_int16_t		an_fwsubrev;		/* 0x78 */
514 	u_int16_t		an_ifacerev;		/* 0x7A */
515 	u_int16_t		an_softcaps;		/* 0x7C */
516 	u_int16_t		an_bootblockrev;	/* 0x7E */
517 	u_int16_t		an_req_hw_support;	/* 0x80 */
518 	u_int16_t		an_unknown[31];		/* 0x82 */
519 };
520 
521 /*
522  * Access point (read only)
523  */
524 struct an_ltv_apinfo {
525 	u_int16_t		an_len;
526 	u_int16_t		an_type;
527 	u_int16_t		an_tim_addr;
528 	u_int16_t		an_airo_addr;
529 };
530 
531 /*
532  * Radio info (read only).
533  */
534 struct an_ltv_radioinfo {
535 	u_int16_t		an_len;
536 	u_int16_t		an_type;
537 	/* ??? */
538 };
539 
540 /*
541  * RSSI map.  If available in the card's firmware, this can be used to
542  * convert the 8-bit RSSI values from the card into dBm.
543  */
544 struct an_ltv_rssi_map {
545 	u_int16_t		an_len;
546 	u_int16_t		an_type;
547 	struct an_rssi_entry	an_entries[256];
548 };
549 
550 /*
551  * Status (read only). Note: the manual claims this RID is 108 bytes
552  * long (0x6A is the last datum, which is 2 bytes long) however when
553  * this RID is read from the NIC, it returns a length of 110. To be
554  * on the safe side, this structure is padded with an extra 16-bit
555  * word. (There is a misprint in the manual which says the macaddr
556  * field is 8 bytes long.)
557  *
558  * Also, the channel_set and current_channel fields appear to be
559  * reversed. Either that, or the hop_period field is unused.
560  */
561 struct an_ltv_status {
562 	u_int16_t		an_len;			/* 0x00 */
563 	u_int16_t		an_type;		/* 0xXX */
564 	u_int8_t		an_macaddr[6];		/* 0x02 */
565 	u_int16_t		an_opmode;		/* 0x08 */
566 	u_int16_t		an_errcode;		/* 0x0A */
567 	u_int16_t		an_signal_quality;	/* 0x0C */
568 	u_int16_t		an_ssidlen;		/* 0x0E */
569 	u_int8_t		an_ssid[32];		/* 0x10 */
570 	u_int8_t		an_ap_name[16];		/* 0x30 */
571 	u_int8_t		an_cur_bssid[6];	/* 0x40 */
572 	u_int8_t		an_prev_bssid1[6];	/* 0x46 */
573 	u_int8_t		an_prev_bssid2[6];	/* 0x4C */
574 	u_int8_t		an_prev_bssid3[6];	/* 0x52 */
575 	u_int16_t		an_beacon_period;	/* 0x58 */
576 	u_int16_t		an_dtim_period;		/* 0x5A */
577 	u_int16_t		an_atim_duration;	/* 0x5C */
578 	u_int16_t		an_hop_period;		/* 0x5E */
579 	u_int16_t		an_cur_channel;		/* 0x62 */
580 	u_int16_t		an_channel_set;		/* 0x60 */
581 	u_int16_t		an_hops_to_backbone;	/* 0x64 */
582 	u_int16_t		an_ap_total_load;	/* 0x66 */
583 	u_int16_t		an_our_generated_load;	/* 0x68 */
584 	u_int16_t		an_accumulated_arl;	/* 0x6A */
585 	u_int16_t		an_cur_signal_quality;	/* 0x6C */
586 	u_int16_t		an_current_tx_rate;	/* 0x6E */
587 	u_int16_t		an_ap_device;		/* 0x70 */
588 	u_int16_t		an_normalized_strength;	/* 0x72 */
589 	u_int16_t		an_short_pre_in_use;	/* 0x74 */
590 	u_int8_t		an_ap_ip_addr[4];	/* 0x76 */
591 	u_int8_t		an_noise_prev_sec_pc;   /* 0x7A */
592 	u_int8_t		an_noise_prev_sec_db;   /* 0x7B */
593 	u_int8_t		an_avg_noise_prev_min_pc;       /* 0x7C */
594 	u_int8_t		an_avg_noise_prev_min_db;       /* 0x7D */
595 	u_int8_t		an_max_noise_prev_min_pc;       /* 0x7E */
596 	u_int8_t		an_max_noise_prev_min_db;       /* 0x7F */
597 	u_int16_t		an_spare[18];
598 };
599 
600 #define AN_STATUS_OPMODE_CONFIGURED		0x0001
601 #define AN_STATUS_OPMODE_MAC_ENABLED		0x0002
602 #define AN_STATUS_OPMODE_RX_ENABLED		0x0004
603 #define AN_STATUS_OPMODE_IN_SYNC		0x0010
604 #define AN_STATUS_OPMODE_ASSOCIATED		0x0020
605 #define AN_STATUS_OPMODE_LEAP			0x0040
606 #define AN_STATUS_OPMODE_ERROR			0x8000
607 
608 /*
609  * WEP Key
610  */
611 struct an_ltv_wepkey {
612 	u_int16_t		an_len;			/* 0x00 */
613 	u_int16_t		an_type;		/* 0xXX */
614 	u_int16_t		an_key_index;		/* 0x02 */
615 	u_int8_t		an_mac_addr[6];		/* 0x04 */
616 	u_int16_t		an_key_len;		/* 0x0A */
617 	u_int8_t		an_key[13];		/* 0x0C */
618 };
619 
620 /*
621  * Receive frame structure.
622  */
623 struct an_rxframe {
624 	u_int32_t		an_rx_time;		/* 0x00 */
625 	u_int16_t		an_rx_status;		/* 0x04 */
626 	u_int16_t		an_rx_payload_len;	/* 0x06 */
627 	u_int8_t		an_rsvd0;		/* 0x08 */
628 	u_int8_t		an_rx_signal_strength;	/* 0x09 */
629 	u_int8_t		an_rx_rate;		/* 0x0A */
630 	u_int8_t		an_rx_chan;		/* 0x0B */
631 	u_int8_t		an_rx_assoc_cnt;	/* 0x0C */
632 	u_int8_t		an_rsvd1[3];		/* 0x0D */
633 	u_int8_t		an_plcp_hdr[4];		/* 0x10 */
634 	u_int16_t		an_frame_ctl;		/* 0x14 */
635 	u_int16_t		an_duration;		/* 0x16 */
636 	u_int8_t		an_addr1[6];		/* 0x18 */
637 	u_int8_t		an_addr2[6];		/* 0x1E */
638 	u_int8_t		an_addr3[6];		/* 0x24 */
639 	u_int16_t		an_seq_ctl;		/* 0x2A */
640 	u_int8_t		an_addr4[6];		/* 0x2C */
641 	u_int8_t		an_gaplen;		/* 0x32 */
642 } __packed;
643 
644 /* Do not modify this unless you are modifying LEAP itself */
645 #define LEAP_USERNAME_MAX 32
646 #define LEAP_PASSWORD_MAX 32
647 
648 /*
649  * LEAP Username
650  */
651 struct an_ltv_leap_username {
652 	u_int16_t		an_len;			/* 0x00 */
653 	u_int16_t		an_type;		/* 0xXX */
654 	u_int16_t		an_username_len;	/* 0x02 */
655 	u_int8_t		an_username[LEAP_USERNAME_MAX];	/* 0x04 */
656 };
657 
658 /*
659  * LEAP Password
660  */
661 struct an_ltv_leap_password {
662 	u_int16_t		an_len;			/* 0x00 */
663 	u_int16_t		an_type;		/* 0xXX */
664 	u_int16_t		an_password_len;	/* 0x02 */
665 	u_int8_t		an_password[LEAP_PASSWORD_MAX];	/* 0x04 */
666 };
667 
668 /*
669  * These are all the LTV record types that we can read or write
670  * from the Aironet. Not all of them are temendously useful, but I
671  * list as many as I know about here for completeness.
672  */
673 
674 /*
675  * Configuration (read/write)
676  */
677 #define AN_RID_GENCONFIG	0xFF10	/* General configuration info */
678 #define AN_RID_SSIDLIST		0xFF11	/* Valid SSID list */
679 #define AN_RID_APLIST		0xFF12	/* Valid AP list */
680 #define AN_RID_DRVNAME		0xFF13	/* ID name of this node for diag */
681 #define AN_RID_ENCAPPROTO	0xFF14	/* Payload encapsulation type */
682 #define AN_RID_WEP_TEMP	        0xFF15  /* Temporary Key */
683 #define AN_RID_WEP_PERM	        0xFF16  /* Perminant Key */
684 #define AN_RID_ACTUALCFG	0xFF20	/* Current configuration settings */
685 
686 /*
687  * Reporting (read only)
688  */
689 #define AN_RID_CAPABILITIES	0xFF00	/* PC 4500/4800 capabilities */
690 #define AN_RID_AP_INFO		0xFF01	/* Access point info */
691 #define AN_RID_RADIO_INFO	0xFF02	/* Radio info */
692 #define AN_RID_RSSI_MAP         0xFF04  /* RSSI <-> dBm table */
693 #define AN_RID_STATUS		0xFF50	/* Current status info */
694 #define AN_RID_BEACONS_HST	0xFF51
695 #define AN_RID_BUSY_HST		0xFF52
696 #define AN_RID_RETRIES_HST	0xFF53
697 
698 /*
699  * Statistics
700  */
701 #define AN_RID_16BITS_CUM	0xFF60	/* Cumulative 16-bit stats counters */
702 #define AN_RID_16BITS_DELTA	0xFF61	/* 16-bit stats (since last clear) */
703 #define AN_RID_16BITS_DELTACLR	0xFF62	/* 16-bit stats, clear on read */
704 #define AN_RID_32BITS_CUM	0xFF68	/* Cumulative 32-bit stats counters */
705 #define AN_RID_32BITS_DELTA	0xFF69	/* 32-bit stats (since last clear) */
706 #define AN_RID_32BITS_DELTACLR	0xFF6A	/* 32-bit stats, clear on read */
707 
708 /*
709  * LEAP
710  */
711 
712 #define AN_RID_LEAPUSERNAME	0xFF23	/* Username */
713 #define AN_RID_LEAPPASSWORD	0xFF24	/* Password */
714 
715 /*
716  * OTHER Unknonwn for now
717  */
718 
719 #define AN_RID_MOD		0xFF17
720 #define AN_RID_OPTIONS		0xFF18
721 #define AN_RID_FACTORY_CONFIG	0xFF18
722 
723 /*
724  *   FreeBSD fake RID
725  */
726 
727 #define AN_RID_MONITOR_MODE	0x0001	/* Set monitor mode for driver */
728 #define AN_MONITOR			 1
729 #define AN_MONITOR_ANY_BSS		 2
730 #define AN_MONITOR_INCLUDE_BEACON	 4
731 #define AN_MONITOR_AIRONET_HEADER	 8
732 
733 #define DLT_AIRONET_HEADER 	120	/* Has been allocated at tcpdump.org */
734 
735 /*
736  * from the Linux driver from Cisco ... no copyright header.
737  * Removed duplicated information that already existed in the FreeBSD driver
738  * provides emulation of the Cisco extensions to the Linux Aironet driver.
739  */
740 
741 /*
742  * Ioctl constants to be used in airo_ioctl.command
743  */
744 
745 #define	AIROGCAP	0	/* Capability rid */
746 #define AIROGCFG	1	/* USED A LOT  */
747 #define AIROGSLIST	2	/* System ID list  */
748 #define AIROGVLIST	3	/* List of specified AP's */
749 #define AIROGDRVNAM	4	/* NOTUSED */
750 #define AIROGEHTENC	5	/* NOTUSED */
751 #define AIROGWEPKTMP	6
752 #define AIROGWEPKNV	7
753 #define AIROGSTAT	8
754 #define AIROGSTATSC32	9
755 #define AIROGSTATSD32	10
756 
757 /*
758  * Leave gap of 40 commands after AIROGSTATSD32
759  */
760 
761 #define AIROPCAP	AIROGSTATSD32	+ 40
762 #define AIROPVLIST	AIROPCAP	+ 1
763 #define AIROPSLIST	AIROPVLIST	+ 1
764 #define AIROPCFG	AIROPSLIST	+ 1
765 #define AIROPSIDS	AIROPCFG	+ 1
766 #define AIROPAPLIST	AIROPSIDS	+ 1
767 #define AIROPMACON	AIROPAPLIST	+ 1	/* Enable mac  */
768 #define AIROPMACOFF	AIROPMACON	+ 1	/* Disable mac */
769 #define AIROPSTCLR	AIROPMACOFF	+ 1
770 #define AIROPWEPKEY	AIROPSTCLR	+ 1
771 #define AIROPWEPKEYNV	AIROPWEPKEY	+ 1
772 #define AIROPLEAPPWD	AIROPWEPKEYNV	+ 1
773 #define AIROPLEAPUSR	AIROPLEAPPWD	+ 1
774 
775 /*
776  * Another gap of 40 commands before flash codes
777  */
778 
779 #define AIROFLSHRST	AIROPWEPKEYNV	+ 40
780 #define AIROFLSHGCHR	AIROFLSHRST	+ 1
781 #define AIROFLSHSTFL	AIROFLSHGCHR	+ 1
782 #define AIROFLSHPCHR	AIROFLSHSTFL	+ 1
783 #define AIROFLPUTBUF	AIROFLSHPCHR	+ 1
784 #define AIRORESTART	AIROFLPUTBUF	+ 1
785 
786 /*
787  * Struct to enable up to 65535 ioctl's
788  */
789 
790 #define AIROMAGIC	0xa55a
791 
792 typedef struct aironet_ioctl {
793   unsigned short command;	/* What to do */
794   unsigned short len;		/* Len of data */
795   unsigned char *data;		/* d-data */
796 } airo_ioctl;
797 
798 #endif
799