$search
00001 /* 00002 * Driver interaction with Linux Host AP driver 00003 * Copyright (c) 2002-2006, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 00013 */ 00014 00015 #ifndef HOSTAP_DRIVER_H 00016 #define HOSTAP_DRIVER_H 00017 00018 /* netdevice private ioctls (used, e.g., with iwpriv from user space) */ 00019 00020 /* New wireless extensions API - SET/GET convention (even ioctl numbers are 00021 * root only) 00022 */ 00023 #define PRISM2_IOCTL_PRISM2_PARAM (SIOCIWFIRSTPRIV + 0) 00024 #define PRISM2_IOCTL_GET_PRISM2_PARAM (SIOCIWFIRSTPRIV + 1) 00025 #define PRISM2_IOCTL_WRITEMIF (SIOCIWFIRSTPRIV + 2) 00026 #define PRISM2_IOCTL_READMIF (SIOCIWFIRSTPRIV + 3) 00027 #define PRISM2_IOCTL_MONITOR (SIOCIWFIRSTPRIV + 4) 00028 #define PRISM2_IOCTL_RESET (SIOCIWFIRSTPRIV + 6) 00029 #define PRISM2_IOCTL_INQUIRE (SIOCIWFIRSTPRIV + 8) 00030 #define PRISM2_IOCTL_WDS_ADD (SIOCIWFIRSTPRIV + 10) 00031 #define PRISM2_IOCTL_WDS_DEL (SIOCIWFIRSTPRIV + 12) 00032 #define PRISM2_IOCTL_SET_RID_WORD (SIOCIWFIRSTPRIV + 14) 00033 #define PRISM2_IOCTL_MACCMD (SIOCIWFIRSTPRIV + 16) 00034 #define PRISM2_IOCTL_ADDMAC (SIOCIWFIRSTPRIV + 18) 00035 #define PRISM2_IOCTL_DELMAC (SIOCIWFIRSTPRIV + 20) 00036 #define PRISM2_IOCTL_KICKMAC (SIOCIWFIRSTPRIV + 22) 00037 00038 /* following are not in SIOCGIWPRIV list; check permission in the driver code 00039 */ 00040 #define PRISM2_IOCTL_DOWNLOAD (SIOCDEVPRIVATE + 13) 00041 #define PRISM2_IOCTL_HOSTAPD (SIOCDEVPRIVATE + 14) 00042 00043 00044 /* PRISM2_IOCTL_PRISM2_PARAM ioctl() subtypes: */ 00045 enum { 00046 /* PRISM2_PARAM_PTYPE = 1, */ /* REMOVED 2003-10-22 */ 00047 PRISM2_PARAM_TXRATECTRL = 2, 00048 PRISM2_PARAM_BEACON_INT = 3, 00049 PRISM2_PARAM_PSEUDO_IBSS = 4, 00050 PRISM2_PARAM_ALC = 5, 00051 /* PRISM2_PARAM_TXPOWER = 6, */ /* REMOVED 2003-10-22 */ 00052 PRISM2_PARAM_DUMP = 7, 00053 PRISM2_PARAM_OTHER_AP_POLICY = 8, 00054 PRISM2_PARAM_AP_MAX_INACTIVITY = 9, 00055 PRISM2_PARAM_AP_BRIDGE_PACKETS = 10, 00056 PRISM2_PARAM_DTIM_PERIOD = 11, 00057 PRISM2_PARAM_AP_NULLFUNC_ACK = 12, 00058 PRISM2_PARAM_MAX_WDS = 13, 00059 PRISM2_PARAM_AP_AUTOM_AP_WDS = 14, 00060 PRISM2_PARAM_AP_AUTH_ALGS = 15, 00061 PRISM2_PARAM_MONITOR_ALLOW_FCSERR = 16, 00062 PRISM2_PARAM_HOST_ENCRYPT = 17, 00063 PRISM2_PARAM_HOST_DECRYPT = 18, 00064 PRISM2_PARAM_BUS_MASTER_THRESHOLD_RX = 19, 00065 PRISM2_PARAM_BUS_MASTER_THRESHOLD_TX = 20, 00066 PRISM2_PARAM_HOST_ROAMING = 21, 00067 PRISM2_PARAM_BCRX_STA_KEY = 22, 00068 PRISM2_PARAM_IEEE_802_1X = 23, 00069 PRISM2_PARAM_ANTSEL_TX = 24, 00070 PRISM2_PARAM_ANTSEL_RX = 25, 00071 PRISM2_PARAM_MONITOR_TYPE = 26, 00072 PRISM2_PARAM_WDS_TYPE = 27, 00073 PRISM2_PARAM_HOSTSCAN = 28, 00074 PRISM2_PARAM_AP_SCAN = 29, 00075 PRISM2_PARAM_ENH_SEC = 30, 00076 PRISM2_PARAM_IO_DEBUG = 31, 00077 PRISM2_PARAM_BASIC_RATES = 32, 00078 PRISM2_PARAM_OPER_RATES = 33, 00079 PRISM2_PARAM_HOSTAPD = 34, 00080 PRISM2_PARAM_HOSTAPD_STA = 35, 00081 PRISM2_PARAM_WPA = 36, 00082 PRISM2_PARAM_PRIVACY_INVOKED = 37, 00083 PRISM2_PARAM_TKIP_COUNTERMEASURES = 38, 00084 PRISM2_PARAM_DROP_UNENCRYPTED = 39, 00085 PRISM2_PARAM_SCAN_CHANNEL_MASK = 40, 00086 }; 00087 00088 enum { HOSTAP_ANTSEL_DO_NOT_TOUCH = 0, HOSTAP_ANTSEL_DIVERSITY = 1, 00089 HOSTAP_ANTSEL_LOW = 2, HOSTAP_ANTSEL_HIGH = 3 }; 00090 00091 00092 /* PRISM2_IOCTL_MACCMD ioctl() subcommands: */ 00093 enum { AP_MAC_CMD_POLICY_OPEN = 0, AP_MAC_CMD_POLICY_ALLOW = 1, 00094 AP_MAC_CMD_POLICY_DENY = 2, AP_MAC_CMD_FLUSH = 3, 00095 AP_MAC_CMD_KICKALL = 4 }; 00096 00097 00098 /* PRISM2_IOCTL_DOWNLOAD ioctl() dl_cmd: */ 00099 enum { 00100 PRISM2_DOWNLOAD_VOLATILE = 1 /* RAM */, 00101 /* Note! Old versions of prism2_srec have a fatal error in CRC-16 00102 * calculation, which will corrupt all non-volatile downloads. 00103 * PRISM2_DOWNLOAD_NON_VOLATILE used to be 2, but it is now 3 to 00104 * prevent use of old versions of prism2_srec for non-volatile 00105 * download. */ 00106 PRISM2_DOWNLOAD_NON_VOLATILE = 3 /* FLASH */, 00107 PRISM2_DOWNLOAD_VOLATILE_GENESIS = 4 /* RAM in Genesis mode */, 00108 /* Persistent versions of volatile download commands (keep firmware 00109 * data in memory and automatically re-download after hw_reset */ 00110 PRISM2_DOWNLOAD_VOLATILE_PERSISTENT = 5, 00111 PRISM2_DOWNLOAD_VOLATILE_GENESIS_PERSISTENT = 6, 00112 }; 00113 00114 struct prism2_download_param { 00115 u32 dl_cmd; 00116 u32 start_addr; 00117 u32 num_areas; 00118 struct prism2_download_area { 00119 u32 addr; /* wlan card address */ 00120 u32 len; 00121 caddr_t ptr; /* pointer to data in user space */ 00122 } data[0]; 00123 }; 00124 00125 #define PRISM2_MAX_DOWNLOAD_AREA_LEN 131072 00126 #define PRISM2_MAX_DOWNLOAD_LEN 262144 00127 00128 00129 /* PRISM2_IOCTL_HOSTAPD ioctl() cmd: */ 00130 enum { 00131 PRISM2_HOSTAPD_FLUSH = 1, 00132 PRISM2_HOSTAPD_ADD_STA = 2, 00133 PRISM2_HOSTAPD_REMOVE_STA = 3, 00134 PRISM2_HOSTAPD_GET_INFO_STA = 4, 00135 /* REMOVED: PRISM2_HOSTAPD_RESET_TXEXC_STA = 5, */ 00136 PRISM2_SET_ENCRYPTION = 6, 00137 PRISM2_GET_ENCRYPTION = 7, 00138 PRISM2_HOSTAPD_SET_FLAGS_STA = 8, 00139 PRISM2_HOSTAPD_GET_RID = 9, 00140 PRISM2_HOSTAPD_SET_RID = 10, 00141 PRISM2_HOSTAPD_SET_ASSOC_AP_ADDR = 11, 00142 PRISM2_HOSTAPD_SET_GENERIC_ELEMENT = 12, 00143 PRISM2_HOSTAPD_MLME = 13, 00144 PRISM2_HOSTAPD_SCAN_REQ = 14, 00145 PRISM2_HOSTAPD_STA_CLEAR_STATS = 15, 00146 }; 00147 00148 #define PRISM2_HOSTAPD_MAX_BUF_SIZE 1024 00149 #define PRISM2_HOSTAPD_RID_HDR_LEN \ 00150 ((size_t) (&((struct prism2_hostapd_param *) 0)->u.rid.data)) 00151 #define PRISM2_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \ 00152 ((size_t) (&((struct prism2_hostapd_param *) 0)->u.generic_elem.data)) 00153 00154 /* Maximum length for algorithm names (-1 for nul termination) used in ioctl() 00155 */ 00156 #define HOSTAP_CRYPT_ALG_NAME_LEN 16 00157 00158 00159 struct prism2_hostapd_param { 00160 u32 cmd; 00161 u8 sta_addr[ETH_ALEN]; 00162 union { 00163 struct { 00164 u16 aid; 00165 u16 capability; 00166 u8 tx_supp_rates; 00167 } add_sta; 00168 struct { 00169 u32 inactive_sec; 00170 } get_info_sta; 00171 struct { 00172 u8 alg[HOSTAP_CRYPT_ALG_NAME_LEN]; 00173 u32 flags; 00174 u32 err; 00175 u8 idx; 00176 u8 seq[8]; /* sequence counter (set: RX, get: TX) */ 00177 u16 key_len; 00178 u8 key[0]; 00179 } crypt; 00180 struct { 00181 u32 flags_and; 00182 u32 flags_or; 00183 } set_flags_sta; 00184 struct { 00185 u16 rid; 00186 u16 len; 00187 u8 data[0]; 00188 } rid; 00189 struct { 00190 u8 len; 00191 u8 data[0]; 00192 } generic_elem; 00193 struct { 00194 #define MLME_STA_DEAUTH 0 00195 #define MLME_STA_DISASSOC 1 00196 u16 cmd; 00197 u16 reason_code; 00198 } mlme; 00199 struct { 00200 u8 ssid_len; 00201 u8 ssid[32]; 00202 } scan_req; 00203 } u; 00204 }; 00205 00206 #define HOSTAP_CRYPT_FLAG_SET_TX_KEY BIT(0) 00207 #define HOSTAP_CRYPT_FLAG_PERMANENT BIT(1) 00208 00209 #define HOSTAP_CRYPT_ERR_UNKNOWN_ALG 2 00210 #define HOSTAP_CRYPT_ERR_UNKNOWN_ADDR 3 00211 #define HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED 4 00212 #define HOSTAP_CRYPT_ERR_KEY_SET_FAILED 5 00213 #define HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED 6 00214 #define HOSTAP_CRYPT_ERR_CARD_CONF_FAILED 7 00215 00216 #endif /* HOSTAP_DRIVER_H */