nl80211: Fix a typo
[hostap-gosc2009.git] / testing / wireless / wireless-12.h
blob3fe8709b469d66f20404ccbb574d27326e7591c3
1 /*
2 * This file define a set of standard wireless extensions
4 * Version : 12 5.10.01
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 */
9 #ifndef _LINUX_WIRELESS_H
10 #define _LINUX_WIRELESS_H
12 /************************** DOCUMENTATION **************************/
14 * Basically, the wireless extensions are for now a set of standard ioctl
15 * call + /proc/net/wireless
17 * The entry /proc/net/wireless give statistics and information on the
18 * driver.
19 * This is better than having each driver having its entry because
20 * its centralised and we may remove the driver module safely.
22 * Ioctl are used to configure the driver and issue commands. This is
23 * better than command line options of insmod because we may want to
24 * change dynamically (while the driver is running) some parameters.
26 * The ioctl mechanimsm are copied from standard devices ioctl.
27 * We have the list of command plus a structure descibing the
28 * data exchanged...
29 * Note that to add these ioctl, I was obliged to modify :
30 * net/core/dev.c (two place + add include)
31 * net/ipv4/af_inet.c (one place + add include)
33 * /proc/net/wireless is a copy of /proc/net/dev.
34 * We have a structure for data passed from the driver to /proc/net/wireless
35 * Too add this, I've modified :
36 * net/core/dev.c (two other places)
37 * include/linux/netdevice.h (one place)
38 * include/linux/proc_fs.h (one place)
40 * Do not add here things that are redundant with other mechanisms
41 * (drivers init, ifconfig, /proc/net/dev, ...) and with are not
42 * wireless specific.
44 * These wireless extensions are not magic : each driver has to provide
45 * support for them...
47 * IMPORTANT NOTE : As everything in the kernel, this is very much a
48 * work in progress. Contact me if you have ideas of improvements...
51 /***************************** INCLUDES *****************************/
53 #include <linux/types.h> /* for "caddr_t" et al */
54 #include <linux/socket.h> /* for "struct sockaddr" et al */
55 #include <linux/if.h> /* for IFNAMSIZ and co... */
57 /**************************** CONSTANTS ****************************/
59 /* --------------------------- VERSION --------------------------- */
61 * This constant is used to know the availability of the wireless
62 * extensions and to know which version of wireless extensions it is
63 * (there is some stuff that will be added in the future...)
64 * I just plan to increment with each new version.
66 #define WIRELESS_EXT 12
69 * Changes :
71 * V2 to V3
72 * --------
73 * Alan Cox start some incompatibles changes. I've integrated a bit more.
74 * - Encryption renamed to Encode to avoid US regulation problems
75 * - Frequency changed from float to struct to avoid problems on old 386
77 * V3 to V4
78 * --------
79 * - Add sensitivity
81 * V4 to V5
82 * --------
83 * - Missing encoding definitions in range
84 * - Access points stuff
86 * V5 to V6
87 * --------
88 * - 802.11 support (ESSID ioctls)
90 * V6 to V7
91 * --------
92 * - define IW_ESSID_MAX_SIZE and IW_MAX_AP
94 * V7 to V8
95 * --------
96 * - Changed my e-mail address
97 * - More 802.11 support (nickname, rate, rts, frag)
98 * - List index in frequencies
100 * V8 to V9
101 * --------
102 * - Support for 'mode of operation' (ad-hoc, managed...)
103 * - Support for unicast and multicast power saving
104 * - Change encoding to support larger tokens (>64 bits)
105 * - Updated iw_params (disable, flags) and use it for NWID
106 * - Extracted iw_point from iwreq for clarity
108 * V9 to V10
109 * ---------
110 * - Add PM capability to range structure
111 * - Add PM modifier : MAX/MIN/RELATIVE
112 * - Add encoding option : IW_ENCODE_NOKEY
113 * - Add TxPower ioctls (work like TxRate)
115 * V10 to V11
116 * ----------
117 * - Add WE version in range (help backward/forward compatibility)
118 * - Add retry ioctls (work like PM)
120 * V11 to V12
121 * ----------
122 * - Add SIOCSIWSTATS to get /proc/net/wireless programatically
123 * - Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space
124 * - Add new statistics (frag, retry, beacon)
125 * - Add average quality (for user space calibration)
128 /* -------------------------- IOCTL LIST -------------------------- */
130 /* Basic operations */
131 #define SIOCSIWNAME 0x8B00 /* Unused */
132 #define SIOCGIWNAME 0x8B01 /* get name == wireless protocol */
133 #define SIOCSIWNWID 0x8B02 /* set network id (the cell) */
134 #define SIOCGIWNWID 0x8B03 /* get network id */
135 #define SIOCSIWFREQ 0x8B04 /* set channel/frequency (Hz) */
136 #define SIOCGIWFREQ 0x8B05 /* get channel/frequency (Hz) */
137 #define SIOCSIWMODE 0x8B06 /* set operation mode */
138 #define SIOCGIWMODE 0x8B07 /* get operation mode */
139 #define SIOCSIWSENS 0x8B08 /* set sensitivity (dBm) */
140 #define SIOCGIWSENS 0x8B09 /* get sensitivity (dBm) */
142 /* Informative stuff */
143 #define SIOCSIWRANGE 0x8B0A /* Unused */
144 #define SIOCGIWRANGE 0x8B0B /* Get range of parameters */
145 #define SIOCSIWPRIV 0x8B0C /* Unused */
146 #define SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */
147 #define SIOCSIWSTATS 0x8B0E /* Unused */
148 #define SIOCGIWSTATS 0x8B0F /* Get /proc/net/wireless stats */
150 /* Mobile IP support */
151 #define SIOCSIWSPY 0x8B10 /* set spy addresses */
152 #define SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */
154 /* Access Point manipulation */
155 #define SIOCSIWAP 0x8B14 /* set access point MAC addresses */
156 #define SIOCGIWAP 0x8B15 /* get access point MAC addresses */
157 #define SIOCGIWAPLIST 0x8B17 /* get list of access point in range */
159 /* 802.11 specific support */
160 #define SIOCSIWESSID 0x8B1A /* set ESSID (network name) */
161 #define SIOCGIWESSID 0x8B1B /* get ESSID */
162 #define SIOCSIWNICKN 0x8B1C /* set node name/nickname */
163 #define SIOCGIWNICKN 0x8B1D /* get node name/nickname */
164 /* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit
165 * within the 'iwreq' structure, so we need to use the 'data' member to
166 * point to a string in user space, like it is done for RANGE...
167 * The "flags" member indicate if the ESSID is active or not (promiscuous).
170 /* Other parameters useful in 802.11 and some other devices */
171 #define SIOCSIWRATE 0x8B20 /* set default bit rate (bps) */
172 #define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */
173 #define SIOCSIWRTS 0x8B22 /* set RTS/CTS threshold (bytes) */
174 #define SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */
175 #define SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */
176 #define SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */
177 #define SIOCSIWTXPOW 0x8B26 /* set transmit power (dBm) */
178 #define SIOCGIWTXPOW 0x8B27 /* get transmit power (dBm) */
179 #define SIOCSIWRETRY 0x8B28 /* set retry limits and lifetime */
180 #define SIOCGIWRETRY 0x8B29 /* get retry limits and lifetime */
182 /* Encoding stuff (scrambling, hardware security, WEP...) */
183 #define SIOCSIWENCODE 0x8B2A /* set encoding token & mode */
184 #define SIOCGIWENCODE 0x8B2B /* get encoding token & mode */
185 /* Power saving stuff (power management, unicast and multicast) */
186 #define SIOCSIWPOWER 0x8B2C /* set Power Management settings */
187 #define SIOCGIWPOWER 0x8B2D /* get Power Management settings */
189 /* -------------------- DEV PRIVATE IOCTL LIST -------------------- */
191 /* These 16 ioctl are wireless device private.
192 * Each driver is free to use them for whatever purpose it chooses,
193 * however the driver *must* export the description of those ioctls
194 * with SIOCGIWPRIV and *must* use arguments as defined below.
195 * If you don't follow those rules, DaveM is going to hate you (reason :
196 * it make mixed 32/64bit operation impossible).
198 #define SIOCIWFIRSTPRIV 0x8BE0
199 #define SIOCIWLASTPRIV 0x8BFF
200 /* Previously, we were using SIOCDEVPRIVATE, but we now have our
201 * separate range because of collisions with other tools such as
202 * 'mii-tool'.
203 * We now have 32 commands, so a bit more space ;-).
204 * Also, all 'odd' commands are only usable by root and don't return the
205 * content of ifr/iwr to user (but you are not obliged to use the set/get
206 * convention, just use every other two command).
207 * And I repeat : you are not obliged to use them with iwspy, but you
208 * must be compliant with it.
211 /* ------------------------- IOCTL STUFF ------------------------- */
213 /* The first and the last (range) */
214 #define SIOCIWFIRST 0x8B00
215 #define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */
217 /* Even : get (world access), odd : set (root access) */
218 #define IW_IS_SET(cmd) (!((cmd) & 0x1))
219 #define IW_IS_GET(cmd) ((cmd) & 0x1)
221 /* ------------------------- PRIVATE INFO ------------------------- */
223 * The following is used with SIOCGIWPRIV. It allow a driver to define
224 * the interface (name, type of data) for its private ioctl.
225 * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV
228 #define IW_PRIV_TYPE_MASK 0x7000 /* Type of arguments */
229 #define IW_PRIV_TYPE_NONE 0x0000
230 #define IW_PRIV_TYPE_BYTE 0x1000 /* Char as number */
231 #define IW_PRIV_TYPE_CHAR 0x2000 /* Char as character */
232 #define IW_PRIV_TYPE_INT 0x4000 /* 32 bits int */
233 #define IW_PRIV_TYPE_FLOAT 0x5000
235 #define IW_PRIV_SIZE_FIXED 0x0800 /* Variable or fixed nuber of args */
237 #define IW_PRIV_SIZE_MASK 0x07FF /* Max number of those args */
240 * Note : if the number of args is fixed and the size < 16 octets,
241 * instead of passing a pointer we will put args in the iwreq struct...
244 /* ----------------------- OTHER CONSTANTS ----------------------- */
246 /* Maximum frequencies in the range struct */
247 #define IW_MAX_FREQUENCIES 16
248 /* Note : if you have something like 80 frequencies,
249 * don't increase this constant and don't fill the frequency list.
250 * The user will be able to set by channel anyway... */
252 /* Maximum bit rates in the range struct */
253 #define IW_MAX_BITRATES 8
255 /* Maximum tx powers in the range struct */
256 #define IW_MAX_TXPOWER 8
258 /* Maximum of address that you may set with SPY */
259 #define IW_MAX_SPY 8
261 /* Maximum of address that you may get in the
262 list of access points in range */
263 #define IW_MAX_AP 8
265 /* Maximum size of the ESSID and NICKN strings */
266 #define IW_ESSID_MAX_SIZE 32
268 /* Modes of operation */
269 #define IW_MODE_AUTO 0 /* Let the driver decides */
270 #define IW_MODE_ADHOC 1 /* Single cell network */
271 #define IW_MODE_INFRA 2 /* Multi cell network, roaming, ... */
272 #define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */
273 #define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */
274 #define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */
276 /* Maximum number of size of encoding token available
277 * they are listed in the range structure */
278 #define IW_MAX_ENCODING_SIZES 8
280 /* Maximum size of the encoding token in bytes */
281 #define IW_ENCODING_TOKEN_MAX 32 /* 256 bits (for now) */
283 /* Flags for encoding (along with the token) */
284 #define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */
285 #define IW_ENCODE_FLAGS 0xFF00 /* Flags defined below */
286 #define IW_ENCODE_MODE 0xF000 /* Modes defined below */
287 #define IW_ENCODE_DISABLED 0x8000 /* Encoding disabled */
288 #define IW_ENCODE_ENABLED 0x0000 /* Encoding enabled */
289 #define IW_ENCODE_RESTRICTED 0x4000 /* Refuse non-encoded packets */
290 #define IW_ENCODE_OPEN 0x2000 /* Accept non-encoded packets */
291 #define IW_ENCODE_NOKEY 0x0800 /* Key is write only, so not present */
293 /* Power management flags available (along with the value, if any) */
294 #define IW_POWER_ON 0x0000 /* No details... */
295 #define IW_POWER_TYPE 0xF000 /* Type of parameter */
296 #define IW_POWER_PERIOD 0x1000 /* Value is a period/duration of */
297 #define IW_POWER_TIMEOUT 0x2000 /* Value is a timeout (to go asleep) */
298 #define IW_POWER_MODE 0x0F00 /* Power Management mode */
299 #define IW_POWER_UNICAST_R 0x0100 /* Receive only unicast messages */
300 #define IW_POWER_MULTICAST_R 0x0200 /* Receive only multicast messages */
301 #define IW_POWER_ALL_R 0x0300 /* Receive all messages though PM */
302 #define IW_POWER_FORCE_S 0x0400 /* Force PM procedure for sending unicast */
303 #define IW_POWER_REPEATER 0x0800 /* Repeat broadcast messages in PM period */
304 #define IW_POWER_MODIFIER 0x000F /* Modify a parameter */
305 #define IW_POWER_MIN 0x0001 /* Value is a minimum */
306 #define IW_POWER_MAX 0x0002 /* Value is a maximum */
307 #define IW_POWER_RELATIVE 0x0004 /* Value is not in seconds/ms/us */
309 /* Transmit Power flags available */
310 #define IW_TXPOW_DBM 0x0000 /* Value is in dBm */
311 #define IW_TXPOW_MWATT 0x0001 /* Value is in mW */
313 /* Retry limits and lifetime flags available */
314 #define IW_RETRY_ON 0x0000 /* No details... */
315 #define IW_RETRY_TYPE 0xF000 /* Type of parameter */
316 #define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/
317 #define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */
318 #define IW_RETRY_MODIFIER 0x000F /* Modify a parameter */
319 #define IW_RETRY_MIN 0x0001 /* Value is a minimum */
320 #define IW_RETRY_MAX 0x0002 /* Value is a maximum */
321 #define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */
323 /****************************** TYPES ******************************/
325 /* --------------------------- SUBTYPES --------------------------- */
327 * Generic format for most parameters that fit in an int
329 struct iw_param
331 __s32 value; /* The value of the parameter itself */
332 __u8 fixed; /* Hardware should not use auto select */
333 __u8 disabled; /* Disable the feature */
334 __u16 flags; /* Various specifc flags (if any) */
338 * For all data larger than 16 octets, we need to use a
339 * pointer to memory allocated in user space.
341 struct iw_point
343 caddr_t pointer; /* Pointer to the data (in user space) */
344 __u16 length; /* number of fields or size in bytes */
345 __u16 flags; /* Optional params */
349 * A frequency
350 * For numbers lower than 10^9, we encode the number in 'm' and
351 * set 'e' to 0
352 * For number greater than 10^9, we divide it by the lowest power
353 * of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')...
354 * The power of 10 is in 'e', the result of the division is in 'm'.
356 struct iw_freq
358 __u32 m; /* Mantissa */
359 __u16 e; /* Exponent */
360 __u8 i; /* List index (when in range struct) */
364 * Quality of the link
366 struct iw_quality
368 __u8 qual; /* link quality (%retries, SNR,
369 %missed beacons or better...) */
370 __u8 level; /* signal level (dBm) */
371 __u8 noise; /* noise level (dBm) */
372 __u8 updated; /* Flags to know if updated */
376 * Packet discarded in the wireless adapter due to
377 * "wireless" specific problems...
378 * Note : the list of counter and statistics in net_device_stats
379 * is already pretty exhaustive, and you should use that first.
380 * This is only additional stats...
382 struct iw_discarded
384 __u32 nwid; /* Rx : Wrong nwid/essid */
385 __u32 code; /* Rx : Unable to code/decode (WEP) */
386 __u32 fragment; /* Rx : Can't perform MAC reassembly */
387 __u32 retries; /* Tx : Max MAC retries num reached */
388 __u32 misc; /* Others cases */
392 * Packet/Time period missed in the wireless adapter due to
393 * "wireless" specific problems...
395 struct iw_missed
397 __u32 beacon; /* Missed beacons/superframe */
400 /* ------------------------ WIRELESS STATS ------------------------ */
402 * Wireless statistics (used for /proc/net/wireless)
404 struct iw_statistics
406 __u16 status; /* Status
407 * - device dependent for now */
409 struct iw_quality qual; /* Quality of the link
410 * (instant/mean/max) */
411 struct iw_discarded discard; /* Packet discarded counts */
412 struct iw_missed miss; /* Packet missed counts */
415 /* ------------------------ IOCTL REQUEST ------------------------ */
417 * The structure to exchange data for ioctl.
418 * This structure is the same as 'struct ifreq', but (re)defined for
419 * convenience...
421 * Note that it should fit on the same memory footprint !
422 * You should check this when increasing the above structures (16 octets)
423 * 16 octets = 128 bits. Warning, pointers might be 64 bits wide...
425 struct iwreq
427 union
429 char ifrn_name[IFNAMSIZ]; /* if name, e.g. "eth0" */
430 } ifr_ifrn;
432 /* Data part */
433 union
435 /* Config - generic */
436 char name[IFNAMSIZ];
437 /* Name : used to verify the presence of wireless extensions.
438 * Name of the protocol/provider... */
440 struct iw_point essid; /* Extended network name */
441 struct iw_param nwid; /* network id (or domain - the cell) */
442 struct iw_freq freq; /* frequency or channel :
443 * 0-1000 = channel
444 * > 1000 = frequency in Hz */
446 struct iw_param sens; /* signal level threshold */
447 struct iw_param bitrate; /* default bit rate */
448 struct iw_param txpower; /* default transmit power */
449 struct iw_param rts; /* RTS threshold threshold */
450 struct iw_param frag; /* Fragmentation threshold */
451 __u32 mode; /* Operation mode */
452 struct iw_param retry; /* Retry limits & lifetime */
454 struct iw_point encoding; /* Encoding stuff : tokens */
455 struct iw_param power; /* PM duration/timeout */
457 struct sockaddr ap_addr; /* Access point address */
459 struct iw_point data; /* Other large parameters */
460 } u;
463 /* -------------------------- IOCTL DATA -------------------------- */
465 * For those ioctl which want to exchange mode data that what could
466 * fit in the above structure...
470 * Range of parameters
473 struct iw_range
475 /* Informative stuff (to choose between different interface) */
476 __u32 throughput; /* To give an idea... */
477 /* In theory this value should be the maximum benchmarked
478 * TCP/IP throughput, because with most of these devices the
479 * bit rate is meaningless (overhead an co) to estimate how
480 * fast the connection will go and pick the fastest one.
481 * I suggest people to play with Netperf or any benchmark...
484 /* NWID (or domain id) */
485 __u32 min_nwid; /* Minimal NWID we are able to set */
486 __u32 max_nwid; /* Maximal NWID we are able to set */
488 /* Frequency */
489 __u16 num_channels; /* Number of channels [0; num - 1] */
490 __u8 num_frequency; /* Number of entry in the list */
491 struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */
492 /* Note : this frequency list doesn't need to fit channel numbers */
494 /* signal level threshold range */
495 __s32 sensitivity;
497 /* Quality of link & SNR stuff */
498 struct iw_quality max_qual; /* Quality of the link */
500 /* Rates */
501 __u8 num_bitrates; /* Number of entries in the list */
502 __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */
504 /* RTS threshold */
505 __s32 min_rts; /* Minimal RTS threshold */
506 __s32 max_rts; /* Maximal RTS threshold */
508 /* Frag threshold */
509 __s32 min_frag; /* Minimal frag threshold */
510 __s32 max_frag; /* Maximal frag threshold */
512 /* Power Management duration & timeout */
513 __s32 min_pmp; /* Minimal PM period */
514 __s32 max_pmp; /* Maximal PM period */
515 __s32 min_pmt; /* Minimal PM timeout */
516 __s32 max_pmt; /* Maximal PM timeout */
517 __u16 pmp_flags; /* How to decode max/min PM period */
518 __u16 pmt_flags; /* How to decode max/min PM timeout */
519 __u16 pm_capa; /* What PM options are supported */
521 /* Encoder stuff */
522 __u16 encoding_size[IW_MAX_ENCODING_SIZES]; /* Different token sizes */
523 __u8 num_encoding_sizes; /* Number of entry in the list */
524 __u8 max_encoding_tokens; /* Max number of tokens */
526 /* Transmit power */
527 __u16 txpower_capa; /* What options are supported */
528 __u8 num_txpower; /* Number of entries in the list */
529 __s32 txpower[IW_MAX_TXPOWER]; /* list, in bps */
531 /* Wireless Extension version info */
532 __u8 we_version_compiled; /* Must be WIRELESS_EXT */
533 __u8 we_version_source; /* Last update of source */
535 /* Retry limits and lifetime */
536 __u16 retry_capa; /* What retry options are supported */
537 __u16 retry_flags; /* How to decode max/min retry limit */
538 __u16 r_time_flags; /* How to decode max/min retry life */
539 __s32 min_retry; /* Minimal number of retries */
540 __s32 max_retry; /* Maximal number of retries */
541 __s32 min_r_time; /* Minimal retry lifetime */
542 __s32 max_r_time; /* Maximal retry lifetime */
544 /* Average quality of link & SNR */
545 struct iw_quality avg_qual; /* Quality of the link */
546 /* This should contain the average/typical values of the quality
547 * indicator. This should be the threshold between a "good" and
548 * a "bad" link (example : monitor going from green to orange).
549 * Currently, user space apps like quality monitors don't have any
550 * way to calibrate the measurement. With this, they can split
551 * the range between 0 and max_qual in different quality level
552 * (using a geometric subdivision centered on the average).
553 * I expect that people doing the user space apps will feedback
554 * us on which value we need to put in each driver...
559 * Private ioctl interface information
562 struct iw_priv_args
564 __u32 cmd; /* Number of the ioctl to issue */
565 __u16 set_args; /* Type and number of args */
566 __u16 get_args; /* Type and number of args */
567 char name[IFNAMSIZ]; /* Name of the extension */
570 #endif /* _LINUX_WIRELESS_H */