root/include/uapi/linux/wireless.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
   2 /*
   3  * This file define a set of standard wireless extensions
   4  *
   5  * Version :    22      16.3.07
   6  *
   7  * Authors :    Jean Tourrilhes - HPL - <jt@hpl.hp.com>
   8  * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved.
   9  */
  10 
  11 #ifndef _UAPI_LINUX_WIRELESS_H
  12 #define _UAPI_LINUX_WIRELESS_H
  13 
  14 /************************** DOCUMENTATION **************************/
  15 /*
  16  * Initial APIs (1996 -> onward) :
  17  * -----------------------------
  18  * Basically, the wireless extensions are for now a set of standard ioctl
  19  * call + /proc/net/wireless
  20  *
  21  * The entry /proc/net/wireless give statistics and information on the
  22  * driver.
  23  * This is better than having each driver having its entry because
  24  * its centralised and we may remove the driver module safely.
  25  *
  26  * Ioctl are used to configure the driver and issue commands.  This is
  27  * better than command line options of insmod because we may want to
  28  * change dynamically (while the driver is running) some parameters.
  29  *
  30  * The ioctl mechanimsm are copied from standard devices ioctl.
  31  * We have the list of command plus a structure descibing the
  32  * data exchanged...
  33  * Note that to add these ioctl, I was obliged to modify :
  34  *      # net/core/dev.c (two place + add include)
  35  *      # net/ipv4/af_inet.c (one place + add include)
  36  *
  37  * /proc/net/wireless is a copy of /proc/net/dev.
  38  * We have a structure for data passed from the driver to /proc/net/wireless
  39  * Too add this, I've modified :
  40  *      # net/core/dev.c (two other places)
  41  *      # include/linux/netdevice.h (one place)
  42  *      # include/linux/proc_fs.h (one place)
  43  *
  44  * New driver API (2002 -> onward) :
  45  * -------------------------------
  46  * This file is only concerned with the user space API and common definitions.
  47  * The new driver API is defined and documented in :
  48  *      # include/net/iw_handler.h
  49  *
  50  * Note as well that /proc/net/wireless implementation has now moved in :
  51  *      # net/core/wireless.c
  52  *
  53  * Wireless Events (2002 -> onward) :
  54  * --------------------------------
  55  * Events are defined at the end of this file, and implemented in :
  56  *      # net/core/wireless.c
  57  *
  58  * Other comments :
  59  * --------------
  60  * Do not add here things that are redundant with other mechanisms
  61  * (drivers init, ifconfig, /proc/net/dev, ...) and with are not
  62  * wireless specific.
  63  *
  64  * These wireless extensions are not magic : each driver has to provide
  65  * support for them...
  66  *
  67  * IMPORTANT NOTE : As everything in the kernel, this is very much a
  68  * work in progress. Contact me if you have ideas of improvements...
  69  */
  70 
  71 /***************************** INCLUDES *****************************/
  72 
  73 #include <linux/types.h>                /* for __u* and __s* typedefs */
  74 #include <linux/socket.h>               /* for "struct sockaddr" et al  */
  75 #include <linux/if.h>                   /* for IFNAMSIZ and co... */
  76 
  77 /***************************** VERSION *****************************/
  78 /*
  79  * This constant is used to know the availability of the wireless
  80  * extensions and to know which version of wireless extensions it is
  81  * (there is some stuff that will be added in the future...)
  82  * I just plan to increment with each new version.
  83  */
  84 #define WIRELESS_EXT    22
  85 
  86 /*
  87  * Changes :
  88  *
  89  * V2 to V3
  90  * --------
  91  *      Alan Cox start some incompatibles changes. I've integrated a bit more.
  92  *      - Encryption renamed to Encode to avoid US regulation problems
  93  *      - Frequency changed from float to struct to avoid problems on old 386
  94  *
  95  * V3 to V4
  96  * --------
  97  *      - Add sensitivity
  98  *
  99  * V4 to V5
 100  * --------
 101  *      - Missing encoding definitions in range
 102  *      - Access points stuff
 103  *
 104  * V5 to V6
 105  * --------
 106  *      - 802.11 support (ESSID ioctls)
 107  *
 108  * V6 to V7
 109  * --------
 110  *      - define IW_ESSID_MAX_SIZE and IW_MAX_AP
 111  *
 112  * V7 to V8
 113  * --------
 114  *      - Changed my e-mail address
 115  *      - More 802.11 support (nickname, rate, rts, frag)
 116  *      - List index in frequencies
 117  *
 118  * V8 to V9
 119  * --------
 120  *      - Support for 'mode of operation' (ad-hoc, managed...)
 121  *      - Support for unicast and multicast power saving
 122  *      - Change encoding to support larger tokens (>64 bits)
 123  *      - Updated iw_params (disable, flags) and use it for NWID
 124  *      - Extracted iw_point from iwreq for clarity
 125  *
 126  * V9 to V10
 127  * ---------
 128  *      - Add PM capability to range structure
 129  *      - Add PM modifier : MAX/MIN/RELATIVE
 130  *      - Add encoding option : IW_ENCODE_NOKEY
 131  *      - Add TxPower ioctls (work like TxRate)
 132  *
 133  * V10 to V11
 134  * ----------
 135  *      - Add WE version in range (help backward/forward compatibility)
 136  *      - Add retry ioctls (work like PM)
 137  *
 138  * V11 to V12
 139  * ----------
 140  *      - Add SIOCSIWSTATS to get /proc/net/wireless programatically
 141  *      - Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space
 142  *      - Add new statistics (frag, retry, beacon)
 143  *      - Add average quality (for user space calibration)
 144  *
 145  * V12 to V13
 146  * ----------
 147  *      - Document creation of new driver API.
 148  *      - Extract union iwreq_data from struct iwreq (for new driver API).
 149  *      - Rename SIOCSIWNAME as SIOCSIWCOMMIT
 150  *
 151  * V13 to V14
 152  * ----------
 153  *      - Wireless Events support : define struct iw_event
 154  *      - Define additional specific event numbers
 155  *      - Add "addr" and "param" fields in union iwreq_data
 156  *      - AP scanning stuff (SIOCSIWSCAN and friends)
 157  *
 158  * V14 to V15
 159  * ----------
 160  *      - Add IW_PRIV_TYPE_ADDR for struct sockaddr private arg
 161  *      - Make struct iw_freq signed (both m & e), add explicit padding
 162  *      - Add IWEVCUSTOM for driver specific event/scanning token
 163  *      - Add IW_MAX_GET_SPY for driver returning a lot of addresses
 164  *      - Add IW_TXPOW_RANGE for range of Tx Powers
 165  *      - Add IWEVREGISTERED & IWEVEXPIRED events for Access Points
 166  *      - Add IW_MODE_MONITOR for passive monitor
 167  *
 168  * V15 to V16
 169  * ----------
 170  *      - Increase the number of bitrates in iw_range to 32 (for 802.11g)
 171  *      - Increase the number of frequencies in iw_range to 32 (for 802.11b+a)
 172  *      - Reshuffle struct iw_range for increases, add filler
 173  *      - Increase IW_MAX_AP to 64 for driver returning a lot of addresses
 174  *      - Remove IW_MAX_GET_SPY because conflict with enhanced spy support
 175  *      - Add SIOCSIWTHRSPY/SIOCGIWTHRSPY and "struct iw_thrspy"
 176  *      - Add IW_ENCODE_TEMP and iw_range->encoding_login_index
 177  *
 178  * V16 to V17
 179  * ----------
 180  *      - Add flags to frequency -> auto/fixed
 181  *      - Document (struct iw_quality *)->updated, add new flags (INVALID)
 182  *      - Wireless Event capability in struct iw_range
 183  *      - Add support for relative TxPower (yick !)
 184  *
 185  * V17 to V18 (From Jouni Malinen <j@w1.fi>)
 186  * ----------
 187  *      - Add support for WPA/WPA2
 188  *      - Add extended encoding configuration (SIOCSIWENCODEEXT and
 189  *        SIOCGIWENCODEEXT)
 190  *      - Add SIOCSIWGENIE/SIOCGIWGENIE
 191  *      - Add SIOCSIWMLME
 192  *      - Add SIOCSIWPMKSA
 193  *      - Add struct iw_range bit field for supported encoding capabilities
 194  *      - Add optional scan request parameters for SIOCSIWSCAN
 195  *      - Add SIOCSIWAUTH/SIOCGIWAUTH for setting authentication and WPA
 196  *        related parameters (extensible up to 4096 parameter values)
 197  *      - Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE,
 198  *        IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND
 199  *
 200  * V18 to V19
 201  * ----------
 202  *      - Remove (struct iw_point *)->pointer from events and streams
 203  *      - Remove header includes to help user space
 204  *      - Increase IW_ENCODING_TOKEN_MAX from 32 to 64
 205  *      - Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros
 206  *      - Add explicit flag to tell stats are in dBm : IW_QUAL_DBM
 207  *      - Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros
 208  *
 209  * V19 to V20
 210  * ----------
 211  *      - RtNetlink requests support (SET/GET)
 212  *
 213  * V20 to V21
 214  * ----------
 215  *      - Remove (struct net_device *)->get_wireless_stats()
 216  *      - Change length in ESSID and NICK to strlen() instead of strlen()+1
 217  *      - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers
 218  *      - Power/Retry relative values no longer * 100000
 219  *      - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI
 220  *
 221  * V21 to V22
 222  * ----------
 223  *      - Prevent leaking of kernel space in stream on 64 bits.
 224  */
 225 
 226 /**************************** CONSTANTS ****************************/
 227 
 228 /* -------------------------- IOCTL LIST -------------------------- */
 229 
 230 /* Wireless Identification */
 231 #define SIOCSIWCOMMIT   0x8B00          /* Commit pending changes to driver */
 232 #define SIOCGIWNAME     0x8B01          /* get name == wireless protocol */
 233 /* SIOCGIWNAME is used to verify the presence of Wireless Extensions.
 234  * Common values : "IEEE 802.11-DS", "IEEE 802.11-FH", "IEEE 802.11b"...
 235  * Don't put the name of your driver there, it's useless. */
 236 
 237 /* Basic operations */
 238 #define SIOCSIWNWID     0x8B02          /* set network id (pre-802.11) */
 239 #define SIOCGIWNWID     0x8B03          /* get network id (the cell) */
 240 #define SIOCSIWFREQ     0x8B04          /* set channel/frequency (Hz) */
 241 #define SIOCGIWFREQ     0x8B05          /* get channel/frequency (Hz) */
 242 #define SIOCSIWMODE     0x8B06          /* set operation mode */
 243 #define SIOCGIWMODE     0x8B07          /* get operation mode */
 244 #define SIOCSIWSENS     0x8B08          /* set sensitivity (dBm) */
 245 #define SIOCGIWSENS     0x8B09          /* get sensitivity (dBm) */
 246 
 247 /* Informative stuff */
 248 #define SIOCSIWRANGE    0x8B0A          /* Unused */
 249 #define SIOCGIWRANGE    0x8B0B          /* Get range of parameters */
 250 #define SIOCSIWPRIV     0x8B0C          /* Unused */
 251 #define SIOCGIWPRIV     0x8B0D          /* get private ioctl interface info */
 252 #define SIOCSIWSTATS    0x8B0E          /* Unused */
 253 #define SIOCGIWSTATS    0x8B0F          /* Get /proc/net/wireless stats */
 254 /* SIOCGIWSTATS is strictly used between user space and the kernel, and
 255  * is never passed to the driver (i.e. the driver will never see it). */
 256 
 257 /* Spy support (statistics per MAC address - used for Mobile IP support) */
 258 #define SIOCSIWSPY      0x8B10          /* set spy addresses */
 259 #define SIOCGIWSPY      0x8B11          /* get spy info (quality of link) */
 260 #define SIOCSIWTHRSPY   0x8B12          /* set spy threshold (spy event) */
 261 #define SIOCGIWTHRSPY   0x8B13          /* get spy threshold */
 262 
 263 /* Access Point manipulation */
 264 #define SIOCSIWAP       0x8B14          /* set access point MAC addresses */
 265 #define SIOCGIWAP       0x8B15          /* get access point MAC addresses */
 266 #define SIOCGIWAPLIST   0x8B17          /* Deprecated in favor of scanning */
 267 #define SIOCSIWSCAN     0x8B18          /* trigger scanning (list cells) */
 268 #define SIOCGIWSCAN     0x8B19          /* get scanning results */
 269 
 270 /* 802.11 specific support */
 271 #define SIOCSIWESSID    0x8B1A          /* set ESSID (network name) */
 272 #define SIOCGIWESSID    0x8B1B          /* get ESSID */
 273 #define SIOCSIWNICKN    0x8B1C          /* set node name/nickname */
 274 #define SIOCGIWNICKN    0x8B1D          /* get node name/nickname */
 275 /* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit
 276  * within the 'iwreq' structure, so we need to use the 'data' member to
 277  * point to a string in user space, like it is done for RANGE... */
 278 
 279 /* Other parameters useful in 802.11 and some other devices */
 280 #define SIOCSIWRATE     0x8B20          /* set default bit rate (bps) */
 281 #define SIOCGIWRATE     0x8B21          /* get default bit rate (bps) */
 282 #define SIOCSIWRTS      0x8B22          /* set RTS/CTS threshold (bytes) */
 283 #define SIOCGIWRTS      0x8B23          /* get RTS/CTS threshold (bytes) */
 284 #define SIOCSIWFRAG     0x8B24          /* set fragmentation thr (bytes) */
 285 #define SIOCGIWFRAG     0x8B25          /* get fragmentation thr (bytes) */
 286 #define SIOCSIWTXPOW    0x8B26          /* set transmit power (dBm) */
 287 #define SIOCGIWTXPOW    0x8B27          /* get transmit power (dBm) */
 288 #define SIOCSIWRETRY    0x8B28          /* set retry limits and lifetime */
 289 #define SIOCGIWRETRY    0x8B29          /* get retry limits and lifetime */
 290 
 291 /* Encoding stuff (scrambling, hardware security, WEP...) */
 292 #define SIOCSIWENCODE   0x8B2A          /* set encoding token & mode */
 293 #define SIOCGIWENCODE   0x8B2B          /* get encoding token & mode */
 294 /* Power saving stuff (power management, unicast and multicast) */
 295 #define SIOCSIWPOWER    0x8B2C          /* set Power Management settings */
 296 #define SIOCGIWPOWER    0x8B2D          /* get Power Management settings */
 297 
 298 /* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM).
 299  * This ioctl uses struct iw_point and data buffer that includes IE id and len
 300  * fields. More than one IE may be included in the request. Setting the generic
 301  * IE to empty buffer (len=0) removes the generic IE from the driver. Drivers
 302  * are allowed to generate their own WPA/RSN IEs, but in these cases, drivers
 303  * are required to report the used IE as a wireless event, e.g., when
 304  * associating with an AP. */
 305 #define SIOCSIWGENIE    0x8B30          /* set generic IE */
 306 #define SIOCGIWGENIE    0x8B31          /* get generic IE */
 307 
 308 /* WPA : IEEE 802.11 MLME requests */
 309 #define SIOCSIWMLME     0x8B16          /* request MLME operation; uses
 310                                          * struct iw_mlme */
 311 /* WPA : Authentication mode parameters */
 312 #define SIOCSIWAUTH     0x8B32          /* set authentication mode params */
 313 #define SIOCGIWAUTH     0x8B33          /* get authentication mode params */
 314 
 315 /* WPA : Extended version of encoding configuration */
 316 #define SIOCSIWENCODEEXT 0x8B34         /* set encoding token & mode */
 317 #define SIOCGIWENCODEEXT 0x8B35         /* get encoding token & mode */
 318 
 319 /* WPA2 : PMKSA cache management */
 320 #define SIOCSIWPMKSA    0x8B36          /* PMKSA cache operation */
 321 
 322 /* -------------------- DEV PRIVATE IOCTL LIST -------------------- */
 323 
 324 /* These 32 ioctl are wireless device private, for 16 commands.
 325  * Each driver is free to use them for whatever purpose it chooses,
 326  * however the driver *must* export the description of those ioctls
 327  * with SIOCGIWPRIV and *must* use arguments as defined below.
 328  * If you don't follow those rules, DaveM is going to hate you (reason :
 329  * it make mixed 32/64bit operation impossible).
 330  */
 331 #define SIOCIWFIRSTPRIV 0x8BE0
 332 #define SIOCIWLASTPRIV  0x8BFF
 333 /* Previously, we were using SIOCDEVPRIVATE, but we now have our
 334  * separate range because of collisions with other tools such as
 335  * 'mii-tool'.
 336  * We now have 32 commands, so a bit more space ;-).
 337  * Also, all 'even' commands are only usable by root and don't return the
 338  * content of ifr/iwr to user (but you are not obliged to use the set/get
 339  * convention, just use every other two command). More details in iwpriv.c.
 340  * And I repeat : you are not forced to use them with iwpriv, but you
 341  * must be compliant with it.
 342  */
 343 
 344 /* ------------------------- IOCTL STUFF ------------------------- */
 345 
 346 /* The first and the last (range) */
 347 #define SIOCIWFIRST     0x8B00
 348 #define SIOCIWLAST      SIOCIWLASTPRIV          /* 0x8BFF */
 349 #define IW_IOCTL_IDX(cmd)       ((cmd) - SIOCIWFIRST)
 350 #define IW_HANDLER(id, func)                    \
 351         [IW_IOCTL_IDX(id)] = func
 352 
 353 /* Odd : get (world access), even : set (root access) */
 354 #define IW_IS_SET(cmd)  (!((cmd) & 0x1))
 355 #define IW_IS_GET(cmd)  ((cmd) & 0x1)
 356 
 357 /* ----------------------- WIRELESS EVENTS ----------------------- */
 358 /* Those are *NOT* ioctls, do not issue request on them !!! */
 359 /* Most events use the same identifier as ioctl requests */
 360 
 361 #define IWEVTXDROP      0x8C00          /* Packet dropped to excessive retry */
 362 #define IWEVQUAL        0x8C01          /* Quality part of statistics (scan) */
 363 #define IWEVCUSTOM      0x8C02          /* Driver specific ascii string */
 364 #define IWEVREGISTERED  0x8C03          /* Discovered a new node (AP mode) */
 365 #define IWEVEXPIRED     0x8C04          /* Expired a node (AP mode) */
 366 #define IWEVGENIE       0x8C05          /* Generic IE (WPA, RSN, WMM, ..)
 367                                          * (scan results); This includes id and
 368                                          * length fields. One IWEVGENIE may
 369                                          * contain more than one IE. Scan
 370                                          * results may contain one or more
 371                                          * IWEVGENIE events. */
 372 #define IWEVMICHAELMICFAILURE 0x8C06    /* Michael MIC failure
 373                                          * (struct iw_michaelmicfailure)
 374                                          */
 375 #define IWEVASSOCREQIE  0x8C07          /* IEs used in (Re)Association Request.
 376                                          * The data includes id and length
 377                                          * fields and may contain more than one
 378                                          * IE. This event is required in
 379                                          * Managed mode if the driver
 380                                          * generates its own WPA/RSN IE. This
 381                                          * should be sent just before
 382                                          * IWEVREGISTERED event for the
 383                                          * association. */
 384 #define IWEVASSOCRESPIE 0x8C08          /* IEs used in (Re)Association
 385                                          * Response. The data includes id and
 386                                          * length fields and may contain more
 387                                          * than one IE. This may be sent
 388                                          * between IWEVASSOCREQIE and
 389                                          * IWEVREGISTERED events for the
 390                                          * association. */
 391 #define IWEVPMKIDCAND   0x8C09          /* PMKID candidate for RSN
 392                                          * pre-authentication
 393                                          * (struct iw_pmkid_cand) */
 394 
 395 #define IWEVFIRST       0x8C00
 396 #define IW_EVENT_IDX(cmd)       ((cmd) - IWEVFIRST)
 397 
 398 /* ------------------------- PRIVATE INFO ------------------------- */
 399 /*
 400  * The following is used with SIOCGIWPRIV. It allow a driver to define
 401  * the interface (name, type of data) for its private ioctl.
 402  * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV
 403  */
 404 
 405 #define IW_PRIV_TYPE_MASK       0x7000  /* Type of arguments */
 406 #define IW_PRIV_TYPE_NONE       0x0000
 407 #define IW_PRIV_TYPE_BYTE       0x1000  /* Char as number */
 408 #define IW_PRIV_TYPE_CHAR       0x2000  /* Char as character */
 409 #define IW_PRIV_TYPE_INT        0x4000  /* 32 bits int */
 410 #define IW_PRIV_TYPE_FLOAT      0x5000  /* struct iw_freq */
 411 #define IW_PRIV_TYPE_ADDR       0x6000  /* struct sockaddr */
 412 
 413 #define IW_PRIV_SIZE_FIXED      0x0800  /* Variable or fixed number of args */
 414 
 415 #define IW_PRIV_SIZE_MASK       0x07FF  /* Max number of those args */
 416 
 417 /*
 418  * Note : if the number of args is fixed and the size < 16 octets,
 419  * instead of passing a pointer we will put args in the iwreq struct...
 420  */
 421 
 422 /* ----------------------- OTHER CONSTANTS ----------------------- */
 423 
 424 /* Maximum frequencies in the range struct */
 425 #define IW_MAX_FREQUENCIES      32
 426 /* Note : if you have something like 80 frequencies,
 427  * don't increase this constant and don't fill the frequency list.
 428  * The user will be able to set by channel anyway... */
 429 
 430 /* Maximum bit rates in the range struct */
 431 #define IW_MAX_BITRATES         32
 432 
 433 /* Maximum tx powers in the range struct */
 434 #define IW_MAX_TXPOWER          8
 435 /* Note : if you more than 8 TXPowers, just set the max and min or
 436  * a few of them in the struct iw_range. */
 437 
 438 /* Maximum of address that you may set with SPY */
 439 #define IW_MAX_SPY              8
 440 
 441 /* Maximum of address that you may get in the
 442    list of access points in range */
 443 #define IW_MAX_AP               64
 444 
 445 /* Maximum size of the ESSID and NICKN strings */
 446 #define IW_ESSID_MAX_SIZE       32
 447 
 448 /* Modes of operation */
 449 #define IW_MODE_AUTO    0       /* Let the driver decides */
 450 #define IW_MODE_ADHOC   1       /* Single cell network */
 451 #define IW_MODE_INFRA   2       /* Multi cell network, roaming, ... */
 452 #define IW_MODE_MASTER  3       /* Synchronisation master or Access Point */
 453 #define IW_MODE_REPEAT  4       /* Wireless Repeater (forwarder) */
 454 #define IW_MODE_SECOND  5       /* Secondary master/repeater (backup) */
 455 #define IW_MODE_MONITOR 6       /* Passive monitor (listen only) */
 456 #define IW_MODE_MESH    7       /* Mesh (IEEE 802.11s) network */
 457 
 458 /* Statistics flags (bitmask in updated) */
 459 #define IW_QUAL_QUAL_UPDATED    0x01    /* Value was updated since last read */
 460 #define IW_QUAL_LEVEL_UPDATED   0x02
 461 #define IW_QUAL_NOISE_UPDATED   0x04
 462 #define IW_QUAL_ALL_UPDATED     0x07
 463 #define IW_QUAL_DBM             0x08    /* Level + Noise are dBm */
 464 #define IW_QUAL_QUAL_INVALID    0x10    /* Driver doesn't provide value */
 465 #define IW_QUAL_LEVEL_INVALID   0x20
 466 #define IW_QUAL_NOISE_INVALID   0x40
 467 #define IW_QUAL_RCPI            0x80    /* Level + Noise are 802.11k RCPI */
 468 #define IW_QUAL_ALL_INVALID     0x70
 469 
 470 /* Frequency flags */
 471 #define IW_FREQ_AUTO            0x00    /* Let the driver decides */
 472 #define IW_FREQ_FIXED           0x01    /* Force a specific value */
 473 
 474 /* Maximum number of size of encoding token available
 475  * they are listed in the range structure */
 476 #define IW_MAX_ENCODING_SIZES   8
 477 
 478 /* Maximum size of the encoding token in bytes */
 479 #define IW_ENCODING_TOKEN_MAX   64      /* 512 bits (for now) */
 480 
 481 /* Flags for encoding (along with the token) */
 482 #define IW_ENCODE_INDEX         0x00FF  /* Token index (if needed) */
 483 #define IW_ENCODE_FLAGS         0xFF00  /* Flags defined below */
 484 #define IW_ENCODE_MODE          0xF000  /* Modes defined below */
 485 #define IW_ENCODE_DISABLED      0x8000  /* Encoding disabled */
 486 #define IW_ENCODE_ENABLED       0x0000  /* Encoding enabled */
 487 #define IW_ENCODE_RESTRICTED    0x4000  /* Refuse non-encoded packets */
 488 #define IW_ENCODE_OPEN          0x2000  /* Accept non-encoded packets */
 489 #define IW_ENCODE_NOKEY         0x0800  /* Key is write only, so not present */
 490 #define IW_ENCODE_TEMP          0x0400  /* Temporary key */
 491 
 492 /* Power management flags available (along with the value, if any) */
 493 #define IW_POWER_ON             0x0000  /* No details... */
 494 #define IW_POWER_TYPE           0xF000  /* Type of parameter */
 495 #define IW_POWER_PERIOD         0x1000  /* Value is a period/duration of  */
 496 #define IW_POWER_TIMEOUT        0x2000  /* Value is a timeout (to go asleep) */
 497 #define IW_POWER_MODE           0x0F00  /* Power Management mode */
 498 #define IW_POWER_UNICAST_R      0x0100  /* Receive only unicast messages */
 499 #define IW_POWER_MULTICAST_R    0x0200  /* Receive only multicast messages */
 500 #define IW_POWER_ALL_R          0x0300  /* Receive all messages though PM */
 501 #define IW_POWER_FORCE_S        0x0400  /* Force PM procedure for sending unicast */
 502 #define IW_POWER_REPEATER       0x0800  /* Repeat broadcast messages in PM period */
 503 #define IW_POWER_MODIFIER       0x000F  /* Modify a parameter */
 504 #define IW_POWER_MIN            0x0001  /* Value is a minimum  */
 505 #define IW_POWER_MAX            0x0002  /* Value is a maximum */
 506 #define IW_POWER_RELATIVE       0x0004  /* Value is not in seconds/ms/us */
 507 
 508 /* Transmit Power flags available */
 509 #define IW_TXPOW_TYPE           0x00FF  /* Type of value */
 510 #define IW_TXPOW_DBM            0x0000  /* Value is in dBm */
 511 #define IW_TXPOW_MWATT          0x0001  /* Value is in mW */
 512 #define IW_TXPOW_RELATIVE       0x0002  /* Value is in arbitrary units */
 513 #define IW_TXPOW_RANGE          0x1000  /* Range of value between min/max */
 514 
 515 /* Retry limits and lifetime flags available */
 516 #define IW_RETRY_ON             0x0000  /* No details... */
 517 #define IW_RETRY_TYPE           0xF000  /* Type of parameter */
 518 #define IW_RETRY_LIMIT          0x1000  /* Maximum number of retries*/
 519 #define IW_RETRY_LIFETIME       0x2000  /* Maximum duration of retries in us */
 520 #define IW_RETRY_MODIFIER       0x00FF  /* Modify a parameter */
 521 #define IW_RETRY_MIN            0x0001  /* Value is a minimum  */
 522 #define IW_RETRY_MAX            0x0002  /* Value is a maximum */
 523 #define IW_RETRY_RELATIVE       0x0004  /* Value is not in seconds/ms/us */
 524 #define IW_RETRY_SHORT          0x0010  /* Value is for short packets  */
 525 #define IW_RETRY_LONG           0x0020  /* Value is for long packets */
 526 
 527 /* Scanning request flags */
 528 #define IW_SCAN_DEFAULT         0x0000  /* Default scan of the driver */
 529 #define IW_SCAN_ALL_ESSID       0x0001  /* Scan all ESSIDs */
 530 #define IW_SCAN_THIS_ESSID      0x0002  /* Scan only this ESSID */
 531 #define IW_SCAN_ALL_FREQ        0x0004  /* Scan all Frequencies */
 532 #define IW_SCAN_THIS_FREQ       0x0008  /* Scan only this Frequency */
 533 #define IW_SCAN_ALL_MODE        0x0010  /* Scan all Modes */
 534 #define IW_SCAN_THIS_MODE       0x0020  /* Scan only this Mode */
 535 #define IW_SCAN_ALL_RATE        0x0040  /* Scan all Bit-Rates */
 536 #define IW_SCAN_THIS_RATE       0x0080  /* Scan only this Bit-Rate */
 537 /* struct iw_scan_req scan_type */
 538 #define IW_SCAN_TYPE_ACTIVE 0
 539 #define IW_SCAN_TYPE_PASSIVE 1
 540 /* Maximum size of returned data */
 541 #define IW_SCAN_MAX_DATA        4096    /* In bytes */
 542 
 543 /* Scan capability flags - in (struct iw_range *)->scan_capa */
 544 #define IW_SCAN_CAPA_NONE               0x00
 545 #define IW_SCAN_CAPA_ESSID              0x01
 546 #define IW_SCAN_CAPA_BSSID              0x02
 547 #define IW_SCAN_CAPA_CHANNEL    0x04
 548 #define IW_SCAN_CAPA_MODE               0x08
 549 #define IW_SCAN_CAPA_RATE               0x10
 550 #define IW_SCAN_CAPA_TYPE               0x20
 551 #define IW_SCAN_CAPA_TIME               0x40
 552 
 553 /* Max number of char in custom event - use multiple of them if needed */
 554 #define IW_CUSTOM_MAX           256     /* In bytes */
 555 
 556 /* Generic information element */
 557 #define IW_GENERIC_IE_MAX       1024
 558 
 559 /* MLME requests (SIOCSIWMLME / struct iw_mlme) */
 560 #define IW_MLME_DEAUTH          0
 561 #define IW_MLME_DISASSOC        1
 562 #define IW_MLME_AUTH            2
 563 #define IW_MLME_ASSOC           3
 564 
 565 /* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */
 566 #define IW_AUTH_INDEX           0x0FFF
 567 #define IW_AUTH_FLAGS           0xF000
 568 /* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095)
 569  * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the
 570  * parameter that is being set/get to; value will be read/written to
 571  * struct iw_param value field) */
 572 #define IW_AUTH_WPA_VERSION             0
 573 #define IW_AUTH_CIPHER_PAIRWISE         1
 574 #define IW_AUTH_CIPHER_GROUP            2
 575 #define IW_AUTH_KEY_MGMT                3
 576 #define IW_AUTH_TKIP_COUNTERMEASURES    4
 577 #define IW_AUTH_DROP_UNENCRYPTED        5
 578 #define IW_AUTH_80211_AUTH_ALG          6
 579 #define IW_AUTH_WPA_ENABLED             7
 580 #define IW_AUTH_RX_UNENCRYPTED_EAPOL    8
 581 #define IW_AUTH_ROAMING_CONTROL         9
 582 #define IW_AUTH_PRIVACY_INVOKED         10
 583 #define IW_AUTH_CIPHER_GROUP_MGMT       11
 584 #define IW_AUTH_MFP                     12
 585 
 586 /* IW_AUTH_WPA_VERSION values (bit field) */
 587 #define IW_AUTH_WPA_VERSION_DISABLED    0x00000001
 588 #define IW_AUTH_WPA_VERSION_WPA         0x00000002
 589 #define IW_AUTH_WPA_VERSION_WPA2        0x00000004
 590 
 591 /* IW_AUTH_PAIRWISE_CIPHER, IW_AUTH_GROUP_CIPHER, and IW_AUTH_CIPHER_GROUP_MGMT
 592  * values (bit field) */
 593 #define IW_AUTH_CIPHER_NONE     0x00000001
 594 #define IW_AUTH_CIPHER_WEP40    0x00000002
 595 #define IW_AUTH_CIPHER_TKIP     0x00000004
 596 #define IW_AUTH_CIPHER_CCMP     0x00000008
 597 #define IW_AUTH_CIPHER_WEP104   0x00000010
 598 #define IW_AUTH_CIPHER_AES_CMAC 0x00000020
 599 
 600 /* IW_AUTH_KEY_MGMT values (bit field) */
 601 #define IW_AUTH_KEY_MGMT_802_1X 1
 602 #define IW_AUTH_KEY_MGMT_PSK    2
 603 
 604 /* IW_AUTH_80211_AUTH_ALG values (bit field) */
 605 #define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001
 606 #define IW_AUTH_ALG_SHARED_KEY  0x00000002
 607 #define IW_AUTH_ALG_LEAP        0x00000004
 608 
 609 /* IW_AUTH_ROAMING_CONTROL values */
 610 #define IW_AUTH_ROAMING_ENABLE  0       /* driver/firmware based roaming */
 611 #define IW_AUTH_ROAMING_DISABLE 1       /* user space program used for roaming
 612                                          * control */
 613 
 614 /* IW_AUTH_MFP (management frame protection) values */
 615 #define IW_AUTH_MFP_DISABLED    0       /* MFP disabled */
 616 #define IW_AUTH_MFP_OPTIONAL    1       /* MFP optional */
 617 #define IW_AUTH_MFP_REQUIRED    2       /* MFP required */
 618 
 619 /* SIOCSIWENCODEEXT definitions */
 620 #define IW_ENCODE_SEQ_MAX_SIZE  8
 621 /* struct iw_encode_ext ->alg */
 622 #define IW_ENCODE_ALG_NONE      0
 623 #define IW_ENCODE_ALG_WEP       1
 624 #define IW_ENCODE_ALG_TKIP      2
 625 #define IW_ENCODE_ALG_CCMP      3
 626 #define IW_ENCODE_ALG_PMK       4
 627 #define IW_ENCODE_ALG_AES_CMAC  5
 628 /* struct iw_encode_ext ->ext_flags */
 629 #define IW_ENCODE_EXT_TX_SEQ_VALID      0x00000001
 630 #define IW_ENCODE_EXT_RX_SEQ_VALID      0x00000002
 631 #define IW_ENCODE_EXT_GROUP_KEY         0x00000004
 632 #define IW_ENCODE_EXT_SET_TX_KEY        0x00000008
 633 
 634 /* IWEVMICHAELMICFAILURE : struct iw_michaelmicfailure ->flags */
 635 #define IW_MICFAILURE_KEY_ID    0x00000003 /* Key ID 0..3 */
 636 #define IW_MICFAILURE_GROUP     0x00000004
 637 #define IW_MICFAILURE_PAIRWISE  0x00000008
 638 #define IW_MICFAILURE_STAKEY    0x00000010
 639 #define IW_MICFAILURE_COUNT     0x00000060 /* 1 or 2 (0 = count not supported)
 640                                             */
 641 
 642 /* Bit field values for enc_capa in struct iw_range */
 643 #define IW_ENC_CAPA_WPA         0x00000001
 644 #define IW_ENC_CAPA_WPA2        0x00000002
 645 #define IW_ENC_CAPA_CIPHER_TKIP 0x00000004
 646 #define IW_ENC_CAPA_CIPHER_CCMP 0x00000008
 647 #define IW_ENC_CAPA_4WAY_HANDSHAKE      0x00000010
 648 
 649 /* Event capability macros - in (struct iw_range *)->event_capa
 650  * Because we have more than 32 possible events, we use an array of
 651  * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */
 652 #define IW_EVENT_CAPA_BASE(cmd)         ((cmd >= SIOCIWFIRSTPRIV) ? \
 653                                          (cmd - SIOCIWFIRSTPRIV + 0x60) : \
 654                                          (cmd - SIOCIWFIRST))
 655 #define IW_EVENT_CAPA_INDEX(cmd)        (IW_EVENT_CAPA_BASE(cmd) >> 5)
 656 #define IW_EVENT_CAPA_MASK(cmd)         (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F))
 657 /* Event capability constants - event autogenerated by the kernel
 658  * This list is valid for most 802.11 devices, customise as needed... */
 659 #define IW_EVENT_CAPA_K_0       (IW_EVENT_CAPA_MASK(0x8B04) | \
 660                                  IW_EVENT_CAPA_MASK(0x8B06) | \
 661                                  IW_EVENT_CAPA_MASK(0x8B1A))
 662 #define IW_EVENT_CAPA_K_1       (IW_EVENT_CAPA_MASK(0x8B2A))
 663 /* "Easy" macro to set events in iw_range (less efficient) */
 664 #define IW_EVENT_CAPA_SET(event_capa, cmd) (event_capa[IW_EVENT_CAPA_INDEX(cmd)] |= IW_EVENT_CAPA_MASK(cmd))
 665 #define IW_EVENT_CAPA_SET_KERNEL(event_capa) {event_capa[0] |= IW_EVENT_CAPA_K_0; event_capa[1] |= IW_EVENT_CAPA_K_1; }
 666 
 667 
 668 /****************************** TYPES ******************************/
 669 
 670 /* --------------------------- SUBTYPES --------------------------- */
 671 /*
 672  *      Generic format for most parameters that fit in an int
 673  */
 674 struct iw_param {
 675   __s32         value;          /* The value of the parameter itself */
 676   __u8          fixed;          /* Hardware should not use auto select */
 677   __u8          disabled;       /* Disable the feature */
 678   __u16         flags;          /* Various specifc flags (if any) */
 679 };
 680 
 681 /*
 682  *      For all data larger than 16 octets, we need to use a
 683  *      pointer to memory allocated in user space.
 684  */
 685 struct iw_point {
 686   void __user   *pointer;       /* Pointer to the data  (in user space) */
 687   __u16         length;         /* number of fields or size in bytes */
 688   __u16         flags;          /* Optional params */
 689 };
 690 
 691 
 692 /*
 693  *      A frequency
 694  *      For numbers lower than 10^9, we encode the number in 'm' and
 695  *      set 'e' to 0
 696  *      For number greater than 10^9, we divide it by the lowest power
 697  *      of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')...
 698  *      The power of 10 is in 'e', the result of the division is in 'm'.
 699  */
 700 struct iw_freq {
 701         __s32           m;              /* Mantissa */
 702         __s16           e;              /* Exponent */
 703         __u8            i;              /* List index (when in range struct) */
 704         __u8            flags;          /* Flags (fixed/auto) */
 705 };
 706 
 707 /*
 708  *      Quality of the link
 709  */
 710 struct iw_quality {
 711         __u8            qual;           /* link quality (%retries, SNR,
 712                                            %missed beacons or better...) */
 713         __u8            level;          /* signal level (dBm) */
 714         __u8            noise;          /* noise level (dBm) */
 715         __u8            updated;        /* Flags to know if updated */
 716 };
 717 
 718 /*
 719  *      Packet discarded in the wireless adapter due to
 720  *      "wireless" specific problems...
 721  *      Note : the list of counter and statistics in net_device_stats
 722  *      is already pretty exhaustive, and you should use that first.
 723  *      This is only additional stats...
 724  */
 725 struct iw_discarded {
 726         __u32           nwid;           /* Rx : Wrong nwid/essid */
 727         __u32           code;           /* Rx : Unable to code/decode (WEP) */
 728         __u32           fragment;       /* Rx : Can't perform MAC reassembly */
 729         __u32           retries;        /* Tx : Max MAC retries num reached */
 730         __u32           misc;           /* Others cases */
 731 };
 732 
 733 /*
 734  *      Packet/Time period missed in the wireless adapter due to
 735  *      "wireless" specific problems...
 736  */
 737 struct iw_missed {
 738         __u32           beacon;         /* Missed beacons/superframe */
 739 };
 740 
 741 /*
 742  *      Quality range (for spy threshold)
 743  */
 744 struct iw_thrspy {
 745         struct sockaddr         addr;           /* Source address (hw/mac) */
 746         struct iw_quality       qual;           /* Quality of the link */
 747         struct iw_quality       low;            /* Low threshold */
 748         struct iw_quality       high;           /* High threshold */
 749 };
 750 
 751 /*
 752  *      Optional data for scan request
 753  *
 754  *      Note: these optional parameters are controlling parameters for the
 755  *      scanning behavior, these do not apply to getting scan results
 756  *      (SIOCGIWSCAN). Drivers are expected to keep a local BSS table and
 757  *      provide a merged results with all BSSes even if the previous scan
 758  *      request limited scanning to a subset, e.g., by specifying an SSID.
 759  *      Especially, scan results are required to include an entry for the
 760  *      current BSS if the driver is in Managed mode and associated with an AP.
 761  */
 762 struct iw_scan_req {
 763         __u8            scan_type; /* IW_SCAN_TYPE_{ACTIVE,PASSIVE} */
 764         __u8            essid_len;
 765         __u8            num_channels; /* num entries in channel_list;
 766                                        * 0 = scan all allowed channels */
 767         __u8            flags; /* reserved as padding; use zero, this may
 768                                 * be used in the future for adding flags
 769                                 * to request different scan behavior */
 770         struct sockaddr bssid; /* ff:ff:ff:ff:ff:ff for broadcast BSSID or
 771                                 * individual address of a specific BSS */
 772 
 773         /*
 774          * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of using
 775          * the current ESSID. This allows scan requests for specific ESSID
 776          * without having to change the current ESSID and potentially breaking
 777          * the current association.
 778          */
 779         __u8            essid[IW_ESSID_MAX_SIZE];
 780 
 781         /*
 782          * Optional parameters for changing the default scanning behavior.
 783          * These are based on the MLME-SCAN.request from IEEE Std 802.11.
 784          * TU is 1.024 ms. If these are set to 0, driver is expected to use
 785          * reasonable default values. min_channel_time defines the time that
 786          * will be used to wait for the first reply on each channel. If no
 787          * replies are received, next channel will be scanned after this. If
 788          * replies are received, total time waited on the channel is defined by
 789          * max_channel_time.
 790          */
 791         __u32           min_channel_time; /* in TU */
 792         __u32           max_channel_time; /* in TU */
 793 
 794         struct iw_freq  channel_list[IW_MAX_FREQUENCIES];
 795 };
 796 
 797 /* ------------------------- WPA SUPPORT ------------------------- */
 798 
 799 /*
 800  *      Extended data structure for get/set encoding (this is used with
 801  *      SIOCSIWENCODEEXT/SIOCGIWENCODEEXT. struct iw_point and IW_ENCODE_*
 802  *      flags are used in the same way as with SIOCSIWENCODE/SIOCGIWENCODE and
 803  *      only the data contents changes (key data -> this structure, including
 804  *      key data).
 805  *
 806  *      If the new key is the first group key, it will be set as the default
 807  *      TX key. Otherwise, default TX key index is only changed if
 808  *      IW_ENCODE_EXT_SET_TX_KEY flag is set.
 809  *
 810  *      Key will be changed with SIOCSIWENCODEEXT in all cases except for
 811  *      special "change TX key index" operation which is indicated by setting
 812  *      key_len = 0 and ext_flags |= IW_ENCODE_EXT_SET_TX_KEY.
 813  *
 814  *      tx_seq/rx_seq are only used when respective
 815  *      IW_ENCODE_EXT_{TX,RX}_SEQ_VALID flag is set in ext_flags. Normal
 816  *      TKIP/CCMP operation is to set RX seq with SIOCSIWENCODEEXT and start
 817  *      TX seq from zero whenever key is changed. SIOCGIWENCODEEXT is normally
 818  *      used only by an Authenticator (AP or an IBSS station) to get the
 819  *      current TX sequence number. Using TX_SEQ_VALID for SIOCSIWENCODEEXT and
 820  *      RX_SEQ_VALID for SIOCGIWENCODEEXT are optional, but can be useful for
 821  *      debugging/testing.
 822  */
 823 struct iw_encode_ext {
 824         __u32           ext_flags; /* IW_ENCODE_EXT_* */
 825         __u8            tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
 826         __u8            rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
 827         struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast
 828                                * (group) keys or unicast address for
 829                                * individual keys */
 830         __u16           alg; /* IW_ENCODE_ALG_* */
 831         __u16           key_len;
 832         __u8            key[0];
 833 };
 834 
 835 /* SIOCSIWMLME data */
 836 struct iw_mlme {
 837         __u16           cmd; /* IW_MLME_* */
 838         __u16           reason_code;
 839         struct sockaddr addr;
 840 };
 841 
 842 /* SIOCSIWPMKSA data */
 843 #define IW_PMKSA_ADD            1
 844 #define IW_PMKSA_REMOVE         2
 845 #define IW_PMKSA_FLUSH          3
 846 
 847 #define IW_PMKID_LEN    16
 848 
 849 struct iw_pmksa {
 850         __u32           cmd; /* IW_PMKSA_* */
 851         struct sockaddr bssid;
 852         __u8            pmkid[IW_PMKID_LEN];
 853 };
 854 
 855 /* IWEVMICHAELMICFAILURE data */
 856 struct iw_michaelmicfailure {
 857         __u32           flags;
 858         struct sockaddr src_addr;
 859         __u8            tsc[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
 860 };
 861 
 862 /* IWEVPMKIDCAND data */
 863 #define IW_PMKID_CAND_PREAUTH   0x00000001 /* RNS pre-authentication enabled */
 864 struct iw_pmkid_cand {
 865         __u32           flags; /* IW_PMKID_CAND_* */
 866         __u32           index; /* the smaller the index, the higher the
 867                                 * priority */
 868         struct sockaddr bssid;
 869 };
 870 
 871 /* ------------------------ WIRELESS STATS ------------------------ */
 872 /*
 873  * Wireless statistics (used for /proc/net/wireless)
 874  */
 875 struct iw_statistics {
 876         __u16           status;         /* Status
 877                                          * - device dependent for now */
 878 
 879         struct iw_quality       qual;           /* Quality of the link
 880                                                  * (instant/mean/max) */
 881         struct iw_discarded     discard;        /* Packet discarded counts */
 882         struct iw_missed        miss;           /* Packet missed counts */
 883 };
 884 
 885 /* ------------------------ IOCTL REQUEST ------------------------ */
 886 /*
 887  * This structure defines the payload of an ioctl, and is used
 888  * below.
 889  *
 890  * Note that this structure should fit on the memory footprint
 891  * of iwreq (which is the same as ifreq), which mean a max size of
 892  * 16 octets = 128 bits. Warning, pointers might be 64 bits wide...
 893  * You should check this when increasing the structures defined
 894  * above in this file...
 895  */
 896 union iwreq_data {
 897         /* Config - generic */
 898         char            name[IFNAMSIZ];
 899         /* Name : used to verify the presence of  wireless extensions.
 900          * Name of the protocol/provider... */
 901 
 902         struct iw_point essid;          /* Extended network name */
 903         struct iw_param nwid;           /* network id (or domain - the cell) */
 904         struct iw_freq  freq;           /* frequency or channel :
 905                                          * 0-1000 = channel
 906                                          * > 1000 = frequency in Hz */
 907 
 908         struct iw_param sens;           /* signal level threshold */
 909         struct iw_param bitrate;        /* default bit rate */
 910         struct iw_param txpower;        /* default transmit power */
 911         struct iw_param rts;            /* RTS threshold threshold */
 912         struct iw_param frag;           /* Fragmentation threshold */
 913         __u32           mode;           /* Operation mode */
 914         struct iw_param retry;          /* Retry limits & lifetime */
 915 
 916         struct iw_point encoding;       /* Encoding stuff : tokens */
 917         struct iw_param power;          /* PM duration/timeout */
 918         struct iw_quality qual;         /* Quality part of statistics */
 919 
 920         struct sockaddr ap_addr;        /* Access point address */
 921         struct sockaddr addr;           /* Destination address (hw/mac) */
 922 
 923         struct iw_param param;          /* Other small parameters */
 924         struct iw_point data;           /* Other large parameters */
 925 };
 926 
 927 /*
 928  * The structure to exchange data for ioctl.
 929  * This structure is the same as 'struct ifreq', but (re)defined for
 930  * convenience...
 931  * Do I need to remind you about structure size (32 octets) ?
 932  */
 933 struct iwreq {
 934         union
 935         {
 936                 char    ifrn_name[IFNAMSIZ];    /* if name, e.g. "eth0" */
 937         } ifr_ifrn;
 938 
 939         /* Data part (defined just above) */
 940         union iwreq_data        u;
 941 };
 942 
 943 /* -------------------------- IOCTL DATA -------------------------- */
 944 /*
 945  *      For those ioctl which want to exchange mode data that what could
 946  *      fit in the above structure...
 947  */
 948 
 949 /*
 950  *      Range of parameters
 951  */
 952 
 953 struct iw_range {
 954         /* Informative stuff (to choose between different interface) */
 955         __u32           throughput;     /* To give an idea... */
 956         /* In theory this value should be the maximum benchmarked
 957          * TCP/IP throughput, because with most of these devices the
 958          * bit rate is meaningless (overhead an co) to estimate how
 959          * fast the connection will go and pick the fastest one.
 960          * I suggest people to play with Netperf or any benchmark...
 961          */
 962 
 963         /* NWID (or domain id) */
 964         __u32           min_nwid;       /* Minimal NWID we are able to set */
 965         __u32           max_nwid;       /* Maximal NWID we are able to set */
 966 
 967         /* Old Frequency (backward compat - moved lower ) */
 968         __u16           old_num_channels;
 969         __u8            old_num_frequency;
 970 
 971         /* Scan capabilities */
 972         __u8            scan_capa;      /* IW_SCAN_CAPA_* bit field */
 973 
 974         /* Wireless event capability bitmasks */
 975         __u32           event_capa[6];
 976 
 977         /* signal level threshold range */
 978         __s32           sensitivity;
 979 
 980         /* Quality of link & SNR stuff */
 981         /* Quality range (link, level, noise)
 982          * If the quality is absolute, it will be in the range [0 ; max_qual],
 983          * if the quality is dBm, it will be in the range [max_qual ; 0].
 984          * Don't forget that we use 8 bit arithmetics... */
 985         struct iw_quality       max_qual;       /* Quality of the link */
 986         /* This should contain the average/typical values of the quality
 987          * indicator. This should be the threshold between a "good" and
 988          * a "bad" link (example : monitor going from green to orange).
 989          * Currently, user space apps like quality monitors don't have any
 990          * way to calibrate the measurement. With this, they can split
 991          * the range between 0 and max_qual in different quality level
 992          * (using a geometric subdivision centered on the average).
 993          * I expect that people doing the user space apps will feedback
 994          * us on which value we need to put in each driver... */
 995         struct iw_quality       avg_qual;       /* Quality of the link */
 996 
 997         /* Rates */
 998         __u8            num_bitrates;   /* Number of entries in the list */
 999         __s32           bitrate[IW_MAX_BITRATES];       /* list, in bps */
1000 
1001         /* RTS threshold */
1002         __s32           min_rts;        /* Minimal RTS threshold */
1003         __s32           max_rts;        /* Maximal RTS threshold */
1004 
1005         /* Frag threshold */
1006         __s32           min_frag;       /* Minimal frag threshold */
1007         __s32           max_frag;       /* Maximal frag threshold */
1008 
1009         /* Power Management duration & timeout */
1010         __s32           min_pmp;        /* Minimal PM period */
1011         __s32           max_pmp;        /* Maximal PM period */
1012         __s32           min_pmt;        /* Minimal PM timeout */
1013         __s32           max_pmt;        /* Maximal PM timeout */
1014         __u16           pmp_flags;      /* How to decode max/min PM period */
1015         __u16           pmt_flags;      /* How to decode max/min PM timeout */
1016         __u16           pm_capa;        /* What PM options are supported */
1017 
1018         /* Encoder stuff */
1019         __u16   encoding_size[IW_MAX_ENCODING_SIZES];   /* Different token sizes */
1020         __u8    num_encoding_sizes;     /* Number of entry in the list */
1021         __u8    max_encoding_tokens;    /* Max number of tokens */
1022         /* For drivers that need a "login/passwd" form */
1023         __u8    encoding_login_index;   /* token index for login token */
1024 
1025         /* Transmit power */
1026         __u16           txpower_capa;   /* What options are supported */
1027         __u8            num_txpower;    /* Number of entries in the list */
1028         __s32           txpower[IW_MAX_TXPOWER];        /* list, in bps */
1029 
1030         /* Wireless Extension version info */
1031         __u8            we_version_compiled;    /* Must be WIRELESS_EXT */
1032         __u8            we_version_source;      /* Last update of source */
1033 
1034         /* Retry limits and lifetime */
1035         __u16           retry_capa;     /* What retry options are supported */
1036         __u16           retry_flags;    /* How to decode max/min retry limit */
1037         __u16           r_time_flags;   /* How to decode max/min retry life */
1038         __s32           min_retry;      /* Minimal number of retries */
1039         __s32           max_retry;      /* Maximal number of retries */
1040         __s32           min_r_time;     /* Minimal retry lifetime */
1041         __s32           max_r_time;     /* Maximal retry lifetime */
1042 
1043         /* Frequency */
1044         __u16           num_channels;   /* Number of channels [0; num - 1] */
1045         __u8            num_frequency;  /* Number of entry in the list */
1046         struct iw_freq  freq[IW_MAX_FREQUENCIES];       /* list */
1047         /* Note : this frequency list doesn't need to fit channel numbers,
1048          * because each entry contain its channel index */
1049 
1050         __u32           enc_capa;       /* IW_ENC_CAPA_* bit field */
1051 };
1052 
1053 /*
1054  * Private ioctl interface information
1055  */
1056 
1057 struct iw_priv_args {
1058         __u32           cmd;            /* Number of the ioctl to issue */
1059         __u16           set_args;       /* Type and number of args */
1060         __u16           get_args;       /* Type and number of args */
1061         char            name[IFNAMSIZ]; /* Name of the extension */
1062 };
1063 
1064 /* ----------------------- WIRELESS EVENTS ----------------------- */
1065 /*
1066  * Wireless events are carried through the rtnetlink socket to user
1067  * space. They are encapsulated in the IFLA_WIRELESS field of
1068  * a RTM_NEWLINK message.
1069  */
1070 
1071 /*
1072  * A Wireless Event. Contains basically the same data as the ioctl...
1073  */
1074 struct iw_event {
1075         __u16           len;                    /* Real length of this stuff */
1076         __u16           cmd;                    /* Wireless IOCTL */
1077         union iwreq_data        u;              /* IOCTL fixed payload */
1078 };
1079 
1080 /* Size of the Event prefix (including padding and alignement junk) */
1081 #define IW_EV_LCP_LEN   (sizeof(struct iw_event) - sizeof(union iwreq_data))
1082 /* Size of the various events */
1083 #define IW_EV_CHAR_LEN  (IW_EV_LCP_LEN + IFNAMSIZ)
1084 #define IW_EV_UINT_LEN  (IW_EV_LCP_LEN + sizeof(__u32))
1085 #define IW_EV_FREQ_LEN  (IW_EV_LCP_LEN + sizeof(struct iw_freq))
1086 #define IW_EV_PARAM_LEN (IW_EV_LCP_LEN + sizeof(struct iw_param))
1087 #define IW_EV_ADDR_LEN  (IW_EV_LCP_LEN + sizeof(struct sockaddr))
1088 #define IW_EV_QUAL_LEN  (IW_EV_LCP_LEN + sizeof(struct iw_quality))
1089 
1090 /* iw_point events are special. First, the payload (extra data) come at
1091  * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second,
1092  * we omit the pointer, so start at an offset. */
1093 #define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \
1094                           (char *) NULL)
1095 #define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \
1096                          IW_EV_POINT_OFF)
1097 
1098 
1099 /* Size of the Event prefix when packed in stream */
1100 #define IW_EV_LCP_PK_LEN        (4)
1101 /* Size of the various events when packed in stream */
1102 #define IW_EV_CHAR_PK_LEN       (IW_EV_LCP_PK_LEN + IFNAMSIZ)
1103 #define IW_EV_UINT_PK_LEN       (IW_EV_LCP_PK_LEN + sizeof(__u32))
1104 #define IW_EV_FREQ_PK_LEN       (IW_EV_LCP_PK_LEN + sizeof(struct iw_freq))
1105 #define IW_EV_PARAM_PK_LEN      (IW_EV_LCP_PK_LEN + sizeof(struct iw_param))
1106 #define IW_EV_ADDR_PK_LEN       (IW_EV_LCP_PK_LEN + sizeof(struct sockaddr))
1107 #define IW_EV_QUAL_PK_LEN       (IW_EV_LCP_PK_LEN + sizeof(struct iw_quality))
1108 #define IW_EV_POINT_PK_LEN      (IW_EV_LCP_PK_LEN + 4)
1109 
1110 #endif /* _UAPI_LINUX_WIRELESS_H */

/* [<][>][^][v][top][bottom][index][help] */