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