Import 2.3.6
[davej-history.git] / include / linux / wireless.h
blobd3c59fff5a67a8e85a4494a3a72fd260f0ddc626
1 /*
2 * This file define a set of standard wireless extensions
4 * Version : 7 23.4.99
6 * Authors : Jean Tourrilhes - HPLB - <jt@hplb.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 6
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
95 /* -------------------------- IOCTL LIST -------------------------- */
97 /* Basic operations */
98 #define SIOCSIWNAME 0x8B00 /* Unused ??? */
99 #define SIOCGIWNAME 0x8B01 /* get name */
100 #define SIOCSIWNWID 0x8B02 /* set network id */
101 #define SIOCGIWNWID 0x8B03 /* get network id */
102 #define SIOCSIWFREQ 0x8B04 /* set channel/frequency */
103 #define SIOCGIWFREQ 0x8B05 /* get channel/frequency */
104 #define SIOCSIWENCODE 0x8B06 /* set encoding info */
105 #define SIOCGIWENCODE 0x8B07 /* get encoding info */
106 #define SIOCSIWSENS 0x8B08 /* set sensitivity */
107 #define SIOCGIWSENS 0x8B09 /* get sensitivity */
109 /* Informative stuff */
110 #define SIOCSIWRANGE 0x8B0A /* Unused ??? */
111 #define SIOCGIWRANGE 0x8B0B /* Get range of parameters */
112 #define SIOCSIWPRIV 0x8B0C /* Unused ??? */
113 #define SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */
115 /* Mobile IP support */
116 #define SIOCSIWSPY 0x8B10 /* set spy addresses */
117 #define SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */
119 /* Access Point manipulation */
120 #define SIOCSIWAP 0x8B14 /* set access point hardware addresses */
121 #define SIOCGIWAP 0x8B15 /* get access point hardware addresses */
122 #define SIOCGIWAPLIST 0x8B17 /* get list of access point in range */
124 /* 802.11 specific support */
125 #define SIOCSIWESSID 0x8B1A /* set ESSID (network name) */
126 #define SIOCGIWESSID 0x8B1B /* get ESSID */
127 /* As the ESSID is a string up to 32 bytes long, it doesn't fit within the
128 * 'iwreq' structure, so we need to use the 'data' member to point to a
129 * string in user space, like it is done for RANGE...
130 * The "flags" member indicate if the ESSID is active or not.
133 /* ------------------------- IOCTL STUFF ------------------------- */
135 /* The first and the last (range) */
136 #define SIOCIWFIRST 0x8B00
137 #define SIOCIWLAST 0x8B1B
139 /* Even : get (world access), odd : set (root access) */
140 #define IW_IS_SET(cmd) (!((cmd) & 0x1))
141 #define IW_IS_GET(cmd) ((cmd) & 0x1)
143 /* ------------------------- PRIVATE INFO ------------------------- */
145 * The following is used with SIOCGIWPRIV. It allow a driver to define
146 * the interface (name, type of data) for its private ioctl.
147 * Privates ioctl are SIOCDEVPRIVATE -> SIOCDEVPRIVATE + 0xF
150 #define IW_PRIV_TYPE_MASK 0x7000 /* Type of arguments */
151 #define IW_PRIV_TYPE_NONE 0x0000
152 #define IW_PRIV_TYPE_BYTE 0x1000 /* Char as number */
153 #define IW_PRIV_TYPE_CHAR 0x2000 /* Char as character */
154 #define IW_PRIV_TYPE_INT 0x4000 /* 32 bits int */
155 #define IW_PRIV_TYPE_FLOAT 0x5000
157 #define IW_PRIV_SIZE_FIXED 0x0800 /* Variable or fixed nuber of args */
159 #define IW_PRIV_SIZE_MASK 0x07FF /* Max number of those args */
162 * Note : if the number of args is fixed and the size < 16 octets,
163 * instead of passing a pointer we will put args in the iwreq struct...
166 /* ----------------------- OTHER CONSTANTS ----------------------- */
168 /* Maximum frequencies in the range struct */
169 #define IW_MAX_FREQUENCIES 16
170 /* Note : if you have something like 80 frequencies,
171 * don't increase this constant and don't fill the frequency list.
172 * The user will be able to set by channel anyway... */
174 /* Maximum of address that you may set with SPY */
175 #define IW_MAX_SPY 8
177 /* Maximum of address that you may get in the
178 list of access points in range */
179 #define IW_MAX_AP 8
181 /* Maximum size of the ESSID string */
182 #define IW_ESSID_MAX_SIZE 32
184 /****************************** TYPES ******************************/
186 /* --------------------------- SUBTYPES --------------------------- */
188 * A frequency
189 * For numbers lower than 10^9, we encode the number in 'mant' and
190 * set 'exp' to 0
191 * For number greater than 10^9, we divide it by a power of 10.
192 * The power of 10 is in 'exp', the result is in 'mant'.
194 struct iw_freq
196 __u32 m; /* Mantissa */
197 __u16 e; /* Exponent */
201 * Quality of the link
203 struct iw_quality
205 __u8 qual; /* link quality (SNR or better...) */
206 __u8 level; /* signal level */
207 __u8 noise; /* noise level */
208 __u8 updated; /* Flags to know if updated */
212 * Packet discarded in the wireless adapter due to
213 * "wireless" specific problems...
215 struct iw_discarded
217 __u32 nwid; /* Wrong nwid */
218 __u32 code; /* Unable to code/decode */
219 __u32 misc; /* Others cases */
223 * Encoding information (setting and so on)
224 * Encoding might be hardware encryption, scrambing or others
226 struct iw_encoding
228 __u8 method; /* Algorithm number / key used */
229 __u64 code; /* Data/key used for algorithm */
233 /* ------------------------ WIRELESS STATS ------------------------ */
235 * Wireless statistics (used for /proc/net/wireless)
237 struct iw_statistics
239 __u8 status; /* Status
240 * - device dependent for now */
242 struct iw_quality qual; /* Quality of the link
243 * (instant/mean/max) */
244 struct iw_discarded discard; /* Packet discarded counts */
247 /* ------------------------ IOCTL REQUEST ------------------------ */
249 * The structure to exchange data for ioctl.
250 * This structure is the same as 'struct ifreq', but (re)defined for
251 * convenience...
253 * Note that it should fit on the same memory footprint !
254 * You should check this when increasing the above structures (16 octets)
255 * 16 octets = 128 bits. Warning, pointers might be 64 bits wide...
257 struct iwreq
259 union
261 char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
262 } ifr_ifrn;
264 /* Data part */
265 union
267 /* Config - generic */
268 char name[IFNAMSIZ];
269 /* Name : used to verify the presence of wireless extensions.
270 * Name of the protocol/provider... */
272 struct /* network id (or domain) : used to to */
273 { /* create logical channels on the air */
274 __u32 nwid; /* value */
275 __u8 on; /* active/unactive nwid */
276 } nwid;
278 struct iw_freq freq; /* frequency or channel :
279 * 0-1000 = channel
280 * > 1000 = frequency in Hz */
282 struct iw_encoding encoding; /* Encoding stuff */
284 __u32 sensitivity; /* signal level threshold */
286 struct sockaddr ap_addr; /* Access point address */
288 struct /* For all data bigger than 16 octets */
290 caddr_t pointer; /* Pointer to the data
291 * (in user space) */
292 __u16 length; /* fields or byte size */
293 __u16 flags; /* Optional params */
294 } data;
295 } u;
298 /* -------------------------- IOCTL DATA -------------------------- */
300 * For those ioctl which want to exchange mode data that what could
301 * fit in the above structure...
305 * Range of parameters
308 struct iw_range
310 /* Informative stuff (to choose between different interface) */
311 __u32 throughput; /* To give an idea... */
313 /* NWID (or domain id) */
314 __u32 min_nwid; /* Minimal NWID we are able to set */
315 __u32 max_nwid; /* Maximal NWID we are able to set */
317 /* Frequency */
318 __u16 num_channels; /* Number of channels [0; num - 1] */
319 __u8 num_frequency; /* Number of entry in the list */
320 struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */
321 /* Note : this frequency list doesn't need to fit channel numbers */
323 /* signal level threshold range */
324 __u32 sensitivity;
326 /* Quality of link & SNR stuff */
327 struct iw_quality max_qual; /* Quality of the link */
329 /* Encoder stuff */
330 struct iw_encoding max_encoding; /* Encoding max range */
334 * Private ioctl interface information
337 struct iw_priv_args
339 __u32 cmd; /* Number of the ioctl to issue */
340 __u16 set_args; /* Type and number of args */
341 __u16 get_args; /* Type and number of args */
342 char name[IFNAMSIZ]; /* Name of the extension */
345 #endif /* _LINUX_WIRELESS_H */