1 /*
2  * Copyright (c) 2001 Atsushi Onoe
3  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission.
16  *
17  * Alternatively, this software may be distributed under the terms of the
18  * GNU General Public License ("GPL") version 2 as published by the Free
19  * Software Foundation.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * $FreeBSD: src/sys/net80211/ieee80211_ioctl.h,v 1.5 2004/03/30 22:57:57 sam Exp $
33  * $DragonFly: src/sys/netproto/802_11/ieee80211_ioctl.h,v 1.1 2004/07/26 16:30:17 joerg Exp $
34  */
35 
36 #ifndef _NETPROTO_802_11_IEEE80211_IOCTL_H_
37 #define	_NETPROTO_802_11_IEEE80211_IOCTL_H_
38 
39 /*
40  * IEEE 802.11 ioctls.
41  */
42 
43 struct ieee80211_stats {
44 	uint32_t	is_rx_badversion;	/* rx frame with bad version */
45 	uint32_t	is_rx_tooshort;		/* rx frame too short */
46 	uint32_t	is_rx_wrongbss;		/* rx from wrong bssid */
47 	uint32_t	is_rx_dup;		/* rx discard 'cuz dup */
48 	uint32_t	is_rx_wrongdir;		/* rx w/ wrong direction */
49 	uint32_t	is_rx_mcastecho;	/* rx discard 'cuz mcast echo */
50 	uint32_t	is_rx_notassoc;		/* rx discard 'cuz sta !assoc */
51 	uint32_t	is_rx_nowep;		/* rx w/ wep but wep !config */
52 	uint32_t	is_rx_wepfail;		/* rx wep processing failed */
53 	uint32_t	is_rx_decap;		/* rx decapsulation failed */
54 	uint32_t	is_rx_mgtdiscard;	/* rx discard mgt frames */
55 	uint32_t	is_rx_ctl;		/* rx discard ctrl frames */
56 	uint32_t	is_rx_rstoobig;		/* rx rate set truncated */
57 	uint32_t	is_rx_elem_missing;	/* rx required element missing*/
58 	uint32_t	is_rx_elem_toobig;	/* rx element too big */
59 	uint32_t	is_rx_elem_toosmall;	/* rx element too small */
60 	uint32_t	is_rx_elem_unknown;	/* rx element unknown */
61 	uint32_t	is_rx_badchan;		/* rx frame w/ invalid chan */
62 	uint32_t	is_rx_chanmismatch;	/* rx frame chan mismatch */
63 	uint32_t	is_rx_nodealloc;	/* rx frame dropped */
64 	uint32_t	is_rx_ssidmismatch;	/* rx frame ssid mismatch  */
65 	uint32_t	is_rx_auth_unsupported;	/* rx w/ unsupported auth alg */
66 	uint32_t	is_rx_auth_fail;	/* rx sta auth failure */
67 	uint32_t	is_rx_assoc_bss;	/* rx assoc from wrong bssid */
68 	uint32_t	is_rx_assoc_notauth;	/* rx assoc w/o auth */
69 	uint32_t	is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */
70 	uint32_t	is_rx_assoc_norate;	/* rx assoc w/ no rate match */
71 	uint32_t	is_rx_deauth;		/* rx deauthentication */
72 	uint32_t	is_rx_disassoc;		/* rx disassociation */
73 	uint32_t	is_rx_badsubtype;	/* rx frame w/ unknown subtype*/
74 	uint32_t	is_rx_nombuf;		/* rx failed for lack of mbuf */
75 	uint32_t	is_rx_decryptcrc;	/* rx decrypt failed on crc */
76 	uint32_t	is_rx_ahdemo_mgt;	/* rx discard ahdemo mgt frame*/
77 	uint32_t	is_rx_bad_auth;		/* rx bad auth request */
78 	uint32_t	is_tx_nombuf;		/* tx failed for lack of mbuf */
79 	uint32_t	is_tx_nonode;		/* tx failed for no node */
80 	uint32_t	is_tx_unknownmgt;	/* tx of unknown mgt frame */
81 	uint32_t	is_scan_active;		/* active scans started */
82 	uint32_t	is_scan_passive;	/* passive scans started */
83 	uint32_t	is_node_timeout;	/* nodes timed out inactivity */
84 	uint32_t	is_crypto_nomem;	/* no memory for crypto ctx */
85 };
86 
87 /*
88  * FreeBSD-style ioctls.
89  */
90 /* the first member must be matched with struct ifreq */
91 struct ieee80211req {
92 	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
93 	uint16_t	i_type;			/* req type */
94 	int16_t		i_val;			/* Index or simple value */
95 	int16_t		i_len;			/* Index or simple value */
96 	void		*i_data;		/* Extra data */
97 };
98 #define	SIOCS80211		 _IOW('i', 234, struct ieee80211req)
99 #define	SIOCG80211		_IOWR('i', 235, struct ieee80211req)
100 
101 #define	IEEE80211_IOC_SSID		1
102 #define	IEEE80211_IOC_NUMSSIDS		2
103 #define	IEEE80211_IOC_WEP		3
104 #define		IEEE80211_WEP_NOSUP	-1
105 #define		IEEE80211_WEP_OFF	0
106 #define		IEEE80211_WEP_ON	1
107 #define		IEEE80211_WEP_MIXED	2
108 #define	IEEE80211_IOC_WEPKEY		4
109 #define	IEEE80211_IOC_NUMWEPKEYS	5
110 #define	IEEE80211_IOC_WEPTXKEY		6
111 #define	IEEE80211_IOC_AUTHMODE		7
112 #define	IEEE80211_IOC_STATIONNAME	8
113 #define	IEEE80211_IOC_CHANNEL		9
114 #define	IEEE80211_IOC_POWERSAVE		10
115 #define		IEEE80211_POWERSAVE_NOSUP	-1
116 #define		IEEE80211_POWERSAVE_OFF		0
117 #define		IEEE80211_POWERSAVE_CAM		1
118 #define		IEEE80211_POWERSAVE_PSP		2
119 #define		IEEE80211_POWERSAVE_PSP_CAM	3
120 #define		IEEE80211_POWERSAVE_ON		IEEE80211_POWERSAVE_CAM
121 #define	IEEE80211_IOC_POWERSAVESLEEP	11
122 #define	IEEE80211_IOC_RTSTHRESHOLD	12
123 #define	IEEE80211_IOC_PROTMODE		13
124 #define		IEEE80211_PROTMODE_OFF		0
125 #define		IEEE80211_PROTMODE_CTS		1
126 #define		IEEE80211_PROTMODE_RTSCTS	2
127 #define	IEEE80211_IOC_TXPOWER		14
128 
129 #ifndef IEEE80211_CHAN_ANY
130 #define	IEEE80211_CHAN_ANY	0xffff		/* token for ``any channel'' */
131 #endif
132 
133 #define	SIOCG80211STATS		_IOWR('i', 236, struct ifreq)
134 
135 #endif /* _NETPROTO_802_11_IEEE80211_IOCTL_H_ */
136