1 /* 2 * Driver interaction with Linux Host AP driver 3 * Copyright (c) 2002-2006, Jouni Malinen <j (at) w1.fi> 4 * 5 * This software may be distributed under the terms of the BSD license. 6 * See README for more details. 7 */ 8 9 #ifndef HOSTAP_DRIVER_H 10 #define HOSTAP_DRIVER_H 11 12 /* netdevice private ioctls (used, e.g., with iwpriv from user space) */ 13 14 /* New wireless extensions API - SET/GET convention (even ioctl numbers are 15 * root only) 16 */ 17 #define PRISM2_IOCTL_PRISM2_PARAM (SIOCIWFIRSTPRIV + 0) 18 #define PRISM2_IOCTL_GET_PRISM2_PARAM (SIOCIWFIRSTPRIV + 1) 19 #define PRISM2_IOCTL_WRITEMIF (SIOCIWFIRSTPRIV + 2) 20 #define PRISM2_IOCTL_READMIF (SIOCIWFIRSTPRIV + 3) 21 #define PRISM2_IOCTL_MONITOR (SIOCIWFIRSTPRIV + 4) 22 #define PRISM2_IOCTL_RESET (SIOCIWFIRSTPRIV + 6) 23 #define PRISM2_IOCTL_INQUIRE (SIOCIWFIRSTPRIV + 8) 24 #define PRISM2_IOCTL_WDS_ADD (SIOCIWFIRSTPRIV + 10) 25 #define PRISM2_IOCTL_WDS_DEL (SIOCIWFIRSTPRIV + 12) 26 #define PRISM2_IOCTL_SET_RID_WORD (SIOCIWFIRSTPRIV + 14) 27 #define PRISM2_IOCTL_MACCMD (SIOCIWFIRSTPRIV + 16) 28 #define PRISM2_IOCTL_ADDMAC (SIOCIWFIRSTPRIV + 18) 29 #define PRISM2_IOCTL_DELMAC (SIOCIWFIRSTPRIV + 20) 30 #define PRISM2_IOCTL_KICKMAC (SIOCIWFIRSTPRIV + 22) 31 32 /* following are not in SIOCGIWPRIV list; check permission in the driver code 33 */ 34 #define PRISM2_IOCTL_DOWNLOAD (SIOCDEVPRIVATE + 13) 35 #define PRISM2_IOCTL_HOSTAPD (SIOCDEVPRIVATE + 14) 36 37 38 /* PRISM2_IOCTL_PRISM2_PARAM ioctl() subtypes: */ 39 enum { 40 /* PRISM2_PARAM_PTYPE = 1, */ /* REMOVED 2003-10-22 */ 41 PRISM2_PARAM_TXRATECTRL = 2, 42 PRISM2_PARAM_BEACON_INT = 3, 43 PRISM2_PARAM_PSEUDO_IBSS = 4, 44 PRISM2_PARAM_ALC = 5, 45 /* PRISM2_PARAM_TXPOWER = 6, */ /* REMOVED 2003-10-22 */ 46 PRISM2_PARAM_DUMP = 7, 47 PRISM2_PARAM_OTHER_AP_POLICY = 8, 48 PRISM2_PARAM_AP_MAX_INACTIVITY = 9, 49 PRISM2_PARAM_AP_BRIDGE_PACKETS = 10, 50 PRISM2_PARAM_DTIM_PERIOD = 11, 51 PRISM2_PARAM_AP_NULLFUNC_ACK = 12, 52 PRISM2_PARAM_MAX_WDS = 13, 53 PRISM2_PARAM_AP_AUTOM_AP_WDS = 14, 54 PRISM2_PARAM_AP_AUTH_ALGS = 15, 55 PRISM2_PARAM_MONITOR_ALLOW_FCSERR = 16, 56 PRISM2_PARAM_HOST_ENCRYPT = 17, 57 PRISM2_PARAM_HOST_DECRYPT = 18, 58 PRISM2_PARAM_BUS_MASTER_THRESHOLD_RX = 19, 59 PRISM2_PARAM_BUS_MASTER_THRESHOLD_TX = 20, 60 PRISM2_PARAM_HOST_ROAMING = 21, 61 PRISM2_PARAM_BCRX_STA_KEY = 22, 62 PRISM2_PARAM_IEEE_802_1X = 23, 63 PRISM2_PARAM_ANTSEL_TX = 24, 64 PRISM2_PARAM_ANTSEL_RX = 25, 65 PRISM2_PARAM_MONITOR_TYPE = 26, 66 PRISM2_PARAM_WDS_TYPE = 27, 67 PRISM2_PARAM_HOSTSCAN = 28, 68 PRISM2_PARAM_AP_SCAN = 29, 69 PRISM2_PARAM_ENH_SEC = 30, 70 PRISM2_PARAM_IO_DEBUG = 31, 71 PRISM2_PARAM_BASIC_RATES = 32, 72 PRISM2_PARAM_OPER_RATES = 33, 73 PRISM2_PARAM_HOSTAPD = 34, 74 PRISM2_PARAM_HOSTAPD_STA = 35, 75 PRISM2_PARAM_WPA = 36, 76 PRISM2_PARAM_PRIVACY_INVOKED = 37, 77 PRISM2_PARAM_TKIP_COUNTERMEASURES = 38, 78 PRISM2_PARAM_DROP_UNENCRYPTED = 39, 79 PRISM2_PARAM_SCAN_CHANNEL_MASK = 40, 80 }; 81 82 enum { HOSTAP_ANTSEL_DO_NOT_TOUCH = 0, HOSTAP_ANTSEL_DIVERSITY = 1, 83 HOSTAP_ANTSEL_LOW = 2, HOSTAP_ANTSEL_HIGH = 3 }; 84 85 86 /* PRISM2_IOCTL_MACCMD ioctl() subcommands: */ 87 enum { AP_MAC_CMD_POLICY_OPEN = 0, AP_MAC_CMD_POLICY_ALLOW = 1, 88 AP_MAC_CMD_POLICY_DENY = 2, AP_MAC_CMD_FLUSH = 3, 89 AP_MAC_CMD_KICKALL = 4 }; 90 91 92 /* PRISM2_IOCTL_DOWNLOAD ioctl() dl_cmd: */ 93 enum { 94 PRISM2_DOWNLOAD_VOLATILE = 1 /* RAM */, 95 /* Note! Old versions of prism2_srec have a fatal error in CRC-16 96 * calculation, which will corrupt all non-volatile downloads. 97 * PRISM2_DOWNLOAD_NON_VOLATILE used to be 2, but it is now 3 to 98 * prevent use of old versions of prism2_srec for non-volatile 99 * download. */ 100 PRISM2_DOWNLOAD_NON_VOLATILE = 3 /* FLASH */, 101 PRISM2_DOWNLOAD_VOLATILE_GENESIS = 4 /* RAM in Genesis mode */, 102 /* Persistent versions of volatile download commands (keep firmware 103 * data in memory and automatically re-download after hw_reset */ 104 PRISM2_DOWNLOAD_VOLATILE_PERSISTENT = 5, 105 PRISM2_DOWNLOAD_VOLATILE_GENESIS_PERSISTENT = 6, 106 }; 107 108 struct prism2_download_param { 109 u32 dl_cmd; 110 u32 start_addr; 111 u32 num_areas; 112 struct prism2_download_area { 113 u32 addr; /* wlan card address */ 114 u32 len; 115 caddr_t ptr; /* pointer to data in user space */ 116 } data[0]; 117 }; 118 119 #define PRISM2_MAX_DOWNLOAD_AREA_LEN 131072 120 #define PRISM2_MAX_DOWNLOAD_LEN 262144 121 122 123 /* PRISM2_IOCTL_HOSTAPD ioctl() cmd: */ 124 enum { 125 PRISM2_HOSTAPD_FLUSH = 1, 126 PRISM2_HOSTAPD_ADD_STA = 2, 127 PRISM2_HOSTAPD_REMOVE_STA = 3, 128 PRISM2_HOSTAPD_GET_INFO_STA = 4, 129 /* REMOVED: PRISM2_HOSTAPD_RESET_TXEXC_STA = 5, */ 130 PRISM2_SET_ENCRYPTION = 6, 131 PRISM2_GET_ENCRYPTION = 7, 132 PRISM2_HOSTAPD_SET_FLAGS_STA = 8, 133 PRISM2_HOSTAPD_GET_RID = 9, 134 PRISM2_HOSTAPD_SET_RID = 10, 135 PRISM2_HOSTAPD_SET_ASSOC_AP_ADDR = 11, 136 PRISM2_HOSTAPD_SET_GENERIC_ELEMENT = 12, 137 PRISM2_HOSTAPD_MLME = 13, 138 PRISM2_HOSTAPD_SCAN_REQ = 14, 139 PRISM2_HOSTAPD_STA_CLEAR_STATS = 15, 140 }; 141 142 #define PRISM2_HOSTAPD_MAX_BUF_SIZE 1024 143 #define PRISM2_HOSTAPD_RID_HDR_LEN \ 144 ((size_t) (&((struct prism2_hostapd_param *) 0)->u.rid.data)) 145 #define PRISM2_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \ 146 ((size_t) (&((struct prism2_hostapd_param *) 0)->u.generic_elem.data)) 147 148 /* Maximum length for algorithm names (-1 for nul termination) used in ioctl() 149 */ 150 #define HOSTAP_CRYPT_ALG_NAME_LEN 16 151 152 153 struct prism2_hostapd_param { 154 u32 cmd; 155 u8 sta_addr[ETH_ALEN]; 156 union { 157 struct { 158 u16 aid; 159 u16 capability; 160 u8 tx_supp_rates; 161 } add_sta; 162 struct { 163 u32 inactive_sec; 164 } get_info_sta; 165 struct { 166 u8 alg[HOSTAP_CRYPT_ALG_NAME_LEN]; 167 u32 flags; 168 u32 err; 169 u8 idx; 170 u8 seq[8]; /* sequence counter (set: RX, get: TX) */ 171 u16 key_len; 172 u8 key[0]; 173 } crypt; 174 struct { 175 u32 flags_and; 176 u32 flags_or; 177 } set_flags_sta; 178 struct { 179 u16 rid; 180 u16 len; 181 u8 data[0]; 182 } rid; 183 struct { 184 u8 len; 185 u8 data[0]; 186 } generic_elem; 187 struct { 188 #define MLME_STA_DEAUTH 0 189 #define MLME_STA_DISASSOC 1 190 u16 cmd; 191 u16 reason_code; 192 } mlme; 193 struct { 194 u8 ssid_len; 195 u8 ssid[32]; 196 } scan_req; 197 } u; 198 }; 199 200 #define HOSTAP_CRYPT_FLAG_SET_TX_KEY BIT(0) 201 #define HOSTAP_CRYPT_FLAG_PERMANENT BIT(1) 202 203 #define HOSTAP_CRYPT_ERR_UNKNOWN_ALG 2 204 #define HOSTAP_CRYPT_ERR_UNKNOWN_ADDR 3 205 #define HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED 4 206 #define HOSTAP_CRYPT_ERR_KEY_SET_FAILED 5 207 #define HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED 6 208 #define HOSTAP_CRYPT_ERR_CARD_CONF_FAILED 7 209 210 #endif /* HOSTAP_DRIVER_H */ 211