2 * hostapd / Kernel driver communication with Linux Host AP driver
3 * Copyright (c) 2002-2006, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
15 #ifndef HOSTAP_COMMON_H
16 #define HOSTAP_COMMON_H
18 /* netdevice private ioctls (used, e.g., with iwpriv from user space) */
20 /* New wireless extensions API - SET/GET convention (even ioctl numbers are
23 #define PRISM2_IOCTL_PRISM2_PARAM (SIOCIWFIRSTPRIV + 0)
24 #define PRISM2_IOCTL_GET_PRISM2_PARAM (SIOCIWFIRSTPRIV + 1)
25 #define PRISM2_IOCTL_WRITEMIF (SIOCIWFIRSTPRIV + 2)
26 #define PRISM2_IOCTL_READMIF (SIOCIWFIRSTPRIV + 3)
27 #define PRISM2_IOCTL_MONITOR (SIOCIWFIRSTPRIV + 4)
28 #define PRISM2_IOCTL_RESET (SIOCIWFIRSTPRIV + 6)
29 #define PRISM2_IOCTL_INQUIRE (SIOCIWFIRSTPRIV + 8)
30 #define PRISM2_IOCTL_WDS_ADD (SIOCIWFIRSTPRIV + 10)
31 #define PRISM2_IOCTL_WDS_DEL (SIOCIWFIRSTPRIV + 12)
32 #define PRISM2_IOCTL_SET_RID_WORD (SIOCIWFIRSTPRIV + 14)
33 #define PRISM2_IOCTL_MACCMD (SIOCIWFIRSTPRIV + 16)
34 #define PRISM2_IOCTL_ADDMAC (SIOCIWFIRSTPRIV + 18)
35 #define PRISM2_IOCTL_DELMAC (SIOCIWFIRSTPRIV + 20)
36 #define PRISM2_IOCTL_KICKMAC (SIOCIWFIRSTPRIV + 22)
38 /* following are not in SIOCGIWPRIV list; check permission in the driver code
40 #define PRISM2_IOCTL_DOWNLOAD (SIOCDEVPRIVATE + 13)
41 #define PRISM2_IOCTL_HOSTAPD (SIOCDEVPRIVATE + 14)
44 /* PRISM2_IOCTL_PRISM2_PARAM ioctl() subtypes: */
46 /* PRISM2_PARAM_PTYPE = 1, */ /* REMOVED 2003-10-22 */
47 PRISM2_PARAM_TXRATECTRL
= 2,
48 PRISM2_PARAM_BEACON_INT
= 3,
49 PRISM2_PARAM_PSEUDO_IBSS
= 4,
51 /* PRISM2_PARAM_TXPOWER = 6, */ /* REMOVED 2003-10-22 */
52 PRISM2_PARAM_DUMP
= 7,
53 PRISM2_PARAM_OTHER_AP_POLICY
= 8,
54 PRISM2_PARAM_AP_MAX_INACTIVITY
= 9,
55 PRISM2_PARAM_AP_BRIDGE_PACKETS
= 10,
56 PRISM2_PARAM_DTIM_PERIOD
= 11,
57 PRISM2_PARAM_AP_NULLFUNC_ACK
= 12,
58 PRISM2_PARAM_MAX_WDS
= 13,
59 PRISM2_PARAM_AP_AUTOM_AP_WDS
= 14,
60 PRISM2_PARAM_AP_AUTH_ALGS
= 15,
61 PRISM2_PARAM_MONITOR_ALLOW_FCSERR
= 16,
62 PRISM2_PARAM_HOST_ENCRYPT
= 17,
63 PRISM2_PARAM_HOST_DECRYPT
= 18,
64 PRISM2_PARAM_BUS_MASTER_THRESHOLD_RX
= 19,
65 PRISM2_PARAM_BUS_MASTER_THRESHOLD_TX
= 20,
66 PRISM2_PARAM_HOST_ROAMING
= 21,
67 PRISM2_PARAM_BCRX_STA_KEY
= 22,
68 PRISM2_PARAM_IEEE_802_1X
= 23,
69 PRISM2_PARAM_ANTSEL_TX
= 24,
70 PRISM2_PARAM_ANTSEL_RX
= 25,
71 PRISM2_PARAM_MONITOR_TYPE
= 26,
72 PRISM2_PARAM_WDS_TYPE
= 27,
73 PRISM2_PARAM_HOSTSCAN
= 28,
74 PRISM2_PARAM_AP_SCAN
= 29,
75 PRISM2_PARAM_ENH_SEC
= 30,
76 PRISM2_PARAM_IO_DEBUG
= 31,
77 PRISM2_PARAM_BASIC_RATES
= 32,
78 PRISM2_PARAM_OPER_RATES
= 33,
79 PRISM2_PARAM_HOSTAPD
= 34,
80 PRISM2_PARAM_HOSTAPD_STA
= 35,
81 PRISM2_PARAM_WPA
= 36,
82 PRISM2_PARAM_PRIVACY_INVOKED
= 37,
83 PRISM2_PARAM_TKIP_COUNTERMEASURES
= 38,
84 PRISM2_PARAM_DROP_UNENCRYPTED
= 39,
85 PRISM2_PARAM_SCAN_CHANNEL_MASK
= 40,
88 enum { HOSTAP_ANTSEL_DO_NOT_TOUCH
= 0, HOSTAP_ANTSEL_DIVERSITY
= 1,
89 HOSTAP_ANTSEL_LOW
= 2, HOSTAP_ANTSEL_HIGH
= 3 };
92 /* PRISM2_IOCTL_MACCMD ioctl() subcommands: */
93 enum { AP_MAC_CMD_POLICY_OPEN
= 0, AP_MAC_CMD_POLICY_ALLOW
= 1,
94 AP_MAC_CMD_POLICY_DENY
= 2, AP_MAC_CMD_FLUSH
= 3,
95 AP_MAC_CMD_KICKALL
= 4 };
98 /* PRISM2_IOCTL_DOWNLOAD ioctl() dl_cmd: */
100 PRISM2_DOWNLOAD_VOLATILE
= 1 /* RAM */,
101 /* Note! Old versions of prism2_srec have a fatal error in CRC-16
102 * calculation, which will corrupt all non-volatile downloads.
103 * PRISM2_DOWNLOAD_NON_VOLATILE used to be 2, but it is now 3 to
104 * prevent use of old versions of prism2_srec for non-volatile
106 PRISM2_DOWNLOAD_NON_VOLATILE
= 3 /* FLASH */,
107 PRISM2_DOWNLOAD_VOLATILE_GENESIS
= 4 /* RAM in Genesis mode */,
108 /* Persistent versions of volatile download commands (keep firmware
109 * data in memory and automatically re-download after hw_reset */
110 PRISM2_DOWNLOAD_VOLATILE_PERSISTENT
= 5,
111 PRISM2_DOWNLOAD_VOLATILE_GENESIS_PERSISTENT
= 6,
114 struct prism2_download_param
{
118 struct prism2_download_area
{
119 u32 addr
; /* wlan card address */
121 caddr_t ptr
; /* pointer to data in user space */
125 #define PRISM2_MAX_DOWNLOAD_AREA_LEN 131072
126 #define PRISM2_MAX_DOWNLOAD_LEN 262144
129 /* PRISM2_IOCTL_HOSTAPD ioctl() cmd: */
131 PRISM2_HOSTAPD_FLUSH
= 1,
132 PRISM2_HOSTAPD_ADD_STA
= 2,
133 PRISM2_HOSTAPD_REMOVE_STA
= 3,
134 PRISM2_HOSTAPD_GET_INFO_STA
= 4,
135 /* REMOVED: PRISM2_HOSTAPD_RESET_TXEXC_STA = 5, */
136 PRISM2_SET_ENCRYPTION
= 6,
137 PRISM2_GET_ENCRYPTION
= 7,
138 PRISM2_HOSTAPD_SET_FLAGS_STA
= 8,
139 PRISM2_HOSTAPD_GET_RID
= 9,
140 PRISM2_HOSTAPD_SET_RID
= 10,
141 PRISM2_HOSTAPD_SET_ASSOC_AP_ADDR
= 11,
142 PRISM2_HOSTAPD_SET_GENERIC_ELEMENT
= 12,
143 PRISM2_HOSTAPD_MLME
= 13,
144 PRISM2_HOSTAPD_SCAN_REQ
= 14,
145 PRISM2_HOSTAPD_STA_CLEAR_STATS
= 15,
148 #define PRISM2_HOSTAPD_MAX_BUF_SIZE 1024
149 #define PRISM2_HOSTAPD_RID_HDR_LEN \
150 ((int) (&((struct prism2_hostapd_param *) 0)->u.rid.data))
151 #define PRISM2_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
152 ((int) (&((struct prism2_hostapd_param *) 0)->u.generic_elem.data))
154 /* Maximum length for algorithm names (-1 for nul termination) used in ioctl()
156 #define HOSTAP_CRYPT_ALG_NAME_LEN 16
159 struct prism2_hostapd_param
{
161 u8 sta_addr
[ETH_ALEN
];
172 u8 alg
[HOSTAP_CRYPT_ALG_NAME_LEN
];
176 u8 seq
[8]; /* sequence counter (set: RX, get: TX) */
194 #define MLME_STA_DEAUTH 0
195 #define MLME_STA_DISASSOC 1
206 #define HOSTAP_CRYPT_FLAG_SET_TX_KEY BIT(0)
207 #define HOSTAP_CRYPT_FLAG_PERMANENT BIT(1)
209 #define HOSTAP_CRYPT_ERR_UNKNOWN_ALG 2
210 #define HOSTAP_CRYPT_ERR_UNKNOWN_ADDR 3
211 #define HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED 4
212 #define HOSTAP_CRYPT_ERR_KEY_SET_FAILED 5
213 #define HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED 6
214 #define HOSTAP_CRYPT_ERR_CARD_CONF_FAILED 7
216 #endif /* HOSTAP_COMMON_H */