1139749Simp/*-
246495Swpaul * Copyright (c) 1997, 1998, 1999
346495Swpaul *	Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.
446495Swpaul *
546495Swpaul * Redistribution and use in source and binary forms, with or without
646495Swpaul * modification, are permitted provided that the following conditions
746495Swpaul * are met:
846495Swpaul * 1. Redistributions of source code must retain the above copyright
946495Swpaul *    notice, this list of conditions and the following disclaimer.
1046495Swpaul * 2. Redistributions in binary form must reproduce the above copyright
1146495Swpaul *    notice, this list of conditions and the following disclaimer in the
1246495Swpaul *    documentation and/or other materials provided with the distribution.
1346495Swpaul * 3. All advertising materials mentioning features or use of this software
1446495Swpaul *    must display the following acknowledgement:
1546495Swpaul *	This product includes software developed by Bill Paul.
1646495Swpaul * 4. Neither the name of the author nor the names of any co-contributors
1746495Swpaul *    may be used to endorse or promote products derived from this software
1846495Swpaul *    without specific prior written permission.
1946495Swpaul *
2046495Swpaul * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
2146495Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2246495Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2346495Swpaul * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
2446495Swpaul * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2546495Swpaul * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2646495Swpaul * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2746495Swpaul * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2846495Swpaul * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2946495Swpaul * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
3046495Swpaul * THE POSSIBILITY OF SUCH DAMAGE.
3146495Swpaul *
3250477Speter * $FreeBSD: releng/10.3/sys/dev/wi/if_wavelan_ieee.h 192492 2009-05-20 22:28:55Z imp $
3346495Swpaul */
3446495Swpaul
3546495Swpaul#ifndef _IF_WAVELAN_IEEE_H
3646495Swpaul#define _IF_WAVELAN_IEEE_H
3746495Swpaul
3846495Swpaul/*
3946495Swpaul * This header defines a simple command interface to the FreeBSD
4046495Swpaul * WaveLAN/IEEE driver (wi) driver, which is used to set certain
4146495Swpaul * device-specific parameters which can't be easily managed through
4246495Swpaul * ifconfig(8). No, sysctl(2) is not the answer. I said a _simple_
4346495Swpaul * interface, didn't I.
4446495Swpaul */
4546495Swpaul
4646495Swpaul#ifndef SIOCSWAVELAN
4746495Swpaul#define SIOCSWAVELAN	SIOCSIFGENERIC
4846495Swpaul#endif
4946495Swpaul
5046495Swpaul#ifndef SIOCGWAVELAN
5146495Swpaul#define SIOCGWAVELAN	SIOCGIFGENERIC
5246495Swpaul#endif
5346495Swpaul
5446495Swpaul/*
5546495Swpaul * Technically I don't think there's a limit to a record
5646495Swpaul * length. The largest record is the one that contains the CIS
5746495Swpaul * data, which is 240 words long, so 256 should be a safe
5846495Swpaul * value.
5946495Swpaul */
6046495Swpaul#define WI_MAX_DATALEN	512
61192492Simp
62192492Simp#if 0
6346495Swpaulstruct wi_req {
6446495Swpaul	u_int16_t	wi_len;
6546495Swpaul	u_int16_t	wi_type;
6646495Swpaul	u_int16_t	wi_val[WI_MAX_DATALEN];
6746495Swpaul};
68192492Simp#endif
6946495Swpaul
7046495Swpaul/*
7146495Swpaul * Private LTV records (interpreted only by the driver). This is
7246495Swpaul * a minor kludge to allow reading the interface statistics from
7346495Swpaul * the driver.
7446495Swpaul */
7546495Swpaul#define WI_RID_IFACE_STATS	0x0100
7646495Swpaul#define WI_RID_MGMT_XMIT	0x0200
7753702Swpaul#define WI_RID_ZERO_CACHE	0x0300
7853702Swpaul#define WI_RID_READ_CACHE	0x0400
79101903Simp#define WI_RID_FWDOWNLOAD	0x0500
80105076Simp#define WI_RID_MONITOR_MODE	0x0600
81105076Simp#define WI_RID_MIF		0x0700
82109323Ssam#define	WI_RID_SCAN_APS		0x0800
83109323Ssam#define	WI_RID_READ_APS		0x0900
8446495Swpaul
8546495Swpaulstruct wi_80211_hdr {
8646495Swpaul	u_int16_t		frame_ctl;
8746495Swpaul	u_int16_t		dur_id;
8846495Swpaul	u_int8_t		addr1[6];
8946495Swpaul	u_int8_t		addr2[6];
9046495Swpaul	u_int8_t		addr3[6];
9146495Swpaul	u_int16_t		seq_ctl;
9246495Swpaul	u_int8_t		addr4[6];
9346495Swpaul};
9446495Swpaul
9546495Swpaul#define WI_FCTL_VERS		0x0002
9646495Swpaul#define WI_FCTL_FTYPE		0x000C
9746495Swpaul#define WI_FCTL_STYPE		0x00F0
9846495Swpaul#define WI_FCTL_TODS		0x0100
9946495Swpaul#define WI_FCTL_FROMDS		0x0200
10046495Swpaul#define WI_FCTL_MOREFRAGS	0x0400
10146495Swpaul#define WI_FCTL_RETRY		0x0800
10246495Swpaul#define WI_FCTL_PM		0x1000
10346495Swpaul#define WI_FCTL_MOREDATA	0x2000
10446495Swpaul#define WI_FCTL_WEP		0x4000
10546495Swpaul#define WI_FCTL_ORDER		0x8000
10646495Swpaul
10746495Swpaul#define WI_FTYPE_MGMT		0x0000
10846495Swpaul#define WI_FTYPE_CTL		0x0004
10946495Swpaul#define WI_FTYPE_DATA		0x0008
11046495Swpaul
11146495Swpaul#define WI_STYPE_MGMT_ASREQ	0x0000	/* association request */
11246495Swpaul#define WI_STYPE_MGMT_ASRESP	0x0010	/* association response */
11346495Swpaul#define WI_STYPE_MGMT_REASREQ	0x0020	/* reassociation request */
11446495Swpaul#define WI_STYPE_MGMT_REASRESP	0x0030	/* reassociation response */
11546495Swpaul#define WI_STYPE_MGMT_PROBEREQ	0x0040	/* probe request */
11646495Swpaul#define WI_STYPE_MGMT_PROBERESP	0x0050	/* probe response */
11746495Swpaul#define WI_STYPE_MGMT_BEACON	0x0080	/* beacon */
11846495Swpaul#define WI_STYPE_MGMT_ATIM	0x0090	/* announcement traffic ind msg */
11946495Swpaul#define WI_STYPE_MGMT_DISAS	0x00A0	/* disassociation */
12046495Swpaul#define WI_STYPE_MGMT_AUTH	0x00B0	/* authentication */
12146495Swpaul#define WI_STYPE_MGMT_DEAUTH	0x00C0	/* deauthentication */
12246495Swpaul
12394405Simp#define WI_STYPE_CTL_PSPOLL     0x00A0
12494405Simp#define WI_STYPE_CTL_RTS        0x00B0
12594405Simp#define WI_STYPE_CTL_CTS        0x00C0
12694405Simp#define WI_STYPE_CTL_ACK        0x00D0
12794405Simp#define WI_STYPE_CTL_CFEND      0x00E0
12894405Simp#define WI_STYPE_CTL_CFENDACK   0x00F0
12994405Simp
13046495Swpaulstruct wi_mgmt_hdr {
13146495Swpaul	u_int16_t		frame_ctl;
13246495Swpaul	u_int16_t		duration;
13346495Swpaul	u_int8_t		dst_addr[6];
13446495Swpaul	u_int8_t		src_addr[6];
13546495Swpaul	u_int8_t		bssid[6];
13646495Swpaul	u_int16_t		seq_ctl;
13746495Swpaul};
13846495Swpaul
13953702Swpaul/*
14053702Swpaul * Lucent/wavelan IEEE signal strength cache
14153702Swpaul *
14253702Swpaul * driver keeps cache of last
14353702Swpaul * MAXWICACHE packets to arrive including signal strength info.
14453702Swpaul * daemons may read this via ioctl
14553702Swpaul *
14653702Swpaul * Each entry in the wi_sigcache has a unique macsrc.
14753702Swpaul */
14853702Swpaulstruct wi_sigcache {
14953702Swpaul	char	macsrc[6];	/* unique MAC address for entry */
15053702Swpaul	int	ipsrc;		/* ip address associated with packet */
15153702Swpaul	int	signal;		/* signal strength of the packet */
15253702Swpaul	int	noise;		/* noise value */
15353702Swpaul	int	quality;	/* quality of the packet */
15453702Swpaul};
15553702Swpaul
156101903Simp/*
157101903Simp * Firmware downloading API.  We support downloading into RAM and into
158101903Simp * flash.  We copy the entire .hex file for both the primary and secondary
159101903Simp * firmware into the kernel, which is minorly gross, but matches the
160101903Simp * format of the compiled in firmware.
161101903Simp */
162101903Simpstruct wi_fwdownload {
163101903Simp	int	type;		/* What type of download. */
164101903Simp#define WI_FW_RAM	1
165101903Simp#define WI_FW_FLASH	2
166101903Simp	size_t	pri_len;	/* Primary firmware length */
167101903Simp	size_t	sec_len;	/* Secondary firmware length */
168101903Simp	caddr_t	pri_data;	/* Pointer (user) to primary data */
169101903Simp	caddr_t sec_data;	/* Pointer (user) to secondary data */
170101903Simp};
171101903Simp
17246495Swpaulstruct wi_counters {
17346495Swpaul	u_int32_t		wi_tx_unicast_frames;
17446495Swpaul	u_int32_t		wi_tx_multicast_frames;
17546495Swpaul	u_int32_t		wi_tx_fragments;
17646495Swpaul	u_int32_t		wi_tx_unicast_octets;
17746495Swpaul	u_int32_t		wi_tx_multicast_octets;
17846495Swpaul	u_int32_t		wi_tx_deferred_xmits;
17946495Swpaul	u_int32_t		wi_tx_single_retries;
18046495Swpaul	u_int32_t		wi_tx_multi_retries;
18146495Swpaul	u_int32_t		wi_tx_retry_limit;
18246495Swpaul	u_int32_t		wi_tx_discards;
18346495Swpaul	u_int32_t		wi_rx_unicast_frames;
18446495Swpaul	u_int32_t		wi_rx_multicast_frames;
18546495Swpaul	u_int32_t		wi_rx_fragments;
18646495Swpaul	u_int32_t		wi_rx_unicast_octets;
18746495Swpaul	u_int32_t		wi_rx_multicast_octets;
18846495Swpaul	u_int32_t		wi_rx_fcs_errors;
18946495Swpaul	u_int32_t		wi_rx_discards_nobuf;
19046495Swpaul	u_int32_t		wi_tx_discards_wrong_sa;
19146495Swpaul	u_int32_t		wi_rx_WEP_cant_decrypt;
19246495Swpaul	u_int32_t		wi_rx_msg_in_msg_frags;
19346495Swpaul	u_int32_t		wi_rx_msg_in_bad_msg_frags;
19446495Swpaul};
19546495Swpaul
19646495Swpaul/*
19746495Swpaul * Network parameters, static configuration entities.
19846495Swpaul */
19946495Swpaul#define WI_RID_PORTTYPE		0xFC00 /* Connection control characteristics */
20046495Swpaul#define WI_RID_MAC_NODE		0xFC01 /* MAC address of this station */
20146495Swpaul#define WI_RID_DESIRED_SSID	0xFC02 /* Service Set ID for connection */
20246495Swpaul#define WI_RID_OWN_CHNL		0xFC03 /* Comm channel for BSS creation */
20346495Swpaul#define WI_RID_OWN_SSID		0xFC04 /* IBSS creation ID */
20446495Swpaul#define WI_RID_OWN_ATIM_WIN	0xFC05 /* ATIM window time for IBSS creation */
20546495Swpaul#define WI_RID_SYSTEM_SCALE	0xFC06 /* scale that specifies AP density */
20646495Swpaul#define WI_RID_MAX_DATALEN	0xFC07 /* Max len of MAC frame body data */
20746495Swpaul#define WI_RID_MAC_WDS		0xFC08 /* MAC addr of corresponding WDS node */
20846495Swpaul#define WI_RID_PM_ENABLED	0xFC09 /* ESS power management enable */
20946495Swpaul#define WI_RID_PM_EPS		0xFC0A /* PM EPS/PS mode */
21046495Swpaul#define WI_RID_MCAST_RX		0xFC0B /* ESS PM mcast reception */
21146495Swpaul#define WI_RID_MAX_SLEEP	0xFC0C /* max sleep time for ESS PM */
21246495Swpaul#define WI_RID_HOLDOVER		0xFC0D /* holdover time for ESS PM */
21346495Swpaul#define WI_RID_NODENAME		0xFC0E /* ID name of this node for diag */
21446495Swpaul#define WI_RID_DTIM_PERIOD	0xFC10 /* beacon interval between DTIMs */
21546495Swpaul#define WI_RID_WDS_ADDR1	0xFC11 /* port 1 MAC of WDS link node */
21646495Swpaul#define WI_RID_WDS_ADDR2	0xFC12 /* port 1 MAC of WDS link node */
21746495Swpaul#define WI_RID_WDS_ADDR3	0xFC13 /* port 1 MAC of WDS link node */
21846495Swpaul#define WI_RID_WDS_ADDR4	0xFC14 /* port 1 MAC of WDS link node */
21946495Swpaul#define WI_RID_WDS_ADDR5	0xFC15 /* port 1 MAC of WDS link node */
22046495Swpaul#define WI_RID_WDS_ADDR6	0xFC16 /* port 1 MAC of WDS link node */
22146495Swpaul#define WI_RID_MCAST_PM_BUF	0xFC17 /* PM buffering of mcast */
22256965Swpaul#define WI_RID_ENCRYPTION	0xFC20 /* enable/disable WEP */
22356965Swpaul#define WI_RID_AUTHTYPE		0xFC21 /* specify authentication type */
22493756Simp#define WI_RID_P2_TX_CRYPT_KEY	0xFC23
22593756Simp#define WI_RID_P2_CRYPT_KEY0	0xFC24
22693756Simp#define WI_RID_P2_CRYPT_KEY1	0xFC25
22793756Simp#define WI_RID_MICROWAVE_OVEN	0xFC25
22893756Simp#define WI_RID_P2_CRYPT_KEY2	0xFC26
22993756Simp#define WI_RID_P2_CRYPT_KEY3	0xFC27
23093756Simp#define WI_RID_P2_ENCRYPTION	0xFC28
231160991Ssam#define WI_RID_ALT_RETRY_CNT	0xFC32
23293756Simp#define	 PRIVACY_INVOKED	0x01
23393756Simp#define	 EXCLUDE_UNENCRYPTED	0x02
23493756Simp#define	 HOST_ENCRYPT		0x10
23593756Simp#define	 IV_EVERY_FRAME		0x00	/* IV = Initialization Vector */
23693756Simp#define	 IV_EVERY10_FRAME	0x20	/* every 10 frame IV reuse */
23793756Simp#define	 IV_EVERY50_FRAME	0x40	/* every 50 frame IV reuse */
23893756Simp#define	 IV_EVERY100_FRAME	0x60	/* every 100 frame IV reuse */
23993756Simp#define	 HOST_DECRYPT		0x80
24093756Simp#define WI_RID_WEP_MAPTABLE	0xFC29
24194405Simp#define WI_RID_CNFAUTHMODE	0xFC2A
24293756Simp#define WI_RID_ROAMING_MODE	0xFC2D
243109323Ssam#define WI_RID_OWN_BEACON_INT	0xFC33 /* beacon xmit time for BSS creation */
244178354Ssam#define	WI_RID_ENH_SECURITY	0xFC43 /* enhanced security (AP mode) */
24598719Simp#define WI_RID_CNF_DBM_ADJUST	0xFC46
246109323Ssam#define WI_RID_DBM_ADJUST	0xFC46 /* RSSI - WI_RID_DBM_ADJUST ~ dBm */
247178354Ssam#define	WI_RID_WPA_DATA		0xFC48 /* WPA IE */
24893756Simp#define WI_RID_BASIC_RATE	0xFCB3
24993756Simp#define WI_RID_SUPPORT_RATE	0xFCB4
250178354Ssam#define	WI_RID_WPA_HANDLING	0xFCBB /* WPA handling procedures */
25146495Swpaul
25246495Swpaul/*
25346495Swpaul * Network parameters, dynamic configuration entities
25446495Swpaul */
25546495Swpaul#define WI_RID_MCAST_LIST	0xFC80 /* list of multicast addrs */
25646495Swpaul#define WI_RID_CREATE_IBSS	0xFC81 /* create IBSS */
25746495Swpaul#define WI_RID_FRAG_THRESH	0xFC82 /* frag len, unicast msg xmit */
25846495Swpaul#define WI_RID_RTS_THRESH	0xFC83 /* frame len for RTS/CTS handshake */
25994405Simp#define WI_RID_TX_RATE		0xFC84 /* data rate for message xmit
26094405Simp 					* 0 == Fixed 1mbps
26194405Simp 					* 1 == Fixed 2mbps
26294405Simp 					* 2 == auto fallback
26394405Simp					*/
26446495Swpaul#define WI_RID_PROMISC		0xFC85 /* enable promisc mode */
26546495Swpaul#define WI_RID_FRAG_THRESH0	0xFC90
26646495Swpaul#define WI_RID_FRAG_THRESH1	0xFC91
26746495Swpaul#define WI_RID_FRAG_THRESH2	0xFC92
26846495Swpaul#define WI_RID_FRAG_THRESH3	0xFC93
26946495Swpaul#define WI_RID_FRAG_THRESH4	0xFC94
27046495Swpaul#define WI_RID_FRAG_THRESH5	0xFC95
27146495Swpaul#define WI_RID_FRAG_THRESH6	0xFC96
27246495Swpaul#define WI_RID_RTS_THRESH0	0xFC97
27346495Swpaul#define WI_RID_RTS_THRESH1	0xFC98
27446495Swpaul#define WI_RID_RTS_THRESH2	0xFC99
27546495Swpaul#define WI_RID_RTS_THRESH3	0xFC9A
27646495Swpaul#define WI_RID_RTS_THRESH4	0xFC9B
27746495Swpaul#define WI_RID_RTS_THRESH5	0xFC9C
27846495Swpaul#define WI_RID_RTS_THRESH6	0xFC9D
27946495Swpaul#define WI_RID_TX_RATE0		0xFC9E
28046495Swpaul#define WI_RID_TX_RATE1		0xFC9F
28146495Swpaul#define WI_RID_TX_RATE2		0xFCA0
28246495Swpaul#define WI_RID_TX_RATE3		0xFCA1
28346495Swpaul#define WI_RID_TX_RATE4		0xFCA2
28446495Swpaul#define WI_RID_TX_RATE5		0xFCA3
28546495Swpaul#define WI_RID_TX_RATE6		0xFCA4
28656965Swpaul#define WI_RID_DEFLT_CRYPT_KEYS	0xFCB0
28756965Swpaul#define WI_RID_TX_CRYPT_KEY	0xFCB1
28846495Swpaul#define WI_RID_TICK_TIME	0xFCE0
28946495Swpaul
29056965Swpaulstruct wi_key {
29156965Swpaul	u_int16_t		wi_keylen;
29256965Swpaul	u_int8_t		wi_keydat[14];
29356965Swpaul};
29456965Swpaul
295109323Ssam#define WI_NLTV_KEYS 4
29656965Swpaulstruct wi_ltv_keys {
29756965Swpaul	u_int16_t		wi_len;
29856965Swpaul	u_int16_t		wi_type;
299109323Ssam	struct wi_key		wi_keys[WI_NLTV_KEYS];
30056965Swpaul};
30156965Swpaul
30246495Swpaul/*
30346495Swpaul * NIC information
30446495Swpaul */
30593564Simp#define WI_RID_DNLD_BUF		0xFD01
30693564Simp#define WI_RID_MEMSZ		0xFD02 /* memory size info (XXX Lucent) */
307101354Simp					/* Looks like on lucnet pri firm too */
30893564Simp#define	WI_RID_PRI_IDENTITY	0xFD02 /* primary funcs firmware ident (PRISM2) */
30946495Swpaul#define WI_RID_PRI_SUP_RANGE	0xFD03 /* primary supplier compatibility */
31046495Swpaul#define WI_RID_CIF_ACT_RANGE	0xFD04 /* controller sup. compatibility */
31146495Swpaul#define WI_RID_SERIALNO		0xFD0A /* card serial number */
31246495Swpaul#define WI_RID_CARD_ID		0xFD0B /* card identification */
31346495Swpaul#define WI_RID_MFI_SUP_RANGE	0xFD0C /* modem supplier compatibility */
31446495Swpaul#define WI_RID_CFI_SUP_RANGE	0xFD0D /* controller sup. compatibility */
31546495Swpaul#define WI_RID_CHANNEL_LIST	0xFD10 /* allowd comm. frequencies. */
31646495Swpaul#define WI_RID_REG_DOMAINS	0xFD11 /* list of intendted regulatory doms */
31746495Swpaul#define WI_RID_TEMP_TYPE	0xFD12 /* hw temp range code */
31846495Swpaul#define WI_RID_CIS		0xFD13 /* PC card info struct */
31992457Simp#define WI_RID_STA_IDENTITY	0xFD20 /* station funcs firmware ident */
32046495Swpaul#define WI_RID_STA_SUP_RANGE	0xFD21 /* station supplier compat */
32146495Swpaul#define WI_RID_MFI_ACT_RANGE	0xFD22
32293564Simp#define WI_RID_SYMBOL_IDENTITY	0xFD24
32346495Swpaul#define WI_RID_CFI_ACT_RANGE	0xFD33
32493564Simp#define WI_RID_COMMQUAL		0xFD43
32593564Simp#define WI_RID_SCALETHRESH	0xFD46
32693564Simp#define WI_RID_PCF		0xFD87
32746495Swpaul
32846495Swpaul/*
32946495Swpaul * MAC information
33046495Swpaul */
33146495Swpaul#define WI_RID_PORT_STAT	0xFD40 /* actual MAC port con control stat */
33246495Swpaul#define WI_RID_CURRENT_SSID	0xFD41 /* ID of actually connected SS */
33346495Swpaul#define WI_RID_CURRENT_BSSID	0xFD42 /* ID of actually connected BSS */
33446495Swpaul#define WI_RID_COMMS_QUALITY	0xFD43 /* quality of BSS connection */
33546495Swpaul#define WI_RID_CUR_TX_RATE	0xFD44 /* current TX rate */
336109323Ssam#define WI_RID_CUR_BEACON_INT	0xFD45 /* current beacon interval */
33746495Swpaul#define WI_RID_CUR_SCALE_THRESH	0xFD46 /* actual system scane thresh setting */
33846495Swpaul#define WI_RID_PROT_RESP_TIME	0xFD47 /* time to wait for resp to req msg */
33946495Swpaul#define WI_RID_SHORT_RTR_LIM	0xFD48 /* max tx attempts for short frames */
34046495Swpaul#define WI_RID_LONG_RTS_LIM	0xFD49 /* max tx attempts for long frames */
34146495Swpaul#define WI_RID_MAX_TX_LIFE	0xFD4A /* max tx frame handling duration */
34246495Swpaul#define WI_RID_MAX_RX_LIFE	0xFD4B /* max rx frame handling duration */
34346495Swpaul#define WI_RID_CF_POLL		0xFD4C /* contention free pollable ind */
34446495Swpaul#define WI_RID_AUTH_ALGS	0xFD4D /* auth algorithms available */
34546495Swpaul#define WI_RID_AUTH_TYPE	0xFD4E /* availanle auth types */
34646495Swpaul#define WI_RID_WEP_AVAIL	0xFD4F /* WEP privacy option available */
347101354Simp#define WI_RID_DBM_COMMS_QUAL	0xFD51 /* CommQuality normalized to dBm */
34846495Swpaul#define WI_RID_CUR_TX_RATE1	0xFD80
34946495Swpaul#define WI_RID_CUR_TX_RATE2	0xFD81
35046495Swpaul#define WI_RID_CUR_TX_RATE3	0xFD82
35146495Swpaul#define WI_RID_CUR_TX_RATE4	0xFD83
35246495Swpaul#define WI_RID_CUR_TX_RATE5	0xFD84
35346495Swpaul#define WI_RID_CUR_TX_RATE6	0xFD85
35446495Swpaul#define WI_RID_OWN_MAC		0xFD86 /* unique local MAC addr */
35546495Swpaul#define WI_RID_PCI_INFO		0xFD87 /* point coordination func cap */
35646495Swpaul
35746495Swpaul/*
358109323Ssam * Scan Information
359109323Ssam */
360109323Ssam#define	WI_RID_BCAST_SCAN_REQ	0xFCAB /* Broadcast Scan request (Symbol) */
361109323Ssam#define	 BSCAN_5SEC		0x01
362109323Ssam#define	 BSCAN_ONETIME		0x02
363109323Ssam#define	 BSCAN_PASSIVE		0x40
364109323Ssam#define	 BSCAN_BCAST		0x80
365109323Ssam#define WI_RID_SCAN_REQ		0xFCE1 /* Scan request (STA only) */
366109323Ssam#define WI_RID_JOIN_REQ		0xFCE2 /* Join request (STA only) */
367109323Ssam#define	WI_RID_AUTH_STATION	0xFCE3 /* Authenticates Station (AP) */
368109323Ssam#define	WI_RID_CHANNEL_REQ	0xFCE4 /* Channel Information Request (AP) */
369109323Ssam#define WI_RID_SCAN_RESULTS	0xFD88 /* Scan Results Table */
370109323Ssam
371109323Ssamstruct wi_apinfo {
372109323Ssam	int			scanreason;	/* ScanReason */
373109323Ssam	char			bssid[6];	/* BSSID (mac address) */
374109323Ssam	int			channel;	/* Channel */
375109323Ssam	int			signal;		/* Signal level */
376109323Ssam	int			noise;		/* Average Noise Level*/
377109323Ssam	int			quality;	/* Quality */
378109323Ssam	int			namelen;	/* Length of SSID string */
379109323Ssam	char			name[32];	/* SSID string */
380109323Ssam	int			capinfo;	/* Capability info. */
381109323Ssam	int			interval;	/* BSS Beacon Interval */
382109323Ssam	int			rate;		/* Data Rate */
383109323Ssam};
384109323Ssam
385109323Ssam/*
38646495Swpaul * Modem information
38746495Swpaul */
38846495Swpaul#define WI_RID_PHY_TYPE		0xFDC0 /* phys layer type indication */
38946495Swpaul#define WI_RID_CURRENT_CHAN	0xFDC1 /* current frequency */
39046495Swpaul#define WI_RID_PWR_STATE	0xFDC2 /* pwr consumption status */
39146495Swpaul#define WI_RID_CCA_MODE		0xFDC3 /* clear chan assess mode indication */
39246495Swpaul#define WI_RID_CCA_TIME		0xFDC4 /* clear chan assess time */
39346495Swpaul#define WI_RID_MAC_PROC_DELAY	0xFDC5 /* MAC processing delay time */
39446495Swpaul#define WI_RID_DATA_RATES	0xFDC6 /* supported data rates */
39546495Swpaul
39693359Simp/*
39793359Simp * bsd-airtools v0.2 - source-mods v0.2 [common.h]
39893359Simp * by h1kari - (c) Dachb0den Labs 2001
39993359Simp */
40046495Swpaul
40193359Simp/*
40293359Simp * Copyright (c) 2001 Dachb0den Labs.
40393359Simp *      David Hulton <h1kari@dachb0den.com>.  All rights reserved.
40493359Simp *
40593359Simp * Redistribution and use in source and binary forms, with or without
40693359Simp * modification, are permitted provided that the following conditions
40793359Simp * are met:
40893359Simp * 1. Redistributions of source code must retain the above copyright
40993359Simp *    notice, this list of conditions and the following disclaimer.
41093359Simp * 2. Redistributions in binary form must reproduce the above copyright
41193359Simp *    notice, this list of conditions and the following disclaimer in the
41293359Simp *    documentation and/or other materials provided with the distribution.
41393359Simp * 3. All advertising materials mentioning features or use of this software
41493359Simp *    must display the following acknowledgement:
41593359Simp *      This product includes software developed by David Hulton.
41693359Simp * 4. Neither the name of the author nor the names of any co-contributors
41793359Simp *    may be used to endorse or promote products derived from this software
41893359Simp *    without specific prior written permission.
41993359Simp *
42093359Simp * THIS SOFTWARE IS PROVIDED BY David Hulton AND CONTRIBUTORS ``AS IS'' AND
42193359Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42293359Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
42393359Simp * ARE DISCLAIMED.  IN NO EVENT SHALL David Hulton OR THE VOICES IN HIS HEAD
42493359Simp * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42593359Simp * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
42693359Simp * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
42793359Simp * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
42893359Simp * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
42993359Simp * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
43093359Simp * THE POSSIBILITY OF SUCH DAMAGE.
43193359Simp */
43293359Simp
43393359Simp/*
43493359Simp * standard hermes recieve frame used by wavelan/prism2 cards
43593359Simp */
43693359Simpstruct wi_rx_frame {
43793359Simp	/*
43893359Simp	 * hermes prefix header. supplies information on the current status of
43993359Simp	 * the network and various other statistics gathered from the
44093359Simp	 * management/control frames as used internally.
44193359Simp	 */
44293359Simp	u_int16_t	wi_status;
44393359Simp	u_int16_t	wi_ts0;
44493359Simp	u_int16_t	wi_ts1;
44593359Simp	u_int8_t	wi_silence;
44693359Simp	u_int8_t	wi_signal;
44793359Simp	u_int8_t	wi_rate;
44893359Simp	u_int8_t	wi_rx_flow;
44993359Simp	u_int16_t	wi_rsvd0;
45093359Simp	u_int16_t	wi_rsvd1;
45193359Simp	/*
45293359Simp	 * standard 80211 frame header. all packets have to use this header as
45393359Simp	 * per the AN9900 from intersil, even management/control. for
45493359Simp	 * management packets, they just threw the header into the data field,
45593359Simp	 * but for control packets the headers are lost in translation and
45693359Simp	 * therefore not all control packet info can be displayed.
45793359Simp	 */
45893359Simp	u_int16_t	wi_frame_ctl;
45993359Simp	u_int16_t	wi_id;
46093359Simp	u_int8_t	wi_addr1[6];
46193359Simp	u_int8_t	wi_addr2[6];
46293359Simp	u_int8_t	wi_addr3[6];
46393359Simp	u_int16_t	wi_seq_ctl;
46493359Simp	u_int8_t	wi_addr4[6];
46593359Simp	u_int16_t	wi_dat_len;
46693359Simp	/*
46793359Simp	 * another wierdity with the drivers. they append a 802.3 header which
46893359Simp	 * is somewhat redundant, since all the same data is provided in the
46993359Simp	 * 802.11 header.
47093359Simp	 */
47193359Simp	u_int8_t	wi_dst_addr[6];
47293359Simp	u_int8_t	wi_src_addr[6];
47393359Simp	u_int16_t	wi_len;
47493359Simp};
475160991Ssam#define WI_DATA_HDRLEN		0x3C
476116898Ssam#define WI_MGMT_HDRLEN		0x3C
477116898Ssam#define WI_CTL_HDRLEN		0x3C
47893359Simp
47993359Simp
48093359Simp/*
48193359Simp * all data packets have a snap (sub-network access protocol) header that
48293359Simp * isn't entirely definied, but added for ethernet compatibility.
48393359Simp */
48493359Simpstruct wi_snap_frame {
48593359Simp	u_int16_t	wi_dat[3];
48693359Simp	u_int16_t	wi_type;
48793359Simp};
48893359Simp
48993359Simp
49093359Simp/*
49193359Simp * management frame headers
49293359Simp * note: all management frames consist of a static header and variable length
49393359Simp * fields.
49493359Simp */
49593359Simp
49693359Simp/*
49793359Simp * variable length field structure
49893359Simp */
49993359Simpstruct wi_mgmt_var_hdr {
50093359Simp	u_int8_t	wi_code;
50193359Simp	u_int8_t	wi_len;
50293359Simp	u_int8_t	wi_data[256];
50393359Simp};
50493359Simp
50593359Simp/*
50693359Simp * management beacon frame prefix
50793359Simp */
50893359Simpstruct wi_mgmt_beacon_hdr {
50993359Simp	u_int32_t	wi_ts0;
51093359Simp	u_int32_t	wi_ts1;
51193359Simp	u_int16_t	wi_interval;
51293359Simp	u_int16_t	wi_capinfo;
51393359Simp};
51493359Simp
51593359Simp/*
51693359Simp * ibss announcement traffic indication message (atim) frame
51793359Simp * note: no parameters
51893359Simp */
51993359Simp
52093359Simp/*
52193359Simp * management disassociation frame
52293359Simp */
52393359Simpstruct wi_mgmt_disas_hdr {
52493359Simp	u_int16_t	wi_reason;
52593359Simp};
52693359Simp
52793359Simp/*
52893359Simp * management association request frame prefix
52993359Simp */
53093359Simpstruct wi_mgmt_asreq_hdr {
53193359Simp	u_int16_t	wi_capinfo;
53293359Simp	u_int16_t	wi_interval;
53393359Simp};
53493359Simp
53593359Simp/*
53693359Simp * management association response frame prefix
53793359Simp */
53893359Simpstruct wi_mgmt_asresp_hdr {
53993359Simp	u_int16_t	wi_capinfo;
54093359Simp	u_int16_t	wi_status;
54193359Simp	u_int16_t	wi_aid;
54293359Simp};
54393359Simp
54493359Simp/*
54593359Simp * management reassociation request frame prefix
54693359Simp */
54793359Simpstruct wi_mgmt_reasreq_hdr {
54893359Simp	u_int16_t	wi_capinfo;
54993359Simp	u_int16_t	wi_interval;
55093359Simp	u_int8_t	wi_currap[6];
55193359Simp};
55293359Simp
55393359Simp/*
55493359Simp * management reassociation response frame prefix
55593359Simp */
55693359Simpstruct wi_mgmt_reasresp_hdr {
55793359Simp	u_int16_t	wi_capinfo;
55893359Simp	u_int16_t	wi_status;
55993359Simp	u_int16_t	wi_aid;
56093359Simp};
56193359Simp
56293359Simp/*
56393359Simp * management probe request frame prefix
56493359Simp * note: no static parameters, only variable length
56593359Simp */
56693359Simp
56793359Simp/*
56893359Simp * management probe response frame prefix
56993359Simp */
57093359Simpstruct wi_mgmt_proberesp_hdr {
57193359Simp	u_int32_t	wi_ts0;
57293359Simp	u_int32_t	wi_ts1;
57393359Simp	u_int16_t	wi_interval;
57493359Simp	u_int16_t	wi_capinfo;
57593359Simp};
57693359Simp
57793359Simp/*
57893359Simp * management authentication frame prefix
57993359Simp */
58093359Simpstruct wi_mgmt_auth_hdr {
58193359Simp	u_int16_t	wi_algo;
58293359Simp	u_int16_t	wi_seq;
58393359Simp	u_int16_t	wi_status;
58493359Simp};
58593359Simp
58693359Simp/*
58793359Simp * management deauthentication frame
58893359Simp */
58993359Simpstruct wi_mgmt_deauth_hdr {
59093359Simp	u_int16_t	wi_reason;
59193359Simp};
59293359Simp
59393359Simp
59493359Simp/*
59593359Simp * rid configuration register definitions
59693359Simp */
59793359Simp#define WI_RID_SCAN_REQ		0xFCE1 /* scan request information */
59893359Simp#define WI_RID_SCAN_RES		0xFD88 /* scan result information */
59993359Simp
60093359Simp#define WI_RID_PROCFRAME	0x3137 /* Return full frame information */
60193359Simp#define WI_RID_PRISM2		0x3138 /* tell if we're a prism2 card or not */
60293359Simp
60393359Simp
60493359Simp/*
60593359Simp * 802.11 definitions
60693359Simp */
60793359Simp#define WI_STAT_BADCRC		0x0001
60893359Simp#define WI_STAT_UNDECRYPTABLE	0x0002
60993359Simp#define WI_STAT_ERRSTAT		0x0003
61093359Simp#define WI_STAT_MAC_PORT	0x0700
61193359Simp#define WI_STAT_1042		0x2000
61293359Simp#define WI_STAT_TUNNEL		0x4000
61393359Simp#define WI_STAT_WMP_MSG		0x6000
61493359Simp#define WI_RXSTAT_MSG_TYPE	0xE000
61593359Simp
61693359Simp#define WI_FCTL_OPT_MASK	0xFF00
61793359Simp#define WI_AID_SET		0xC000
61893359Simp#define WI_AID_MASK		0x3FFF
61993359Simp#define WI_SCTL_FRAGNUM_MASK	0x000F
62093359Simp#define WI_SCTL_SEQNUM_MASK	0xFFF0
62193359Simp
62293359Simp#define WI_STAT_UNSPEC_FAIL	1
62393359Simp#define WI_STAT_CAPINFO_FAIL	10
62493359Simp#define WI_STAT_REAS_DENY	11
62593359Simp#define WI_STAT_ASSOC_DENY	12
62693359Simp#define WI_STAT_ALGO_FAIL	13
62793359Simp#define WI_STAT_SEQ_FAIL	14
62893359Simp#define WI_STAT_CHAL_FAIL	15
62993359Simp#define WI_STAT_TOUT_FAIL	16
63093359Simp#define WI_STAT_OVERL_DENY	17
63193359Simp#define WI_STAT_RATE_DENY	18
63293359Simp
63393359Simp#define WI_FTYPE_MGMT		0x0000
63493359Simp#define WI_FTYPE_CTL		0x0004
63593359Simp#define WI_FTYPE_DATA		0x0008
63693359Simp
63793359Simp#define WI_FCTL_VERS		0x0002
63893359Simp#define WI_FCTL_FTYPE		0x000C
63993359Simp#define WI_FCTL_STYPE		0x00F0
64093359Simp#define WI_FCTL_TODS		0x0100
64193359Simp#define WI_FCTL_FROMDS		0x0200
64293359Simp#define WI_FCTL_MOREFRAGS	0x0400
64393359Simp#define WI_FCTL_RETRY		0x0800
64493359Simp#define WI_FCTL_PM		0x1000
64593359Simp#define WI_FCTL_MOREDATA	0x2000
64693359Simp#define WI_FCTL_WEP		0x4000
64793359Simp#define WI_FCTL_ORDER		0x8000
64893359Simp
64993359Simp#define WI_FCS_LEN		0x4 /* checksum length */
65093359Simp
65193359Simp
65293359Simp/*
65393359Simp * management definitions
65493359Simp */
65593359Simp#define WI_STYPE_MGMT_ASREQ	0x0000
65693359Simp#define WI_STYPE_MGMT_ASRESP	0x0010
65793359Simp#define WI_STYPE_MGMT_REASREQ	0x0020
65893359Simp#define WI_STYPE_MGMT_REASRESP	0x0030
65993359Simp#define WI_STYPE_MGMT_PROBEREQ	0x0040
66093359Simp#define WI_STYPE_MGMT_PROBERESP	0x0050
66193359Simp#define WI_STYPE_MGMT_BEACON	0x0080
66293359Simp#define WI_STYPE_MGMT_ATIM	0x0090
66393359Simp#define WI_STYPE_MGMT_DISAS	0x00A0
66493359Simp#define WI_STYPE_MGMT_AUTH	0x00B0
66593359Simp#define WI_STYPE_MGMT_DEAUTH	0x00C0
66693359Simp
66793359Simp#define WI_CAPINFO_ESS		0x01
66893359Simp#define WI_CAPINFO_IBSS		0x02
66993359Simp#define WI_CAPINFO_CFPOLL	0x04
67093359Simp#define WI_CAPINFO_CFPOLLREQ	0x08
67193359Simp#define WI_CAPINFO_PRIV		0x10
67293359Simp
67393359Simp#define WI_REASON_UNSPEC	1
67493359Simp#define WI_REASON_AUTH_INVALID	2
67593359Simp#define WI_REASON_DEAUTH_LEAVE	3
67693359Simp#define WI_REASON_DISAS_INACT	4
67793359Simp#define WI_REASON_DISAS_OVERL	5
67893359Simp#define WI_REASON_CLASS2	6
67993359Simp#define WI_REASON_CLASS3	7
68093359Simp#define WI_REASON_DISAS_LEAVE	8
68193359Simp#define WI_REASON_NOAUTH	9
68293359Simp
68393359Simp#define WI_VAR_SSID		0
68493359Simp#define WI_VAR_SRATES		1
68593359Simp#define WI_VAR_FH		2
68693359Simp#define WI_VAR_DS		3
68793359Simp#define WI_VAR_CF		4
68893359Simp#define WI_VAR_TIM		5
68993359Simp#define WI_VAR_IBSS		6
69093359Simp#define WI_VAR_CHAL		16
69193359Simp
69293359Simp#define WI_VAR_SRATES_MASK	0x7F
69393359Simp
69493359Simp
69593359Simp/*
69693359Simp * control definitions
69793359Simp */
69893359Simp#define WI_STYPE_CTL_PSPOLL	0x00A0
69993359Simp#define WI_STYPE_CTL_RTS	0x00B0
70093359Simp#define WI_STYPE_CTL_CTS	0x00C0
70193359Simp#define WI_STYPE_CTL_ACK	0x00D0
70293359Simp#define WI_STYPE_CTL_CFEND	0x00E0
70393359Simp#define WI_STYPE_CTL_CFENDCFACK	0x00F0
70493359Simp
70593359Simp
70693359Simp/*
70793359Simp * ap scanning structures
70893359Simp */
70993359Simpstruct wi_scan_res {
71093359Simp	u_int16_t	wi_chan;
71193359Simp	u_int16_t	wi_noise;
71293359Simp	u_int16_t	wi_signal;
71393359Simp	u_int8_t	wi_bssid[6];
71493359Simp	u_int16_t	wi_interval;
71593359Simp	u_int16_t	wi_capinfo;
71693359Simp	u_int16_t	wi_ssid_len;
71793359Simp	u_int8_t	wi_ssid[32];
71893359Simp	u_int8_t	wi_srates[10];
71993359Simp	u_int8_t	wi_rate;
72093359Simp	u_int8_t	wi_rsvd;
72193359Simp};
72293359Simp#define WI_WAVELAN_RES_SIZE	50
72393359Simp
72493359Simpstruct wi_scan_p2_hdr {
72593359Simp	u_int16_t	wi_rsvd;
72693359Simp	u_int16_t	wi_reason;
72793359Simp};
72893359Simp#define WI_PRISM2_RES_SIZE	62
72993359Simp
73093359Simp
73193359Simp/*
73293359Simp * prism2 debug mode definitions
73393359Simp */
73493359Simp#define SIOCSPRISM2DEBUG	_IOW('i', 137, struct ifreq)
73593359Simp#define SIOCGPRISM2DEBUG	_IOWR('i', 138, struct ifreq)
73693359Simp
73793359Simp#define WI_DEBUG_RESET		0x00
73893359Simp#define WI_DEBUG_INIT		0x01
73993359Simp#define WI_DEBUG_SLEEP		0x02
74093359Simp#define WI_DEBUG_WAKE		0x03
74193359Simp#define WI_DEBUG_CHAN		0x08
74293359Simp#define WI_DEBUG_DELAYSUPP	0x09
74393359Simp#define WI_DEBUG_TXSUPP		0x0A
74493359Simp#define WI_DEBUG_MONITOR	0x0B
74593359Simp#define WI_DEBUG_LEDTEST	0x0C
74693359Simp#define WI_DEBUG_CONTTX		0x0E
74793359Simp#define WI_DEBUG_STOPTEST	0x0F
74893359Simp#define WI_DEBUG_CONTRX		0x10
74993359Simp#define WI_DEBUG_SIGSTATE	0x11
75093359Simp#define WI_DEBUG_CALENABLE	0x13
75193359Simp#define WI_DEBUG_CONFBITS	0x15
75293359Simp
75346495Swpaul#endif
754