2 * This file define a set of standard wireless extensions
6 * Authors : Jean Tourrilhes - HPLB - <jt@hplb.hpl.hp.com>
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
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
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
44 * These wireless extensions are not magic : each driver has to provide
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 *****************************/
54 #include <linux/types.h> /* for "caddr_t" et al */
55 #include <linux/socket.h> /* for "struct sockaddr" et al */
56 #include <linux/if.h> /* for IFNAMSIZ and co... */
59 /**************************** CONSTANTS ****************************/
61 /* --------------------------- VERSION --------------------------- */
63 * This constant is used to know the availability of the wireless
64 * extensions and to know which version of wireless extensions it is
65 * (there is some stuff that will be added in the future...)
66 * I just plan to increment with each new version.
68 #define WIRELESS_EXT 6
75 * Alan Cox start some incompatibles changes. I've integrated a bit more.
76 * - Encryption renamed to Encode to avoid US regulation problems
77 * - Frequency changed from float to struct to avoid problems on old 386
85 * - Missing encoding definitions in range
86 * - Access points stuff
90 * - 802.11 support (ESSID ioctls)
94 * - define IW_ESSID_MAX_SIZE and IW_MAX_AP
97 /* -------------------------- IOCTL LIST -------------------------- */
99 /* Basic operations */
100 #define SIOCSIWNAME 0x8B00 /* Unused ??? */
101 #define SIOCGIWNAME 0x8B01 /* get name */
102 #define SIOCSIWNWID 0x8B02 /* set network id */
103 #define SIOCGIWNWID 0x8B03 /* get network id */
104 #define SIOCSIWFREQ 0x8B04 /* set channel/frequency */
105 #define SIOCGIWFREQ 0x8B05 /* get channel/frequency */
106 #define SIOCSIWENCODE 0x8B06 /* set encoding info */
107 #define SIOCGIWENCODE 0x8B07 /* get encoding info */
108 #define SIOCSIWSENS 0x8B08 /* set sensitivity */
109 #define SIOCGIWSENS 0x8B09 /* get sensitivity */
111 /* Informative stuff */
112 #define SIOCSIWRANGE 0x8B0A /* Unused ??? */
113 #define SIOCGIWRANGE 0x8B0B /* Get range of parameters */
114 #define SIOCSIWPRIV 0x8B0C /* Unused ??? */
115 #define SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */
117 /* Mobile IP support */
118 #define SIOCSIWSPY 0x8B10 /* set spy addresses */
119 #define SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */
121 /* Access Point manipulation */
122 #define SIOCSIWAP 0x8B14 /* set access point hardware addresses */
123 #define SIOCGIWAP 0x8B15 /* get access point hardware addresses */
124 #define SIOCGIWAPLIST 0x8B17 /* get list of access point in range */
126 /* 802.11 specific support */
127 #define SIOCSIWESSID 0x8B1A /* set ESSID (network name) */
128 #define SIOCGIWESSID 0x8B1B /* get ESSID */
129 /* As the ESSID is a string up to 32 bytes long, it doesn't fit within the
130 * 'iwreq' structure, so we need to use the 'data' member to point to a
131 * string in user space, like it is done for RANGE...
132 * The "flags" member indicate if the ESSID is active or not.
135 /* ------------------------- IOCTL STUFF ------------------------- */
137 /* The first and the last (range) */
138 #define SIOCIWFIRST 0x8B00
139 #define SIOCIWLAST 0x8B1B
141 /* Even : get (world access), odd : set (root access) */
142 #define IW_IS_SET(cmd) (!((cmd) & 0x1))
143 #define IW_IS_GET(cmd) ((cmd) & 0x1)
145 /* ------------------------- PRIVATE INFO ------------------------- */
147 * The following is used with SIOCGIWPRIV. It allow a driver to define
148 * the interface (name, type of data) for its private ioctl.
149 * Privates ioctl are SIOCDEVPRIVATE -> SIOCDEVPRIVATE + 0xF
152 #define IW_PRIV_TYPE_MASK 0x7000 /* Type of arguments */
153 #define IW_PRIV_TYPE_NONE 0x0000
154 #define IW_PRIV_TYPE_BYTE 0x1000 /* Char as number */
155 #define IW_PRIV_TYPE_CHAR 0x2000 /* Char as character */
156 #define IW_PRIV_TYPE_INT 0x4000 /* 32 bits int */
157 #define IW_PRIV_TYPE_FLOAT 0x5000
159 #define IW_PRIV_SIZE_FIXED 0x0800 /* Variable or fixed nuber of args */
161 #define IW_PRIV_SIZE_MASK 0x07FF /* Max number of those args */
164 * Note : if the number of args is fixed and the size < 16 octets,
165 * instead of passing a pointer we will put args in the iwreq struct...
168 /* ----------------------- OTHER CONSTANTS ----------------------- */
170 /* Maximum frequencies in the range struct */
171 #define IW_MAX_FREQUENCIES 16
172 /* Note : if you have something like 80 frequencies,
173 * don't increase this constant and don't fill the frequency list.
174 * The user will be able to set by channel anyway... */
176 /* Maximum of address that you may set with SPY */
179 /* Maximum of address that you may get in the
180 list of access points in range */
183 /* Maximum size of the ESSID string */
184 #define IW_ESSID_MAX_SIZE 32
186 /****************************** TYPES ******************************/
188 /* --------------------------- SUBTYPES --------------------------- */
191 * For numbers lower than 10^9, we encode the number in 'mant' and
193 * For number greater than 10^9, we divide it by a power of 10.
194 * The power of 10 is in 'exp', the result is in 'mant'.
198 __u32 m
; /* Mantissa */
199 __u16 e
; /* Exponent */
203 * Quality of the link
207 __u8 qual
; /* link quality (SNR or better...) */
208 __u8 level
; /* signal level */
209 __u8 noise
; /* noise level */
210 __u8 updated
; /* Flags to know if updated */
214 * Packet discarded in the wireless adapter due to
215 * "wireless" specific problems...
219 __u32 nwid
; /* Wrong nwid */
220 __u32 code
; /* Unable to code/decode */
221 __u32 misc
; /* Others cases */
225 * Encoding information (setting and so on)
226 * Encoding might be hardware encryption, scrambing or others
230 __u8 method
; /* Algorithm number / key used */
231 __u64 code
; /* Data/key used for algorithm */
235 /* ------------------------ WIRELESS STATS ------------------------ */
237 * Wireless statistics (used for /proc/net/wireless)
241 __u8 status
; /* Status
242 * - device dependent for now */
244 struct iw_quality qual
; /* Quality of the link
245 * (instant/mean/max) */
246 struct iw_discarded discard
; /* Packet discarded counts */
249 /* ------------------------ IOCTL REQUEST ------------------------ */
251 * The structure to exchange data for ioctl.
252 * This structure is the same as 'struct ifreq', but (re)defined for
255 * Note that it should fit on the same memory footprint !
256 * You should check this when increasing the above structures (16 octets)
257 * 16 octets = 128 bits. Warning, pointers might be 64 bits wide...
263 char ifrn_name
[IFNAMSIZ
]; /* if name, e.g. "en0" */
269 /* Config - generic */
271 /* Name : used to verify the presence of wireless extensions.
272 * Name of the protocol/provider... */
274 struct /* network id (or domain) : used to to */
275 { /* create logical channels on the air */
276 __u32 nwid
; /* value */
277 __u8 on
; /* active/unactive nwid */
280 struct iw_freq freq
; /* frequency or channel :
282 * > 1000 = frequency in Hz */
284 struct iw_encoding encoding
; /* Encoding stuff */
286 __u32 sensitivity
; /* signal level threshold */
288 struct sockaddr ap_addr
; /* Access point address */
290 struct /* For all data bigger than 16 octets */
292 caddr_t pointer
; /* Pointer to the data
294 __u16 length
; /* fields or byte size */
295 __u16 flags
; /* Optional params */
300 /* -------------------------- IOCTL DATA -------------------------- */
302 * For those ioctl which want to exchange mode data that what could
303 * fit in the above structure...
307 * Range of parameters
312 /* Informative stuff (to choose between different interface) */
313 __u32 throughput
; /* To give an idea... */
315 /* NWID (or domain id) */
316 __u32 min_nwid
; /* Minimal NWID we are able to set */
317 __u32 max_nwid
; /* Maximal NWID we are able to set */
320 __u16 num_channels
; /* Number of channels [0; num - 1] */
321 __u8 num_frequency
; /* Number of entry in the list */
322 struct iw_freq freq
[IW_MAX_FREQUENCIES
]; /* list */
323 /* Note : this frequency list doesn't need to fit channel numbers */
325 /* signal level threshold range */
328 /* Quality of link & SNR stuff */
329 struct iw_quality max_qual
; /* Quality of the link */
332 struct iw_encoding max_encoding
; /* Encoding max range */
336 * Private ioctl interface information
341 __u32 cmd
; /* Number of the ioctl to issue */
342 __u16 set_args
; /* Type and number of args */
343 __u16 get_args
; /* Type and number of args */
344 char name
[IFNAMSIZ
]; /* Name of the extension */
347 #endif /* _LINUX_WIRELESS_H */