⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wireless_utility.h

📁 270的linux说明
💻 H
字号:
/*

Copyright (c) 2008, Intel Corporation. 

All rights reserved.

 

Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met:


    * Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer.

    * Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation and/or 
other materials provided with the distribution.

    * Neither the name of Intel Corporation nor the names of its contributors 
may be used to endorse or promote products derived from this software without 
specific prior written permission.

 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.

*/#ifndef WIRELESS_UTILITY_H

#define WIRELESS_EXT	22
#define SIOCSIWCOMMIT	0x8B00		#define SIOCGIWNAME	0x8B01		#define SIOCSIWNWID	0x8B02		#define SIOCGIWNWID	0x8B03		#define SIOCSIWFREQ	0x8B04		#define SIOCGIWFREQ	0x8B05		#define SIOCSIWMODE	0x8B06		#define SIOCGIWMODE	0x8B07		#define SIOCSIWSENS	0x8B08		#define SIOCGIWSENS	0x8B09		#define SIOCSIWRANGE	0x8B0A		#define SIOCGIWRANGE	0x8B0B		#define SIOCSIWPRIV	0x8B0C		#define SIOCGIWPRIV	0x8B0D		#define SIOCSIWSTATS	0x8B0E		#define SIOCGIWSTATS	0x8B0F		#define SIOCSIWSPY	0x8B10		#define SIOCGIWSPY	0x8B11		#define SIOCSIWTHRSPY	0x8B12		#define SIOCGIWTHRSPY	0x8B13		#define SIOCSIWAP	0x8B14		#define SIOCGIWAP	0x8B15		#define SIOCGIWAPLIST	0x8B17		#define SIOCSIWSCAN	0x8B18		#define SIOCGIWSCAN	0x8B19		#define SIOCSIWESSID	0x8B1A		#define SIOCGIWESSID	0x8B1B		#define SIOCSIWNICKN	0x8B1C		#define SIOCGIWNICKN	0x8B1D		#define SIOCSIWRATE	0x8B20		#define SIOCGIWRATE	0x8B21		#define SIOCSIWRTS	0x8B22		#define SIOCGIWRTS	0x8B23		#define SIOCSIWFRAG	0x8B24		#define SIOCGIWFRAG	0x8B25		#define SIOCSIWTXPOW	0x8B26		#define SIOCGIWTXPOW	0x8B27		#define SIOCSIWRETRY	0x8B28		#define SIOCGIWRETRY	0x8B29		#define SIOCSIWENCODE	0x8B2A		#define SIOCGIWENCODE	0x8B2B		#define SIOCSIWPOWER	0x8B2C		#define SIOCGIWPOWER	0x8B2D		#define SIOCSIWGENIE	0x8B30		#define SIOCGIWGENIE	0x8B31		#define SIOCSIWMLME	0x8B16		#define SIOCSIWAUTH	0x8B32		#define SIOCGIWAUTH	0x8B33		#define SIOCSIWENCODEEXT 0x8B34		#define SIOCGIWENCODEEXT 0x8B35		#define SIOCSIWPMKSA	0x8B36		#define SIOCIWFIRST	0x8B00#define SIOCIWLAST	SIOCIWLASTPRIV		#define IW_IOCTL_IDX(cmd)	((cmd) - SIOCIWFIRST)#define IW_IS_SET(cmd)	(!((cmd) & 0x1))#define IW_IS_GET(cmd)	((cmd) & 0x1)#define IWEVTXDROP	0x8C00		#define IWEVQUAL	0x8C01		#define IWEVCUSTOM	0x8C02		#define IWEVREGISTERED	0x8C03		#define IWEVEXPIRED	0x8C04		#define IWEVGENIE	0x8C05		#define IWEVMICHAELMICFAILURE 0x8C06	#define IWEVASSOCREQIE	0x8C07		#define IWEVASSOCRESPIE	0x8C08		#define IWEVPMKIDCAND	0x8C09		#define IWEVFIRST	0x8C00#define IW_EVENT_IDX(cmd)	((cmd) - IWEVFIRST)#define IW_MAX_FREQUENCIES	32#define IW_MAX_BITRATES		32#define IW_MAX_TXPOWER		8/* Note : if you more than 8 TXPowers, just set the max and min or * a few of them in the struct iw_range. */#define IW_MAX_SPY		8/* Maximum of address that you may get in the   list of access points in range */#define IW_MAX_AP		64#define IW_ESSID_MAX_SIZE	32#define IW_MODE_AUTO	0	#define IW_MODE_ADHOC	1	#define IW_MODE_INFRA	2	#define IW_MODE_MASTER	3	/* Maximum number of size of encoding token available * they are listed in the range structure */#define IW_MAX_ENCODING_SIZES	8#define IW_ENCODING_TOKEN_MAX	64	#define IW_ENCODE_INDEX		0x00FF	#define IW_ENCODE_FLAGS		0xFF00	#define IW_ENCODE_MODE		0xF000	#define IW_ENCODE_DISABLED	0x8000	#define IW_ENCODE_ENABLED	0x0000	#define IW_ENCODE_RESTRICTED	0x4000	#define IW_ENCODE_OPEN		0x2000	#define IW_ENCODE_NOKEY		0x0800  #define IW_ENCODE_TEMP		0x0400  #define IW_POWER_ON		0x0000	#define IW_POWER_TYPE		0xF000	#define IW_POWER_PERIOD		0x1000	#define IW_POWER_TIMEOUT	0x2000	#define IW_POWER_MODE		0x0F00	#define IW_POWER_UNICAST_R	0x0100	#define IW_POWER_MULTICAST_R	0x0200	#define IW_POWER_ALL_R		0x0300	#define IW_POWER_FORCE_S	0x0400	#define IW_POWER_REPEATER	0x0800	#define IW_POWER_MODIFIER	0x000F	#define IW_POWER_MIN		0x0001	#define IW_POWER_MAX		0x0002	#define IW_POWER_RELATIVE	0x0004	#define IW_TXPOW_TYPE		0x00FF	#define IW_TXPOW_DBM		0x0000	#define IW_TXPOW_MWATT		0x0001	#define IW_TXPOW_RELATIVE	0x0002	#define IW_TXPOW_RANGE		0x1000	#define IW_RETRY_ON		0x0000	#define IW_RETRY_TYPE		0xF000	#define IW_RETRY_LIMIT		0x1000	#define IW_RETRY_LIFETIME	0x2000	#define IW_RETRY_MODIFIER	0x00FF	#define IW_RETRY_MIN		0x0001	#define IW_RETRY_MAX		0x0002	#define IW_RETRY_RELATIVE	0x0004	#define IW_RETRY_SHORT		0x0010	#define IW_RETRY_LONG		0x0020	#define IW_SCAN_DEFAULT		0x0000	#define IW_SCAN_ALL_ESSID	0x0001	#define IW_SCAN_THIS_ESSID	0x0002	#define IW_SCAN_ALL_FREQ	0x0004	#define IW_SCAN_THIS_FREQ	0x0008	#define IW_SCAN_ALL_MODE	0x0010	#define IW_SCAN_THIS_MODE	0x0020	#define IW_SCAN_ALL_RATE	0x0040	#define IW_SCAN_THIS_RATE	0x0080	#define IW_SCAN_TYPE_ACTIVE 0#define IW_SCAN_TYPE_PASSIVE 1#define IW_SCAN_MAX_DATA	4096	#define IW_CUSTOM_MAX		256	#define IW_GENERIC_IE_MAX	1024#define IW_MLME_DEAUTH		0#define IW_MLME_DISASSOC	1#define IW_MLME_AUTH		2#define IW_MLME_ASSOC		3#define IW_AUTH_INDEX		0x0FFF#define IW_AUTH_FLAGS		0xF000/* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095) * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the * parameter that is being set/get to; value will be read/written to * struct iw_param value field) */#define IW_AUTH_WPA_VERSION		0#define IW_AUTH_CIPHER_PAIRWISE		1#define IW_AUTH_CIPHER_GROUP		2#define IW_AUTH_KEY_MGMT		3#define IW_AUTH_TKIP_COUNTERMEASURES	4#define IW_AUTH_DROP_UNENCRYPTED	5#define IW_AUTH_80211_AUTH_ALG		6#define IW_AUTH_WPA_ENABLED		7#define IW_AUTH_RX_UNENCRYPTED_EAPOL	8#define IW_AUTH_ROAMING_CONTROL		9#define IW_AUTH_PRIVACY_INVOKED		10#define IW_AUTH_WPA_VERSION_DISABLED	0x00000001#define IW_AUTH_WPA_VERSION_WPA		0x00000002#define IW_AUTH_WPA_VERSION_WPA2	0x00000004#define IW_AUTH_CIPHER_NONE	0x00000001#define IW_AUTH_CIPHER_WEP40	0x00000002#define IW_AUTH_CIPHER_TKIP	0x00000004#define IW_AUTH_CIPHER_CCMP	0x00000008#define IW_AUTH_CIPHER_WEP104	0x00000010#define IW_AUTH_KEY_MGMT_802_1X	1#define IW_AUTH_KEY_MGMT_PSK	2#define IW_AUTH_ALG_OPEN_SYSTEM	0x00000001#define IW_AUTH_ALG_SHARED_KEY	0x00000002#define IW_AUTH_ALG_LEAP	0x00000004#define IW_AUTH_ROAMING_ENABLE	0	#define IW_AUTH_ROAMING_DISABLE	1	/* user space program used for roaming					 * control */#define IW_ENCODE_SEQ_MAX_SIZE	8#define IW_ENCODE_ALG_NONE	0#define IW_ENCODE_ALG_WEP	1#define IW_ENCODE_ALG_TKIP	2#define IW_ENCODE_ALG_CCMP	3#define IW_ENCODE_EXT_TX_SEQ_VALID	0x00000001#define IW_ENCODE_EXT_RX_SEQ_VALID	0x00000002#define IW_ENCODE_EXT_GROUP_KEY		0x00000004#define IW_ENCODE_EXT_SET_TX_KEY	0x00000008#define IW_MICFAILURE_KEY_ID	0x00000003 #define IW_MICFAILURE_GROUP	0x00000004#define IW_MICFAILURE_PAIRWISE	0x00000008#define IW_MICFAILURE_STAKEY	0x00000010#define IW_MICFAILURE_COUNT	0x00000060 /* 1 or 2 (0 = count not supported)					    *//* *	Generic format for most parameters that fit in an int */struct	iw_param{  __s32		value;		  __u8		fixed;		  __u8		disabled;	  __u16		flags;		};/* *	For all data larger than 16 octets, we need to use a *	pointer to memory allocated in user space. */struct	iw_point{  void *pointer;	  __u16		length;		  __u16		flags;		};/* *	A frequency *	For numbers lower than 10^9, we encode the number in 'm' and *	set 'e' to 0 *	For number greater than 10^9, we divide it by the lowest power *	of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')... *	The power of 10 is in 'e', the result of the division is in 'm'. */struct	iw_freq{	__s32		m;			__s16		e;			__u8		i;			__u8		flags;		};/* *	Quality of the link */struct	iw_quality{	__u8		qual;		/* link quality (%retries, SNR,					   %missed beacons or better...) */	__u8		level;			__u8		noise;			__u8		updated;	};/* *	Packet discarded in the wireless adapter due to *	"wireless" specific problems... *	Note : the list of counter and statistics in net_device_stats *	is already pretty exhaustive, and you should use that first. *	This is only additional stats... */struct	iw_discarded{	__u32		nwid;			__u32		code;			__u32		fragment;		__u32		retries;		__u32		misc;		};/* *	Packet/Time period missed in the wireless adapter due to *	"wireless" specific problems... */struct	iw_missed{	__u32		beacon;		};/* * Wireless statistics (used for /proc/net/wireless) */struct	iw_statistics{	__u16		status;		/* Status					 * - device dependent for now */	struct iw_quality	qual;		/* Quality of the link						 * (instant/mean/max) */	struct iw_discarded	discard;		struct iw_missed	miss;		};/* * This structure defines the payload of an ioctl, and is used  * below. * * Note that this structure should fit on the memory footprint * of iwreq (which is the same as ifreq), which mean a max size of * 16 octets = 128 bits. Warning, pointers might be 64 bits wide... * You should check this when increasing the structures defined * above in this file... */union	iwreq_data{		char		name[IFNAMSIZ];	/* Name : used to verify the presence of  wireless extensions.	 * Name of the protocol/provider... */	struct iw_point	essid;			struct iw_param	nwid;			struct iw_freq	freq;		/* frequency or channel :					 * 0-1000 = channel					 * > 1000 = frequency in Hz */	struct iw_param	sens;			struct iw_param	bitrate;		struct iw_param	txpower;		struct iw_param	rts;			struct iw_param	frag;			__u32		mode;			struct iw_param	retry;			struct iw_point	encoding;		struct iw_param	power;			struct iw_quality qual;			struct sockaddr	ap_addr;		struct sockaddr	addr;			struct iw_param	param;			struct iw_point	data;		};/* * The structure to exchange data for ioctl. * This structure is the same as 'struct ifreq', but (re)defined for * convenience... * Do I need to remind you about structure size (32 octets) ? */struct	iwreq {	union	{		char	ifrn_name[IFNAMSIZ];		} ifr_ifrn;		union	iwreq_data	u;};/* *	For those ioctl which want to exchange mode data that what could *	fit in the above structure... *//* *	Range of parameters */struct	iw_range{		__u32		throughput;		/* In theory this value should be the maximum benchmarked	 * TCP/IP throughput, because with most of these devices the	 * bit rate is meaningless (overhead an co) to estimate how	 * fast the connection will go and pick the fastest one.	 * I suggest people to play with Netperf or any benchmark...	 */		__u32		min_nwid;		__u32		max_nwid;			__u16		old_num_channels;	__u8		old_num_frequency;		__u32		event_capa[6];		__s32		sensitivity;		/* Quality range (link, level, noise)	 * If the quality is absolute, it will be in the range [0 ; max_qual],	 * if the quality is dBm, it will be in the range [max_qual ; 0].	 * Don't forget that we use 8 bit arithmetics... */	struct iw_quality	max_qual;		/* This should contain the average/typical values of the quality	 * indicator. This should be the threshold between a "good" and	 * a "bad" link (example : monitor going from green to orange).	 * Currently, user space apps like quality monitors don't have any	 * way to calibrate the measurement. With this, they can split	 * the range between 0 and max_qual in different quality level	 * (using a geometric subdivision centered on the average).	 * I expect that people doing the user space apps will feedback	 * us on which value we need to put in each driver... */	struct iw_quality	avg_qual;			__u8		num_bitrates;		__s32		bitrate[IW_MAX_BITRATES];			__s32		min_rts;		__s32		max_rts;			__s32		min_frag;		__s32		max_frag;			__s32		min_pmp;		__s32		max_pmp;		__s32		min_pmt;		__s32		max_pmt;		__u16		pmp_flags;		__u16		pmt_flags;		__u16		pm_capa;			__u16	encoding_size[IW_MAX_ENCODING_SIZES];		__u8	num_encoding_sizes;		__u8	max_encoding_tokens;			__u8	encoding_login_index;			__u16		txpower_capa;		__u8		num_txpower;		__s32		txpower[IW_MAX_TXPOWER];			__u8		we_version_compiled;		__u8		we_version_source;			__u16		retry_capa;		__u16		retry_flags;		__u16		r_time_flags;		__s32		min_retry;		__s32		max_retry;		__s32		min_r_time;		__s32		max_r_time;			__u16		num_channels;		__u8		num_frequency;		struct iw_freq	freq[IW_MAX_FREQUENCIES];		/* Note : this frequency list doesn't need to fit channel numbers,	 * because each entry contain its channel index */	__u32		enc_capa;	};/* * Wireless events are carried through the rtnetlink socket to user * space. They are encapsulated in the IFLA_WIRELESS field of * a RTM_NEWLINK message. *//* * A Wireless Event. Contains basically the same data as the ioctl... */struct iw_event{	__u16		len;				__u16		cmd;				union iwreq_data	u;		};#define IW_EV_LCP_LEN	(sizeof(struct iw_event) - sizeof(union iwreq_data))/* iw_point events are special. First, the payload (extra data) come at * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second, * we omit the pointer, so start at an offset. */#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \			  (char *) NULL)#define IW_EV_LCP_PK_LEN	(4)#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -