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