Annotation of sys/net80211/ieee80211_ioctl.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: ieee80211_ioctl.h,v 1.10 2007/08/14 20:33:47 bluhm Exp $ */
2: /* $NetBSD: ieee80211_ioctl.h,v 1.7 2004/04/30 22:51:04 dyoung Exp $ */
3:
4: /*-
5: * Copyright (c) 2001 Atsushi Onoe
6: * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
7: * All rights reserved.
8: *
9: * Redistribution and use in source and binary forms, with or without
10: * modification, are permitted provided that the following conditions
11: * are met:
12: * 1. Redistributions of source code must retain the above copyright
13: * notice, this list of conditions and the following disclaimer.
14: * 2. Redistributions in binary form must reproduce the above copyright
15: * notice, this list of conditions and the following disclaimer in the
16: * documentation and/or other materials provided with the distribution.
17: * 3. The name of the author may not be used to endorse or promote products
18: * derived from this software without specific prior written permission.
19: *
20: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30: *
31: * $FreeBSD: src/sys/net80211/ieee80211_ioctl.h,v 1.5 2004/03/30 22:57:57 sam Exp $
32: */
33: #ifndef _NET80211_IEEE80211_IOCTL_H_
34: #define _NET80211_IEEE80211_IOCTL_H_
35:
36: /*
37: * IEEE 802.11 ioctls.
38: */
39:
40: /* per-interface statistics */
41: struct ieee80211_stats {
42: u_int32_t is_rx_badversion; /* rx frame with bad version */
43: u_int32_t is_rx_tooshort; /* rx frame too short */
44: u_int32_t is_rx_wrongbss; /* rx from wrong bssid */
45: u_int32_t is_rx_dup; /* rx discard 'cuz dup */
46: u_int32_t is_rx_wrongdir; /* rx w/ wrong direction */
47: u_int32_t is_rx_mcastecho; /* rx discard 'cuz mcast echo */
48: u_int32_t is_rx_notassoc; /* rx discard 'cuz sta !assoc */
49: u_int32_t is_rx_nowep; /* rx w/ wep but wep !config */
50: u_int32_t is_rx_unencrypted; /* rx w/o wep but wep config */
51: u_int32_t is_rx_wepfail; /* rx wep processing failed */
52: u_int32_t is_rx_decap; /* rx decapsulation failed */
53: u_int32_t is_rx_mgtdiscard; /* rx discard mgt frames */
54: u_int32_t is_rx_ctl; /* rx discard ctrl frames */
55: u_int32_t is_rx_rstoobig; /* rx rate set truncated */
56: u_int32_t is_rx_elem_missing; /* rx required element missing*/
57: u_int32_t is_rx_elem_toobig; /* rx element too big */
58: u_int32_t is_rx_elem_toosmall; /* rx element too small */
59: u_int32_t is_rx_elem_unknown; /* rx element unknown */
60: u_int32_t is_rx_badchan; /* rx frame w/ invalid chan */
61: u_int32_t is_rx_chanmismatch; /* rx frame chan mismatch */
62: u_int32_t is_rx_nodealloc; /* rx frame dropped */
63: u_int32_t is_rx_ssidmismatch; /* rx frame ssid mismatch */
64: u_int32_t is_rx_auth_unsupported; /* rx w/ unsupported auth alg */
65: u_int32_t is_rx_auth_fail; /* rx sta auth failure */
66: u_int32_t is_rx_assoc_bss; /* rx assoc from wrong bssid */
67: u_int32_t is_rx_assoc_notauth; /* rx assoc w/o auth */
68: u_int32_t is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */
69: u_int32_t is_rx_assoc_norate; /* rx assoc w/ no rate match */
70: u_int32_t is_rx_deauth; /* rx deauthentication */
71: u_int32_t is_rx_disassoc; /* rx disassociation */
72: u_int32_t is_rx_badsubtype; /* rx frame w/ unknown subtype*/
73: u_int32_t is_rx_nombuf; /* rx failed for lack of mbuf */
74: u_int32_t is_rx_decryptcrc; /* rx decrypt failed on crc */
75: u_int32_t is_rx_ahdemo_mgt; /* rx discard ahdemo mgt frame*/
76: u_int32_t is_rx_bad_auth; /* rx bad auth request */
77: u_int32_t is_tx_nombuf; /* tx failed for lack of mbuf */
78: u_int32_t is_tx_nonode; /* tx failed for no node */
79: u_int32_t is_tx_unknownmgt; /* tx of unknown mgt frame */
80: u_int32_t is_scan_active; /* active scans started */
81: u_int32_t is_scan_passive; /* passive scans started */
82: u_int32_t is_node_timeout; /* nodes timed out inactivity */
83: u_int32_t is_crypto_nomem; /* no memory for crypto ctx */
84: u_int32_t is_rx_assoc_badrsnie; /* rx assoc w/ bad RSN IE */
85: };
86:
87: #define SIOCG80211STATS _IOWR('i', 242, struct ifreq)
88:
89: /* network identifier (ESSID), nwid is pointed at by ifr.ifr_data */
90: struct ieee80211_nwid {
91: u_int8_t i_len;
92: u_int8_t i_nwid[IEEE80211_NWID_LEN];
93: };
94:
95: #define SIOCS80211NWID _IOWR('i', 230, struct ifreq)
96: #define SIOCG80211NWID _IOWR('i', 231, struct ifreq)
97:
98: /* network key (WEP), the first member must be matched with struct ifreq */
99: struct ieee80211_nwkey {
100: char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
101: int i_wepon; /* wep enabled flag */
102: int i_defkid; /* default encrypt key id */
103: struct {
104: int i_keylen;
105: u_int8_t *i_keydat;
106: } i_key[IEEE80211_WEP_NKID];
107: };
108:
109: #define IEEE80211_NWKEY_OPEN 0 /* No privacy */
110: #define IEEE80211_NWKEY_WEP 1 /* WEP enabled */
111: #define IEEE80211_NWKEY_EAP 2 /* EAP enabled */
112: #define IEEE80211_NWKEY_PERSIST 0x100 /* designate persist keyset */
113:
114: #define SIOCS80211NWKEY _IOW('i', 232, struct ieee80211_nwkey)
115: #define SIOCG80211NWKEY _IOWR('i', 233, struct ieee80211_nwkey)
116:
117: /* power management parameters */
118: struct ieee80211_power {
119: char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
120: int i_enabled; /* 1 == on, 0 == off */
121: int i_maxsleep; /* max sleep in ms */
122: };
123: #define SIOCS80211POWER _IOW('i', 234, struct ieee80211_power)
124: #define SIOCG80211POWER _IOWR('i', 235, struct ieee80211_power)
125:
126: /* authentication type */
127: struct ieee80211_auth {
128: char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
129: int i_authtype;
130: };
131:
132: #define IEEE80211_AUTH_NONE 0
133: #define IEEE80211_AUTH_OPEN 1
134: #define IEEE80211_AUTH_SHARED 2
135:
136: #define SIOCS80211AUTH _IOW('i', 236, struct ieee80211_auth)
137: #define SIOCG80211AUTH _IOWR('i', 237, struct ieee80211_auth)
138:
139: /* channel request */
140: struct ieee80211chanreq {
141: char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
142: u_int16_t i_channel;
143: };
144:
145: #ifndef IEEE80211_CHAN_ANY
146: #define IEEE80211_CHAN_ANY 0xffff
147: #endif
148:
149: #define SIOCS80211CHANNEL _IOW('i', 238, struct ieee80211chanreq)
150: #define SIOCG80211CHANNEL _IOWR('i', 239, struct ieee80211chanreq)
151:
152: /* BSS identifier */
153: struct ieee80211_bssid {
154: char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
155: u_int8_t i_bssid[IEEE80211_ADDR_LEN];
156: };
157:
158: #define SIOCS80211BSSID _IOW('i', 240, struct ieee80211_bssid)
159: #define SIOCG80211BSSID _IOWR('i', 241, struct ieee80211_bssid)
160:
161: /* transmit power */
162: struct ieee80211_txpower {
163: char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
164: int i_mode; /* auto, manual */
165: int16_t i_val; /* dBm */
166: };
167:
168: #define SIOCS80211TXPOWER _IOW('i', 243, struct ieee80211_txpower)
169: #define SIOCG80211TXPOWER _IOWR('i', 244, struct ieee80211_txpower)
170:
171: #define IEEE80211_TXPOWER_MODE_FIXED 0 /* fixed tx power value */
172: #define IEEE80211_TXPOWER_MODE_AUTO 1 /* auto level control */
173:
174: /* scan request (will block) */
175: #define IEEE80211_SCAN_TIMEOUT 30 /* timeout in seconds */
176:
177: #define SIOCS80211SCAN _IOW('i', 210, struct ifreq)
178:
179: /* node and requests */
180: struct ieee80211_nodereq {
181: char nr_ifname[IFNAMSIZ]; /* e.g. "ath0" */
182:
183: /* Node address and name information */
184: u_int8_t nr_macaddr[IEEE80211_ADDR_LEN]; /* node lladdr */
185: u_int8_t nr_bssid[IEEE80211_ADDR_LEN]; /* bssid */
186: u_int8_t nr_nwid_len; /* ESSID length */
187: u_int8_t nr_nwid[IEEE80211_NWID_LEN]; /* ESSID */
188:
189: /* Channel and rates */
190: u_int16_t nr_channel; /* last channel */
191: u_int16_t nr_chan_flags; /* channel flags */
192: u_int8_t nr_nrates; /* rate count */
193: u_int8_t nr_rates[IEEE80211_RATE_MAXSIZE]; /* rate set */
194:
195: /* Node status information */
196: u_int8_t nr_rssi; /* received signal strength */
197: u_int8_t nr_max_rssi; /* maximum rssi */
198: u_int8_t nr_tstamp[8]; /* from last received beacon */
199: u_int16_t nr_intval; /* beacon interval */
200: u_int16_t nr_capinfo; /* capabilities */
201: u_int16_t nr_fhdwell; /* FH only */
202: u_int8_t nr_fhindex; /* FH only */
203: u_int8_t nr_erp; /* 11g only */
204: u_int8_t nr_pwrsave; /* power saving mode */
205: u_int16_t nr_associd; /* assoc response */
206: u_int16_t nr_txseq; /* seq to be transmitted */
207: u_int16_t nr_rxseq; /* seq previous received */
208: u_int32_t nr_fails; /* failure count to associate */
209: u_int32_t nr_inact; /* inactivity mark count */
210: u_int8_t nr_txrate; /* index to nr_rates[] */
211: u_int16_t nr_state; /* node state in the cache */
212:
213: /* Node flags */
214: u_int8_t nr_flags;
215: };
216:
217: #define IEEE80211_NODEREQ_STATE(_s) (1 << _s)
218: #define IEEE80211_NODEREQ_STATE_BITS \
219: "\20\01CACHE\02BSS\03AUTH\04ASSOC\05COLLECT"
220:
221: #define IEEE80211_NODEREQ_RSSI(_nr) \
222: ((u_int)(((float)(_nr)->nr_rssi / (_nr)->nr_max_rssi) * 100))
223:
224: #define IEEE80211_NODEREQ_STA 0x00 /* station */
225: #define IEEE80211_NODEREQ_AP 0x01 /* access point */
226: #define IEEE80211_NODEREQ_AP_BSS 0x02 /* current bss access point */
227: #define IEEE80211_NODEREQ_COPY 0x04 /* add node with flags */
228:
229: #define SIOCG80211NODE _IOWR('i', 211, struct ieee80211_nodereq)
230: #define SIOCS80211NODE _IOW('i', 212, struct ieee80211_nodereq)
231: #define SIOCS80211DELNODE _IOW('i', 213, struct ieee80211_nodereq)
232:
233: /* get the entire node cache */
234: struct ieee80211_nodereq_all {
235: char na_ifname[IFNAMSIZ]; /* e.g. "ath0" */
236:
237: int na_nodes; /* returned count */
238: size_t na_size; /* size of node buffer */
239: struct ieee80211_nodereq *na_node; /* allocated node buffer */
240:
241: /* Match nodes by flag */
242: u_int8_t na_flags; /* IEEE80211_NODEREQ_* */
243: };
244:
245: #define SIOCG80211ALLNODES _IOWR('i', 214, struct ieee80211_nodereq)
246:
247: /* net80211 specific interface flags */
248: #define IEEE80211_F_HIDENWID 0x10000000 /* CONF: hidden ssid mode */
249: #define IEEE80211_F_NOBRIDGE 0x20000000 /* CONF: no internal bridging */
250: #define IEEE80211_F_HOSTAPMASK 0x30000000
251: #define IEEE80211_F_USERSHIFT 28
252: #define IEEE80211_F_USERBITS "\20\01HIDENWID\02NOBRIDGE"
253:
254: struct ieee80211_flags {
255: const char *f_name;
256: u_int f_flag;
257: };
258:
259: #define IEEE80211_FLAGS { \
260: { "hidenwid", IEEE80211_F_HIDENWID >> IEEE80211_F_USERSHIFT }, \
261: { "nobridge", IEEE80211_F_NOBRIDGE >> IEEE80211_F_USERSHIFT } \
262: }
263:
264: #define SIOCG80211FLAGS _IOWR('i', 216, struct ifreq)
265: #define SIOCS80211FLAGS _IOW('i', 217, struct ifreq)
266:
267: #endif /* _NET80211_IEEE80211_IOCTL_H_ */
CVSweb