iwlib.h | iwlib.h | |||
---|---|---|---|---|
/* | /* | |||
* Wireless Tools | * Wireless Tools | |||
* | * | |||
* Jean II - HPLB 97->99 - HPL 99->07 | * Jean II - HPLB 97->99 - HPL 99->09 | |||
* | * | |||
* Common header for the Wireless Extension library... | * Common header for the Wireless Extension library... | |||
* | * | |||
* This file is released under the GPL license. | * This file is released under the GPL license. | |||
* Copyright (c) 1997-2007 Jean Tourrilhes <jt@hpl.hp.com> | * Copyright (c) 1997-2009 Jean Tourrilhes <jt@hpl.hp.com> | |||
*/ | */ | |||
#ifndef IWLIB_H | #ifndef IWLIB_H | |||
#define IWLIB_H | #define IWLIB_H | |||
/*#include "CHANGELOG.h"*/ | ||||
/***************************** INCLUDES *****************************/ | /***************************** INCLUDES *****************************/ | |||
/* Standard headers */ | /* Standard headers */ | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/ioctl.h> | #include <sys/ioctl.h> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <math.h> | #include <math.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include <fcntl.h> | #include <fcntl.h> | |||
#include <ctype.h> | #include <ctype.h> | |||
skipping to change at line 63 | skipping to change at line 61 | |||
#include <linux/types.h> /* for "caddr_t" et al */ | #include <linux/types.h> /* for "caddr_t" et al */ | |||
/* Glibc systems headers are supposedly less problematic than kernel ones * / | /* Glibc systems headers are supposedly less problematic than kernel ones * / | |||
#include <sys/socket.h> /* for "struct sockaddr" et al */ | #include <sys/socket.h> /* for "struct sockaddr" et al */ | |||
#include <net/if.h> /* for IFNAMSIZ and co... */ | #include <net/if.h> /* for IFNAMSIZ and co... */ | |||
/* Private copy of Wireless extensions (in this directoty) */ | /* Private copy of Wireless extensions (in this directoty) */ | |||
#include "wireless.h" | #include "wireless.h" | |||
/* Make gcc understant that when we say inline, we mean it. | ||||
* I really hate when the compiler is trying to be more clever than me, | ||||
* because in this case gcc is not able to figure out functions with a | ||||
* single call site, so not only I have to tag those functions inline | ||||
* by hand, but then it refuse to inline them properly. | ||||
* Total saving for iwevent : 150B = 0.7%. | ||||
* Fortunately, in gcc 3.4, they now automatically inline static functions | ||||
* with a single call site. Hurrah ! | ||||
* Jean II */ | ||||
#undef IW_GCC_HAS_BROKEN_INLINE | ||||
#if __GNUC__ == 3 | ||||
#if __GNUC_MINOR__ >= 1 && __GNUC_MINOR__ < 4 | ||||
#define IW_GCC_HAS_BROKEN_INLINE 1 | ||||
#endif /* __GNUC_MINOR__ */ | ||||
#endif /* __GNUC__ */ | ||||
/* However, gcc 4.0 has introduce a new "feature", when compiling with | ||||
* '-Os', it does not want to inline iw_ether_cmp() and friends. | ||||
* So, we need to fix inline again ! | ||||
* Jean II */ | ||||
#if __GNUC__ == 4 | ||||
#define IW_GCC_HAS_BROKEN_INLINE 1 | ||||
#endif /* __GNUC__ */ | ||||
/* Now, really fix the inline */ | ||||
#ifdef IW_GCC_HAS_BROKEN_INLINE | ||||
#ifdef inline | ||||
#undef inline | ||||
#endif /* inline */ | ||||
#define inline inline __attribute__((always_inline)) | ||||
#endif /* IW_GCC_HAS_BROKEN_INLINE */ | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/****************************** DEBUG ******************************/ | ||||
//#define DEBUG 1 | ||||
/************************ CONSTANTS & MACROS ************************/ | /************************ CONSTANTS & MACROS ************************/ | |||
/* Various versions information */ | /* Various versions information */ | |||
/* Recommended Wireless Extension version */ | /* Recommended Wireless Extension version */ | |||
#define WE_VERSION 21 | #define WE_VERSION 22 | |||
/* Maximum forward compatibility built in this version of WT */ | /* Maximum forward compatibility built in this version of WT */ | |||
#define WE_MAX_VERSION 22 | #define WE_MAX_VERSION 22 | |||
/* Version of Wireless Tools */ | /* Version of Wireless Tools */ | |||
#define WT_VERSION 29 | #define WT_VERSION 30 | |||
/* Paths */ | ||||
#define PROC_NET_WIRELESS "/proc/net/wireless" | ||||
#define PROC_NET_DEV "/proc/net/dev" | ||||
/* Some usefull constants */ | ||||
#define KILO 1e3 | ||||
#define MEGA 1e6 | ||||
#define GIGA 1e9 | ||||
/* For doing log10/exp10 without libm */ | ||||
#define LOG10_MAGIC 1.25892541179 | ||||
/* Backward compatibility for network headers */ | ||||
#ifndef ARPHRD_IEEE80211 | ||||
#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */ | ||||
#endif /* ARPHRD_IEEE80211 */ | ||||
#ifndef IW_EV_LCP_PK_LEN | ||||
/* Size of the Event prefix when packed in stream */ | ||||
#define IW_EV_LCP_PK_LEN (4) | ||||
/* Size of the various events when packed in stream */ | ||||
#define IW_EV_CHAR_PK_LEN (IW_EV_LCP_PK_LEN + IFNAMSIZ) | ||||
#define IW_EV_UINT_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(__u32)) | ||||
#define IW_EV_FREQ_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_freq)) | ||||
#define IW_EV_PARAM_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_param)) | ||||
#define IW_EV_ADDR_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct sockaddr)) | ||||
#define IW_EV_QUAL_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_quality | ||||
)) | ||||
#define IW_EV_POINT_PK_LEN (IW_EV_LCP_PK_LEN + 4) | ||||
struct iw_pk_event | ||||
{ | ||||
__u16 len; /* Real lenght of this stuff | ||||
*/ | ||||
__u16 cmd; /* Wireless IOCTL */ | ||||
union iwreq_data u; /* IOCTL fixed payload */ | ||||
} __attribute__ ((packed)); | ||||
struct iw_pk_point | ||||
{ | ||||
void __user *pointer; /* Pointer to the data (in user space) */ | ||||
__u16 length; /* number of fields or size in bytes | ||||
*/ | ||||
__u16 flags; /* Optional params */ | ||||
} __attribute__ ((packed)); | ||||
#define IW_EV_LCP_PK2_LEN (sizeof(struct iw_pk_event) - sizeof(union i | ||||
wreq_data)) | ||||
#define IW_EV_POINT_PK2_LEN (IW_EV_LCP_PK2_LEN + sizeof(struct iw_pk_poi | ||||
nt) - IW_EV_POINT_OFF) | ||||
#endif /* IW_EV_LCP_PK_LEN */ | ||||
/****************************** TYPES ******************************/ | /****************************** TYPES ******************************/ | |||
/* Shortcuts */ | /* Shortcuts */ | |||
typedef struct iw_statistics iwstats; | typedef struct iw_statistics iwstats; | |||
typedef struct iw_range iwrange; | typedef struct iw_range iwrange; | |||
typedef struct iw_param iwparam; | typedef struct iw_param iwparam; | |||
typedef struct iw_freq iwfreq; | typedef struct iw_freq iwfreq; | |||
typedef struct iw_quality iwqual; | typedef struct iw_quality iwqual; | |||
typedef struct iw_priv_args iwprivargs; | typedef struct iw_priv_args iwprivargs; | |||
skipping to change at line 186 | skipping to change at line 104 | |||
iwparam nwid; /* Network ID */ | iwparam nwid; /* Network ID */ | |||
int has_freq; | int has_freq; | |||
double freq; /* Frequency/channel */ | double freq; /* Frequency/channel */ | |||
int freq_flags; | int freq_flags; | |||
int has_key; | int has_key; | |||
unsigned char key[IW_ENCODING_TOKEN_MAX]; /* Encoding key used */ | unsigned char key[IW_ENCODING_TOKEN_MAX]; /* Encoding key used */ | |||
int key_size; /* Number of bytes */ | int key_size; /* Number of bytes */ | |||
int key_flags; /* Various flags */ | int key_flags; /* Various flags */ | |||
int has_essid; | int has_essid; | |||
int essid_on; | int essid_on; | |||
char essid[IW_ESSID_MAX_SIZE + 1]; /* ESSID (extended network) | char essid[IW_ESSID_MAX_SIZE + 2]; /* ESSID (extended network) | |||
*/ | */ | |||
int essid_len; | ||||
int has_mode; | int has_mode; | |||
int mode; /* Operation mode */ | int mode; /* Operation mode */ | |||
} wireless_config; | } wireless_config; | |||
/* Structure for storing all wireless information for each device | /* Structure for storing all wireless information for each device | |||
* This is pretty exhaustive... */ | * This is pretty exhaustive... */ | |||
typedef struct wireless_info | typedef struct wireless_info | |||
{ | { | |||
struct wireless_config b; /* Basic information */ | struct wireless_config b; /* Basic information */ | |||
int has_sens; | int has_sens; | |||
iwparam sens; /* sensitivity */ | iwparam sens; /* sensitivity */ | |||
int has_nickname; | int has_nickname; | |||
char nickname[IW_ESSID_MAX_SIZE + 1]; /* NickName */ | char nickname[IW_ESSID_MAX_SIZE + 2]; /* NickName */ | |||
int has_ap_addr; | int has_ap_addr; | |||
sockaddr ap_addr; /* Access point address */ | sockaddr ap_addr; /* Access point address */ | |||
int has_bitrate; | int has_bitrate; | |||
iwparam bitrate; /* Bit rate in bps */ | iwparam bitrate; /* Bit rate in bps */ | |||
int has_rts; | int has_rts; | |||
iwparam rts; /* RTS threshold in bytes */ | iwparam rts; /* RTS threshold in bytes */ | |||
int has_frag; | int has_frag; | |||
iwparam frag; /* Fragmentation threshold in bytes */ | iwparam frag; /* Fragmentation threshold in bytes */ | |||
int has_power; | int has_power; | |||
iwparam power; /* Power management parameters */ | iwparam power; /* Power management parameters */ | |||
skipping to change at line 287 | skipping to change at line 206 | |||
/* Describe a modulation */ | /* Describe a modulation */ | |||
typedef struct iw_modul_descr | typedef struct iw_modul_descr | |||
{ | { | |||
unsigned int mask; /* Modulation bitmask */ | unsigned int mask; /* Modulation bitmask */ | |||
char cmd[8]; /* Short name */ | char cmd[8]; /* Short name */ | |||
char * verbose; /* Verbose description */ | char * verbose; /* Verbose description */ | |||
} iw_modul_descr; | } iw_modul_descr; | |||
/**************************** PROTOTYPES ****************************/ | /**************************** PROTOTYPES ****************************/ | |||
/* | /* | |||
* All the functions in iwcommon.c | * All the functions in iwlib.c | |||
*/ | */ | |||
/* ---------------------- SOCKET SUBROUTINES -----------------------*/ | /* ---------------------- SOCKET SUBROUTINES -----------------------*/ | |||
int | int | |||
iw_sockets_open(void); | iw_sockets_open(void); | |||
void | void | |||
iw_enum_devices(int skfd, | iw_enum_devices(int skfd, | |||
iw_enum_handler fn, | iw_enum_handler fn, | |||
char * args[], | char * args[], | |||
int count); | int count); | |||
skipping to change at line 323 | skipping to change at line 242 | |||
const char * ifname, | const char * ifname, | |||
wireless_config * info); | wireless_config * info); | |||
int | int | |||
iw_set_basic_config(int skfd, | iw_set_basic_config(int skfd, | |||
const char * ifname, | const char * ifname, | |||
wireless_config * info); | wireless_config * info); | |||
/* --------------------- PROTOCOL SUBROUTINES --------------------- */ | /* --------------------- PROTOCOL SUBROUTINES --------------------- */ | |||
int | int | |||
iw_protocol_compare(const char * protocol1, | iw_protocol_compare(const char * protocol1, | |||
const char * protocol2); | const char * protocol2); | |||
/* ---------------------- ESSID SUBROUTINES ---------------------- */ | ||||
void | ||||
iw_essid_escape(char * dest, | ||||
const char * src, | ||||
const int slen); | ||||
int | ||||
iw_essid_unescape(char * dest, | ||||
const char * src); | ||||
/* -------------------- FREQUENCY SUBROUTINES --------------------- */ | /* -------------------- FREQUENCY SUBROUTINES --------------------- */ | |||
void | void | |||
iw_float2freq(double in, | iw_float2freq(double in, | |||
iwfreq * out); | iwfreq * out); | |||
double | double | |||
iw_freq2float(const iwfreq * in); | iw_freq2float(const iwfreq * in); | |||
void | void | |||
iw_print_freq_value(char * buffer, | iw_print_freq_value(char * buffer, | |||
int buflen, | int buflen, | |||
double freq); | double freq); | |||
skipping to change at line 419 | skipping to change at line 346 | |||
int buflen, | int buflen, | |||
const struct timeval * time, | const struct timeval * time, | |||
const struct timezone * tz); | const struct timezone * tz); | |||
/* --------------------- ADDRESS SUBROUTINES ---------------------- */ | /* --------------------- ADDRESS SUBROUTINES ---------------------- */ | |||
int | int | |||
iw_check_mac_addr_type(int skfd, | iw_check_mac_addr_type(int skfd, | |||
const char * ifname); | const char * ifname); | |||
int | int | |||
iw_check_if_addr_type(int skfd, | iw_check_if_addr_type(int skfd, | |||
const char * ifname); | const char * ifname); | |||
#if 0 | ||||
int | ||||
iw_check_addr_type(int skfd, | ||||
const char * ifname); | ||||
#endif | ||||
#if 0 | ||||
int | ||||
iw_get_mac_addr(int skfd, | ||||
const char * name, | ||||
struct ether_addr * eth, | ||||
unsigned short * ptype); | ||||
#endif | ||||
char * | char * | |||
iw_mac_ntop(const unsigned char * mac, | iw_mac_ntop(const unsigned char * mac, | |||
int maclen, | int maclen, | |||
char * buf, | char * buf, | |||
int buflen); | int buflen); | |||
void | void | |||
iw_ether_ntop(const struct ether_addr * eth, | iw_ether_ntop(const struct ether_addr * eth, | |||
char * buf); | char * buf); | |||
char * | char * | |||
iw_sawap_ntop(const struct sockaddr * sap, | iw_sawap_ntop(const struct sockaddr * sap, | |||
skipping to change at line 494 | skipping to change at line 409 | |||
#define IW_NUM_OPER_MODE 7 | #define IW_NUM_OPER_MODE 7 | |||
#define IW_NUM_OPER_MODE_EXT 8 | #define IW_NUM_OPER_MODE_EXT 8 | |||
/* Modulations as human readable strings */ | /* Modulations as human readable strings */ | |||
extern const struct iw_modul_descr iw_modul_list[]; | extern const struct iw_modul_descr iw_modul_list[]; | |||
#define IW_SIZE_MODUL_LIST 16 | #define IW_SIZE_MODUL_LIST 16 | |||
/************************* INLINE FUNTIONS *************************/ | /************************* INLINE FUNTIONS *************************/ | |||
/* | /* | |||
* Functions that are so simple that it's more efficient inlining them | * Functions that are so simple that it's more efficient inlining them | |||
* Most inline are private because gcc is fussy about inline... | ||||
*/ | */ | |||
/* | /* | |||
* Note : I've defined wrapper for the ioctl request so that | * Note : I've defined wrapper for the ioctl request so that | |||
* it will be easier to migrate to other kernel API if needed | * it will be easier to migrate to other kernel API if needed | |||
*/ | */ | |||
/*------------------------------------------------------------------*/ | /*------------------------------------------------------------------*/ | |||
/* | /* | |||
* Wrapper to push some Wireless Parameter in the driver | * Wrapper to push some Wireless Parameter in the driver | |||
*/ | */ | |||
static inline int | static inline __attribute__((always_inline)) int | |||
iw_set_ext(int skfd, /* Socket to the kernel */ | iw_set_ext(int skfd, /* Socket to the kernel */ | |||
const char * ifname, /* Device name */ | const char * ifname, /* Device name */ | |||
int request, /* WE ID */ | int request, /* WE ID */ | |||
struct iwreq * pwrq) /* Fixed part of the request */ | struct iwreq * pwrq) /* Fixed part of the request */ | |||
{ | { | |||
/* Set device name */ | /* Set device name */ | |||
strncpy(pwrq->ifr_name, ifname, IFNAMSIZ); | strncpy(pwrq->ifr_name, ifname, IFNAMSIZ); | |||
/* Do the request */ | /* Do the request */ | |||
return(ioctl(skfd, request, pwrq)); | return(ioctl(skfd, request, pwrq)); | |||
} | } | |||
/*------------------------------------------------------------------*/ | /*------------------------------------------------------------------*/ | |||
/* | /* | |||
* Wrapper to extract some Wireless Parameter out of the driver | * Wrapper to extract some Wireless Parameter out of the driver | |||
*/ | */ | |||
static inline int | static inline __attribute__((always_inline)) int | |||
iw_get_ext(int skfd, /* Socket to the kernel */ | iw_get_ext(int skfd, /* Socket to the kernel */ | |||
const char * ifname, /* Device name */ | const char * ifname, /* Device name */ | |||
int request, /* WE ID */ | int request, /* WE ID */ | |||
struct iwreq * pwrq) /* Fixed part of the request */ | struct iwreq * pwrq) /* Fixed part of the request */ | |||
{ | { | |||
/* Set device name */ | /* Set device name */ | |||
strncpy(pwrq->ifr_name, ifname, IFNAMSIZ); | strncpy(pwrq->ifr_name, ifname, IFNAMSIZ); | |||
/* Do the request */ | /* Do the request */ | |||
return(ioctl(skfd, request, pwrq)); | return(ioctl(skfd, request, pwrq)); | |||
} | } | |||
skipping to change at line 543 | skipping to change at line 459 | |||
/*------------------------------------------------------------------*/ | /*------------------------------------------------------------------*/ | |||
/* | /* | |||
* Close the socket used for ioctl. | * Close the socket used for ioctl. | |||
*/ | */ | |||
static inline void | static inline void | |||
iw_sockets_close(int skfd) | iw_sockets_close(int skfd) | |||
{ | { | |||
close(skfd); | close(skfd); | |||
} | } | |||
/*------------------------------------------------------------------*/ | ||||
/* | ||||
* Display an Ethernet Socket Address in readable format. | ||||
*/ | ||||
static inline char * | ||||
iw_saether_ntop(const struct sockaddr *sap, char* bufp) | ||||
{ | ||||
iw_ether_ntop((const struct ether_addr *) sap->sa_data, bufp); | ||||
return bufp; | ||||
} | ||||
/*------------------------------------------------------------------*/ | ||||
/* | ||||
* Input an Ethernet Socket Address and convert to binary. | ||||
*/ | ||||
static inline int | ||||
iw_saether_aton(const char *bufp, struct sockaddr *sap) | ||||
{ | ||||
sap->sa_family = ARPHRD_ETHER; | ||||
return iw_ether_aton(bufp, (struct ether_addr *) sap->sa_data); | ||||
} | ||||
/*------------------------------------------------------------------*/ | ||||
/* | ||||
* Create an Ethernet broadcast address | ||||
*/ | ||||
static inline void | ||||
iw_broad_ether(struct sockaddr *sap) | ||||
{ | ||||
sap->sa_family = ARPHRD_ETHER; | ||||
memset((char *) sap->sa_data, 0xFF, ETH_ALEN); | ||||
} | ||||
/*------------------------------------------------------------------*/ | ||||
/* | ||||
* Create an Ethernet NULL address | ||||
*/ | ||||
static inline void | ||||
iw_null_ether(struct sockaddr *sap) | ||||
{ | ||||
sap->sa_family = ARPHRD_ETHER; | ||||
memset((char *) sap->sa_data, 0x00, ETH_ALEN); | ||||
} | ||||
/*------------------------------------------------------------------*/ | ||||
/* | ||||
* Compare two ethernet addresses | ||||
*/ | ||||
static inline int | ||||
iw_ether_cmp(const struct ether_addr* eth1, const struct ether_addr* eth2) | ||||
{ | ||||
return memcmp(eth1, eth2, sizeof(*eth1)); | ||||
} | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* IWLIB_H */ | #endif /* IWLIB_H */ | |||
End of changes. 16 change blocks. | ||||
162 lines changed or deleted | 20 lines changed or added | |||
wireless.h | wireless.h | |||
---|---|---|---|---|
/* | /* | |||
* This file define a set of standard wireless extensions | * This file define a set of standard wireless extensions | |||
* | * | |||
* Version : 21 14.3.06 | * Version : 22 16.3.07 | |||
* | * | |||
* Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> | * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> | |||
* Copyright (c) 1997-2005 Jean Tourrilhes, All Rights Reserved. | * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved. | |||
* | ||||
* This file, and only this file, is licensed under the terms of the LGPL. | ||||
* You can redistribute it and/or modify it under the terms of the GNU | ||||
* Lesser General Public License as published by the Free Software | ||||
* Foundation; either version 2.1 of the License, or (at your option) | ||||
* any later version. | ||||
*/ | */ | |||
#ifndef _LINUX_WIRELESS_H | #ifndef _LINUX_WIRELESS_H | |||
#define _LINUX_WIRELESS_H | #define _LINUX_WIRELESS_H | |||
/************************** DOCUMENTATION **************************/ | /************************** DOCUMENTATION **************************/ | |||
/* | /* | |||
* Initial APIs (1996 -> onward) : | * Initial APIs (1996 -> onward) : | |||
* ----------------------------- | * ----------------------------- | |||
* Basically, the wireless extensions are for now a set of standard ioctl | * Basically, the wireless extensions are for now a set of standard ioctl | |||
skipping to change at line 88 | skipping to change at line 94 | |||
#include <linux/if.h> /* for IFNAMSIZ and co... */ | #include <linux/if.h> /* for IFNAMSIZ and co... */ | |||
#endif /* __KERNEL__ */ | #endif /* __KERNEL__ */ | |||
/***************************** VERSION *****************************/ | /***************************** VERSION *****************************/ | |||
/* | /* | |||
* This constant is used to know the availability of the wireless | * This constant is used to know the availability of the wireless | |||
* extensions and to know which version of wireless extensions it is | * extensions and to know which version of wireless extensions it is | |||
* (there is some stuff that will be added in the future...) | * (there is some stuff that will be added in the future...) | |||
* I just plan to increment with each new version. | * I just plan to increment with each new version. | |||
*/ | */ | |||
#define WIRELESS_EXT 21 | #define WIRELESS_EXT 22 | |||
/* | /* | |||
* Changes : | * Changes : | |||
* | * | |||
* V2 to V3 | * V2 to V3 | |||
* -------- | * -------- | |||
* Alan Cox start some incompatibles changes. I've integrated a bit mor e. | * Alan Cox start some incompatibles changes. I've integrated a bit mor e. | |||
* - Encryption renamed to Encode to avoid US regulation problems | * - Encryption renamed to Encode to avoid US regulation problems | |||
* - Frequency changed from float to struct to avoid problems on old 38 6 | * - Frequency changed from float to struct to avoid problems on old 38 6 | |||
* | * | |||
skipping to change at line 222 | skipping to change at line 228 | |||
* | * | |||
* V20 to V21 | * V20 to V21 | |||
* ---------- | * ---------- | |||
* - Remove (struct net_device *)->get_wireless_stats() | * - Remove (struct net_device *)->get_wireless_stats() | |||
* - Change length in ESSID and NICK to strlen() instead of strlen()+1 | * - Change length in ESSID and NICK to strlen() instead of strlen()+1 | |||
* - Add SIOCSIWMODUL/SIOCGIWMODUL for modulation setting | * - Add SIOCSIWMODUL/SIOCGIWMODUL for modulation setting | |||
* - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers | * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers | |||
* - Add IW_POWER_SAVING power type | * - Add IW_POWER_SAVING power type | |||
* - Power/Retry relative values no longer * 100000 | * - Power/Retry relative values no longer * 100000 | |||
* - Add bitrate flags for unicast/broadcast | * - Add bitrate flags for unicast/broadcast | |||
* - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI | ||||
* | ||||
* V21 to V22 | ||||
* ---------- | ||||
* - Prevent leaking of kernel space in stream on 64 bits. | ||||
* - Scan capabilities in struct iw_range (Dan Williams) | ||||
*/ | */ | |||
/**************************** CONSTANTS ****************************/ | /**************************** CONSTANTS ****************************/ | |||
/* -------------------------- IOCTL LIST -------------------------- */ | /* -------------------------- IOCTL LIST -------------------------- */ | |||
/* Wireless Identification */ | /* Wireless Identification */ | |||
#define SIOCSIWCOMMIT 0x8B00 /* Commit pending changes to driver */ | #define SIOCSIWCOMMIT 0x8B00 /* Commit pending changes to driver */ | |||
#define SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ | #define SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ | |||
/* SIOCGIWNAME is used to verify the presence of Wireless Extensions. | /* SIOCGIWNAME is used to verify the presence of Wireless Extensions. | |||
skipping to change at line 338 | skipping to change at line 350 | |||
* with SIOCGIWPRIV and *must* use arguments as defined below. | * with SIOCGIWPRIV and *must* use arguments as defined below. | |||
* If you don't follow those rules, DaveM is going to hate you (reason : | * If you don't follow those rules, DaveM is going to hate you (reason : | |||
* it make mixed 32/64bit operation impossible). | * it make mixed 32/64bit operation impossible). | |||
*/ | */ | |||
#define SIOCIWFIRSTPRIV 0x8BE0 | #define SIOCIWFIRSTPRIV 0x8BE0 | |||
#define SIOCIWLASTPRIV 0x8BFF | #define SIOCIWLASTPRIV 0x8BFF | |||
/* Previously, we were using SIOCDEVPRIVATE, but we now have our | /* Previously, we were using SIOCDEVPRIVATE, but we now have our | |||
* separate range because of collisions with other tools such as | * separate range because of collisions with other tools such as | |||
* 'mii-tool'. | * 'mii-tool'. | |||
* We now have 32 commands, so a bit more space ;-). | * We now have 32 commands, so a bit more space ;-). | |||
* Also, all 'odd' commands are only usable by root and don't return the | * Also, all 'even' 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 | * content of ifr/iwr to user (but you are not obliged to use the set/get | |||
* convention, just use every other two command). More details in iwpriv.c. | * convention, just use every other two command). More details in iwpriv.c. | |||
* And I repeat : you are not forced to use them with iwpriv, but you | * And I repeat : you are not forced to use them with iwpriv, but you | |||
* must be compliant with it. | * must be compliant with it. | |||
*/ | */ | |||
/* ------------------------- IOCTL STUFF ------------------------- */ | /* ------------------------- IOCTL STUFF ------------------------- */ | |||
/* The first and the last (range) */ | /* The first and the last (range) */ | |||
#define SIOCIWFIRST 0x8B00 | #define SIOCIWFIRST 0x8B00 | |||
#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */ | #define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */ | |||
#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST) | #define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST) | |||
/* Even : get (world access), odd : set (root access) */ | /* Odd : get (world access), Even : set (root access) */ | |||
#define IW_IS_SET(cmd) (!((cmd) & 0x1)) | #define IW_IS_SET(cmd) (!((cmd) & 0x1)) | |||
#define IW_IS_GET(cmd) ((cmd) & 0x1) | #define IW_IS_GET(cmd) ((cmd) & 0x1) | |||
/* ----------------------- WIRELESS EVENTS ----------------------- */ | /* ----------------------- WIRELESS EVENTS ----------------------- */ | |||
/* Those are *NOT* ioctls, do not issue request on them !!! */ | /* Those are *NOT* ioctls, do not issue request on them !!! */ | |||
/* Most events use the same identifier as ioctl requests */ | /* Most events use the same identifier as ioctl requests */ | |||
#define IWEVTXDROP 0x8C00 /* Packet dropped to excessive retry */ | #define IWEVTXDROP 0x8C00 /* Packet dropped to excessive retry */ | |||
#define IWEVQUAL 0x8C01 /* Quality part of statistics (scan) */ | #define IWEVQUAL 0x8C01 /* Quality part of statistics (scan) */ | |||
#define IWEVCUSTOM 0x8C02 /* Driver specific ascii string */ | #define IWEVCUSTOM 0x8C02 /* Driver specific ascii string */ | |||
skipping to change at line 542 | skipping to change at line 554 | |||
#define IW_SCAN_ALL_MODE 0x0010 /* Scan all Modes */ | #define IW_SCAN_ALL_MODE 0x0010 /* Scan all Modes */ | |||
#define IW_SCAN_THIS_MODE 0x0020 /* Scan only this Mode */ | #define IW_SCAN_THIS_MODE 0x0020 /* Scan only this Mode */ | |||
#define IW_SCAN_ALL_RATE 0x0040 /* Scan all Bit-Rates */ | #define IW_SCAN_ALL_RATE 0x0040 /* Scan all Bit-Rates */ | |||
#define IW_SCAN_THIS_RATE 0x0080 /* Scan only this Bit-Rate */ | #define IW_SCAN_THIS_RATE 0x0080 /* Scan only this Bit-Rate */ | |||
/* struct iw_scan_req scan_type */ | /* struct iw_scan_req scan_type */ | |||
#define IW_SCAN_TYPE_ACTIVE 0 | #define IW_SCAN_TYPE_ACTIVE 0 | |||
#define IW_SCAN_TYPE_PASSIVE 1 | #define IW_SCAN_TYPE_PASSIVE 1 | |||
/* Maximum size of returned data */ | /* Maximum size of returned data */ | |||
#define IW_SCAN_MAX_DATA 4096 /* In bytes */ | #define IW_SCAN_MAX_DATA 4096 /* In bytes */ | |||
/* Scan capability flags - in (struct iw_range *)->scan_capa */ | ||||
#define IW_SCAN_CAPA_NONE 0x00 | ||||
#define IW_SCAN_CAPA_ESSID 0x01 | ||||
#define IW_SCAN_CAPA_BSSID 0x02 | ||||
#define IW_SCAN_CAPA_CHANNEL 0x04 | ||||
#define IW_SCAN_CAPA_MODE 0x08 | ||||
#define IW_SCAN_CAPA_RATE 0x10 | ||||
#define IW_SCAN_CAPA_TYPE 0x20 | ||||
#define IW_SCAN_CAPA_TIME 0x40 | ||||
/* Max number of char in custom event - use multiple of them if needed */ | /* Max number of char in custom event - use multiple of them if needed */ | |||
#define IW_CUSTOM_MAX 256 /* In bytes */ | #define IW_CUSTOM_MAX 256 /* In bytes */ | |||
/* Generic information element */ | /* Generic information element */ | |||
#define IW_GENERIC_IE_MAX 1024 | #define IW_GENERIC_IE_MAX 1024 | |||
/* MLME requests (SIOCSIWMLME / struct iw_mlme) */ | /* MLME requests (SIOCSIWMLME / struct iw_mlme) */ | |||
#define IW_MLME_DEAUTH 0 | #define IW_MLME_DEAUTH 0 | |||
#define IW_MLME_DISASSOC 1 | #define IW_MLME_DISASSOC 1 | |||
#define IW_MLME_AUTH 2 | ||||
#define IW_MLME_ASSOC 3 | ||||
/* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */ | /* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */ | |||
#define IW_AUTH_INDEX 0x0FFF | #define IW_AUTH_INDEX 0x0FFF | |||
#define IW_AUTH_FLAGS 0xF000 | #define IW_AUTH_FLAGS 0xF000 | |||
/* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095) | /* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095) | |||
* (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the | * (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 | * parameter that is being set/get to; value will be read/written to | |||
* struct iw_param value field) */ | * struct iw_param value field) */ | |||
#define IW_AUTH_WPA_VERSION 0 | #define IW_AUTH_WPA_VERSION 0 | |||
#define IW_AUTH_CIPHER_PAIRWISE 1 | #define IW_AUTH_CIPHER_PAIRWISE 1 | |||
skipping to change at line 983 | skipping to change at line 1007 | |||
*/ | */ | |||
/* NWID (or domain id) */ | /* NWID (or domain id) */ | |||
__u32 min_nwid; /* Minimal NWID we are able to set * / | __u32 min_nwid; /* Minimal NWID we are able to set * / | |||
__u32 max_nwid; /* Maximal NWID we are able to set * / | __u32 max_nwid; /* Maximal NWID we are able to set * / | |||
/* Old Frequency (backward compat - moved lower ) */ | /* Old Frequency (backward compat - moved lower ) */ | |||
__u16 old_num_channels; | __u16 old_num_channels; | |||
__u8 old_num_frequency; | __u8 old_num_frequency; | |||
/* Scan capabilities */ | ||||
__u8 scan_capa; /* IW_SCAN_CAPA_* bit field */ | ||||
/* Wireless event capability bitmasks */ | /* Wireless event capability bitmasks */ | |||
__u32 event_capa[6]; | __u32 event_capa[6]; | |||
/* signal level threshold range */ | /* signal level threshold range */ | |||
__s32 sensitivity; | __s32 sensitivity; | |||
/* Quality of link & SNR stuff */ | /* Quality of link & SNR stuff */ | |||
/* Quality range (link, level, noise) | /* Quality range (link, level, noise) | |||
* If the quality is absolute, it will be in the range [0 ; max_qual ], | * 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]. | * if the quality is dBm, it will be in the range [max_qual ; 0]. | |||
skipping to change at line 1120 | skipping to change at line 1147 | |||
#define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality)) | #define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality)) | |||
/* iw_point events are special. First, the payload (extra data) come at | /* 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, | * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second, | |||
* we omit the pointer, so start at an offset. */ | * we omit the pointer, so start at an offset. */ | |||
#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \ | #define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \ | |||
(char *) NULL) | (char *) NULL) | |||
#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \ | #define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \ | |||
IW_EV_POINT_OFF) | IW_EV_POINT_OFF) | |||
/* Size of the Event prefix when packed in stream */ | ||||
#define IW_EV_LCP_PK_LEN (4) | ||||
/* Size of the various events when packed in stream */ | ||||
#define IW_EV_CHAR_PK_LEN (IW_EV_LCP_PK_LEN + IFNAMSIZ) | ||||
#define IW_EV_UINT_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(__u32)) | ||||
#define IW_EV_FREQ_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_freq)) | ||||
#define IW_EV_PARAM_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_param)) | ||||
#define IW_EV_ADDR_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct sockaddr)) | ||||
#define IW_EV_QUAL_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_quality | ||||
)) | ||||
#define IW_EV_POINT_PK_LEN (IW_EV_LCP_PK_LEN + 4) | ||||
#endif /* _LINUX_WIRELESS_H */ | #endif /* _LINUX_WIRELESS_H */ | |||
End of changes. 10 change blocks. | ||||
5 lines changed or deleted | 44 lines changed or added | |||