fix compat hacks for init_work
[openwrt.git] / package / d80211 / src / 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 #define PRISM2_IOCTL_TEST_PARAM (SIOCIWFIRSTPRIV + 4)
24
25 /* PRISM2_IOCTL_PRISM2_PARAM ioctl() subtypes: */
26 enum {
27 PRISM2_PARAM_PTYPE = 1,
28 PRISM2_PARAM_TXRATECTRL = 2,
29 PRISM2_PARAM_BEACON_INT = 3,
30 PRISM2_PARAM_PSEUDO_IBSS = 4,
31 PRISM2_PARAM_ALC = 5,
32 PRISM2_PARAM_TXPOWER = 6,
33 PRISM2_PARAM_DUMP = 7,
34 PRISM2_PARAM_OTHER_AP_POLICY = 8,
35 PRISM2_PARAM_AP_MAX_INACTIVITY = 9,
36 PRISM2_PARAM_AP_BRIDGE_PACKETS = 10,
37 PRISM2_PARAM_DTIM_PERIOD = 11,
38 PRISM2_PARAM_AP_NULLFUNC_ACK = 12,
39 PRISM2_PARAM_MAX_WDS = 13,
40 PRISM2_PARAM_AP_AUTOM_AP_WDS = 14,
41 PRISM2_PARAM_AP_AUTH_ALGS = 15,
42 PRISM2_PARAM_MONITOR_ALLOW_FCSERR = 16,
43 PRISM2_PARAM_HOST_ENCRYPT = 17,
44 PRISM2_PARAM_HOST_DECRYPT = 18,
45 PRISM2_PARAM_BUS_MASTER_THRESHOLD_RX = 19,
46 PRISM2_PARAM_BUS_MASTER_THRESHOLD_TX = 20,
47 PRISM2_PARAM_HOST_ROAMING = 21,
48 PRISM2_PARAM_BCRX_STA_KEY = 22,
49 PRISM2_PARAM_IEEE_802_1X = 23,
50 PRISM2_PARAM_ANTSEL_TX = 24,
51 PRISM2_PARAM_ANTSEL_RX = 25,
52 PRISM2_PARAM_MONITOR_TYPE = 26,
53 PRISM2_PARAM_WDS_TYPE = 27,
54 PRISM2_PARAM_HOSTSCAN = 28,
55 PRISM2_PARAM_AP_SCAN = 29,
56
57 /* Instant802 additions */
58 PRISM2_PARAM_CTS_PROTECT_ERP_FRAMES = 1001,
59 PRISM2_PARAM_DROP_UNENCRYPTED = 1002,
60 PRISM2_PARAM_PREAMBLE = 1003,
61 PRISM2_PARAM_RATE_LIMIT = 1004, /* no longer used */
62 PRISM2_PARAM_RATE_LIMIT_BURST = 1005, /* no longer used */
63 PRISM2_PARAM_SHORT_SLOT_TIME = 1006,
64 PRISM2_PARAM_TEST_MODE = 1007,
65 PRISM2_PARAM_NEXT_MODE = 1008,
66 PRISM2_PARAM_CLEAR_KEYS = 1009,
67 PRISM2_PARAM_RADIO_ENABLED = 1010,
68 PRISM2_PARAM_ANTENNA_SEL = 1011,
69 PRISM2_PARAM_CALIB_INT = 1012,
70 PRISM2_PARAM_ANTENNA_MODE = 1013,
71 PRISM2_PARAM_PRIVACY_INVOKED = 1014,
72 PRISM2_PARAM_BROADCAST_SSID = 1015,
73 PRISM2_PARAM_STAT_TIME = 1016,
74 PRISM2_PARAM_STA_ANTENNA_SEL = 1017,
75 PRISM2_PARAM_FORCE_UNICAST_RATE = 1018,
76 PRISM2_PARAM_RATE_CTRL_NUM_UP = 1019,
77 PRISM2_PARAM_RATE_CTRL_NUM_DOWN = 1020,
78 PRISM2_PARAM_MAX_RATECTRL_RATE = 1021,
79 PRISM2_PARAM_TX_POWER_REDUCTION = 1022,
80 PRISM2_PARAM_EAPOL = 1023,
81 PRISM2_PARAM_KEY_TX_RX_THRESHOLD = 1024,
82 PRISM2_PARAM_KEY_INDEX = 1025,
83 PRISM2_PARAM_DEFAULT_WEP_ONLY = 1026,
84 PRISM2_PARAM_WIFI_WME_NOACK_TEST = 1033,
85 PRISM2_PARAM_ALLOW_BROADCAST_ALWAYS = 1034,
86 PRISM2_PARAM_SCAN_FLAGS = 1035,
87 PRISM2_PARAM_HW_MODES = 1036,
88 PRISM2_PARAM_CREATE_IBSS = 1037,
89 PRISM2_PARAM_WMM_ENABLED = 1038,
90 PRISM2_PARAM_MIXED_CELL = 1039,
91 PRISM2_PARAM_KEY_MGMT = 1040,
92 PRISM2_PARAM_RADAR_DETECT = 1043,
93 PRISM2_PARAM_SPECTRUM_MGMT = 1044,
94 PRISM2_PARAM_USER_SPACE_MLME = 1045,
95 PRISM2_PARAM_MGMT_IF = 1046,
96 /* NOTE: Please try to coordinate with other active development
97 * branches before allocating new param numbers so that each new param
98 * will be unique within all branches and the allocated number will not
99 * need to be changed when merging new features. Existing numbers in
100 * the mainline (or main devel branch) must not be changed when merging
101 * in new features. */
102 };
103
104 /* PRISM2_IOCTL_HOSTAPD ioctl() cmd: */
105 enum {
106 PRISM2_HOSTAPD_FLUSH = 1,
107 PRISM2_HOSTAPD_ADD_STA = 2,
108 PRISM2_HOSTAPD_REMOVE_STA = 3,
109 PRISM2_HOSTAPD_GET_INFO_STA = 4,
110 /* REMOVED: PRISM2_HOSTAPD_RESET_TXEXC_STA = 5, */
111 PRISM2_SET_ENCRYPTION = 6,
112 PRISM2_GET_ENCRYPTION = 7,
113 PRISM2_HOSTAPD_SET_FLAGS_STA = 8,
114 PRISM2_HOSTAPD_GET_RID = 9,
115 PRISM2_HOSTAPD_SET_RID = 10,
116 PRISM2_HOSTAPD_SET_ASSOC_AP_ADDR = 11,
117 PRISM2_HOSTAPD_MLME = 13,
118
119 /* Instant802 additions */
120 PRISM2_HOSTAPD_SET_BEACON = 1001,
121 PRISM2_HOSTAPD_GET_HW_FEATURES = 1002,
122 PRISM2_HOSTAPD_SCAN = 1003,
123 PRISM2_HOSTAPD_WPA_TRIGGER = 1004,
124 PRISM2_HOSTAPD_SET_RATE_SETS = 1005,
125 PRISM2_HOSTAPD_ADD_IF = 1006,
126 PRISM2_HOSTAPD_REMOVE_IF = 1007,
127 PRISM2_HOSTAPD_GET_DOT11COUNTERSTABLE = 1008,
128 PRISM2_HOSTAPD_GET_LOAD_STATS = 1009,
129 PRISM2_HOSTAPD_SET_STA_VLAN = 1010,
130 PRISM2_HOSTAPD_SET_GENERIC_INFO_ELEM = 1011,
131 PRISM2_HOSTAPD_SET_CHANNEL_FLAG = 1012,
132 PRISM2_HOSTAPD_SET_REGULATORY_DOMAIN = 1013,
133 PRISM2_HOSTAPD_SET_TX_QUEUE_PARAMS = 1014,
134 PRISM2_HOSTAPD_GET_TX_STATS = 1016,
135 PRISM2_HOSTAPD_UPDATE_IF = 1017,
136 PRISM2_HOSTAPD_SCAN_REQ = 1019,
137 PRISM2_STA_GET_STATE = 1020,
138 PRISM2_HOSTAPD_FLUSH_IFS = 1021,
139 PRISM2_HOSTAPD_SET_RADAR_PARAMS = 1023,
140 PRISM2_HOSTAPD_SET_QUIET_PARAMS = 1024,
141 PRISM2_HOSTAPD_GET_TX_POWER = 1025,
142 /* NOTE: Please try to coordinate with other active development
143 * branches before allocating new param numbers so that each new param
144 * will be unique within all branches and the allocated number will not
145 * need to be changed when merging new features. Existing numbers in
146 * the mainline (or main devel branch) must not be changed when merging
147 * in new features. */
148 };
149
150 /* these definitions mirror the ieee80211_i.h
151 * IEEE80211_DISABLED, ... IEEE80211_ASSOCIATED enumeration */
152 enum {
153 PRISM2_PARAM_STA_DISABLED,
154 PRISM2_PARAM_STA_AUTHENTICATE,
155 PRISM2_PARAM_STA_ASSOCIATE,
156 PRISM2_PARAM_STA_ASSOCIATED,
157 };
158
159 #define PRISM2_HOSTAPD_MAX_BUF_SIZE 2048
160 #define HOSTAP_CRYPT_ALG_NAME_LEN 16
161
162 /* Use this to make sure that structure elements are correctly aligned
163 * for access as other types. Most commonly, this affects the placeholder
164 * types used for data at the end of a structure in this union.
165 */
166 #ifdef __GNUC__
167 #undef ALIGNED
168 #define ALIGNED __attribute__ ((aligned))
169 #else
170 /* Check if it has been defined elsewhere */
171 #ifndef ALIGNED
172 #error "Must define ALIGNED to generate aligned structure elements"
173 #endif
174 #endif
175
176 struct prism2_hostapd_param {
177 u32 cmd;
178 u8 sta_addr[ETH_ALEN];
179 u8 pad[2];
180 union {
181 struct {
182 u16 aid;
183 u16 capability;
184 u8 supp_rates[32];
185 u8 wds_flags;
186 #define IEEE80211_STA_DYNAMIC_ENC BIT(0)
187 u8 enc_flags;
188 u16 listen_interval;
189 } add_sta;
190 struct {
191 u32 inactive_msec;
192 u32 rx_packets;
193 u32 tx_packets;
194 u32 rx_bytes;
195 u32 tx_bytes;
196 u32 current_tx_rate; /* in 100 kbps */
197 u32 channel_use;
198 u32 flags;
199 u32 num_ps_buf_frames;
200 u32 tx_retry_failed;
201 u32 tx_retry_count;
202 u32 last_rssi;
203 u32 last_ack_rssi;
204 } get_info_sta;
205 struct {
206 char alg[HOSTAP_CRYPT_ALG_NAME_LEN];
207 u32 flags;
208 u32 err;
209 u8 idx;
210 #define HOSTAP_SEQ_COUNTER_SIZE 8
211 u8 seq_counter[HOSTAP_SEQ_COUNTER_SIZE];
212 u16 key_len;
213 u8 key[0] ALIGNED;
214 } crypt;
215 struct {
216 u32 flags_and;
217 u32 flags_or;
218 } set_flags_sta;
219 struct {
220 u16 rid;
221 u16 len;
222 u8 data[0] ALIGNED;
223 } rid;
224 struct {
225 u16 head_len;
226 u16 tail_len;
227 u8 data[0] ALIGNED; /* head_len + tail_len bytes */
228 } beacon;
229 struct {
230 u16 num_modes;
231 u16 flags;
232 u8 data[0] ALIGNED; /* num_modes * feature data */
233 } hw_features;
234 struct {
235 u8 now;
236 s8 our_mode_only;
237 s16 last_rx;
238 u16 channel;
239 s16 interval; /* seconds */
240 s32 listen; /* microseconds */
241 } scan;
242 struct {
243 #define WPA_TRIGGER_FAIL_TX_MIC BIT(0)
244 #define WPA_TRIGGER_FAIL_TX_ICV BIT(1)
245 #define WPA_TRIGGER_FAIL_RX_MIC BIT(2)
246 #define WPA_TRIGGER_FAIL_RX_ICV BIT(3)
247 #define WPA_TRIGGER_TX_REPLAY BIT(4)
248 #define WPA_TRIGGER_TX_REPLAY_FRAG BIT(5)
249 #define WPA_TRIGGER_TX_SKIP_SEQ BIT(6)
250 u32 trigger;
251 } wpa_trigger;
252 struct {
253 u16 mode; /* MODE_* */
254 u16 num_supported_rates;
255 u16 num_basic_rates;
256 u8 data[0] ALIGNED; /* num_supported_rates * u16 +
257 * num_basic_rates * u16 */
258 } set_rate_sets;
259 struct {
260 u8 type; /* WDS, VLAN, etc */
261 u8 name[IFNAMSIZ];
262 u8 data[0] ALIGNED;
263 } if_info;
264 struct dot11_counters {
265 u32 dot11TransmittedFragmentCount;
266 u32 dot11MulticastTransmittedFrameCount;
267 u32 dot11FailedCount;
268 u32 dot11ReceivedFragmentCount;
269 u32 dot11MulticastReceivedFrameCount;
270 u32 dot11FCSErrorCount;
271 u32 dot11TransmittedFrameCount;
272 u32 dot11WEPUndecryptableCount;
273 u32 dot11ACKFailureCount;
274 u32 dot11RTSFailureCount;
275 u32 dot11RTSSuccessCount;
276 } dot11CountersTable;
277 struct {
278 #define LOAD_STATS_CLEAR BIT(1)
279 u32 flags;
280 u32 channel_use;
281 } get_load_stats;
282 struct {
283 char vlan_name[IFNAMSIZ];
284 int vlan_id;
285 } set_sta_vlan;
286 struct {
287 u8 len;
288 u8 data[0] ALIGNED;
289 } set_generic_info_elem;
290 struct {
291 u16 mode; /* MODE_* */
292 u16 chan;
293 u32 flag;
294 u8 power_level; /* regulatory limit in dBm */
295 u8 antenna_max;
296 } set_channel_flag;
297 struct {
298 u32 rd;
299 } set_regulatory_domain;
300 struct {
301 u32 queue;
302 s32 aifs;
303 u32 cw_min;
304 u32 cw_max;
305 u32 burst_time; /* maximum burst time in 0.1 ms, i.e.,
306 * 10 = 1 ms */
307 } tx_queue_params;
308 struct {
309 u32 bss_count;
310 u8 bssid_mask[ETH_ALEN];
311 } set_bss;
312 struct ieee80211_tx_stats {
313 struct {
314 unsigned int len; /* num packets in queue */
315 unsigned int limit; /* queue len (soft) limit
316 */
317 unsigned int count; /* total num frames sent */
318 } data[4];
319 } get_tx_stats;
320 struct {
321 u8 ssid_len;
322 u8 ssid[0] ALIGNED;
323 } scan_req;
324 struct {
325 u32 state;
326 } sta_get_state;
327 struct {
328 #define MLME_STA_DEAUTH 0
329 #define MLME_STA_DISASSOC 1
330 u16 cmd;
331 u16 reason_code;
332 } mlme;
333 struct {
334 u8 radar_firpwr_threshold;
335 u8 radar_rssi_threshold;
336 u8 pulse_height_threshold;
337 u8 pulse_rssi_threshold;
338 u8 pulse_inband_threshold;
339 } radar;
340 struct {
341 unsigned int period;
342 unsigned int offset;
343 unsigned int duration;
344 } quiet;
345 struct {
346 unsigned int tx_power_min;
347 unsigned int tx_power_max;
348 } tx_power;
349 struct {
350 u8 dummy[80]; /* Make sizeof() this struct large enough
351 * with some compiler versions. */
352 } dummy;
353 } u;
354 };
355
356
357 #ifndef IEEE80211_TX_QUEUE_NUMS
358 #define IEEE80211_TX_QUEUE_NUMS
359 /* TODO: these need to be synchronized with ieee80211.h; make a shared header
360 * file that can be included into low-level drivers, 80211.o, and hostapd */
361 /* tx_queue_params - queue */
362 enum {
363 IEEE80211_TX_QUEUE_DATA0 = 0, /* used for EDCA AC_VO data */
364 IEEE80211_TX_QUEUE_DATA1 = 1, /* used for EDCA AC_VI data */
365 IEEE80211_TX_QUEUE_DATA2 = 2, /* used for EDCA AC_BE data */
366 IEEE80211_TX_QUEUE_DATA3 = 3, /* used for EDCA AC_BK data */
367 IEEE80211_TX_QUEUE_DATA4 = 4,
368 IEEE80211_TX_QUEUE_AFTER_BEACON = 6,
369 IEEE80211_TX_QUEUE_BEACON = 7
370 };
371 #endif /* IEEE80211_TX_QUEUE_NUMS */
372
373
374 #define HOSTAP_CRYPT_FLAG_SET_TX_KEY BIT(0)
375 #define HOSTAP_CRYPT_FLAG_PERMANENT BIT(1)
376
377 #define HOSTAP_CRYPT_ERR_UNKNOWN_ALG 2
378 #define HOSTAP_CRYPT_ERR_UNKNOWN_ADDR 3
379 #define HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED 4
380 #define HOSTAP_CRYPT_ERR_KEY_SET_FAILED 5
381 #define HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED 6
382 #define HOSTAP_CRYPT_ERR_CARD_CONF_FAILED 7
383
384 #define HOSTAP_HW_FLAG_NULLFUNC_OK BIT(0)
385
386 enum {
387 IEEE80211_KEY_MGMT_NONE = 0,
388 IEEE80211_KEY_MGMT_IEEE8021X = 1,
389 IEEE80211_KEY_MGMT_WPA_PSK = 2,
390 IEEE80211_KEY_MGMT_WPA_EAP = 3,
391 };
392
393
394 /* Data structures used for get_hw_features ioctl */
395 struct hostapd_ioctl_hw_modes_hdr {
396 int mode;
397 int num_channels;
398 int num_rates;
399 };
400
401 struct ieee80211_channel_data {
402 short chan; /* channel number (IEEE 802.11) */
403 short freq; /* frequency in MHz */
404 int flag; /* flag for hostapd use (IEEE80211_CHAN_*) */
405 };
406
407 struct ieee80211_rate_data {
408 int rate; /* rate in 100 kbps */
409 int flags; /* IEEE80211_RATE_ flags */
410 };
411
412
413 /* ADD_IF, REMOVE_IF, and UPDATE_IF 'type' argument */
414 enum {
415 HOSTAP_IF_WDS = 1, HOSTAP_IF_VLAN = 2, HOSTAP_IF_BSS = 3,
416 HOSTAP_IF_STA = 4
417 };
418
419 struct hostapd_if_wds {
420 u8 remote_addr[ETH_ALEN];
421 };
422
423 struct hostapd_if_vlan {
424 u8 id;
425 };
426
427 struct hostapd_if_bss {
428 u8 bssid[ETH_ALEN];
429 };
430
431 struct hostapd_if_sta {
432 };
433
434 #endif /* HOSTAPD_IOCTL_H */
This page took 0.068063 seconds and 5 git commands to generate.