remove @EAP_LDFLAGS@, no longer exists
[mech_eap.orig] / libeap / testing / wireless / wireless-6.h
1 /*
2  * This file define a set of standard wireless extensions
3  *
4  * Version :    7       23.4.99
5  *
6  * Authors :    Jean Tourrilhes - HPLB - <jt@hplb.hpl.hp.com>
7  */
8
9 #ifndef _LINUX_WIRELESS_H
10 #define _LINUX_WIRELESS_H
11
12 /************************** DOCUMENTATION **************************/
13 /*
14  * Basically, the wireless extensions are for now a set of standard ioctl
15  * call + /proc/net/wireless
16  *
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.
21  *
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.
25  *
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)
32  *
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)
39  *
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.
43  *
44  * These wireless extensions are not magic : each driver has to provide
45  * support for them...
46  *
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...
49  */
50
51 /***************************** INCLUDES *****************************/
52
53 #if 0
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... */
57 #endif
58
59 /**************************** CONSTANTS ****************************/
60
61 /* --------------------------- VERSION --------------------------- */
62 /*
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.
67  */
68 #define WIRELESS_EXT    6
69
70 /*
71  * Changes :
72  *
73  * V2 to V3
74  * --------
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
78  *
79  * V3 to V4
80  * --------
81  *      - Add sensitivity
82  *
83  * V4 to V5
84  * --------
85  *      - Missing encoding definitions in range
86  *      - Access points stuff
87  *
88  * V5 to V6
89  * --------
90  *      - 802.11 support (ESSID ioctls)
91  *
92  * V6 to V7
93  * --------
94  *      - define IW_ESSID_MAX_SIZE and IW_MAX_AP
95  */
96
97 /* -------------------------- IOCTL LIST -------------------------- */
98
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 */
110
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 */
116
117 /* Mobile IP support */
118 #define SIOCSIWSPY      0x8B10          /* set spy addresses */
119 #define SIOCGIWSPY      0x8B11          /* get spy info (quality of link) */
120
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 */
125
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.
133  */
134
135 /* ------------------------- IOCTL STUFF ------------------------- */
136
137 /* The first and the last (range) */
138 #define SIOCIWFIRST     0x8B00
139 #define SIOCIWLAST      0x8B1B
140
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)
144
145 /* ------------------------- PRIVATE INFO ------------------------- */
146 /*
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
150  */
151
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
158
159 #define IW_PRIV_SIZE_FIXED      0x0800  /* Variable or fixed nuber of args */
160
161 #define IW_PRIV_SIZE_MASK       0x07FF  /* Max number of those args */
162
163 /*
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...
166  */
167
168 /* ----------------------- OTHER CONSTANTS ----------------------- */
169
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... */
175
176 /* Maximum of address that you may set with SPY */
177 #define IW_MAX_SPY              8
178
179 /* Maximum of address that you may get in the
180    list of access points in range */
181 #define IW_MAX_AP               8
182
183 /* Maximum size of the ESSID string */
184 #define IW_ESSID_MAX_SIZE       32
185
186 /****************************** TYPES ******************************/
187
188 /* --------------------------- SUBTYPES --------------------------- */
189 /*
190  *      A frequency
191  *      For numbers lower than 10^9, we encode the number in 'mant' and
192  *      set 'exp' to 0
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'.
195  */
196 struct  iw_freq
197 {
198         __u32           m;              /* Mantissa */
199         __u16           e;              /* Exponent */
200 };
201
202 /*
203  *      Quality of the link
204  */
205 struct  iw_quality
206 {
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 */
211 };
212
213 /*
214  *      Packet discarded in the wireless adapter due to
215  *      "wireless" specific problems...
216  */
217 struct  iw_discarded
218 {
219         __u32           nwid;           /* Wrong nwid */
220         __u32           code;           /* Unable to code/decode */
221         __u32           misc;           /* Others cases */
222 };
223
224 /*
225  *      Encoding information (setting and so on)
226  *      Encoding might be hardware encryption, scrambing or others
227  */
228 struct  iw_encoding
229 {
230   __u8  method;                 /* Algorithm number / key used */
231   __u64 code;                   /* Data/key used for algorithm */
232 };
233
234
235 /* ------------------------ WIRELESS STATS ------------------------ */
236 /*
237  * Wireless statistics (used for /proc/net/wireless)
238  */
239 struct  iw_statistics
240 {
241         __u8            status;         /* Status
242                                          * - device dependent for now */
243
244         struct iw_quality       qual;           /* Quality of the link
245                                                  * (instant/mean/max) */
246         struct iw_discarded     discard;        /* Packet discarded counts */
247 };
248
249 /* ------------------------ IOCTL REQUEST ------------------------ */
250 /*
251  * The structure to exchange data for ioctl.
252  * This structure is the same as 'struct ifreq', but (re)defined for
253  * convenience...
254  *
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...
258  */
259 struct  iwreq 
260 {
261         union
262         {
263                 char    ifrn_name[IFNAMSIZ];    /* if name, e.g. "en0" */
264         } ifr_ifrn;
265
266         /* Data part */
267         union
268         {
269                 /* Config - generic */
270                 char    name[IFNAMSIZ];
271                 /* Name : used to verify the presence of  wireless extensions.
272                  * Name of the protocol/provider... */
273
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 */
278                 }       nwid;
279
280                 struct iw_freq  freq;   /* frequency or channel :
281                                          * 0-1000 = channel
282                                          * > 1000 = frequency in Hz */
283
284                 struct iw_encoding      encoding;       /* Encoding stuff */
285
286                 __u32   sensitivity;            /* signal level threshold */
287
288                 struct sockaddr ap_addr;        /* Access point address */
289
290                 struct          /* For all data bigger than 16 octets */
291                 {
292                         caddr_t pointer;        /* Pointer to the data
293                                                  * (in user space) */
294                         __u16   length;         /* fields or byte size */
295                         __u16   flags;          /* Optional params */
296                 }       data;
297         }       u;
298 };
299
300 /* -------------------------- IOCTL DATA -------------------------- */
301 /*
302  *      For those ioctl which want to exchange mode data that what could
303  *      fit in the above structure...
304  */
305
306 /*
307  *      Range of parameters
308  */
309
310 struct  iw_range
311 {
312         /* Informative stuff (to choose between different interface) */
313         __u32           throughput;     /* To give an idea... */
314
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 */
318
319         /* Frequency */
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 */
324
325         /* signal level threshold range */
326         __u32   sensitivity;
327
328         /* Quality of link & SNR stuff */
329         struct iw_quality       max_qual;       /* Quality of the link */
330
331         /* Encoder stuff */
332         struct iw_encoding      max_encoding;   /* Encoding max range */
333 };
334
335 /*
336  * Private ioctl interface information
337  */
338  
339 struct  iw_priv_args
340 {
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 */
345 };
346
347 #endif  /* _LINUX_WIRELESS_H */