OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [include/] [linux/] [wireless.h] - Blame information for rev 199

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 * This file define a set of standard wireless extensions
3
 *
4
 * Version :    6       18.2.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
#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... */
56
 
57
/**************************** CONSTANTS ****************************/
58
 
59
/* --------------------------- VERSION --------------------------- */
60
/*
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.
65
 */
66
#define WIRELESS_EXT    6
67
 
68
/*
69
 * Changes :
70
 *
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
76
 *
77
 * V3 to V4
78
 * --------
79
 *      - Add sensitivity
80
 *
81
 * V4 to V5
82
 * --------
83
 *      - Missing encoding definitions in range
84
 *      - Access points stuff
85
 *
86
 * V5 to V6
87
 * --------
88
 *      - 802.11 support
89
 */
90
 
91
/* -------------------------- IOCTL LIST -------------------------- */
92
 
93
/* Basic operations */
94
#define SIOCSIWNAME     0x8B00          /* Unused ??? */
95
#define SIOCGIWNAME     0x8B01          /* get name */
96
#define SIOCSIWNWID     0x8B02          /* set network id */
97
#define SIOCGIWNWID     0x8B03          /* get network id */
98
#define SIOCSIWFREQ     0x8B04          /* set channel/frequency */
99
#define SIOCGIWFREQ     0x8B05          /* get channel/frequency */
100
#define SIOCSIWENCODE   0x8B06          /* set encoding info */
101
#define SIOCGIWENCODE   0x8B07          /* get encoding info */
102
#define SIOCSIWSENS     0x8B08          /* set sensitivity */
103
#define SIOCGIWSENS     0x8B09          /* get sensitivity */
104
 
105
/* Informative stuff */
106
#define SIOCSIWRANGE    0x8B0A          /* Unused ??? */
107
#define SIOCGIWRANGE    0x8B0B          /* Get range of parameters */
108
#define SIOCSIWPRIV     0x8B0C          /* Unused ??? */
109
#define SIOCGIWPRIV     0x8B0D          /* get private ioctl interface info */
110
 
111
/* Mobile IP support */
112
#define SIOCSIWSPY      0x8B10          /* set spy addresses */
113
#define SIOCGIWSPY      0x8B11          /* get spy info (quality of link) */
114
 
115
/* Access Point manipulation */
116
#define SIOCSIWAP       0x8B14          /* set access point hardware addresses */
117
#define SIOCGIWAP       0x8B15          /* get access point hardware addresses */
118
#define SIOCGIWAPLIST   0x8B17          /* get list of access point in range */
119
 
120
/* 802.11 specific support */
121
#define SIOCSIWESSID    0x8B1A          /* set ESSID (network name) */
122
#define SIOCGIWESSID    0x8B1B          /* get ESSID */
123
/* As the ESSID is a string up to 32 bytes long, it doesn't fit within the
124
 * 'iwreq' structure, so we need to use the 'data' member to point to a
125
 * string in user space, like it is done for RANGE...
126
 */
127
 
128
/* ------------------------- IOCTL STUFF ------------------------- */
129
 
130
/* The first and the last (range) */
131
#define SIOCIWFIRST     0x8B00
132
#define SIOCIWLAST      0x8B1B
133
 
134
/* Even : get (world access), odd : set (root access) */
135
#define IW_IS_SET(cmd)  (!((cmd) & 0x1))
136
#define IW_IS_GET(cmd)  ((cmd) & 0x1)
137
 
138
/* ------------------------- PRIVATE INFO ------------------------- */
139
/*
140
 * The following is used with SIOCGIWPRIV. It allow a driver to define
141
 * the interface (name, type of data) for its private ioctl.
142
 * Privates ioctl are SIOCDEVPRIVATE -> SIOCDEVPRIVATE + 0xF
143
 */
144
 
145
#define IW_PRIV_TYPE_MASK       0x7000  /* Type of arguments */
146
#define IW_PRIV_TYPE_NONE       0x0000
147
#define IW_PRIV_TYPE_BYTE       0x1000  /* Char as number */
148
#define IW_PRIV_TYPE_CHAR       0x2000  /* Char as character */
149
#define IW_PRIV_TYPE_INT        0x4000  /* 32 bits int */
150
#define IW_PRIV_TYPE_FLOAT      0x5000
151
 
152
#define IW_PRIV_SIZE_FIXED      0x0800  /* Variable or fixed nuber of args */
153
 
154
#define IW_PRIV_SIZE_MASK       0x07FF  /* Max number of those args */
155
 
156
/*
157
 * Note : if the number of args is fixed and the size < 16 octets,
158
 * instead of passing a pointer we will put args in the iwreq struct...
159
 */
160
 
161
/* ----------------------- OTHER CONSTANTS ----------------------- */
162
 
163
/* Maximum frequencies in the range struct */
164
#define IW_MAX_FREQUENCIES      16
165
/* Note : if you have something like 80 frequencies,
166
 * don't increase this constant and don't fill the frequency list.
167
 * The user will be able to set by channel anyway... */
168
 
169
/* Maximum of address that you may set with SPY */
170
#define IW_MAX_SPY              8
171
 
172
/****************************** TYPES ******************************/
173
 
