📄 wireless.14.h
字号:
/* * This file define a set of standard wireless extensions * * Version : 14 25.1.02 * * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> * Copyright (c) 1997-2002 Jean Tourrilhes, All Rights Reserved. */#ifndef _LINUX_WIRELESS_H#define _LINUX_WIRELESS_H/************************** DOCUMENTATION **************************//* * Initial APIs (1996 -> onward) : * ----------------------------- * Basically, the wireless extensions are for now a set of standard ioctl * call + /proc/net/wireless * * The entry /proc/net/wireless give statistics and information on the * driver. * This is better than having each driver having its entry because * its centralised and we may remove the driver module safely. * * Ioctl are used to configure the driver and issue commands. This is * better than command line options of insmod because we may want to * change dynamically (while the driver is running) some parameters. * * The ioctl mechanimsm are copied from standard devices ioctl. * We have the list of command plus a structure descibing the * data exchanged... * Note that to add these ioctl, I was obliged to modify : * # net/core/dev.c (two place + add include) * # net/ipv4/af_inet.c (one place + add include) * * /proc/net/wireless is a copy of /proc/net/dev. * We have a structure for data passed from the driver to /proc/net/wireless * Too add this, I've modified : * # net/core/dev.c (two other places) * # include/linux/netdevice.h (one place) * # include/linux/proc_fs.h (one place) * * New driver API (2002 -> onward) : * ------------------------------- * This file is only concerned with the user space API and common definitions. * The new driver API is defined and documented in : * # include/net/iw_handler.h * * Note as well that /proc/net/wireless implementation has now moved in : * # include/linux/wireless.c * * Wireless Events (2002 -> onward) : * -------------------------------- * Events are defined at the end of this file, and implemented in : * # include/linux/wireless.c * * Other comments : * -------------- * Do not add here things that are redundant with other mechanisms * (drivers init, ifconfig, /proc/net/dev, ...) and with are not * wireless specific. * * These wireless extensions are not magic : each driver has to provide * support for them... * * IMPORTANT NOTE : As everything in the kernel, this is very much a * work in progress. Contact me if you have ideas of improvements... *//***************************** INCLUDES *****************************/#include <linux/types.h> /* for "caddr_t" et al */#include <linux/socket.h> /* for "struct sockaddr" et al */#include <linux/if.h> /* for IFNAMSIZ and co... *//***************************** VERSION *****************************//* * This constant is used to know the availability of the wireless * extensions and to know which version of wireless extensions it is * (there is some stuff that will be added in the future...) * I just plan to increment with each new version. */#define WIRELESS_EXT 14/* * Changes : * * V2 to V3 * -------- * Alan Cox start some incompatibles changes. I've integrated a bit more. * - Encryption renamed to Encode to avoid US regulation problems * - Frequency changed from float to struct to avoid problems on old 386 * * V3 to V4 * -------- * - Add sensitivity * * V4 to V5 * -------- * - Missing encoding definitions in range * - Access points stuff * * V5 to V6 * -------- * - 802.11 support (ESSID ioctls) * * V6 to V7 * -------- * - define IW_ESSID_MAX_SIZE and IW_MAX_AP * * V7 to V8 * -------- * - Changed my e-mail address * - More 802.11 support (nickname, rate, rts, frag) * - List index in frequencies * * V8 to V9 * -------- * - Support for 'mode of operation' (ad-hoc, managed...) * - Support for unicast and multicast power saving * - Change encoding to support larger tokens (>64 bits) * - Updated iw_params (disable, flags) and use it for NWID * - Extracted iw_point from iwreq for clarity * * V9 to V10 * --------- * - Add PM capability to range structure * - Add PM modifier : MAX/MIN/RELATIVE * - Add encoding option : IW_ENCODE_NOKEY * - Add TxPower ioctls (work like TxRate) * * V10 to V11 * ---------- * - Add WE version in range (help backward/forward compatibility) * - Add retry ioctls (work like PM) * * V11 to V12 * ---------- * - Add SIOCSIWSTATS to get /proc/net/wireless programatically * - Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space * - Add new statistics (frag, retry, beacon) * - Add average quality (for user space calibration) * * V12 to V13 * ---------- * - Document creation of new driver API. * - Extract union iwreq_data from struct iwreq (for new driver API). * - Rename SIOCSIWNAME as SIOCSIWCOMMIT * * V13 to V14 * ---------- * - Wireless Events support : define struct iw_event * - Define additional specific event numbers * - Add "addr" and "param" fields in union iwreq_data * - AP scanning stuff (SIOCSIWSCAN and friends) *//**************************** CONSTANTS ****************************//* -------------------------- IOCTL LIST -------------------------- *//* Basic operations */#define SIOCSIWCOMMIT 0x8B00 /* Commit pending changes to driver */#define SIOCGIWNAME 0x8B01 /* get name == wireless protocol */#define SIOCSIWNWID 0x8B02 /* set network id (the cell) */#define SIOCGIWNWID 0x8B03 /* get network id */#define SIOCSIWFREQ 0x8B04 /* set channel/frequency (Hz) */#define SIOCGIWFREQ 0x8B05 /* get channel/frequency (Hz) */#define SIOCSIWMODE 0x8B06 /* set operation mode */#define SIOCGIWMODE 0x8B07 /* get operation mode */#define SIOCSIWSENS 0x8B08 /* set sensitivity (dBm) */#define SIOCGIWSENS 0x8B09 /* get sensitivity (dBm) *//* Informative stuff */#define SIOCSIWRANGE 0x8B0A /* Unused */#define SIOCGIWRANGE 0x8B0B /* Get range of parameters */#define SIOCSIWPRIV 0x8B0C /* Unused */#define SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */#define SIOCSIWSTATS 0x8B0E /* Unused */#define SIOCGIWSTATS 0x8B0F /* Get /proc/net/wireless stats *//* Mobile IP support */#define SIOCSIWSPY 0x8B10 /* set spy addresses */#define SIOCGIWSPY 0x8B11 /* get spy info (quality of link) *//* Access Point manipulation */#define SIOCSIWAP 0x8B14 /* set access point MAC addresses */#define SIOCGIWAP 0x8B15 /* get access point MAC addresses */#define SIOCGIWAPLIST 0x8B17 /* get list of access point in range */#define SIOCSIWSCAN 0x8B18 /* trigger scanning */#define SIOCGIWSCAN 0x8B19 /* get scanning results *//* 802.11 specific support */#define SIOCSIWESSID 0x8B1A /* set ESSID (network name) */#define SIOCGIWESSID 0x8B1B /* get ESSID */#define SIOCSIWNICKN 0x8B1C /* set node name/nickname */#define SIOCGIWNICKN 0x8B1D /* get node name/nickname *//* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit * within the 'iwreq' structure, so we need to use the 'data' member to * point to a string in user space, like it is done for RANGE... * The "flags" member indicate if the ESSID is active or not (promiscuous). *//* Other parameters useful in 802.11 and some other devices */#define SIOCSIWRATE 0x8B20 /* set default bit rate (bps) */#define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */#define SIOCSIWRTS 0x8B22 /* set RTS/CTS threshold (bytes) */#define SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */#define SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */#define SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */#define SIOCSIWTXPOW 0x8B26 /* set transmit power (dBm) */#define SIOCGIWTXPOW 0x8B27 /* get transmit power (dBm) */#define SIOCSIWRETRY 0x8B28 /* set retry limits and lifetime */#define SIOCGIWRETRY 0x8B29 /* get retry limits and lifetime *//* Encoding stuff (scrambling, hardware security, WEP...) */#define SIOCSIWENCODE 0x8B2A /* set encoding token & mode */#define SIOCGIWENCODE 0x8B2B /* get encoding token & mode *//* Power saving stuff (power management, unicast and multicast) */#define SIOCSIWPOWER 0x8B2C /* set Power Management settings */#define SIOCGIWPOWER 0x8B2D /* get Power Management settings *//* -------------------- DEV PRIVATE IOCTL LIST -------------------- *//* These 16 ioctl are wireless device private. * Each driver is free to use them for whatever purpose it chooses, * however the driver *must* export the description of those ioctls * with SIOCGIWPRIV and *must* use arguments as defined below. * If you don't follow those rules, DaveM is going to hate you (reason : * it make mixed 32/64bit operation impossible). */#define SIOCIWFIRSTPRIV 0x8BE0#define SIOCIWLASTPRIV 0x8BFF/* Previously, we were using SIOCDEVPRIVATE, but we now have our * separate range because of collisions with other tools such as * 'mii-tool'. * We now have 32 commands, so a bit more space ;-). * Also, all 'odd' commands are only usable by root and don't return the * content of ifr/iwr to user (but you are not obliged to use the set/get * convention, just use every other two command). * And I repeat : you are not obliged to use them with iwspy, but you * must be compliant with it. *//* ------------------------- IOCTL STUFF ------------------------- *//* The first and the last (range) */#define SIOCIWFIRST 0x8B00#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF *//* Even : get (world access), odd : set (root access) */#define IW_IS_SET(cmd) (!((cmd) & 0x1))#define IW_IS_GET(cmd) ((cmd) & 0x1)/* ----------------------- WIRELESS EVENTS ----------------------- *//* Those are *NOT* ioctls, do not issue request on them !!! *//* Most events use the same identifier as ioctl requests */#define IWEVTXDROP 0x8C00 /* Packet dropped to excessive retry */#define IWEVQUAL 0x8C01 /* Quality part of statistics */#define IWEVFIRST 0x8C00/* ------------------------- PRIVATE INFO ------------------------- *//* * The following is used with SIOCGIWPRIV. It allow a driver to define * the interface (name, type of data) for its private ioctl. * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV */#define IW_PRIV_TYPE_MASK 0x7000 /* Type of arguments */#define IW_PRIV_TYPE_NONE 0x0000#define IW_PRIV_TYPE_BYTE 0x1000 /* Char as number */#define IW_PRIV_TYPE_CHAR 0x2000 /* Char as character */#define IW_PRIV_TYPE_INT 0x4000 /* 32 bits int */#define IW_PRIV_TYPE_FLOAT 0x5000#define IW_PRIV_SIZE_FIXED 0x0800 /* Variable or fixed nuber of args */#define IW_PRIV_SIZE_MASK 0x07FF /* Max number of those args *//* * Note : if the number of args is fixed and the size < 16 octets, * instead of passing a pointer we will put args in the iwreq struct... *//* ----------------------- OTHER CONSTANTS ----------------------- *//* Maximum frequencies in the range struct */#define IW_MAX_FREQUENCIES 16/* Note : if you have something like 80 frequencies, * don't increase this constant and don't fill the frequency list. * The user will be able to set by channel anyway... *//* Maximum bit rates in the range struct */#define IW_MAX_BITRATES 8/* Maximum tx powers in the range struct */#define IW_MAX_TXPOWER 8/* Maximum of address that you may set with SPY */#define IW_MAX_SPY 8/* Maximum of address that you may get in the list of access points in range */#define IW_MAX_AP 8/* Maximum size of the ESSID and NICKN strings */#define IW_ESSID_MAX_SIZE 32/* Modes of operation */#define IW_MODE_AUTO 0 /* Let the driver decides */#define IW_MODE_ADHOC 1 /* Single cell network */#define IW_MODE_INFRA 2 /* Multi cell network, roaming, ... */#define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) *//* Maximum number of size of encoding token available * they are listed in the range structure */#define IW_MAX_ENCODING_SIZES 8/* Maximum size of the encoding token in bytes */#define IW_ENCODING_TOKEN_MAX 32 /* 256 bits (for now) *//* Flags for encoding (along with the token) */#define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */#define IW_ENCODE_FLAGS 0xFF00 /* Flags defined below */#define IW_ENCODE_MODE 0xF000 /* Modes defined below */#define IW_ENCODE_DISABLED 0x8000 /* Encoding disabled */#define IW_ENCODE_ENABLED 0x0000 /* Encoding enabled */#define IW_ENCODE_RESTRICTED 0x4000 /* Refuse non-encoded packets */#define IW_ENCODE_OPEN 0x2000 /* Accept non-encoded packets */#define IW_ENCODE_NOKEY 0x0800 /* Key is write only, so not present */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -