Import 2.3.28
[davej-history.git] / include / linux / wireless.h
blobacc0619eb5e575c446611822f1a2d9a6fcc459d8
1 /*
2 * This file define a set of standard wireless extensions
4 * Version : 8 28.7.99
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 8
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
101 /* -------------------------- IOCTL LIST -------------------------- */
103 /* Basic operations */
104 #define SIOCSIWNAME 0x8B00 /* Unused ??? */
105 #define SIOCGIWNAME 0x8B01 /* get name */
106 #define SIOCSIWNWID 0x8B02 /* set network id */
107 #define SIOCGIWNWID 0x8B03 /* get network id */
108 #define SIOCSIWFREQ 0x8B04 /* set channel/frequency */
109 #define SIOCGIWFREQ 0x8B05 /* get channel/frequency */
110 #define SIOCSIWENCODE 0x8B06 /* set encoding info */
111 #define SIOCGIWENCODE 0x8B07 /* get encoding info */
112 #define SIOCSIWSENS 0x8B08 /* set sensitivity */
113 #define SIOCGIWSENS 0x8B09 /* get sensitivity */
115 /* Informative stuff */
116 #define SIOCSIWRANGE 0x8B0A /* Unused ??? */
117 #define SIOCGIWRANGE 0x8B0B /* Get range of parameters */
118 #define SIOCSIWPRIV 0x8B0C /* Unused ??? */
119 #define SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */
121 /* Mobile IP support */
122 #define SIOCSIWSPY 0x8B10 /* set spy addresses */
123 #define SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */
125 /* Access Point manipulation */
126 #define SIOCSIWAP 0x8B14 /* set access point MAC addresses */
127 #define SIOCGIWAP 0x8B15 /* get access point MAC addresses */
128 #define SIOCGIWAPLIST 0x8B17 /* get list of access point in range */
130 /* 802.11 specific support */
131 #define SIOCSIWESSID 0x8B1A /* set ESSID (network name) */
132 #define SIOCGIWESSID 0x8B1B /* get ESSID */
133 #define SIOCSIWNICKN 0x8B1C /* set node name/nickname */
134 #define SIOCGIWNICKN 0x8B1D /* get node name/nickname */
135 /* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit
136 * within the 'iwreq' structure, so we need to use the 'data' member to
137 * point to a string in user space, like it is done for RANGE...
138 * The "flags" member indicate if the ESSID is active or not (promiscuous).
141 /* Other parameters usefull in 802.11 and some other devices */
142 #define SIOCSIWRATE 0x8B20 /* set default bit rate (bps) */
143 #define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */
144 #define SIOCSIWRTS 0x8B22 /* set RTS/CTS threshold (bytes) */
145 #define SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */
146 #define SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */
147 #define SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */
149 /* ------------------------- IOCTL STUFF ------------------------- */
151 /* The first and the last (range) */
152 #define SIOCIWFIRST 0x8B00
153 #define SIOCIWLAST 0x8B25
155 /* Even : get (world access), odd : set (root access) */
156 #define IW_IS_SET(cmd) (!((cmd) & 0x1))
157 #define IW_IS_GET(cmd) ((cmd) & 0x1)
159 /* ------------------------- PRIVATE INFO ------------------------- */
161 * The following is used with SIOCGIWPRIV. It allow a driver to define
162 * the interface (name, type of data) for its private ioctl.
163 * Privates ioctl are SIOCDEVPRIVATE -> SIOCDEVPRIVATE + 0xF
166 #define IW_PRIV_TYPE_MASK 0x7000 /* Type of arguments */
167 #define IW_PRIV_TYPE_NONE 0x0000
168 #define IW_PRIV_TYPE_BYTE 0x1000 /* Char as number */
169 #define IW_PRIV_TYPE_CHAR 0x2000 /* Char as character */
170 #define IW_PRIV_TYPE_INT 0x4000 /* 32 bits int */
171 #define IW_PRIV_TYPE_FLOAT 0x5000
173 #define IW_PRIV_SIZE_FIXED 0x0800 /* Variable or fixed nuber of args */
175 #define IW_PRIV_SIZE_MASK 0x07FF /* Max number of those args */
178 * Note : if the number of args is fixed and the size < 16 octets,
179 * instead of passing a pointer we will put args in the iwreq struct...
182 /* ----------------------- OTHER CONSTANTS ----------------------- */
184 /* Maximum frequencies in the range struct */
185 #define IW_MAX_FREQUENCIES 16
186 /* Note : if you have something like 80 frequencies,
187 * don't increase this constant and don't fill the frequency list.
188 * The user will be able to set by channel anyway... */
190 /* Maximum bit rates in the range struct */
191 #define IW_MAX_BITRATES 8
193 /* Maximum of address that you may set with SPY */
194 #define IW_MAX_SPY 8
196 /* Maximum of address that you may get in the
197 list of access points in range */
198 #define IW_MAX_AP 8
200 /* Maximum size of the ESSID and NICKN strings */
201 #define IW_ESSID_MAX_SIZE 32
203 /****************************** TYPES ******************************/
205 /* --------------------------- SUBTYPES --------------------------- */
207 * A frequency
208 * For numbers lower than 10^9, we encode the number in 'm' and
209 * set 'e' to 0
210 * For number greater than 10^9, we divide it by the lowest power
211 * of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')...
212 * The power of 10 is in 'e', the result of the division is in 'm'.
214 struct iw_freq
216 __u32 m; /* Mantissa */
217 __u16 e; /* Exponent */
218 __u8 i; /* List index (when in range struct) */
222 * Quality of the link
224 struct iw_quality
226 __u8 qual; /* link quality (SNR or better...) */
227 __u8 level; /* signal level */
228 __u8 noise; /* noise level */
229 __u8 updated; /* Flags to know if updated */
233 * Packet discarded in the wireless adapter due to
234 * "wireless" specific problems...
236 struct iw_discarded
238 __u32 nwid; /* Wrong nwid */
239 __u32 code; /* Unable to code/decode */
240 __u32 misc; /* Others cases */
244 * Encoding information (setting and so on)
245 * Encoding might be hardware encryption, scrambing or others
247 struct iw_encoding
249 __u8 method; /* Algorithm number / key used */
250 __u64 code; /* Data/key used for algorithm */
254 * Generic format for parameters
256 struct iw_param
258 __s32 value; /* The value of the parameter itself */
259 __u8 fixed; /* Hardware should not use auto select */
263 /* ------------------------ WIRELESS STATS ------------------------ */
265 * Wireless statistics (used for /proc/net/wireless)
267 struct iw_statistics
269 __u8 status; /* Status
270 * - device dependent for now */
272 struct iw_quality qual; /* Quality of the link
273 * (instant/mean/max) */
274 struct iw_discarded discard; /* Packet discarded counts */
277 /* ------------------------ IOCTL REQUEST ------------------------ */
279 * The structure to exchange data for ioctl.
280 * This structure is the same as 'struct ifreq', but (re)defined for
281 * convenience...
283 * Note that it should fit on the same memory footprint !
284 * You should check this when increasing the above structures (16 octets)
285 * 16 octets = 128 bits. Warning, pointers might be 64 bits wide...
287 struct iwreq
289 union
291 char ifrn_name[IFNAMSIZ]; /* if name, e.g. "eth0" */
292 } ifr_ifrn;
294 /* Data part */
295 union
297 /* Config - generic */
298 char name[IFNAMSIZ];
299 /* Name : used to verify the presence of wireless extensions.
300 * Name of the protocol/provider... */
302 struct /* network id (or domain) : used to to */
303 { /* create logical channels on the air */
304 __u32 nwid; /* value */
305 __u8 on; /* active/unactive nwid */
306 } nwid;
308 struct iw_freq freq; /* frequency or channel :
309 * 0-1000 = channel
310 * > 1000 = frequency in Hz */
312 struct iw_encoding encoding; /* Encoding stuff */
314 __u32 sensitivity; /* Obsolete, but compatible */
315 struct iw_param sens; /* signal level threshold */
316 struct iw_param bitrate; /* default bit rate */
317 struct iw_param rts; /* RTS threshold threshold */
318 struct iw_param frag; /* Fragmentation threshold */
320 struct sockaddr ap_addr; /* Access point address */
322 struct /* For all data bigger than 16 octets */
324 caddr_t pointer; /* Pointer to the data
325 * (in user space) */
326 __u16 length; /* fields or byte size */
327 __u16 flags; /* Optional params */
328 } data;
329 } u;
332 /* -------------------------- IOCTL DATA -------------------------- */
334 * For those ioctl which want to exchange mode data that what could
335 * fit in the above structure...
339 * Range of parameters
342 struct iw_range
344 /* Informative stuff (to choose between different interface) */
345 __u32 throughput; /* To give an idea... */
346 /* In theory this value should be the maximum benchmarked
347 * TCP/IP throughput, because with most of these devices the
348 * bit rate is meaningless (overhead an co) to estimate how
349 * fast the connection will go and pick the fastest one.
350 * I suggest people to play with Netperf or any benchmark...
353 /* NWID (or domain id) */
354 __u32 min_nwid; /* Minimal NWID we are able to set */
355 __u32 max_nwid; /* Maximal NWID we are able to set */
357 /* Frequency */
358 __u16 num_channels; /* Number of channels [0; num - 1] */
359 __u8 num_frequency; /* Number of entry in the list */
360 struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */
361 /* Note : this frequency list doesn't need to fit channel numbers */
363 /* signal level threshold range */
364 __s32 sensitivity;
366 /* Quality of link & SNR stuff */
367 struct iw_quality max_qual; /* Quality of the link */
369 /* Encoder stuff */
370 struct iw_encoding max_encoding; /* Encoding max range */
372 /* Rates */
373 __u8 num_bitrates; /* Number of entries in the list */
374 __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */
376 /* RTS threshold */
377 __s32 min_rts; /* Minimal RTS threshold */
378 __s32 max_rts; /* Maximal RTS threshold */
380 /* Frag threshold */
381 __s32 min_frag; /* Minimal frag threshold */
382 __s32 max_frag; /* Maximal frag threshold */
386 * Private ioctl interface information
389 struct iw_priv_args
391 __u32 cmd; /* Number of the ioctl to issue */
392 __u16 set_args; /* Type and number of args */
393 __u16 get_args; /* Type and number of args */
394 char name[IFNAMSIZ]; /* Name of the extension */
397 #endif /* _LINUX_WIRELESS_H */