New: mac80211 stack from the wireless-dev tree
[openwrt/svn-archive/archive.git] / package / mac80211 / src / mac80211 / hostapd_ioctl.h
1 /*
2 * Host AP (software wireless LAN access point) user space daemon for
3 * Host AP kernel driver
4 * Copyright 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
5 * Copyright 2002-2004, Instant802 Networks, Inc.
6 * Copyright 2005, Devicescape Software, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13 #ifndef HOSTAPD_IOCTL_H
14 #define HOSTAPD_IOCTL_H
15
16 #ifdef __KERNEL__
17 #include <linux/types.h>
18 #endif /* __KERNEL__ */
19
20 #define PRISM2_IOCTL_PRISM2_PARAM (SIOCIWFIRSTPRIV + 0)
21 #define PRISM2_IOCTL_GET_PRISM2_PARAM (SIOCIWFIRSTPRIV + 1)
22 #define PRISM2_IOCTL_HOSTAPD (SIOCIWFIRSTPRIV + 3)
23
24 /* PRISM2_IOCTL_PRISM2_PARAM ioctl() subtypes:
25 * This table is no longer added to, the whole sub-ioctl
26 * mess shall be deleted completely. */
27 enum {
28 PRISM2_PARAM_BEACON_INT = 3,
29 PRISM2_PARAM_AP_BRIDGE_PACKETS = 10,
30 PRISM2_PARAM_DTIM_PERIOD = 11,
31 PRISM2_PARAM_AP_AUTH_ALGS = 15,
32 PRISM2_PARAM_HOST_ENCRYPT = 17,
33 PRISM2_PARAM_HOST_DECRYPT = 18,
34 PRISM2_PARAM_IEEE_802_1X = 23,
35 PRISM2_PARAM_ANTSEL_TX = 24,
36 PRISM2_PARAM_ANTSEL_RX = 25,
37
38 /* Instant802 additions */
39 PRISM2_PARAM_CTS_PROTECT_ERP_FRAMES = 1001,
40 PRISM2_PARAM_DROP_UNENCRYPTED = 1002,
41 PRISM2_PARAM_PREAMBLE = 1003,
42 PRISM2_PARAM_SHORT_SLOT_TIME = 1006,
43 PRISM2_PARAM_NEXT_MODE = 1008,
44 PRISM2_PARAM_CLEAR_KEYS = 1009,
45 PRISM2_PARAM_RADIO_ENABLED = 1010,
46 PRISM2_PARAM_ANTENNA_MODE = 1013,
47 PRISM2_PARAM_PRIVACY_INVOKED = 1014,
48 PRISM2_PARAM_BROADCAST_SSID = 1015,
49 PRISM2_PARAM_STAT_TIME = 1016,
50 PRISM2_PARAM_STA_ANTENNA_SEL = 1017,
51 PRISM2_PARAM_FORCE_UNICAST_RATE = 1018,
52 PRISM2_PARAM_RATE_CTRL_NUM_UP = 1019,
53 PRISM2_PARAM_RATE_CTRL_NUM_DOWN = 1020,
54 PRISM2_PARAM_MAX_RATECTRL_RATE = 1021,
55 PRISM2_PARAM_TX_POWER_REDUCTION = 1022,
56 PRISM2_PARAM_EAPOL = 1023,
57 PRISM2_PARAM_KEY_TX_RX_THRESHOLD = 1024,
58 PRISM2_PARAM_KEY_INDEX = 1025,
59 PRISM2_PARAM_DEFAULT_WEP_ONLY = 1026,
60 PRISM2_PARAM_WIFI_WME_NOACK_TEST = 1033,
61 PRISM2_PARAM_ALLOW_BROADCAST_ALWAYS = 1034,
62 PRISM2_PARAM_SCAN_FLAGS = 1035,
63 PRISM2_PARAM_HW_MODES = 1036,
64 PRISM2_PARAM_CREATE_IBSS = 1037,
65 PRISM2_PARAM_WMM_ENABLED = 1038,
66 PRISM2_PARAM_MIXED_CELL = 1039,
67 PRISM2_PARAM_KEY_MGMT = 1040,
68 PRISM2_PARAM_RADAR_DETECT = 1043,
69 PRISM2_PARAM_SPECTRUM_MGMT = 1044,
70 PRISM2_PARAM_USER_SPACE_MLME = 1045,
71 PRISM2_PARAM_MGMT_IF = 1046,
72 };
73
74 /* PRISM2_IOCTL_HOSTAPD ioctl() cmd:
75 * This table is no longer added to, the hostapd ioctl
76 * shall be deleted completely. */
77 enum {
78 PRISM2_HOSTAPD_FLUSH = 1,
79 PRISM2_HOSTAPD_ADD_STA = 2,
80 PRISM2_HOSTAPD_REMOVE_STA = 3,
81 PRISM2_HOSTAPD_GET_INFO_STA = 4,
82 PRISM2_SET_ENCRYPTION = 6,
83 PRISM2_GET_ENCRYPTION = 7,
84 PRISM2_HOSTAPD_SET_FLAGS_STA = 8,
85 PRISM2_HOSTAPD_MLME = 13,
86
87 /* Instant802 additions */
88 PRISM2_HOSTAPD_SET_BEACON = 1001,
89 PRISM2_HOSTAPD_GET_HW_FEATURES = 1002,
90 PRISM2_HOSTAPD_WPA_TRIGGER = 1004,
91 PRISM2_HOSTAPD_SET_RATE_SETS = 1005,
92 PRISM2_HOSTAPD_ADD_IF = 1006,
93 PRISM2_HOSTAPD_REMOVE_IF = 1007,
94 PRISM2_HOSTAPD_GET_DOT11COUNTERSTABLE = 1008,
95 PRISM2_HOSTAPD_GET_LOAD_STATS = 1009,
96 PRISM2_HOSTAPD_SET_STA_VLAN = 1010,
97 PRISM2_HOSTAPD_SET_GENERIC_INFO_ELEM = 1011,
98 PRISM2_HOSTAPD_SET_CHANNEL_FLAG = 1012,
99 PRISM2_HOSTAPD_SET_REGULATORY_DOMAIN = 1013,
100 PRISM2_HOSTAPD_SET_TX_QUEUE_PARAMS = 1014,
101 PRISM2_HOSTAPD_GET_TX_STATS = 1016,
102 PRISM2_HOSTAPD_UPDATE_IF = 1017,
103 PRISM2_HOSTAPD_SCAN_REQ = 1019,
104 PRISM2_STA_GET_STATE = 1020,
105 PRISM2_HOSTAPD_FLUSH_IFS = 1021,
106 PRISM2_HOSTAPD_SET_RADAR_PARAMS = 1023,
107 PRISM2_HOSTAPD_SET_QUIET_PARAMS = 1024,
108 };
109
110 #define PRISM2_HOSTAPD_MAX_BUF_SIZE 2048
111 #define HOSTAP_CRYPT_ALG_NAME_LEN 16
112
113 #ifndef ALIGNED
114 #define ALIGNED __attribute__ ((aligned))
115 #endif
116
117 struct prism2_hostapd_param {
118 u32 cmd;
119 u8 sta_addr[ETH_ALEN];
120 u8 pad[2];
121 union {
122 struct {
123 u16 aid;
124 u16 capability;
125 u8 supp_rates[32];
126 u8 wds_flags;
127 #define IEEE80211_STA_DYNAMIC_ENC BIT(0)
128 u8 enc_flags;
129 u16 listen_interval;
130 } add_sta;
131 struct {
132 u32 inactive_msec;
133 u32 rx_packets;
134 u32 tx_packets;
135 u32 rx_bytes;
136 u32 tx_bytes;
137 u32 current_tx_rate; /* in 100 kbps */
138 u32 channel_use;
139 u32 flags;
140 u32 num_ps_buf_frames;
141 u32 tx_retry_failed;
142 u32 tx_retry_count;
143 u32 last_rssi;
144 u32 last_ack_rssi;
145 } get_info_sta;
146 struct {
147 char alg[HOSTAP_CRYPT_ALG_NAME_LEN];
148 u32 flags;
149 u32 err;
150 u8 idx;
151 #define HOSTAP_SEQ_COUNTER_SIZE 8
152 u8 seq_counter[HOSTAP_SEQ_COUNTER_SIZE];
153 u16 key_len;
154 u8 key[0] ALIGNED;
155 } crypt;
156 struct {
157 u32 flags_and;
158 u32 flags_or;
159 } set_flags_sta;
160 struct {
161 u16 head_len;
162 u16 tail_len;
163 u8 data[0] ALIGNED; /* head_len + tail_len bytes */
164 } beacon;
165 struct {
166 u16 num_modes;
167 u16 flags;
168 u8 data[0] ALIGNED; /* num_modes * feature data */
169 } hw_features;
170 struct {
171 u8 now;
172 s8 our_mode_only;
173 s16 last_rx;
174 u16 channel;
175 s16 interval; /* seconds */
176 s32 listen; /* microseconds */
177 } scan;
178 struct {
179 #define WPA_TRIGGER_FAIL_TX_MIC BIT(0)
180 #define WPA_TRIGGER_FAIL_TX_ICV BIT(1)
181 #define WPA_TRIGGER_FAIL_RX_MIC BIT(2)
182 #define WPA_TRIGGER_FAIL_RX_ICV BIT(3)
183 #define WPA_TRIGGER_TX_REPLAY BIT(4)
184 #define WPA_TRIGGER_TX_REPLAY_FRAG BIT(5)
185 #define WPA_TRIGGER_TX_SKIP_SEQ BIT(6)
186 u32 trigger;
187 } wpa_trigger;
188 struct {
189 u16 mode; /* MODE_* */
190 u16 num_supported_rates;
191 u16 num_basic_rates;
192 u8 data[0] ALIGNED; /* num_supported_rates * u16 +
193 * num_basic_rates * u16 */
194 } set_rate_sets;
195 struct {
196 u8 type; /* WDS, VLAN, etc */
197 u8 name[IFNAMSIZ];
198 u8 data[0] ALIGNED;
199 } if_info;
200 struct dot11_counters {
201 u32 dot11TransmittedFragmentCount;
202 u32 dot11MulticastTransmittedFrameCount;
203 u32 dot11FailedCount;
204 u32 dot11ReceivedFragmentCount;
205 u32 dot11MulticastReceivedFrameCount;
206 u32 dot11FCSErrorCount;
207 u32 dot11TransmittedFrameCount;
208 u32 dot11WEPUndecryptableCount;
209 u32 dot11ACKFailureCount;
210 u32 dot11RTSFailureCount;
211 u32 dot11RTSSuccessCount;
212 } dot11CountersTable;
213 struct {
214 #define LOAD_STATS_CLEAR BIT(1)
215 u32 flags;
216 u32 channel_use;
217 } get_load_stats;
218 struct {
219 char vlan_name[IFNAMSIZ];
220 int vlan_id;
221 } set_sta_vlan;
222 struct {
223 u8 len;
224 u8 data[0] ALIGNED;
225 } set_generic_info_elem;
226 struct {
227 u16 mode; /* MODE_* */
228 u16 chan;
229 u32 flag;
230 u8 power_level; /* regulatory limit in dBm */
231 u8 antenna_max;
232 } set_channel_flag;
233 struct {
234 u32 rd;
235 } set_regulatory_domain;
236 struct {
237 u32 queue;
238 s32 aifs;
239 u32 cw_min;
240 u32 cw_max;
241 u32 burst_time; /* maximum burst time in 0.1 ms, i.e.,
242 * 10 = 1 ms */
243 } tx_queue_params;
244 struct ieee80211_tx_stats {
245 struct {
246 unsigned int len; /* num packets in queue */
247 unsigned int limit; /* queue len (soft) limit
248 */
249 unsigned int count; /* total num frames sent */
250 } data[4];
251 } get_tx_stats;
252 struct {
253 u8 ssid_len;
254 u8 ssid[0] ALIGNED;
255 } scan_req;
256 struct {
257 u32 state;
258 } sta_get_state;
259 struct {
260 #define MLME_STA_DEAUTH 0
261 #define MLME_STA_DISASSOC 1
262 u16 cmd;
263 u16 reason_code;
264 } mlme;
265 struct {
266 u8 radar_firpwr_threshold;
267 u8 radar_rssi_threshold;
268 u8 pulse_height_threshold;
269 u8 pulse_rssi_threshold;
270 u8 pulse_inband_threshold;
271 } radar;
272 struct {
273 unsigned int period;
274 unsigned int offset;
275 unsigned int duration;
276 } quiet;
277 struct {
278 u8 dummy[80]; /* Make sizeof() this struct large enough
279 * with some compiler versions. */
280 } dummy;
281 } u;
282 };
283
284 #define HOSTAP_CRYPT_FLAG_SET_TX_KEY BIT(0)
285 #define HOSTAP_CRYPT_FLAG_PERMANENT BIT(1)
286
287 #define HOSTAP_CRYPT_ERR_UNKNOWN_ALG 2
288 #define HOSTAP_CRYPT_ERR_UNKNOWN_ADDR 3
289 #define HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED 4
290 #define HOSTAP_CRYPT_ERR_KEY_SET_FAILED 5
291 #define HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED 6
292 #define HOSTAP_CRYPT_ERR_CARD_CONF_FAILED 7
293
294 #define HOSTAP_HW_FLAG_NULLFUNC_OK BIT(0)
295
296 enum {
297 IEEE80211_KEY_MGMT_NONE = 0,
298 IEEE80211_KEY_MGMT_IEEE8021X = 1,
299 IEEE80211_KEY_MGMT_WPA_PSK = 2,
300 IEEE80211_KEY_MGMT_WPA_EAP = 3,
301 };
302
303
304 /* Data structures used for get_hw_features ioctl */
305 struct hostapd_ioctl_hw_modes_hdr {
306 int mode;
307 int num_channels;
308 int num_rates;
309 };
310
311 struct ieee80211_channel_data {
312 short chan; /* channel number (IEEE 802.11) */
313 short freq; /* frequency in MHz */
314 int flag; /* flag for hostapd use (IEEE80211_CHAN_*) */
315 };
316
317 struct ieee80211_rate_data {
318 int rate; /* rate in 100 kbps */
319 int flags; /* IEEE80211_RATE_ flags */
320 };
321
322
323 /* ADD_IF, REMOVE_IF, and UPDATE_IF 'type' argument */
324 enum {
325 HOSTAP_IF_WDS = 1, HOSTAP_IF_VLAN = 2, HOSTAP_IF_BSS = 3,
326 HOSTAP_IF_STA = 4
327 };
328
329 struct hostapd_if_wds {
330 u8 remote_addr[ETH_ALEN];
331 };
332
333 struct hostapd_if_vlan {
334 u8 id;
335 };
336
337 struct hostapd_if_bss {
338 u8 bssid[ETH_ALEN];
339 };
340
341 struct hostapd_if_sta {
342 };
343
344 #endif /* HOSTAPD_IOCTL_H */