174
/* --------------------------- SUBTYPES --------------------------- */
175
/*
176
 *      A frequency
177
 *      For numbers lower than 10^9, we encode the number in 'mant' and
178
 *      set 'exp' to 0
179
 *      For number greater than 10^9, we divide it by a power of 10.
180
 *      The power of 10 is in 'exp', the result is in 'mant'.
181
 */
182
struct  iw_freq
183
{
184
        __u32           m;              /* Mantissa */
185
        __u16           e;              /* Exponent */
186
};
187
 
188
/*
189
 *      Quality of the link
190
 */
191
struct  iw_quality
192
{
193
        __u8            qual;           /* link quality (SNR or better...) */
194
        __u8            level;          /* signal level */
195
        __u8            noise;          /* noise level */
196
        __u8            updated;        /* Flags to know if updated */
197
};
198
 
199
/*
200
 *      Packet discarded in the wireless adapter due to
201
 *      "wireless" specific problems...
202
 */
203
struct  iw_discarded
204
{
205
        __u32           nwid;           /* Wrong nwid */
206
        __u32           code;           /* Unable to code/decode */
207
        __u32           misc;           /* Others cases */
208
};
209
 
210
/*
211
 *      Encoding information (setting and so on)
212
 *      Encoding might be hardware encryption, scrambing or others
213
 */
214
struct  iw_encoding
215
{
216
  __u8  method;                 /* Algorithm number / key used */
217
  __u64 code;                   /* Data/key used for algorithm */
218
};
219
 
220
 
221
/* ------------------------ WIRELESS STATS ------------------------ */
222
/*
223
 * Wireless statistics (used for /proc/net/wireless)
224
 */
225
struct  iw_statistics
226
{
227
        __u8            status;         /* Status
228
                                         * - device dependant for now */
229
 
230
        struct iw_quality       qual;           /* Quality of the link
231
                                                 * (instant/mean/max) */
232
        struct iw_discarded     discard;        /* Packet discarded counts */
233
};
234
 
235
/* ------------------------ IOCTL REQUEST ------------------------ */
236
/*
237
 * The structure to exchange data for ioctl.
238
 * This structure is the same as 'struct ifreq', but (re)defined for
239
 * convenience...
240
 *
241
 * Note that it should fit on the same memory footprint !
242
 * You should check this when increasing the above structures (16 octets)
243
 * 16 octets = 128 bits. Warning, pointers might be 64 bits wide...
244
 */
245
struct  iwreq
246
{
247
        union
248
        {
249
                char    ifrn_name[IFNAMSIZ];    /* if name, e.g. "en0" */
250
        } ifr_ifrn;
251
 
252
        /* Data part */
253
        union
254
        {
255
                /* Config - generic */
256
                char    name[IFNAMSIZ];
257
                /* Name : used to verify the presence of  wireless extensions.
258
                 * Name of the protocol/provider... */
259
 
260
                struct          /* network id (or domain) : used to */
261
                {               /* create logical channels on the air */
262
                        __u32   nwid;           /* value */
263
                        __u8    on;             /* active/unactive nwid */
264
                }       nwid;
265
 
266
                struct iw_freq  freq;   /* frequency or channel :
267
                                         * 0-1000 = channel
268
                                         * > 1000 = frequency in Hz */
269
 
270
                struct iw_encoding      encoding;       /* Encoding stuff */
271
 
272
                __u32   sensitivity;            /* signal level threshold */
273
 
274
                struct sockaddr ap_addr;        /* Access point address */
275
 
276
                struct          /* For all data bigger than 16 octets */
277
                {
278
                        caddr_t pointer;        /* Pointer to the data
279
                                                 * (in user space) */
280
                        __u16   length;         /* fields or byte size */
281
                        __u16   flags;          /* Unused */
282
                }       data;
283
        }       u;
284
};
285
 
286
/* -------------------------- IOCTL DATA -------------------------- */
287
/*
288
 *      For those ioctl which want to exchange mode data that what could
289
 *      fit in the above structure...
290
 */
291
 
292
/*
293
 *      Range of parameters
294
 */
295
 
296
struct  iw_range
297
{
298
        /* Informative stuff (to choose between different interface) */
299
        __u32           throughput;     /* To give an idea... */
300
 
301
        /* NWID (or domain id) */
302
        __u32           min_nwid;       /* Minimal NWID we are able to set */
303
        __u32           max_nwid;       /* Maximal NWID we are able to set */
304
 
305
        /* Frequency */
306
        __u16           num_channels;   /* Number of channels [0; num - 1] */
307
        __u8            num_frequency;  /* Number of entry in the list */
308
        struct iw_freq  freq[IW_MAX_FREQUENCIES];       /* list */
309
        /* Note : this frequency list doesn't need to fit channel numbers */
310
 
311
        /* signal level threshold range */
312
        __u32   sensitivity;
313
 
314
        /* Quality of link & SNR stuff */
315
        struct iw_quality       max_qual;       /* Quality of the link */
316
 
317
        /* Encoder stuff */
318
        struct iw_encoding      max_encoding;   /* Encoding max range */
319
};
320
 
321
/*
322
 * Private ioctl interface information
323
 */
324
 
325
struct  iw_priv_args
326
{
327
        __u32           cmd;            /* Number of the ioctl to issue */
328
        __u16           set_args;       /* Type and number of args */
329
        __u16           get_args;       /* Type and number of args */
330
        char            name[IFNAMSIZ]; /* Name of the extension */
331
};
332
 
333
#endif  /* _LINUX_WIRELESS_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.