]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/drivers/driver.h
HS 2.0: Add Hotspot 2.0 Indication for AP
[thirdparty/hostap.git] / src / drivers / driver.h
CommitLineData
6fc6879b 1/*
e0498677 2 * Driver interface definition
3d9975d5 3 * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
6fc6879b 4 *
0f3d578e
JM
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
e0498677
JM
7 *
8 * This file defines a driver interface used by both %wpa_supplicant and
9 * hostapd. The first part of the file defines data structures used in various
10 * driver operations. This is followed by the struct wpa_driver_ops that each
11 * driver wrapper will beed to define with callback functions for requesting
12 * driver operations. After this, there are definitions for driver event
13 * reporting with wpa_supplicant_event() and some convenience helper functions
14 * that can be used to report events.
6fc6879b
JM
15 */
16
17#ifndef DRIVER_H
18#define DRIVER_H
19
642187d6 20#define WPA_SUPPLICANT_DRIVER_VERSION 4
6fc6879b 21
90973fb2 22#include "common/defs.h"
6fc6879b 23
c5121837
JM
24#define HOSTAPD_CHAN_DISABLED 0x00000001
25#define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002
26#define HOSTAPD_CHAN_NO_IBSS 0x00000004
27#define HOSTAPD_CHAN_RADAR 0x00000008
d8e66e80
JM
28#define HOSTAPD_CHAN_HT40PLUS 0x00000010
29#define HOSTAPD_CHAN_HT40MINUS 0x00000020
30#define HOSTAPD_CHAN_HT40 0x00000040
c5121837 31
e0498677
JM
32/**
33 * struct hostapd_channel_data - Channel information
34 */
c5121837 35struct hostapd_channel_data {
e0498677
JM
36 /**
37 * chan - Channel number (IEEE 802.11)
38 */
39 short chan;
40
41 /**
42 * freq - Frequency in MHz
43 */
44 short freq;
45
46 /**
47 * flag - Channel flags (HOSTAPD_CHAN_*)
48 */
49 int flag;
50
51 /**
52 * max_tx_power - maximum transmit power in dBm
53 */
54 u8 max_tx_power;
c5121837
JM
55};
56
e3b473eb
JM
57#define HOSTAPD_MODE_FLAG_HT_INFO_KNOWN BIT(0)
58
e0498677
JM
59/**
60 * struct hostapd_hw_modes - Supported hardware mode information
61 */
c5121837 62struct hostapd_hw_modes {
e0498677
JM
63 /**
64 * mode - Hardware mode
65 */
71934751 66 enum hostapd_hw_mode mode;
e0498677
JM
67
68 /**
69 * num_channels - Number of entries in the channels array
70 */
c5121837 71 int num_channels;
e0498677
JM
72
73 /**
74 * channels - Array of supported channels
75 */
c5121837 76 struct hostapd_channel_data *channels;
e0498677
JM
77
78 /**
79 * num_rates - Number of entries in the rates array
80 */
c5121837 81 int num_rates;
e0498677
JM
82
83 /**
84 * rates - Array of supported rates in 100 kbps units
85 */
86 int *rates;
87
88 /**
89 * ht_capab - HT (IEEE 802.11n) capabilities
90 */
c5121837 91 u16 ht_capab;
e0498677
JM
92
93 /**
94 * mcs_set - MCS (IEEE 802.11n) rate parameters
95 */
08eb154d 96 u8 mcs_set[16];
e0498677
JM
97
98 /**
99 * a_mpdu_params - A-MPDU (IEEE 802.11n) parameters
100 */
be8eb8ab 101 u8 a_mpdu_params;
e3b473eb 102
efe45d14
MP
103 /**
104 * vht_capab - VHT (IEEE 802.11ac) capabilities
105 */
106 u32 vht_capab;
107
108 /**
109 * vht_mcs_set - VHT MCS (IEEE 802.11ac) rate parameters
110 */
111 u8 vht_mcs_set[8];
112
e3b473eb 113 unsigned int flags; /* HOSTAPD_MODE_FLAG_* */
c5121837
JM
114};
115
116
6fc6879b
JM
117#define IEEE80211_MODE_INFRA 0
118#define IEEE80211_MODE_IBSS 1
ad1e68e6 119#define IEEE80211_MODE_AP 2
6fc6879b
JM
120
121#define IEEE80211_CAP_ESS 0x0001
122#define IEEE80211_CAP_IBSS 0x0002
123#define IEEE80211_CAP_PRIVACY 0x0010
124
7c2849d2
JM
125#define WPA_SCAN_QUAL_INVALID BIT(0)
126#define WPA_SCAN_NOISE_INVALID BIT(1)
127#define WPA_SCAN_LEVEL_INVALID BIT(2)
128#define WPA_SCAN_LEVEL_DBM BIT(3)
e6b8efeb
JM
129#define WPA_SCAN_AUTHENTICATED BIT(4)
130#define WPA_SCAN_ASSOCIATED BIT(5)
7c2849d2 131
6fc6879b
JM
132/**
133 * struct wpa_scan_res - Scan result for an BSS/IBSS
7c2849d2 134 * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
6fc6879b
JM
135 * @bssid: BSSID
136 * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
137 * @beacon_int: beacon interval in TUs (host byte order)
138 * @caps: capability information field in host byte order
139 * @qual: signal quality
140 * @noise: noise level
141 * @level: signal level
142 * @tsf: Timestamp
b3ad11bb
JM
143 * @age: Age of the information in milliseconds (i.e., how many milliseconds
144 * ago the last Beacon or Probe Response frame was received)
6fc6879b 145 * @ie_len: length of the following IE field in octets
8c090654 146 * @beacon_ie_len: length of the following Beacon IE field in octets
6fc6879b
JM
147 *
148 * This structure is used as a generic format for scan results from the
149 * driver. Each driver interface implementation is responsible for converting
150 * the driver or OS specific scan results into this format.
151 *
152 * If the driver does not support reporting all IEs, the IE data structure is
153 * constructed of the IEs that are available. This field will also need to
154 * include SSID in IE format. All drivers are encouraged to be extended to
155 * report all IEs to make it easier to support future additions.
156 */
157struct wpa_scan_res {
7c2849d2 158 unsigned int flags;
6fc6879b
JM
159 u8 bssid[ETH_ALEN];
160 int freq;
161 u16 beacon_int;
162 u16 caps;
163 int qual;
164 int noise;
165 int level;
166 u64 tsf;
b3ad11bb 167 unsigned int age;
6fc6879b 168 size_t ie_len;
8c090654
JM
169 size_t beacon_ie_len;
170 /*
171 * Followed by ie_len octets of IEs from Probe Response frame (or if
172 * the driver does not indicate source of IEs, these may also be from
173 * Beacon frame). After the first set of IEs, another set of IEs may
174 * follow (with beacon_ie_len octets of data) if the driver provides
175 * both IE sets.
176 */
6fc6879b
JM
177};
178
179/**
180 * struct wpa_scan_results - Scan results
181 * @res: Array of pointers to allocated variable length scan result entries
182 * @num: Number of entries in the scan result array
183 */
184struct wpa_scan_results {
185 struct wpa_scan_res **res;
186 size_t num;
187};
188
4b4a8ae5
JM
189/**
190 * struct wpa_interface_info - Network interface information
191 * @next: Pointer to the next interface or NULL if this is the last one
192 * @ifname: Interface name that can be used with init() or init2()
193 * @desc: Human readable adapter description (e.g., vendor/model) or NULL if
194 * not available
60ad2c7b 195 * @drv_name: struct wpa_driver_ops::name (note: unlike other strings, this one
4b4a8ae5
JM
196 * is not an allocated copy, i.e., get_interfaces() caller will not free
197 * this)
198 */
199struct wpa_interface_info {
200 struct wpa_interface_info *next;
201 char *ifname;
202 char *desc;
203 const char *drv_name;
204};
205
35b741fd 206#define WPAS_MAX_SCAN_SSIDS 16
fc2b7ed5
JM
207
208/**
209 * struct wpa_driver_scan_params - Scan parameters
210 * Data for struct wpa_driver_ops::scan2().
211 */
212struct wpa_driver_scan_params {
213 /**
214 * ssids - SSIDs to scan for
215 */
216 struct wpa_driver_scan_ssid {
217 /**
218 * ssid - specific SSID to scan for (ProbeReq)
219 * %NULL or zero-length SSID is used to indicate active scan
ba2a573c 220 * with wildcard SSID.
fc2b7ed5
JM
221 */
222 const u8 *ssid;
223 /**
224 * ssid_len: Length of the SSID in octets
225 */
226 size_t ssid_len;
227 } ssids[WPAS_MAX_SCAN_SSIDS];
228
229 /**
230 * num_ssids - Number of entries in ssids array
231 * Zero indicates a request for a passive scan.
232 */
233 size_t num_ssids;
234
235 /**
236 * extra_ies - Extra IE(s) to add into Probe Request or %NULL
237 */
238 const u8 *extra_ies;
239
240 /**
241 * extra_ies_len - Length of extra_ies in octets
242 */
243 size_t extra_ies_len;
d3a98225
JM
244
245 /**
246 * freqs - Array of frequencies to scan or %NULL for all frequencies
247 *
248 * The frequency is set in MHz. The array is zero-terminated.
249 */
250 int *freqs;
3812464c
JM
251
252 /**
253 * filter_ssids - Filter for reporting SSIDs
254 *
255 * This optional parameter can be used to request the driver wrapper to
256 * filter scan results to include only the specified SSIDs. %NULL
257 * indicates that no filtering is to be done. This can be used to
258 * reduce memory needs for scan results in environments that have large
259 * number of APs with different SSIDs.
260 *
261 * The driver wrapper is allowed to take this allocated buffer into its
262 * own use by setting the pointer to %NULL. In that case, the driver
263 * wrapper is responsible for freeing the buffer with os_free() once it
264 * is not needed anymore.
265 */
266 struct wpa_driver_scan_filter {
267 u8 ssid[32];
268 size_t ssid_len;
269 } *filter_ssids;
270
271 /**
272 * num_filter_ssids - Number of entries in filter_ssids array
273 */
274 size_t num_filter_ssids;
47185fc7 275
bf8d6d24
TP
276 /**
277 * filter_rssi - Filter by RSSI
278 *
279 * The driver may filter scan results in firmware to reduce host
280 * wakeups and thereby save power. Specify the RSSI threshold in s32
281 * dBm.
282 */
283 s32 filter_rssi;
284
47185fc7
RM
285 /**
286 * p2p_probe - Used to disable CCK (802.11b) rates for P2P probes
287 *
288 * When set, the driver is expected to remove rates 1, 2, 5.5, and 11
289 * Mbps from the support rates element(s) in the Probe Request frames
290 * and not to transmit the frames at any of those rates.
291 */
292 u8 p2p_probe;
fc2b7ed5
JM
293};
294
c2a04078
JM
295/**
296 * struct wpa_driver_auth_params - Authentication parameters
297 * Data for struct wpa_driver_ops::authenticate().
298 */
299struct wpa_driver_auth_params {
300 int freq;
301 const u8 *bssid;
302 const u8 *ssid;
303 size_t ssid_len;
304 int auth_alg;
305 const u8 *ie;
306 size_t ie_len;
a0b2f99b
JM
307 const u8 *wep_key[4];
308 size_t wep_key_len[4];
309 int wep_tx_keyidx;
2a7e7f4e 310 int local_state_change;
2f4f73b1
EP
311
312 /**
313 * p2p - Whether this connection is a P2P group
314 */
315 int p2p;
316
c2a04078
JM
317};
318
0c80427d
JM
319enum wps_mode {
320 WPS_MODE_NONE /* no WPS provisioning being used */,
321 WPS_MODE_OPEN /* WPS provisioning with AP that is in open mode */,
322 WPS_MODE_PRIVACY /* WPS provisioning with AP that is using protection
323 */
324};
325
6fc6879b
JM
326/**
327 * struct wpa_driver_associate_params - Association parameters
328 * Data for struct wpa_driver_ops::associate().
329 */
330struct wpa_driver_associate_params {
331 /**
332 * bssid - BSSID of the selected AP
333 * This can be %NULL, if ap_scan=2 mode is used and the driver is
334 * responsible for selecting with which BSS to associate. */
335 const u8 *bssid;
336
337 /**
338 * ssid - The selected SSID
339 */
340 const u8 *ssid;
e0498677
JM
341
342 /**
343 * ssid_len - Length of the SSID (1..32)
344 */
6fc6879b
JM
345 size_t ssid_len;
346
347 /**
348 * freq - Frequency of the channel the selected AP is using
349 * Frequency that the selected AP is using (in MHz as
350 * reported in the scan results)
351 */
352 int freq;
353
1f6c0ab8
BS
354 /**
355 * bg_scan_period - Background scan period in seconds, 0 to disable
356 * background scan, or -1 to indicate no change to default driver
357 * configuration
358 */
359 int bg_scan_period;
360
6fc6879b
JM
361 /**
362 * wpa_ie - WPA information element for (Re)Association Request
363 * WPA information element to be included in (Re)Association
364 * Request (including information element id and length). Use
365 * of this WPA IE is optional. If the driver generates the WPA
366 * IE, it can use pairwise_suite, group_suite, and
367 * key_mgmt_suite to select proper algorithms. In this case,
368 * the driver has to notify wpa_supplicant about the used WPA
369 * IE by generating an event that the interface code will
370 * convert into EVENT_ASSOCINFO data (see below).
371 *
372 * When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE
373 * instead. The driver can determine which version is used by
374 * looking at the first byte of the IE (0xdd for WPA, 0x30 for
375 * WPA2/RSN).
ad08c363
JM
376 *
377 * When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE.
6fc6879b
JM
378 */
379 const u8 *wpa_ie;
e0498677 380
6fc6879b
JM
381 /**
382 * wpa_ie_len - length of the wpa_ie
383 */
384 size_t wpa_ie_len;
385
64fa840a
JM
386 /**
387 * wpa_proto - Bitfield of WPA_PROTO_* values to indicate WPA/WPA2
388 */
389 unsigned int wpa_proto;
390
e0498677
JM
391 /**
392 * pairwise_suite - Selected pairwise cipher suite
393 *
394 * This is usually ignored if @wpa_ie is used.
395 */
71934751 396 enum wpa_cipher pairwise_suite;
e0498677
JM
397
398 /**
399 * group_suite - Selected group cipher suite
400 *
401 * This is usually ignored if @wpa_ie is used.
402 */
71934751 403 enum wpa_cipher group_suite;
e0498677
JM
404
405 /**
406 * key_mgmt_suite - Selected key management suite
407 *
408 * This is usually ignored if @wpa_ie is used.
409 */
71934751 410 enum wpa_key_mgmt key_mgmt_suite;
6fc6879b
JM
411
412 /**
413 * auth_alg - Allowed authentication algorithms
abd9fafa 414 * Bit field of WPA_AUTH_ALG_*
6fc6879b
JM
415 */
416 int auth_alg;
417
418 /**
419 * mode - Operation mode (infra/ibss) IEEE80211_MODE_*
420 */
421 int mode;
422
423 /**
424 * wep_key - WEP keys for static WEP configuration
425 */
426 const u8 *wep_key[4];
427
428 /**
429 * wep_key_len - WEP key length for static WEP configuration
430 */
431 size_t wep_key_len[4];
432
433 /**
434 * wep_tx_keyidx - WEP TX key index for static WEP configuration
435 */
436 int wep_tx_keyidx;
437
438 /**
439 * mgmt_frame_protection - IEEE 802.11w management frame protection
440 */
70f8cc8e 441 enum mfp_options mgmt_frame_protection;
6fc6879b
JM
442
443 /**
444 * ft_ies - IEEE 802.11r / FT information elements
445 * If the supplicant is using IEEE 802.11r (FT) and has the needed keys
446 * for fast transition, this parameter is set to include the IEs that
447 * are to be sent in the next FT Authentication Request message.
448 * update_ft_ies() handler is called to update the IEs for further
449 * FT messages in the sequence.
450 *
451 * The driver should use these IEs only if the target AP is advertising
452 * the same mobility domain as the one included in the MDIE here.
453 *
454 * In ap_scan=2 mode, the driver can use these IEs when moving to a new
455 * AP after the initial association. These IEs can only be used if the
456 * target AP is advertising support for FT and is using the same MDIE
457 * and SSID as the current AP.
458 *
459 * The driver is responsible for reporting the FT IEs received from the
460 * AP's response using wpa_supplicant_event() with EVENT_FT_RESPONSE
461 * type. update_ft_ies() handler will then be called with the FT IEs to
462 * include in the next frame in the authentication sequence.
463 */
464 const u8 *ft_ies;
465
466 /**
467 * ft_ies_len - Length of ft_ies in bytes
468 */
469 size_t ft_ies_len;
470
471 /**
472 * ft_md - FT Mobility domain (6 octets) (also included inside ft_ies)
473 *
474 * This value is provided to allow the driver interface easier access
475 * to the current mobility domain. This value is set to %NULL if no
476 * mobility domain is currently active.
477 */
478 const u8 *ft_md;
479
480 /**
481 * passphrase - RSN passphrase for PSK
482 *
483 * This value is made available only for WPA/WPA2-Personal (PSK) and
484 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
485 * the 8..63 character ASCII passphrase, if available. Please note that
486 * this can be %NULL if passphrase was not used to generate the PSK. In
487 * that case, the psk field must be used to fetch the PSK.
488 */
489 const char *passphrase;
490
491 /**
492 * psk - RSN PSK (alternative for passphrase for PSK)
493 *
494 * This value is made available only for WPA/WPA2-Personal (PSK) and
495 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
496 * the 32-octet (256-bit) PSK, if available. The driver wrapper should
497 * be prepared to handle %NULL value as an error.
498 */
499 const u8 *psk;
36b15723
JM
500
501 /**
502 * drop_unencrypted - Enable/disable unencrypted frame filtering
503 *
504 * Configure the driver to drop all non-EAPOL frames (both receive and
505 * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
506 * still be allowed for key negotiation.
507 */
508 int drop_unencrypted;
62fa124c
JM
509
510 /**
511 * prev_bssid - Previously used BSSID in this ESS
512 *
513 * When not %NULL, this is a request to use reassociation instead of
514 * association.
515 */
516 const u8 *prev_bssid;
0c80427d
JM
517
518 /**
519 * wps - WPS mode
520 *
521 * If the driver needs to do special configuration for WPS association,
522 * this variable provides more information on what type of association
523 * is being requested. Most drivers should not need ot use this.
524 */
525 enum wps_mode wps;
75bde05d
JM
526
527 /**
528 * p2p - Whether this connection is a P2P group
529 */
530 int p2p;
eea2fd9e
JM
531
532 /**
533 * uapsd - UAPSD parameters for the network
534 * -1 = do not change defaults
535 * AP mode: 1 = enabled, 0 = disabled
536 * STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE
537 */
538 int uapsd;
9e2af29f
NC
539
540 /**
541 * fixed_bssid - Whether to force this BSSID in IBSS mode
542 * 1 = Fix this BSSID and prevent merges.
543 * 0 = Do not fix BSSID.
544 */
545 int fixed_bssid;
80e8a5ee
BG
546
547 /**
548 * disable_ht - Disable HT (IEEE 802.11n) for this connection
549 */
550 int disable_ht;
551
552 /**
553 * HT Capabilities over-rides. Only bits set in the mask will be used,
554 * and not all values are used by the kernel anyway. Currently, MCS,
555 * MPDU and MSDU fields are used.
556 */
557 const u8 *htcaps; /* struct ieee80211_ht_capabilities * */
558 const u8 *htcaps_mask; /* struct ieee80211_ht_capabilities * */
6fc6879b
JM
559};
560
97a7a0b5
JM
561enum hide_ssid {
562 NO_SSID_HIDING,
563 HIDDEN_SSID_ZERO_LEN,
564 HIDDEN_SSID_ZERO_CONTENTS
565};
566
19c3b566
JM
567struct wpa_driver_ap_params {
568 /**
569 * head - Beacon head from IEEE 802.11 header to IEs before TIM IE
570 */
571 const u8 *head;
572
573 /**
574 * head_len - Length of the head buffer in octets
575 */
576 size_t head_len;
577
578 /**
579 * tail - Beacon tail following TIM IE
580 */
581 const u8 *tail;
582
583 /**
584 * tail_len - Length of the tail buffer in octets
585 */
586 size_t tail_len;
587
588 /**
589 * dtim_period - DTIM period
590 */
591 int dtim_period;
592
593 /**
594 * beacon_int - Beacon interval
595 */
596 int beacon_int;
ccb941e6 597
e5693c47
JM
598 /**
599 * basic_rates: -1 terminated array of basic rates in 100 kbps
600 *
601 * This parameter can be used to set a specific basic rate set for the
602 * BSS. If %NULL, default basic rate set is used.
603 */
604 int *basic_rates;
605
5b99e21a
AN
606 /**
607 * proberesp - Probe Response template
608 *
609 * This is used by drivers that reply to Probe Requests internally in
610 * AP mode and require the full Probe Response template.
611 */
612 const u8 *proberesp;
613
614 /**
615 * proberesp_len - Length of the proberesp buffer in octets
616 */
617 size_t proberesp_len;
618
ccb941e6
JM
619 /**
620 * ssid - The SSID to use in Beacon/Probe Response frames
621 */
622 const u8 *ssid;
623
624 /**
625 * ssid_len - Length of the SSID (1..32)
626 */
627 size_t ssid_len;
b11d1d64 628
97a7a0b5
JM
629 /**
630 * hide_ssid - Whether to hide the SSID
631 */
632 enum hide_ssid hide_ssid;
633
b11d1d64
JM
634 /**
635 * pairwise_ciphers - WPA_CIPHER_* bitfield
636 */
637 unsigned int pairwise_ciphers;
638
639 /**
640 * group_cipher - WPA_CIPHER_*
641 */
642 unsigned int group_cipher;
643
644 /**
645 * key_mgmt_suites - WPA_KEY_MGMT_* bitfield
646 */
647 unsigned int key_mgmt_suites;
648
649 /**
650 * auth_algs - WPA_AUTH_ALG_* bitfield
651 */
652 unsigned int auth_algs;
653
654 /**
655 * wpa_version - WPA_PROTO_* bitfield
656 */
657 unsigned int wpa_version;
658
659 /**
660 * privacy - Whether privacy is used in the BSS
661 */
662 int privacy;
fb91db56
JM
663
664 /**
665 * beacon_ies - WPS/P2P IE(s) for Beacon frames
666 *
dcd1eb5b
JM
667 * This is used to add IEs like WPS IE and P2P IE by drivers that do
668 * not use the full Beacon template.
fb91db56
JM
669 */
670 const struct wpabuf *beacon_ies;
671
672 /**
673 * proberesp_ies - P2P/WPS IE(s) for Probe Response frames
674 *
675 * This is used to add IEs like WPS IE and P2P IE by drivers that
676 * reply to Probe Request frames internally.
677 */
678 const struct wpabuf *proberesp_ies;
679
680 /**
681 * assocresp_ies - WPS IE(s) for (Re)Association Response frames
062390ef
JM
682 *
683 * This is used to add IEs like WPS IE by drivers that reply to
684 * (Re)Association Request frames internally.
fb91db56
JM
685 */
686 const struct wpabuf *assocresp_ies;
fd13a541
JM
687
688 /**
689 * isolate - Whether to isolate frames between associated stations
690 *
691 * If this is non-zero, the AP is requested to disable forwarding of
e53a0c74 692 * frames between associated stations.
fd13a541
JM
693 */
694 int isolate;
31357268
JM
695
696 /**
697 * cts_protect - Whether CTS protection is enabled
698 */
699 int cts_protect;
700
701 /**
702 * preamble - Whether short preamble is enabled
703 */
704 int preamble;
705
706 /**
707 * short_slot_time - Whether short slot time is enabled
708 *
709 * 0 = short slot time disable, 1 = short slot time enabled, -1 = do
710 * not set (e.g., when 802.11g mode is not in use)
711 */
712 int short_slot_time;
713
714 /**
715 * ht_opmode - HT operation mode or -1 if HT not in use
716 */
717 int ht_opmode;
8a33a63f
JM
718
719 /**
720 * interworking - Whether Interworking is enabled
721 */
722 int interworking;
723
724 /**
725 * hessid - Homogeneous ESS identifier or %NULL if not set
726 */
727 const u8 *hessid;
16991cff
JM
728
729 /**
730 * access_network_type - Access Network Type (0..15)
731 *
732 * This is used for filtering Probe Request frames when Interworking is
733 * enabled.
734 */
735 u8 access_network_type;
a0133ee1
VT
736
737 /**
738 * ap_max_inactivity - Timeout in seconds to detect STA's inactivity
739 *
740 * This is used by driver which advertises this capability.
741 */
742 int ap_max_inactivity;
19c3b566
JM
743};
744
6fc6879b
JM
745/**
746 * struct wpa_driver_capa - Driver capability information
747 */
748struct wpa_driver_capa {
749#define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001
750#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002
751#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004
752#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008
753#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010
754#define WPA_DRIVER_CAPA_KEY_MGMT_FT 0x00000020
755#define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK 0x00000040
756 unsigned int key_mgmt;
757
758#define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001
759#define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002
760#define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004
761#define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008
349493bd 762#define WPA_DRIVER_CAPA_ENC_WEP128 0x00000010
6fc6879b
JM
763 unsigned int enc;
764
765#define WPA_DRIVER_AUTH_OPEN 0x00000001
766#define WPA_DRIVER_AUTH_SHARED 0x00000002
767#define WPA_DRIVER_AUTH_LEAP 0x00000004
768 unsigned int auth;
769
770/* Driver generated WPA/RSN IE */
771#define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001
0194fedb 772/* Driver needs static WEP key setup after association command */
6fc6879b 773#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
17fbb751 774/* unused: 0x00000004 */
6fc6879b
JM
775/* Driver takes care of RSN 4-way handshake internally; PMK is configured with
776 * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
777#define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008
4ef1e644 778#define WPA_DRIVER_FLAGS_WIRED 0x00000010
c2a04078
JM
779/* Driver provides separate commands for authentication and association (SME in
780 * wpa_supplicant). */
781#define WPA_DRIVER_FLAGS_SME 0x00000020
1581b38b
JM
782/* Driver supports AP mode */
783#define WPA_DRIVER_FLAGS_AP 0x00000040
0194fedb
JB
784/* Driver needs static WEP key setup after association has been completed */
785#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080
75bde05d
JM
786/* Driver takes care of P2P management operations */
787#define WPA_DRIVER_FLAGS_P2P_MGMT 0x00000100
788/* Driver supports concurrent P2P operations */
789#define WPA_DRIVER_FLAGS_P2P_CONCURRENT 0x00000200
790/*
791 * Driver uses the initial interface as a dedicated management interface, i.e.,
971e357f 792 * it cannot be used for P2P group operations or non-P2P purposes.
75bde05d
JM
793 */
794#define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE 0x00000400
795/* This interface is P2P capable (P2P Device, GO, or P2P Client */
796#define WPA_DRIVER_FLAGS_P2P_CAPABLE 0x00000800
d054a462
JM
797/* Driver supports concurrent operations on multiple channels */
798#define WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT 0x00001000
971e357f
JM
799/*
800 * Driver uses the initial interface for P2P management interface and non-P2P
801 * purposes (e.g., connect to infra AP), but this interface cannot be used for
802 * P2P group operations.
803 */
804#define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P 0x00002000
871f4dd0
JM
805/*
806 * Driver is known to use sane error codes, i.e., when it indicates that
807 * something (e.g., association) fails, there was indeed a failure and the
808 * operation does not end up getting completed successfully later.
809 */
810#define WPA_DRIVER_FLAGS_SANE_ERROR_CODES 0x00004000
190b9062
JB
811/* Driver supports off-channel TX */
812#define WPA_DRIVER_FLAGS_OFFCHANNEL_TX 0x00008000
2fee890a
JM
813/* Driver indicates TX status events for EAPOL Data frames */
814#define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS 0x00010000
4dc03726
JM
815/* Driver indicates TX status events for Deauth/Disassoc frames */
816#define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS 0x00020000
004ba773
VN
817/* Driver supports roaming (BSS selection) in firmware */
818#define WPA_DRIVER_FLAGS_BSS_SELECTION 0x00040000
03ea1786
AN
819/* Driver supports operating as a TDLS peer */
820#define WPA_DRIVER_FLAGS_TDLS_SUPPORT 0x00080000
821/* Driver requires external TDLS setup/teardown/discovery */
822#define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP 0x00100000
562c9d97
AN
823/* Driver indicates support for Probe Response offloading in AP mode */
824#define WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD 0x00200000
70619a5d
EP
825/* Driver supports U-APSD in AP mode */
826#define WPA_DRIVER_FLAGS_AP_UAPSD 0x00400000
a0133ee1
VT
827/* Driver supports inactivity timer in AP mode */
828#define WPA_DRIVER_FLAGS_INACTIVITY_TIMER 0x00800000
6fc6879b 829 unsigned int flags;
80bc75f1
JM
830
831 int max_scan_ssids;
cbdf3507
LC
832 int max_sched_scan_ssids;
833 int sched_scan_supported;
b59e6f26 834 int max_match_sets;
814782b9
JM
835
836 /**
837 * max_remain_on_chan - Maximum remain-on-channel duration in msec
838 */
839 unsigned int max_remain_on_chan;
c4ea4c5c
JM
840
841 /**
842 * max_stations - Maximum number of associated stations the driver
843 * supports in AP mode
844 */
845 unsigned int max_stations;
562c9d97
AN
846
847 /**
848 * probe_resp_offloads - Bitmap of supported protocols by the driver
849 * for Probe Response offloading.
850 */
851/* Driver Probe Response offloading support for WPS ver. 1 */
852#define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS 0x00000001
853/* Driver Probe Response offloading support for WPS ver. 2 */
854#define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS2 0x00000002
855/* Driver Probe Response offloading support for P2P */
856#define WPA_DRIVER_PROBE_RESP_OFFLOAD_P2P 0x00000004
857/* Driver Probe Response offloading support for IEEE 802.11u (Interworking) */
858#define WPA_DRIVER_PROBE_RESP_OFFLOAD_INTERWORKING 0x00000008
859 unsigned int probe_resp_offloads;
6fc6879b
JM
860};
861
862
c5121837
JM
863struct hostapd_data;
864
865struct hostap_sta_driver_data {
866 unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
867 unsigned long current_tx_rate;
868 unsigned long inactive_msec;
869 unsigned long flags;
870 unsigned long num_ps_buf_frames;
871 unsigned long tx_retry_failed;
872 unsigned long tx_retry_count;
873 int last_rssi;
874 int last_ack_rssi;
875};
876
877struct hostapd_sta_add_params {
878 const u8 *addr;
879 u16 aid;
880 u16 capability;
881 const u8 *supp_rates;
882 size_t supp_rates_len;
c5121837 883 u16 listen_interval;
fc4e2d95 884 const struct ieee80211_ht_capabilities *ht_capabilities;
d83ab1fe 885 u32 flags; /* bitmask of WPA_STA_* flags */
45b722f1 886 int set; /* Set STA parameters instead of add */
5d061637 887 u8 qosinfo;
c5121837
JM
888};
889
890struct hostapd_freq_params {
891 int mode;
892 int freq;
893 int channel;
894 int ht_enabled;
895 int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
896 * secondary channel below primary, 1 = HT40
897 * enabled, secondary channel above primary */
898};
899
22a7c9d7
JM
900enum wpa_driver_if_type {
901 /**
902 * WPA_IF_STATION - Station mode interface
903 */
904 WPA_IF_STATION,
905
906 /**
907 * WPA_IF_AP_VLAN - AP mode VLAN interface
908 *
909 * This interface shares its address and Beacon frame with the main
910 * BSS.
911 */
912 WPA_IF_AP_VLAN,
913
914 /**
915 * WPA_IF_AP_BSS - AP mode BSS interface
916 *
917 * This interface has its own address and Beacon frame.
918 */
919 WPA_IF_AP_BSS,
75bde05d
JM
920
921 /**
922 * WPA_IF_P2P_GO - P2P Group Owner
923 */
924 WPA_IF_P2P_GO,
925
926 /**
927 * WPA_IF_P2P_CLIENT - P2P Client
928 */
929 WPA_IF_P2P_CLIENT,
930
931 /**
932 * WPA_IF_P2P_GROUP - P2P Group interface (will become either
933 * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known)
934 */
935 WPA_IF_P2P_GROUP
c5121837
JM
936};
937
92f475b4 938struct wpa_init_params {
4b24282a 939 void *global_priv;
92f475b4
JM
940 const u8 *bssid;
941 const char *ifname;
942 const u8 *ssid;
943 size_t ssid_len;
944 const char *test_socket;
945 int use_pae_group_addr;
92f475b4
JM
946 char **bridge;
947 size_t num_bridge;
412036f5
JM
948
949 u8 *own_addr; /* buffer for writing own MAC address */
92f475b4
JM
950};
951
c5121837 952
e3bd3912
JM
953struct wpa_bss_params {
954 /** Interface name (for multi-SSID/VLAN support) */
955 const char *ifname;
956 /** Whether IEEE 802.1X or WPA/WPA2 is enabled */
957 int enabled;
af586419
JM
958
959 int wpa;
960 int ieee802_1x;
961 int wpa_group;
962 int wpa_pairwise;
963 int wpa_key_mgmt;
964 int rsn_preauth;
a1ca0292 965 enum mfp_options ieee80211w;
e3bd3912
JM
966};
967
0de39516
JM
968#define WPA_STA_AUTHORIZED BIT(0)
969#define WPA_STA_WMM BIT(1)
970#define WPA_STA_SHORT_PREAMBLE BIT(2)
971#define WPA_STA_MFP BIT(3)
45b722f1 972#define WPA_STA_TDLS_PEER BIT(4)
e3bd3912 973
3ac17eba
JM
974/**
975 * struct p2p_params - P2P parameters for driver-based P2P management
976 */
977struct p2p_params {
978 const char *dev_name;
979 u8 pri_dev_type[8];
980#define DRV_MAX_SEC_DEV_TYPES 5
981 u8 sec_dev_type[DRV_MAX_SEC_DEV_TYPES][8];
982 size_t num_sec_dev_types;
983};
984
281ff0aa
GP
985enum tdls_oper {
986 TDLS_DISCOVERY_REQ,
987 TDLS_SETUP,
988 TDLS_TEARDOWN,
989 TDLS_ENABLE_LINK,
b8f64582
JM
990 TDLS_DISABLE_LINK,
991 TDLS_ENABLE,
992 TDLS_DISABLE
281ff0aa
GP
993};
994
1c5c7273
PS
995/**
996 * struct wpa_signal_info - Information about channel signal quality
997 */
998struct wpa_signal_info {
999 u32 frequency;
1000 int above_threshold;
1001 int current_signal;
1002 int current_noise;
1003 int current_txrate;
1004};
1005
6fc6879b
JM
1006/**
1007 * struct wpa_driver_ops - Driver interface API definition
1008 *
1009 * This structure defines the API that each driver interface needs to implement
1010 * for core wpa_supplicant code. All driver specific functionality is captured
1011 * in this wrapper.
1012 */
1013struct wpa_driver_ops {
1014 /** Name of the driver interface */
1015 const char *name;
1016 /** One line description of the driver interface */
1017 const char *desc;
1018
1019 /**
1020 * get_bssid - Get the current BSSID
1021 * @priv: private driver interface data
1022 * @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)
1023 *
1024 * Returns: 0 on success, -1 on failure
1025 *
1026 * Query kernel driver for the current BSSID and copy it to bssid.
1027 * Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not
1028 * associated.
1029 */
1030 int (*get_bssid)(void *priv, u8 *bssid);
1031
1032 /**
1033 * get_ssid - Get the current SSID
1034 * @priv: private driver interface data
1035 * @ssid: buffer for SSID (at least 32 bytes)
1036 *
1037 * Returns: Length of the SSID on success, -1 on failure
1038 *
1039 * Query kernel driver for the current SSID and copy it to ssid.
1040 * Returning zero is recommended if the STA is not associated.
1041 *
1042 * Note: SSID is an array of octets, i.e., it is not nul terminated and
1043 * can, at least in theory, contain control characters (including nul)
1044 * and as such, should be processed as binary data, not a printable
1045 * string.
1046 */
1047 int (*get_ssid)(void *priv, u8 *ssid);
1048
6fc6879b
JM
1049 /**
1050 * set_key - Configure encryption key
642187d6 1051 * @ifname: Interface name (for multi-SSID/VLAN support)
6fc6879b
JM
1052 * @priv: private driver interface data
1053 * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
1054 * %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK);
1055 * %WPA_ALG_NONE clears the key.
0382097e
JM
1056 * @addr: Address of the peer STA (BSSID of the current AP when setting
1057 * pairwise key in station mode), ff:ff:ff:ff:ff:ff for
1058 * broadcast keys, %NULL for default keys that are used both for
1059 * broadcast and unicast; when clearing keys, %NULL is used to
1060 * indicate that both the broadcast-only and default key of the
1061 * specified key index is to be cleared
6fc6879b
JM
1062 * @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
1063 * IGTK
1064 * @set_tx: configure this key as the default Tx key (only used when
1065 * driver does not support separate unicast/individual key
1066 * @seq: sequence number/packet number, seq_len octets, the next
1067 * packet number to be used for in replay protection; configured
1068 * for Rx keys (in most cases, this is only used with broadcast
da64c266 1069 * keys and set to zero for unicast keys); %NULL if not set
6fc6879b
JM
1070 * @seq_len: length of the seq, depends on the algorithm:
1071 * TKIP: 6 octets, CCMP: 6 octets, IGTK: 6 octets
1072 * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
1073 * 8-byte Rx Mic Key
1074 * @key_len: length of the key buffer in octets (WEP: 5 or 13,
1075 * TKIP: 32, CCMP: 16, IGTK: 16)
1076 *
1077 * Returns: 0 on success, -1 on failure
1078 *
1079 * Configure the given key for the kernel driver. If the driver
1080 * supports separate individual keys (4 default keys + 1 individual),
1081 * addr can be used to determine whether the key is default or
1082 * individual. If only 4 keys are supported, the default key with key
1083 * index 0 is used as the individual key. STA must be configured to use
1084 * it as the default Tx key (set_tx is set) and accept Rx for all the
1085 * key indexes. In most cases, WPA uses only key indexes 1 and 2 for
1086 * broadcast keys, so key index 0 is available for this kind of
1087 * configuration.
1088 *
1089 * Please note that TKIP keys include separate TX and RX MIC keys and
1090 * some drivers may expect them in different order than wpa_supplicant
1091 * is using. If the TX/RX keys are swapped, all TKIP encrypted packets
61fbd3df 1092 * will trigger Michael MIC errors. This can be fixed by changing the
6fc6879b
JM
1093 * order of MIC keys by swapping te bytes 16..23 and 24..31 of the key
1094 * in driver_*.c set_key() implementation, see driver_ndis.c for an
1095 * example on how this can be done.
1096 */
71934751 1097 int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg,
642187d6
JM
1098 const u8 *addr, int key_idx, int set_tx,
1099 const u8 *seq, size_t seq_len,
6fc6879b
JM
1100 const u8 *key, size_t key_len);
1101
1102 /**
1103 * init - Initialize driver interface
1104 * @ctx: context to be used when calling wpa_supplicant functions,
1105 * e.g., wpa_supplicant_event()
1106 * @ifname: interface name, e.g., wlan0
1107 *
1108 * Returns: Pointer to private data, %NULL on failure
1109 *
1110 * Initialize driver interface, including event processing for kernel
1111 * driver events (e.g., associated, scan results, Michael MIC failure).
1112 * This function can allocate a private configuration data area for
1113 * @ctx, file descriptor, interface name, etc. information that may be
1114 * needed in future driver operations. If this is not used, non-NULL
1115 * value will need to be returned because %NULL is used to indicate
1116 * failure. The returned value will be used as 'void *priv' data for
1117 * all other driver_ops functions.
1118 *
1119 * The main event loop (eloop.c) of wpa_supplicant can be used to
1120 * register callback for read sockets (eloop_register_read_sock()).
1121 *
1122 * See below for more information about events and
1123 * wpa_supplicant_event() function.
1124 */
1125 void * (*init)(void *ctx, const char *ifname);
1126
1127 /**
1128 * deinit - Deinitialize driver interface
1129 * @priv: private driver interface data from init()
1130 *
1131 * Shut down driver interface and processing of driver events. Free
1132 * private data buffer if one was allocated in init() handler.
1133 */
1134 void (*deinit)(void *priv);
1135
1136 /**
1137 * set_param - Set driver configuration parameters
1138 * @priv: private driver interface data from init()
1139 * @param: driver specific configuration parameters
1140 *
1141 * Returns: 0 on success, -1 on failure
1142 *
1143 * Optional handler for notifying driver interface about configuration
1144 * parameters (driver_param).
1145 */
1146 int (*set_param)(void *priv, const char *param);
1147
1148 /**
1149 * set_countermeasures - Enable/disable TKIP countermeasures
1150 * @priv: private driver interface data
1151 * @enabled: 1 = countermeasures enabled, 0 = disabled
1152 *
1153 * Returns: 0 on success, -1 on failure
1154 *
1155 * Configure TKIP countermeasures. When these are enabled, the driver
1156 * should drop all received and queued frames that are using TKIP.
1157 */
1158 int (*set_countermeasures)(void *priv, int enabled);
1159
6fc6879b
JM
1160 /**
1161 * deauthenticate - Request driver to deauthenticate
1162 * @priv: private driver interface data
1163 * @addr: peer address (BSSID of the AP)
1164 * @reason_code: 16-bit reason code to be sent in the deauthentication
1165 * frame
1166 *
1167 * Returns: 0 on success, -1 on failure
1168 */
1169 int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
1170
1171 /**
1172 * disassociate - Request driver to disassociate
1173 * @priv: private driver interface data
1174 * @addr: peer address (BSSID of the AP)
1175 * @reason_code: 16-bit reason code to be sent in the disassociation
1176 * frame
1177 *
1178 * Returns: 0 on success, -1 on failure
1179 */
1180 int (*disassociate)(void *priv, const u8 *addr, int reason_code);
1181
1182 /**
1183 * associate - Request driver to associate
1184 * @priv: private driver interface data
1185 * @params: association parameters
1186 *
1187 * Returns: 0 on success, -1 on failure
1188 */
1189 int (*associate)(void *priv,
1190 struct wpa_driver_associate_params *params);
1191
6fc6879b
JM
1192 /**
1193 * add_pmkid - Add PMKSA cache entry to the driver
1194 * @priv: private driver interface data
1195 * @bssid: BSSID for the PMKSA cache entry
1196 * @pmkid: PMKID for the PMKSA cache entry
1197 *
1198 * Returns: 0 on success, -1 on failure
1199 *
1200 * This function is called when a new PMK is received, as a result of
1201 * either normal authentication or RSN pre-authentication.
1202 *
1203 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
1204 * associate(), add_pmkid() can be used to add new PMKSA cache entries
1205 * in the driver. If the driver uses wpa_ie from wpa_supplicant, this
1206 * driver_ops function does not need to be implemented. Likewise, if
1207 * the driver does not support WPA, this function is not needed.
1208 */
1209 int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
1210
1211 /**
1212 * remove_pmkid - Remove PMKSA cache entry to the driver
1213 * @priv: private driver interface data
1214 * @bssid: BSSID for the PMKSA cache entry
1215 * @pmkid: PMKID for the PMKSA cache entry
1216 *
1217 * Returns: 0 on success, -1 on failure
1218 *
1219 * This function is called when the supplicant drops a PMKSA cache
1220 * entry for any reason.
1221 *
1222 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
1223 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
1224 * between the driver and wpa_supplicant. If the driver uses wpa_ie
1225 * from wpa_supplicant, this driver_ops function does not need to be
1226 * implemented. Likewise, if the driver does not support WPA, this
1227 * function is not needed.
1228 */
1229 int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
1230
1231 /**
1232 * flush_pmkid - Flush PMKSA cache
1233 * @priv: private driver interface data
1234 *
1235 * Returns: 0 on success, -1 on failure
1236 *
1237 * This function is called when the supplicant drops all PMKSA cache
1238 * entries for any reason.
1239 *
1240 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
1241 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
1242 * between the driver and wpa_supplicant. If the driver uses wpa_ie
1243 * from wpa_supplicant, this driver_ops function does not need to be
1244 * implemented. Likewise, if the driver does not support WPA, this
1245 * function is not needed.
1246 */
1247 int (*flush_pmkid)(void *priv);
1248
1249 /**
6179d2fd 1250 * get_capa - Get driver capabilities
6fc6879b
JM
1251 * @priv: private driver interface data
1252 *
1253 * Returns: 0 on success, -1 on failure
1254 *
1255 * Get driver/firmware/hardware capabilities.
1256 */
1257 int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
1258
1259 /**
1260 * poll - Poll driver for association information
1261 * @priv: private driver interface data
1262 *
1263 * This is an option callback that can be used when the driver does not
1264 * provide event mechanism for association events. This is called when
1265 * receiving WPA EAPOL-Key messages that require association
1266 * information. The driver interface is supposed to generate associnfo
1267 * event before returning from this callback function. In addition, the
1268 * driver interface should generate an association event after having
1269 * sent out associnfo.
1270 */
1271 void (*poll)(void *priv);
1272
1273 /**
1274 * get_ifname - Get interface name
1275 * @priv: private driver interface data
1276 *
1277 * Returns: Pointer to the interface name. This can differ from the
e519314e 1278 * interface name used in init() call. Init() is called first.
6fc6879b
JM
1279 *
1280 * This optional function can be used to allow the driver interface to
1281 * replace the interface name with something else, e.g., based on an
1282 * interface mapping from a more descriptive name.
1283 */
1284 const char * (*get_ifname)(void *priv);
1285
1286 /**
1287 * get_mac_addr - Get own MAC address
1288 * @priv: private driver interface data
1289 *
1290 * Returns: Pointer to own MAC address or %NULL on failure
1291 *
1292 * This optional function can be used to get the own MAC address of the
1293 * device from the driver interface code. This is only needed if the
1294 * l2_packet implementation for the OS does not provide easy access to
1295 * a MAC address. */
1296 const u8 * (*get_mac_addr)(void *priv);
1297
1298 /**
1299 * send_eapol - Optional function for sending EAPOL packets
1300 * @priv: private driver interface data
1301 * @dest: Destination MAC address
1302 * @proto: Ethertype
1303 * @data: EAPOL packet starting with IEEE 802.1X header
1304 * @data_len: Size of the EAPOL packet
1305 *
1306 * Returns: 0 on success, -1 on failure
1307 *
1308 * This optional function can be used to override l2_packet operations
1309 * with driver specific functionality. If this function pointer is set,
1310 * l2_packet module is not used at all and the driver interface code is
1311 * responsible for receiving and sending all EAPOL packets. The
a8e0505b
JM
1312 * received EAPOL packets are sent to core code with EVENT_EAPOL_RX
1313 * event. The driver interface is required to implement get_mac_addr()
1314 * handler if send_eapol() is used.
6fc6879b
JM
1315 */
1316 int (*send_eapol)(void *priv, const u8 *dest, u16 proto,
1317 const u8 *data, size_t data_len);
1318
1319 /**
1320 * set_operstate - Sets device operating state to DORMANT or UP
1321 * @priv: private driver interface data
1322 * @state: 0 = dormant, 1 = up
1323 * Returns: 0 on success, -1 on failure
1324 *
1325 * This is an optional function that can be used on operating systems
1326 * that support a concept of controlling network device state from user
1327 * space applications. This function, if set, gets called with
1328 * state = 1 when authentication has been completed and with state = 0
1329 * when connection is lost.
1330 */
1331 int (*set_operstate)(void *priv, int state);
1332
1333 /**
1334 * mlme_setprotection - MLME-SETPROTECTION.request primitive
1335 * @priv: Private driver interface data
1336 * @addr: Address of the station for which to set protection (may be
1337 * %NULL for group keys)
1338 * @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_*
1339 * @key_type: MLME_SETPROTECTION_KEY_TYPE_*
1340 * Returns: 0 on success, -1 on failure
1341 *
1342 * This is an optional function that can be used to set the driver to
1343 * require protection for Tx and/or Rx frames. This uses the layer
1344 * interface defined in IEEE 802.11i-2004 clause 10.3.22.1
1345 * (MLME-SETPROTECTION.request). Many drivers do not use explicit
1346 * set protection operation; instead, they set protection implicitly
1347 * based on configured keys.
1348 */
1349 int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
1350 int key_type);
1351
1352 /**
1353 * get_hw_feature_data - Get hardware support data (channels and rates)
1354 * @priv: Private driver interface data
1355 * @num_modes: Variable for returning the number of returned modes
1356 * flags: Variable for returning hardware feature flags
1357 * Returns: Pointer to allocated hardware data on success or %NULL on
1358 * failure. Caller is responsible for freeing this.
6fc6879b 1359 */
6caf9ca6
JM
1360 struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
1361 u16 *num_modes,
1362 u16 *flags);
6fc6879b 1363
6fc6879b
JM
1364 /**
1365 * send_mlme - Send management frame from MLME
1366 * @priv: Private driver interface data
1367 * @data: IEEE 802.11 management frame with IEEE 802.11 header
1368 * @data_len: Size of the management frame
8cfa3527 1369 * @noack: Do not wait for this frame to be acked (disable retries)
6fc6879b 1370 * Returns: 0 on success, -1 on failure
6fc6879b 1371 */
8cfa3527
HS
1372 int (*send_mlme)(void *priv, const u8 *data, size_t data_len,
1373 int noack);
6fc6879b 1374
6fc6879b
JM
1375 /**
1376 * update_ft_ies - Update FT (IEEE 802.11r) IEs
1377 * @priv: Private driver interface data
1378 * @md: Mobility domain (2 octets) (also included inside ies)
1379 * @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs
1380 * @ies_len: Length of FT IEs in bytes
1381 * Returns: 0 on success, -1 on failure
1382 *
1383 * The supplicant uses this callback to let the driver know that keying
1384 * material for FT is available and that the driver can use the
1385 * provided IEs in the next message in FT authentication sequence.
1386 *
1387 * This function is only needed for driver that support IEEE 802.11r
1388 * (Fast BSS Transition).
1389 */
1390 int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies,
1391 size_t ies_len);
1392
1393 /**
1394 * send_ft_action - Send FT Action frame (IEEE 802.11r)
1395 * @priv: Private driver interface data
1396 * @action: Action field value
1397 * @target_ap: Target AP address
1398 * @ies: FT IEs (MDIE, FTIE, ...) (FT Request action frame body)
1399 * @ies_len: Length of FT IEs in bytes
1400 * Returns: 0 on success, -1 on failure
1401 *
1402 * The supplicant uses this callback to request the driver to transmit
1403 * an FT Action frame (action category 6) for over-the-DS fast BSS
1404 * transition.
1405 */
1406 int (*send_ft_action)(void *priv, u8 action, const u8 *target_ap,
1407 const u8 *ies, size_t ies_len);
1408
1409 /**
1410 * get_scan_results2 - Fetch the latest scan results
1411 * @priv: private driver interface data
1412 *
1413 * Returns: Allocated buffer of scan results (caller is responsible for
1414 * freeing the data structure) on success, NULL on failure
1415 */
1416 struct wpa_scan_results * (*get_scan_results2)(void *priv);
1417
6d158490
LR
1418 /**
1419 * set_country - Set country
1420 * @priv: Private driver interface data
1421 * @alpha2: country to which to switch to
1422 * Returns: 0 on success, -1 on failure
1423 *
1424 * This function is for drivers which support some form
1425 * of setting a regulatory domain.
1426 */
1427 int (*set_country)(void *priv, const char *alpha2);
ac305589
JM
1428
1429 /**
1430 * global_init - Global driver initialization
1431 * Returns: Pointer to private data (global), %NULL on failure
1432 *
1433 * This optional function is called to initialize the driver wrapper
1434 * for global data, i.e., data that applies to all interfaces. If this
1435 * function is implemented, global_deinit() will also need to be
1436 * implemented to free the private data. The driver will also likely
1437 * use init2() function instead of init() to get the pointer to global
1438 * data available to per-interface initializer.
1439 */
1440 void * (*global_init)(void);
1441
1442 /**
1443 * global_deinit - Global driver deinitialization
1444 * @priv: private driver global data from global_init()
1445 *
1446 * Terminate any global driver related functionality and free the
1447 * global data structure.
1448 */
1449 void (*global_deinit)(void *priv);
1450
1451 /**
1452 * init2 - Initialize driver interface (with global data)
1453 * @ctx: context to be used when calling wpa_supplicant functions,
1454 * e.g., wpa_supplicant_event()
1455 * @ifname: interface name, e.g., wlan0
1456 * @global_priv: private driver global data from global_init()
1457 * Returns: Pointer to private data, %NULL on failure
1458 *
1459 * This function can be used instead of init() if the driver wrapper
1460 * uses global data.
1461 */
1462 void * (*init2)(void *ctx, const char *ifname, void *global_priv);
4b4a8ae5
JM
1463
1464 /**
1465 * get_interfaces - Get information about available interfaces
1466 * @global_priv: private driver global data from global_init()
1467 * Returns: Allocated buffer of interface information (caller is
1468 * responsible for freeing the data structure) on success, NULL on
1469 * failure
1470 */
1471 struct wpa_interface_info * (*get_interfaces)(void *global_priv);
fc2b7ed5
JM
1472
1473 /**
1474 * scan2 - Request the driver to initiate scan
1475 * @priv: private driver interface data
1476 * @params: Scan parameters
1477 *
1478 * Returns: 0 on success, -1 on failure
1479 *
1480 * Once the scan results are ready, the driver should report scan
1481 * results event for wpa_supplicant which will eventually request the
1482 * results with wpa_driver_get_scan_results2().
1483 */
1484 int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
c2a04078
JM
1485
1486 /**
1487 * authenticate - Request driver to authenticate
1488 * @priv: private driver interface data
1489 * @params: authentication parameters
1490 * Returns: 0 on success, -1 on failure
1491 *
1492 * This is an optional function that can be used with drivers that
1493 * support separate authentication and association steps, i.e., when
1494 * wpa_supplicant can act as the SME. If not implemented, associate()
1495 * function is expected to take care of IEEE 802.11 authentication,
1496 * too.
1497 */
d2440ba0
JM
1498 int (*authenticate)(void *priv,
1499 struct wpa_driver_auth_params *params);
1500
15333707 1501 /**
19c3b566 1502 * set_ap - Set Beacon and Probe Response information for AP mode
15333707 1503 * @priv: Private driver interface data
19c3b566 1504 * @params: Parameters to use in AP mode
15333707 1505 *
19c3b566
JM
1506 * This function is used to configure Beacon template and/or extra IEs
1507 * to add for Beacon and Probe Response frames for the driver in
15333707
JM
1508 * AP mode. The driver is responsible for building the full Beacon
1509 * frame by concatenating the head part with TIM IE generated by the
19c3b566
JM
1510 * driver/firmware and finishing with the tail part. Depending on the
1511 * driver architectue, this can be done either by using the full
1512 * template or the set of additional IEs (e.g., WPS and P2P IE).
1513 * Similarly, Probe Response processing depends on the driver design.
1514 * If the driver (or firmware) takes care of replying to Probe Request
1515 * frames, the extra IEs provided here needs to be added to the Probe
1516 * Response frames.
1517 *
1518 * Returns: 0 on success, -1 on failure
15333707 1519 */
19c3b566 1520 int (*set_ap)(void *priv, struct wpa_driver_ap_params *params);
c5121837 1521
15333707
JM
1522 /**
1523 * hapd_init - Initialize driver interface (hostapd only)
1524 * @hapd: Pointer to hostapd context
1525 * @params: Configuration for the driver wrapper
1526 * Returns: Pointer to private data, %NULL on failure
1527 *
1528 * This function is used instead of init() or init2() when the driver
ffbf1eaa 1529 * wrapper is used with hostapd.
15333707 1530 */
92f475b4
JM
1531 void * (*hapd_init)(struct hostapd_data *hapd,
1532 struct wpa_init_params *params);
15333707
JM
1533
1534 /**
1535 * hapd_deinit - Deinitialize driver interface (hostapd only)
1536 * @priv: Private driver interface data from hapd_init()
1537 */
c5121837
JM
1538 void (*hapd_deinit)(void *priv);
1539
1540 /**
15333707 1541 * set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
15333707 1542 * @priv: Private driver interface data
e3bd3912 1543 * @params: BSS parameters
c5121837
JM
1544 * Returns: 0 on success, -1 on failure
1545 *
15333707 1546 * This is an optional function to configure the kernel driver to
e3bd3912
JM
1547 * enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
1548 * can be left undefined (set to %NULL) if IEEE 802.1X support is
dcd1eb5b 1549 * always enabled and the driver uses set_ap() to set WPA/RSN IE
e3bd3912 1550 * for Beacon frames.
062390ef
JM
1551 *
1552 * DEPRECATED - use set_ap() instead
c5121837 1553 */
e3bd3912 1554 int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
c5121837
JM
1555
1556 /**
15333707
JM
1557 * set_privacy - Enable/disable privacy (AP only)
1558 * @priv: Private driver interface data
c5121837 1559 * @enabled: 1 = privacy enabled, 0 = disabled
15333707 1560 * Returns: 0 on success, -1 on failure
c5121837 1561 *
15333707
JM
1562 * This is an optional function to configure privacy field in the
1563 * kernel driver for Beacon frames. This can be left undefined (set to
dcd1eb5b 1564 * %NULL) if the driver uses the Beacon template from set_ap().
062390ef
JM
1565 *
1566 * DEPRECATED - use set_ap() instead
c5121837 1567 */
d5dd016a 1568 int (*set_privacy)(void *priv, int enabled);
c5121837 1569
15333707
JM
1570 /**
1571 * get_seqnum - Fetch the current TSC/packet number (AP only)
1572 * @ifname: The interface name (main or virtual)
1573 * @priv: Private driver interface data
1574 * @addr: MAC address of the station or %NULL for group keys
1575 * @idx: Key index
1576 * @seq: Buffer for returning the latest used TSC/packet number
1577 * Returns: 0 on success, -1 on failure
1578 *
1579 * This function is used to fetch the last used TSC/packet number for
9008a3e4
JM
1580 * a TKIP, CCMP, or BIP/IGTK key. It is mainly used with group keys, so
1581 * there is no strict requirement on implementing support for unicast
1582 * keys (i.e., addr != %NULL).
15333707 1583 */
c5121837
JM
1584 int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
1585 int idx, u8 *seq);
15333707 1586
15333707
JM
1587 /**
1588 * flush - Flush all association stations (AP only)
1589 * @priv: Private driver interface data
1590 * Returns: 0 on success, -1 on failure
1591 *
1592 * This function requests the driver to disassociate all associated
1593 * stations. This function does not need to be implemented if the
1594 * driver does not process association frames internally.
1595 */
c5121837 1596 int (*flush)(void *priv);
15333707
JM
1597
1598 /**
1599 * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP)
15333707
JM
1600 * @priv: Private driver interface data
1601 * @elem: Information elements
1602 * @elem_len: Length of the elem buffer in octets
1603 * Returns: 0 on success, -1 on failure
1604 *
1605 * This is an optional function to add information elements in the
1606 * kernel driver for Beacon and Probe Response frames. This can be left
1607 * undefined (set to %NULL) if the driver uses the Beacon template from
dcd1eb5b 1608 * set_ap().
062390ef
JM
1609 *
1610 * DEPRECATED - use set_ap() instead
15333707 1611 */
aa484516 1612 int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
c5121837 1613
15333707
JM
1614 /**
1615 * read_sta_data - Fetch station data (AP only)
1616 * @priv: Private driver interface data
1617 * @data: Buffer for returning station information
1618 * @addr: MAC address of the station
1619 * Returns: 0 on success, -1 on failure
1620 */
c5121837
JM
1621 int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
1622 const u8 *addr);
15333707
JM
1623
1624 /**
1625 * hapd_send_eapol - Send an EAPOL packet (AP only)
1626 * @priv: private driver interface data
1627 * @addr: Destination MAC address
1628 * @data: EAPOL packet starting with IEEE 802.1X header
1629 * @data_len: Length of the EAPOL packet in octets
1630 * @encrypt: Whether the frame should be encrypted
1631 * @own_addr: Source MAC address
4378fc14 1632 * @flags: WPA_STA_* flags for the destination station
15333707
JM
1633 *
1634 * Returns: 0 on success, -1 on failure
1635 */
c5121837
JM
1636 int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
1637 size_t data_len, int encrypt,
4378fc14 1638 const u8 *own_addr, u32 flags);
15333707 1639
90b8c4c5
JM
1640 /**
1641 * sta_deauth - Deauthenticate a station (AP only)
1642 * @priv: Private driver interface data
1643 * @own_addr: Source address and BSSID for the Deauthentication frame
1644 * @addr: MAC address of the station to deauthenticate
1645 * @reason: Reason code for the Deauthentiation frame
1646 * Returns: 0 on success, -1 on failure
1647 *
1648 * This function requests a specific station to be deauthenticated and
1649 * a Deauthentication frame to be sent to it.
1650 */
731723a5
JM
1651 int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
1652 int reason);
90b8c4c5
JM
1653
1654 /**
1655 * sta_disassoc - Disassociate a station (AP only)
1656 * @priv: Private driver interface data
1657 * @own_addr: Source address and BSSID for the Disassociation frame
1658 * @addr: MAC address of the station to disassociate
1659 * @reason: Reason code for the Disassociation frame
1660 * Returns: 0 on success, -1 on failure
1661 *
1662 * This function requests a specific station to be disassociated and
1663 * a Disassociation frame to be sent to it.
1664 */
731723a5
JM
1665 int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
1666 int reason);
90b8c4c5
JM
1667
1668 /**
1669 * sta_remove - Remove a station entry (AP only)
1670 * @priv: Private driver interface data
1671 * @addr: MAC address of the station to be removed
1672 * Returns: 0 on success, -1 on failure
1673 */
c5121837 1674 int (*sta_remove)(void *priv, const u8 *addr);
90b8c4c5
JM
1675
1676 /**
1677 * hapd_get_ssid - Get the current SSID (AP only)
90b8c4c5
JM
1678 * @priv: Private driver interface data
1679 * @buf: Buffer for returning the SSID
1680 * @len: Maximum length of the buffer
1681 * Returns: Length of the SSID on success, -1 on failure
1682 *
1683 * This function need not be implemented if the driver uses Beacon
dcd1eb5b 1684 * template from set_ap() and does not reply to Probe Request frames.
90b8c4c5 1685 */
8709de1a 1686 int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
90b8c4c5
JM
1687
1688 /**
1689 * hapd_set_ssid - Set SSID (AP only)
90b8c4c5
JM
1690 * @priv: Private driver interface data
1691 * @buf: SSID
1692 * @len: Length of the SSID in octets
1693 * Returns: 0 on success, -1 on failure
062390ef
JM
1694 *
1695 * DEPRECATED - use set_ap() instead
90b8c4c5 1696 */
8709de1a
JM
1697 int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
1698
90b8c4c5
JM
1699 /**
1700 * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP)
1701 * @priv: Private driver interface data
1702 * @enabled: 1 = countermeasures enabled, 0 = disabled
1703 * Returns: 0 on success, -1 on failure
1704 *
1705 * This need not be implemented if the driver does not take care of
1706 * association processing.
1707 */
c5121837 1708 int (*hapd_set_countermeasures)(void *priv, int enabled);
90b8c4c5
JM
1709
1710 /**
1711 * sta_add - Add a station entry
90b8c4c5
JM
1712 * @priv: Private driver interface data
1713 * @params: Station parameters
1714 * Returns: 0 on success, -1 on failure
1715 *
1716 * This function is used to add a station entry to the driver once the
1717 * station has completed association. This is only used if the driver
1718 * does not take care of association processing.
45b722f1
AN
1719 *
1720 * With TDLS, this function is also used to add or set (params->set 1)
1721 * TDLS peer entries.
90b8c4c5 1722 */
62847751 1723 int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
90b8c4c5
JM
1724
1725 /**
1726 * get_inact_sec - Get station inactivity duration (AP only)
1727 * @priv: Private driver interface data
1728 * @addr: Station address
1729 * Returns: Number of seconds station has been inactive, -1 on failure
1730 */
c5121837 1731 int (*get_inact_sec)(void *priv, const u8 *addr);
90b8c4c5
JM
1732
1733 /**
1734 * sta_clear_stats - Clear station statistics (AP only)
1735 * @priv: Private driver interface data
1736 * @addr: Station address
1737 * Returns: 0 on success, -1 on failure
1738 */
c5121837
JM
1739 int (*sta_clear_stats)(void *priv, const u8 *addr);
1740
90b8c4c5
JM
1741 /**
1742 * set_freq - Set channel/frequency (AP only)
1743 * @priv: Private driver interface data
1744 * @freq: Channel parameters
1745 * Returns: 0 on success, -1 on failure
1746 */
c5121837 1747 int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
90b8c4c5
JM
1748
1749 /**
1750 * set_rts - Set RTS threshold
1751 * @priv: Private driver interface data
1752 * @rts: RTS threshold in octets
1753 * Returns: 0 on success, -1 on failure
1754 */
c5121837 1755 int (*set_rts)(void *priv, int rts);
90b8c4c5
JM
1756
1757 /**
1758 * set_frag - Set fragmentation threshold
1759 * @priv: Private driver interface data
1760 * @frag: Fragmentation threshold in octets
1761 * Returns: 0 on success, -1 on failure
1762 */
c5121837 1763 int (*set_frag)(void *priv, int frag);
c5121837 1764
90b8c4c5
JM
1765 /**
1766 * sta_set_flags - Set station flags (AP only)
1767 * @priv: Private driver interface data
1768 * @addr: Station address
0de39516
JM
1769 * @total_flags: Bitmap of all WPA_STA_* flags currently set
1770 * @flags_or: Bitmap of WPA_STA_* flags to add
1771 * @flags_and: Bitmap of WPA_STA_* flags to us as a mask
90b8c4c5
JM
1772 * Returns: 0 on success, -1 on failure
1773 */
3234cba4 1774 int (*sta_set_flags)(void *priv, const u8 *addr,
c5121837 1775 int total_flags, int flags_or, int flags_and);
90b8c4c5 1776
90b8c4c5
JM
1777 /**
1778 * set_tx_queue_params - Set TX queue parameters
1779 * @priv: Private driver interface data
7e3c1781 1780 * @queue: Queue number (0 = VO, 1 = VI, 2 = BE, 3 = BK)
90b8c4c5
JM
1781 * @aifs: AIFS
1782 * @cw_min: cwMin
1783 * @cw_max: cwMax
1784 * @burst_time: Maximum length for bursting in 0.1 msec units
1785 */
c5121837
JM
1786 int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
1787 int cw_max, int burst_time);
90b8c4c5 1788
22a7c9d7
JM
1789 /**
1790 * if_add - Add a virtual interface
15333707 1791 * @priv: Private driver interface data
22a7c9d7
JM
1792 * @type: Interface type
1793 * @ifname: Interface name for the new virtual interface
1794 * @addr: Local address to use for the interface or %NULL to use the
1795 * parent interface address
8043e725 1796 * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces
a2e40bb6
FF
1797 * @drv_priv: Pointer for overwriting the driver context or %NULL if
1798 * not allowed (applies only to %WPA_IF_AP_BSS type)
f3585c8a
JM
1799 * @force_ifname: Buffer for returning an interface name that the
1800 * driver ended up using if it differs from the requested ifname
1801 * @if_addr: Buffer for returning the allocated interface address
1802 * (this may differ from the requested addr if the driver cannot
1803 * change interface address)
e17a2477 1804 * @bridge: Bridge interface to use or %NULL if no bridge configured
22a7c9d7
JM
1805 * Returns: 0 on success, -1 on failure
1806 */
7ab68865
JM
1807 int (*if_add)(void *priv, enum wpa_driver_if_type type,
1808 const char *ifname, const u8 *addr, void *bss_ctx,
e17a2477
JM
1809 void **drv_priv, char *force_ifname, u8 *if_addr,
1810 const char *bridge);
22a7c9d7
JM
1811
1812 /**
1813 * if_remove - Remove a virtual interface
1814 * @priv: Private driver interface data
1815 * @type: Interface type
1816 * @ifname: Interface name of the virtual interface to be removed
1817 * Returns: 0 on success, -1 on failure
1818 */
1819 int (*if_remove)(void *priv, enum wpa_driver_if_type type,
1820 const char *ifname);
90b8c4c5 1821
15333707
JM
1822 /**
1823 * set_sta_vlan - Bind a station into a specific interface (AP only)
1824 * @priv: Private driver interface data
1825 * @ifname: Interface (main or virtual BSS or VLAN)
1826 * @addr: MAC address of the associated station
1827 * @vlan_id: VLAN ID
1828 * Returns: 0 on success, -1 on failure
1829 *
1830 * This function is used to bind a station to a specific virtual
1831 * interface. It is only used if when virtual interfaces are supported,
1832 * e.g., to assign stations to different VLAN interfaces based on
1833 * information from a RADIUS server. This allows separate broadcast
1834 * domains to be used with a single BSS.
1835 */
c5121837
JM
1836 int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
1837 int vlan_id);
15333707 1838
c5121837 1839 /**
15333707 1840 * commit - Optional commit changes handler (AP only)
c5121837
JM
1841 * @priv: driver private data
1842 * Returns: 0 on success, -1 on failure
1843 *
1844 * This optional handler function can be registered if the driver
1845 * interface implementation needs to commit changes (e.g., by setting
1846 * network interface up) at the end of initial configuration. If set,
1847 * this handler will be called after initial setup has been completed.
1848 */
1849 int (*commit)(void *priv);
1850
90b8c4c5
JM
1851 /**
1852 * send_ether - Send an ethernet packet (AP only)
1853 * @priv: private driver interface data
1854 * @dst: Destination MAC address
1855 * @src: Source MAC address
1856 * @proto: Ethertype
1857 * @data: EAPOL packet starting with IEEE 802.1X header
1858 * @data_len: Length of the EAPOL packet in octets
1859 * Returns: 0 on success, -1 on failure
1860 */
c5121837
JM
1861 int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
1862 const u8 *data, size_t data_len);
1863
90b8c4c5
JM
1864 /**
1865 * set_radius_acl_auth - Notification of RADIUS ACL change
1866 * @priv: Private driver interface data
1867 * @mac: MAC address of the station
1868 * @accepted: Whether the station was accepted
1869 * @session_timeout: Session timeout for the station
1870 * Returns: 0 on success, -1 on failure
1871 */
c5121837
JM
1872 int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
1873 u32 session_timeout);
90b8c4c5
JM
1874
1875 /**
1876 * set_radius_acl_expire - Notification of RADIUS ACL expiration
1877 * @priv: Private driver interface data
1878 * @mac: MAC address of the station
1879 * Returns: 0 on success, -1 on failure
1880 */
c5121837
JM
1881 int (*set_radius_acl_expire)(void *priv, const u8 *mac);
1882
15333707 1883 /**
b3db190f 1884 * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP)
15333707 1885 * @priv: Private driver interface data
b3db190f
JM
1886 * @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s)
1887 * @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove
1888 * extra IE(s)
0e2e565a
JM
1889 * @assocresp: WPS IE(s) for (Re)Association Response frames or %NULL
1890 * to remove extra IE(s)
15333707
JM
1891 * Returns: 0 on success, -1 on failure
1892 *
1893 * This is an optional function to add WPS IE in the kernel driver for
14f79386 1894 * Beacon and Probe Response frames. This can be left undefined (set
dcd1eb5b 1895 * to %NULL) if the driver uses the Beacon template from set_ap()
0e2e565a
JM
1896 * and does not process Probe Request frames. If the driver takes care
1897 * of (Re)Association frame processing, the assocresp buffer includes
1898 * WPS IE(s) that need to be added to (Re)Association Response frames
1899 * whenever a (Re)Association Request frame indicated use of WPS.
75bde05d
JM
1900 *
1901 * This will also be used to add P2P IE(s) into Beacon/Probe Response
1902 * frames when operating as a GO. The driver is responsible for adding
1903 * timing related attributes (e.g., NoA) in addition to the IEs
1904 * included here by appending them after these buffers. This call is
1905 * also used to provide Probe Response IEs for P2P Listen state
1906 * operations for drivers that generate the Probe Response frames
1907 * internally.
062390ef
JM
1908 *
1909 * DEPRECATED - use set_ap() instead
15333707 1910 */
0ebdf627 1911 int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
0e2e565a
JM
1912 const struct wpabuf *proberesp,
1913 const struct wpabuf *assocresp);
4bc181ec
JM
1914
1915 /**
1916 * set_supp_port - Set IEEE 802.1X Supplicant Port status
1917 * @priv: Private driver interface data
1918 * @authorized: Whether the port is authorized
1919 * Returns: 0 on success, -1 on failure
1920 */
1921 int (*set_supp_port)(void *priv, int authorized);
fbbfcbac
FF
1922
1923 /**
1924 * set_wds_sta - Bind a station into a 4-address WDS (AP only)
1925 * @priv: Private driver interface data
1926 * @addr: MAC address of the associated station
1927 * @aid: Association ID
1928 * @val: 1 = bind to 4-address WDS; 0 = unbind
d38ae2ea
FF
1929 * @bridge_ifname: Bridge interface to use for the WDS station or %NULL
1930 * to indicate that bridge is not to be used
fbbfcbac
FF
1931 * Returns: 0 on success, -1 on failure
1932 */
d38ae2ea
FF
1933 int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
1934 const char *bridge_ifname);
504e905c 1935
55777702
JM
1936 /**
1937 * send_action - Transmit an Action frame
1938 * @priv: Private driver interface data
1939 * @freq: Frequency (in MHz) of the channel
190b9062 1940 * @wait: Time to wait off-channel for a response (in ms), or zero
e8828999
JM
1941 * @dst: Destination MAC address (Address 1)
1942 * @src: Source MAC address (Address 2)
1943 * @bssid: BSSID (Address 3)
55777702
JM
1944 * @data: Frame body
1945 * @data_len: data length in octets
b106173a 1946 @ @no_cck: Whether CCK rates must not be used to transmit this frame
55777702
JM
1947 * Returns: 0 on success, -1 on failure
1948 *
1949 * This command can be used to request the driver to transmit an action
190b9062
JB
1950 * frame to the specified destination.
1951 *
1952 * If the %WPA_DRIVER_FLAGS_OFFCHANNEL_TX flag is set, the frame will
1953 * be transmitted on the given channel and the device will wait for a
1954 * response on that channel for the given wait time.
1955 *
1956 * If the flag is not set, the wait time will be ignored. In this case,
1957 * if a remain-on-channel duration is in progress, the frame must be
1958 * transmitted on that channel; alternatively the frame may be sent on
1959 * the current operational channel (if in associated state in station
1960 * mode or while operating as an AP.)
55777702 1961 */
190b9062 1962 int (*send_action)(void *priv, unsigned int freq, unsigned int wait,
e8828999 1963 const u8 *dst, const u8 *src, const u8 *bssid,
b106173a 1964 const u8 *data, size_t data_len, int no_cck);
55777702 1965
190b9062
JB
1966 /**
1967 * send_action_cancel_wait - Cancel action frame TX wait
1968 * @priv: Private driver interface data
1969 *
1970 * This command cancels the wait time associated with sending an action
1971 * frame. It is only available when %WPA_DRIVER_FLAGS_OFFCHANNEL_TX is
1972 * set in the driver flags.
1973 */
1974 void (*send_action_cancel_wait)(void *priv);
1975
55777702
JM
1976 /**
1977 * remain_on_channel - Remain awake on a channel
1978 * @priv: Private driver interface data
1979 * @freq: Frequency (in MHz) of the channel
1980 * @duration: Duration in milliseconds
1981 * Returns: 0 on success, -1 on failure
1982 *
1983 * This command is used to request the driver to remain awake on the
1984 * specified channel for the specified duration and report received
1985 * Action frames with EVENT_RX_ACTION events. Optionally, received
1986 * Probe Request frames may also be requested to be reported by calling
1987 * probe_req_report(). These will be reported with EVENT_RX_PROBE_REQ.
1988 *
1989 * The driver may not be at the requested channel when this function
1990 * returns, i.e., the return code is only indicating whether the
1991 * request was accepted. The caller will need to wait until the
1992 * EVENT_REMAIN_ON_CHANNEL event indicates that the driver has
1993 * completed the channel change. This may take some time due to other
1994 * need for the radio and the caller should be prepared to timing out
1995 * its wait since there are no guarantees on when this request can be
1996 * executed.
1997 */
1998 int (*remain_on_channel)(void *priv, unsigned int freq,
1999 unsigned int duration);
2000
2001 /**
2002 * cancel_remain_on_channel - Cancel remain-on-channel operation
2003 * @priv: Private driver interface data
2004 *
2005 * This command can be used to cancel a remain-on-channel operation
2006 * before its originally requested duration has passed. This could be
2007 * used, e.g., when remain_on_channel() is used to request extra time
2008 * to receive a response to an Action frame and the response is
2009 * received when there is still unneeded time remaining on the
2010 * remain-on-channel operation.
2011 */
2012 int (*cancel_remain_on_channel)(void *priv);
2013
504e905c
JM
2014 /**
2015 * probe_req_report - Request Probe Request frames to be indicated
2016 * @priv: Private driver interface data
2017 * @report: Whether to report received Probe Request frames
2018 * Returns: 0 on success, -1 on failure (or if not supported)
2019 *
2020 * This command can be used to request the driver to indicate when
2021 * Probe Request frames are received with EVENT_RX_PROBE_REQ events.
2022 * Since this operation may require extra resources, e.g., due to less
2023 * optimal hardware/firmware RX filtering, many drivers may disable
2024 * Probe Request reporting at least in station mode. This command is
2025 * used to notify the driver when the Probe Request frames need to be
2026 * reported, e.g., during remain-on-channel operations.
2027 */
2028 int (*probe_req_report)(void *priv, int report);
4e5cb1a3 2029
af473088
JM
2030 /**
2031 * deinit_ap - Deinitialize AP mode
2032 * @priv: Private driver interface data
2033 * Returns: 0 on success, -1 on failure (or if not supported)
2034 *
2035 * This optional function can be used to disable AP mode related
2036 * configuration and change the driver mode to station mode to allow
2037 * normal station operations like scanning to be completed.
2038 */
2039 int (*deinit_ap)(void *priv);
207ef3fb 2040
3c29244e
EP
2041 /**
2042 * deinit_p2p_cli - Deinitialize P2P client mode
2043 * @priv: Private driver interface data
2044 * Returns: 0 on success, -1 on failure (or if not supported)
2045 *
2046 * This optional function can be used to disable P2P client mode. It
2047 * can be used to change the interface type back to station mode.
2048 */
2049 int (*deinit_p2p_cli)(void *priv);
2050
207ef3fb
JM
2051 /**
2052 * suspend - Notification on system suspend/hibernate event
2053 * @priv: Private driver interface data
2054 */
2055 void (*suspend)(void *priv);
2056
2057 /**
2058 * resume - Notification on system resume/thaw event
2059 * @priv: Private driver interface data
2060 */
2061 void (*resume)(void *priv);
b625473c
JM
2062
2063 /**
2064 * signal_monitor - Set signal monitoring parameters
2065 * @priv: Private driver interface data
2066 * @threshold: Threshold value for signal change events; 0 = disabled
2067 * @hysteresis: Minimum change in signal strength before indicating a
2068 * new event
2069 * Returns: 0 on success, -1 on failure (or if not supported)
2070 *
2071 * This function can be used to configure monitoring of signal strength
2072 * with the current AP. Whenever signal strength drops below the
2073 * %threshold value or increases above it, EVENT_SIGNAL_CHANGE event
2074 * should be generated assuming the signal strength has changed at
2075 * least %hysteresis from the previously indicated signal change event.
2076 */
2077 int (*signal_monitor)(void *priv, int threshold, int hysteresis);
b91ab76e
JM
2078
2079 /**
2080 * send_frame - Send IEEE 802.11 frame (testing use only)
2081 * @priv: Private driver interface data
2082 * @data: IEEE 802.11 frame with IEEE 802.11 header
2083 * @data_len: Size of the frame
2084 * @encrypt: Whether to encrypt the frame (if keys are set)
2085 * Returns: 0 on success, -1 on failure
2086 *
2087 * This function is only used for debugging purposes and is not
2088 * required to be implemented for normal operations.
2089 */
2090 int (*send_frame)(void *priv, const u8 *data, size_t data_len,
2091 int encrypt);
75bde05d
JM
2092
2093 /**
2094 * shared_freq - Get operating frequency of shared interface(s)
2095 * @priv: Private driver interface data
2096 * Returns: Operating frequency in MHz, 0 if no shared operation in
2097 * use, or -1 on failure
2098 *
2099 * This command can be used to request the current operating frequency
2100 * of any virtual interface that shares the same radio to provide
2101 * information for channel selection for other virtual interfaces.
2102 */
2103 int (*shared_freq)(void *priv);
2104
2105 /**
2106 * get_noa - Get current Notice of Absence attribute payload
2107 * @priv: Private driver interface data
2108 * @buf: Buffer for returning NoA
2109 * @buf_len: Buffer length in octets
2110 * Returns: Number of octets used in buf, 0 to indicate no NoA is being
2111 * advertized, or -1 on failure
2112 *
2113 * This function is used to fetch the current Notice of Absence
2114 * attribute value from GO.
2115 */
2116 int (*get_noa)(void *priv, u8 *buf, size_t buf_len);
2117
2118 /**
2119 * set_noa - Set Notice of Absence parameters for GO (testing)
2120 * @priv: Private driver interface data
2121 * @count: Count
2122 * @start: Start time in ms from next TBTT
2123 * @duration: Duration in ms
2124 * Returns: 0 on success or -1 on failure
2125 *
2126 * This function is used to set Notice of Absence parameters for GO. It
2127 * is used only for testing. To disable NoA, all parameters are set to
2128 * 0.
2129 */
2130 int (*set_noa)(void *priv, u8 count, int start, int duration);
c381508d
JM
2131
2132 /**
2133 * set_p2p_powersave - Set P2P power save options
2134 * @priv: Private driver interface data
2135 * @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change
2136 * @opp_ps: 0 = disable, 1 = enable, -1 = no change
2137 * @ctwindow: 0.. = change (msec), -1 = no change
2138 * Returns: 0 on success or -1 on failure
2139 */
2140 int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
2141 int ctwindow);
b6c79a99
JM
2142
2143 /**
2144 * ampdu - Enable/disable aggregation
2145 * @priv: Private driver interface data
2146 * @ampdu: 1/0 = enable/disable A-MPDU aggregation
2147 * Returns: 0 on success or -1 on failure
2148 */
2149 int (*ampdu)(void *priv, int ampdu);
0f66abd2 2150
6859f1cb
BG
2151 /**
2152 * get_radio_name - Get physical radio name for the device
2153 * @priv: Private driver interface data
2154 * Returns: Radio name or %NULL if not known
2155 *
2156 * The returned data must not be modified by the caller. It is assumed
2157 * that any interface that has the same radio name as another is
2158 * sharing the same physical radio. This information can be used to
2159 * share scan results etc. information between the virtual interfaces
2160 * to speed up various operations.
2161 */
2162 const char * (*get_radio_name)(void *priv);
3ac17eba
JM
2163
2164 /**
2165 * p2p_find - Start P2P Device Discovery
2166 * @priv: Private driver interface data
2167 * @timeout: Timeout for find operation in seconds or 0 for no timeout
2168 * @type: Device Discovery type (enum p2p_discovery_type)
2169 * Returns: 0 on success, -1 on failure
2170 *
2171 * This function is only used if the driver implements P2P management,
2172 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2173 * struct wpa_driver_capa.
2174 */
2175 int (*p2p_find)(void *priv, unsigned int timeout, int type);
2176
2177 /**
2178 * p2p_stop_find - Stop P2P Device Discovery
2179 * @priv: Private driver interface data
2180 * Returns: 0 on success, -1 on failure
2181 *
2182 * This function is only used if the driver implements P2P management,
2183 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2184 * struct wpa_driver_capa.
2185 */
2186 int (*p2p_stop_find)(void *priv);
2187
2188 /**
2189 * p2p_listen - Start P2P Listen state for specified duration
2190 * @priv: Private driver interface data
2191 * @timeout: Listen state duration in milliseconds
2192 * Returns: 0 on success, -1 on failure
2193 *
2194 * This function can be used to request the P2P module to keep the
2195 * device discoverable on the listen channel for an extended set of
2196 * time. At least in its current form, this is mainly used for testing
2197 * purposes and may not be of much use for normal P2P operations.
2198 *
2199 * This function is only used if the driver implements P2P management,
2200 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2201 * struct wpa_driver_capa.
2202 */
2203 int (*p2p_listen)(void *priv, unsigned int timeout);
2204
2205 /**
2206 * p2p_connect - Start P2P group formation (GO negotiation)
2207 * @priv: Private driver interface data
2208 * @peer_addr: MAC address of the peer P2P client
2209 * @wps_method: enum p2p_wps_method value indicating config method
2210 * @go_intent: Local GO intent value (1..15)
2211 * @own_interface_addr: Intended interface address to use with the
2212 * group
2213 * @force_freq: The only allowed channel frequency in MHz or 0
2214 * @persistent_group: Whether to create persistent group
2215 * Returns: 0 on success, -1 on failure
2216 *
2217 * This function is only used if the driver implements P2P management,
2218 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2219 * struct wpa_driver_capa.
2220 */
2221 int (*p2p_connect)(void *priv, const u8 *peer_addr, int wps_method,
2222 int go_intent, const u8 *own_interface_addr,
2223 unsigned int force_freq, int persistent_group);
2224
2225 /**
2226 * wps_success_cb - Report successfully completed WPS provisioning
2227 * @priv: Private driver interface data
2228 * @peer_addr: Peer address
2229 * Returns: 0 on success, -1 on failure
2230 *
2231 * This function is used to report successfully completed WPS
2232 * provisioning during group formation in both GO/Registrar and
2233 * client/Enrollee roles.
2234 *
2235 * This function is only used if the driver implements P2P management,
2236 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2237 * struct wpa_driver_capa.
2238 */
2239 int (*wps_success_cb)(void *priv, const u8 *peer_addr);
2240
2241 /**
2242 * p2p_group_formation_failed - Report failed WPS provisioning
2243 * @priv: Private driver interface data
2244 * Returns: 0 on success, -1 on failure
2245 *
2246 * This function is used to report failed group formation. This can
2247 * happen either due to failed WPS provisioning or due to 15 second
2248 * timeout during the provisioning phase.
2249 *
2250 * This function is only used if the driver implements P2P management,
2251 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2252 * struct wpa_driver_capa.
2253 */
2254 int (*p2p_group_formation_failed)(void *priv);
2255
2256 /**
2257 * p2p_set_params - Set P2P parameters
2258 * @priv: Private driver interface data
2259 * @params: P2P parameters
2260 * Returns: 0 on success, -1 on failure
2261 *
2262 * This function is only used if the driver implements P2P management,
2263 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2264 * struct wpa_driver_capa.
2265 */
2266 int (*p2p_set_params)(void *priv, const struct p2p_params *params);
2267
2268 /**
2269 * p2p_prov_disc_req - Send Provision Discovery Request
2270 * @priv: Private driver interface data
2271 * @peer_addr: MAC address of the peer P2P client
2272 * @config_methods: WPS Config Methods value (only one bit set)
2273 * Returns: 0 on success, -1 on failure
2274 *
2275 * This function can be used to request a discovered P2P peer to
2276 * display a PIN (config_methods = WPS_CONFIG_DISPLAY) or be prepared
2277 * to enter a PIN from us (config_methods = WPS_CONFIG_KEYPAD). The
2278 * Provision Discovery Request frame is transmitted once immediately
2279 * and if no response is received, the frame will be sent again
2280 * whenever the target device is discovered during device dsicovery
2281 * (start with a p2p_find() call). Response from the peer is indicated
2282 * with the EVENT_P2P_PROV_DISC_RESPONSE event.
2283 *
2284 * This function is only used if the driver implements P2P management,
2285 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2286 * struct wpa_driver_capa.
2287 */
2288 int (*p2p_prov_disc_req)(void *priv, const u8 *peer_addr,
8c5f7309 2289 u16 config_methods, int join);
3ac17eba
JM
2290
2291 /**
2292 * p2p_sd_request - Schedule a service discovery query
2293 * @priv: Private driver interface data
2294 * @dst: Destination peer or %NULL to apply for all peers
2295 * @tlvs: P2P Service Query TLV(s)
2296 * Returns: Reference to the query or 0 on failure
2297 *
2298 * Response to the query is indicated with the
2299 * EVENT_P2P_SD_RESPONSE driver event.
2300 *
2301 * This function is only used if the driver implements P2P management,
2302 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2303 * struct wpa_driver_capa.
2304 */
2305 u64 (*p2p_sd_request)(void *priv, const u8 *dst,
2306 const struct wpabuf *tlvs);
2307
2308 /**
2309 * p2p_sd_cancel_request - Cancel a pending service discovery query
2310 * @priv: Private driver interface data
2311 * @req: Query reference from p2p_sd_request()
2312 * Returns: 0 on success, -1 on failure
2313 *
2314 * This function is only used if the driver implements P2P management,
2315 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2316 * struct wpa_driver_capa.
2317 */
2318 int (*p2p_sd_cancel_request)(void *priv, u64 req);
2319
2320 /**
2321 * p2p_sd_response - Send response to a service discovery query
2322 * @priv: Private driver interface data
2323 * @freq: Frequency from EVENT_P2P_SD_REQUEST event
2324 * @dst: Destination address from EVENT_P2P_SD_REQUEST event
2325 * @dialog_token: Dialog token from EVENT_P2P_SD_REQUEST event
2326 * @resp_tlvs: P2P Service Response TLV(s)
2327 * Returns: 0 on success, -1 on failure
2328 *
2329 * This function is called as a response to the request indicated with
2330 * the EVENT_P2P_SD_REQUEST driver event.
2331 *
2332 * This function is only used if the driver implements P2P management,
2333 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2334 * struct wpa_driver_capa.
2335 */
2336 int (*p2p_sd_response)(void *priv, int freq, const u8 *dst,
2337 u8 dialog_token,
2338 const struct wpabuf *resp_tlvs);
2339
2340 /**
2341 * p2p_service_update - Indicate a change in local services
2342 * @priv: Private driver interface data
2343 * Returns: 0 on success, -1 on failure
2344 *
2345 * This function needs to be called whenever there is a change in
2346 * availability of the local services. This will increment the
2347 * Service Update Indicator value which will be used in SD Request and
2348 * Response frames.
2349 *
2350 * This function is only used if the driver implements P2P management,
2351 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2352 * struct wpa_driver_capa.
2353 */
2354 int (*p2p_service_update)(void *priv);
2355
2356 /**
2357 * p2p_reject - Reject peer device (explicitly block connections)
2358 * @priv: Private driver interface data
2359 * @addr: MAC address of the peer
2360 * Returns: 0 on success, -1 on failure
2361 */
2362 int (*p2p_reject)(void *priv, const u8 *addr);
2363
2364 /**
2365 * p2p_invite - Invite a P2P Device into a group
2366 * @priv: Private driver interface data
2367 * @peer: Device Address of the peer P2P Device
2368 * @role: Local role in the group
2369 * @bssid: Group BSSID or %NULL if not known
2370 * @ssid: Group SSID
2371 * @ssid_len: Length of ssid in octets
2372 * @go_dev_addr: Forced GO Device Address or %NULL if none
2373 * @persistent_group: Whether this is to reinvoke a persistent group
2374 * Returns: 0 on success, -1 on failure
2375 */
2376 int (*p2p_invite)(void *priv, const u8 *peer, int role,
2377 const u8 *bssid, const u8 *ssid, size_t ssid_len,
2378 const u8 *go_dev_addr, int persistent_group);
281ff0aa
GP
2379
2380 /**
2381 * send_tdls_mgmt - for sending TDLS management packets
2382 * @priv: private driver interface data
2383 * @dst: Destination (peer) MAC address
2384 * @action_code: TDLS action code for the mssage
2385 * @dialog_token: Dialog Token to use in the message (if needed)
2386 * @status_code: Status Code or Reason Code to use (if needed)
2387 * @buf: TDLS IEs to add to the message
2388 * @len: Length of buf in octets
45b722f1 2389 * Returns: 0 on success, negative (<0) on failure
281ff0aa
GP
2390 *
2391 * This optional function can be used to send packet to driver which is
2392 * responsible for receiving and sending all TDLS packets.
2393 */
2394 int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
2395 u8 dialog_token, u16 status_code,
2396 const u8 *buf, size_t len);
2397
45b722f1
AN
2398 /**
2399 * tdls_oper - Ask the driver to perform high-level TDLS operations
2400 * @priv: Private driver interface data
2401 * @oper: TDLS high-level operation. See %enum tdls_oper
2402 * @peer: Destination (peer) MAC address
2403 * Returns: 0 on success, negative (<0) on failure
2404 *
2405 * This optional function can be used to send high-level TDLS commands
2406 * to the driver.
2407 */
281ff0aa 2408 int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
1c5c7273
PS
2409
2410 /**
2411 * signal_poll - Get current connection information
2412 * @priv: Private driver interface data
2413 * @signal_info: Connection info structure
2414 */
2415 int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
41fd1d9e
KZ
2416
2417 /**
2418 * set_authmode - Set authentication algorithm(s) for static WEP
2419 * @priv: Private driver interface data
2420 * @authmode: 1=Open System, 2=Shared Key, 3=both
2421 * Returns: 0 on success, -1 on failure
2422 *
2423 * This function can be used to set authentication algorithms for AP
2424 * mode when static WEP is used. If the driver uses user space MLME/SME
2425 * implementation, there is no need to implement this function.
062390ef
JM
2426 *
2427 * DEPRECATED - use set_ap() instead
41fd1d9e
KZ
2428 */
2429 int (*set_authmode)(void *priv, int authmode);
b14a210c
JB
2430
2431 /**
2432 * set_rekey_info - Set rekey information
2433 * @priv: Private driver interface data
2434 * @kek: Current KEK
2435 * @kck: Current KCK
2436 * @replay_ctr: Current EAPOL-Key Replay Counter
2437 *
2438 * This optional function can be used to provide information for the
2439 * driver/firmware to process EAPOL-Key frames in Group Key Handshake
2440 * while the host (including wpa_supplicant) is sleeping.
2441 */
2442 void (*set_rekey_info)(void *priv, const u8 *kek, const u8 *kck,
2443 const u8 *replay_ctr);
a52eba0f
SP
2444
2445 /**
2446 * sta_assoc - Station association indication
2447 * @priv: Private driver interface data
2448 * @own_addr: Source address and BSSID for association frame
2449 * @addr: MAC address of the station to associate
2450 * @reassoc: flag to indicate re-association
2451 * @status: association response status code
2452 * @ie: assoc response ie buffer
2453 * @len: ie buffer length
2454 * Returns: 0 on success, -1 on failure
2455 *
2456 * This function indicates the driver to send (Re)Association
2457 * Response frame to the station.
2458 */
2459 int (*sta_assoc)(void *priv, const u8 *own_addr, const u8 *addr,
2460 int reassoc, u16 status, const u8 *ie, size_t len);
2461
2462 /**
2463 * sta_auth - Station authentication indication
2464 * @priv: Private driver interface data
2465 * @own_addr: Source address and BSSID for authentication frame
2466 * @addr: MAC address of the station to associate
2467 * @seq: authentication sequence number
2468 * @status: authentication response status code
2469 * @ie: authentication frame ie buffer
2470 * @len: ie buffer length
2471 *
2472 * This function indicates the driver to send Authentication frame
2473 * to the station.
2474 */
2475 int (*sta_auth)(void *priv, const u8 *own_addr, const u8 *addr,
2476 u16 seq, u16 status, const u8 *ie, size_t len);
2477
2478 /**
2479 * add_tspec - Add traffic stream
2480 * @priv: Private driver interface data
2481 * @addr: MAC address of the station to associate
2482 * @tspec_ie: tspec ie buffer
2483 * @tspec_ielen: tspec ie length
2484 * Returns: 0 on success, -1 on failure
2485 *
2486 * This function adds the traffic steam for the station
2487 * and fills the medium_time in tspec_ie.
2488 */
2489 int (*add_tspec)(void *priv, const u8 *addr, u8 *tspec_ie,
2490 size_t tspec_ielen);
2491
2492 /**
2493 * add_sta_node - Add a station node in the driver
2494 * @priv: Private driver interface data
2495 * @addr: MAC address of the station to add
2496 * @auth_alg: authentication algorithm used by the station
2497 * Returns: 0 on success, -1 on failure
2498 *
2499 * This function adds the station node in the driver, when
2500 * the station gets added by FT-over-DS.
2501 */
2502 int (*add_sta_node)(void *priv, const u8 *addr, u16 auth_alg);
cbdf3507
LC
2503
2504 /**
2505 * sched_scan - Request the driver to initiate scheduled scan
2506 * @priv: Private driver interface data
2507 * @params: Scan parameters
2508 * @interval: Interval between scan cycles in milliseconds
2509 * Returns: 0 on success, -1 on failure
2510 *
2511 * This operation should be used for scheduled scan offload to
2512 * the hardware. Every time scan results are available, the
2513 * driver should report scan results event for wpa_supplicant
2514 * which will eventually request the results with
2515 * wpa_driver_get_scan_results2(). This operation is optional
2516 * and if not provided or if it returns -1, we fall back to
2517 * normal host-scheduled scans.
2518 */
2519 int (*sched_scan)(void *priv, struct wpa_driver_scan_params *params,
2520 u32 interval);
2521
2522 /**
2523 * stop_sched_scan - Request the driver to stop a scheduled scan
2524 * @priv: Private driver interface data
2525 * Returns: 0 on success, -1 on failure
2526 *
2527 * This should cause the scheduled scan to be stopped and
2528 * results should stop being sent. Must be supported if
2529 * sched_scan is supported.
2530 */
2531 int (*stop_sched_scan)(void *priv);
bcf24348
JB
2532
2533 /**
2534 * poll_client - Probe (null data or such) the given station
2535 * @priv: Private driver interface data
2536 * @own_addr: MAC address of sending interface
2537 * @addr: MAC address of the station to probe
2538 * @qos: Indicates whether station is QoS station
2539 *
2540 * This function is used to verify whether an associated station is
2541 * still present. This function does not need to be implemented if the
2542 * driver provides such inactivity polling mechanism.
2543 */
2544 void (*poll_client)(void *priv, const u8 *own_addr,
2545 const u8 *addr, int qos);
8b9d0bfa
JM
2546
2547 /**
2548 * radio_disable - Disable/enable radio
2549 * @priv: Private driver interface data
2550 * @disabled: 1=disable 0=enable radio
2551 * Returns: 0 on success, -1 on failure
2552 *
2553 * This optional command is for testing purposes. It can be used to
2554 * disable the radio on a testbed device to simulate out-of-radio-range
2555 * conditions.
2556 */
2557 int (*radio_disable)(void *priv, int disabled);
ef35f5a0
JJ
2558
2559 /**
2560 * switch_channel - Announce channel switch and migrate the GO to the
2561 * given frequency
2562 * @priv: Private driver interface data
2563 * @freq: Frequency in MHz
2564 * Returns: 0 on success, -1 on failure
2565 *
2566 * This function is used to move the GO to the legacy STA channel to
2567 * avoid frequency conflict in single channel concurrency.
2568 */
2569 int (*switch_channel)(void *priv, unsigned int freq);
6fc6879b
JM
2570};
2571
e0498677 2572
6fc6879b
JM
2573/**
2574 * enum wpa_event_type - Event type for wpa_supplicant_event() calls
2575 */
9646a8ab 2576enum wpa_event_type {
6fc6879b
JM
2577 /**
2578 * EVENT_ASSOC - Association completed
2579 *
2580 * This event needs to be delivered when the driver completes IEEE
2581 * 802.11 association or reassociation successfully.
2582 * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
2583 * after this event has been generated. In addition, optional
2584 * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
2585 * more information about the association. If the driver interface gets
2586 * both of these events at the same time, it can also include the
2587 * assoc_info data in EVENT_ASSOC call.
2588 */
2589 EVENT_ASSOC,
2590
2591 /**
2592 * EVENT_DISASSOC - Association lost
2593 *
2594 * This event should be called when association is lost either due to
2595 * receiving deauthenticate or disassociate frame from the AP or when
c2a04078
JM
2596 * sending either of these frames to the current AP. If the driver
2597 * supports separate deauthentication event, EVENT_DISASSOC should only
2598 * be used for disassociation and EVENT_DEAUTH for deauthentication.
1d041bec 2599 * In AP mode, union wpa_event_data::disassoc_info is required.
6fc6879b
JM
2600 */
2601 EVENT_DISASSOC,
2602
2603 /**
2604 * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
2605 *
2606 * This event must be delivered when a Michael MIC error is detected by
2607 * the local driver. Additional data for event processing is
2608 * provided with union wpa_event_data::michael_mic_failure. This
2609 * information is used to request new encyption key and to initiate
2610 * TKIP countermeasures if needed.
2611 */
2612 EVENT_MICHAEL_MIC_FAILURE,
2613
2614 /**
2615 * EVENT_SCAN_RESULTS - Scan results available
2616 *
2617 * This event must be called whenever scan results are available to be
2618 * fetched with struct wpa_driver_ops::get_scan_results(). This event
2619 * is expected to be used some time after struct wpa_driver_ops::scan()
2620 * is called. If the driver provides an unsolicited event when the scan
2621 * has been completed, this event can be used to trigger
2622 * EVENT_SCAN_RESULTS call. If such event is not available from the
2623 * driver, the driver wrapper code is expected to use a registered
2624 * timeout to generate EVENT_SCAN_RESULTS call after the time that the
8d923a4a
JM
2625 * scan is expected to be completed. Optional information about
2626 * completed scan can be provided with union wpa_event_data::scan_info.
6fc6879b
JM
2627 */
2628 EVENT_SCAN_RESULTS,
2629
2630 /**
2631 * EVENT_ASSOCINFO - Report optional extra information for association
2632 *
2633 * This event can be used to report extra association information for
2634 * EVENT_ASSOC processing. This extra information includes IEs from
2635 * association frames and Beacon/Probe Response frames in union
2636 * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
2637 * EVENT_ASSOC. Alternatively, the driver interface can include
2638 * assoc_info data in the EVENT_ASSOC call if it has all the
2639 * information available at the same point.
2640 */
2641 EVENT_ASSOCINFO,
2642
2643 /**
2644 * EVENT_INTERFACE_STATUS - Report interface status changes
2645 *
2646 * This optional event can be used to report changes in interface
2647 * status (interface added/removed) using union
2648 * wpa_event_data::interface_status. This can be used to trigger
2649 * wpa_supplicant to stop and re-start processing for the interface,
2650 * e.g., when a cardbus card is ejected/inserted.
2651 */
2652 EVENT_INTERFACE_STATUS,
2653
2654 /**
2655 * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
2656 *
2657 * This event can be used to inform wpa_supplicant about candidates for
2658 * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
2659 * for scan request (ap_scan=2 mode), this event is required for
2660 * pre-authentication. If wpa_supplicant is performing scan request
2661 * (ap_scan=1), this event is optional since scan results can be used
2662 * to add pre-authentication candidates. union
2663 * wpa_event_data::pmkid_candidate is used to report the BSSID of the
2664 * candidate and priority of the candidate, e.g., based on the signal
2665 * strength, in order to try to pre-authenticate first with candidates
2666 * that are most likely targets for re-association.
2667 *
2668 * EVENT_PMKID_CANDIDATE can be called whenever the driver has updates
2669 * on the candidate list. In addition, it can be called for the current
2670 * AP and APs that have existing PMKSA cache entries. wpa_supplicant
2671 * will automatically skip pre-authentication in cases where a valid
2672 * PMKSA exists. When more than one candidate exists, this event should
2673 * be generated once for each candidate.
2674 *
2675 * Driver will be notified about successful pre-authentication with
2676 * struct wpa_driver_ops::add_pmkid() calls.
2677 */
2678 EVENT_PMKID_CANDIDATE,
2679
2680 /**
2681 * EVENT_STKSTART - Request STK handshake (MLME-STKSTART.request)
2682 *
2683 * This event can be used to inform wpa_supplicant about desire to set
2684 * up secure direct link connection between two stations as defined in
2685 * IEEE 802.11e with a new PeerKey mechanism that replaced the original
2686 * STAKey negotiation. The caller will need to set peer address for the
2687 * event.
2688 */
2689 EVENT_STKSTART,
2690
281ff0aa
GP
2691 /**
2692 * EVENT_TDLS - Request TDLS operation
2693 *
2694 * This event can be used to request a TDLS operation to be performed.
2695 */
2696 EVENT_TDLS,
2697
6fc6879b
JM
2698 /**
2699 * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
2700 *
2701 * The driver is expected to report the received FT IEs from
2702 * FT authentication sequence from the AP. The FT IEs are included in
2703 * the extra information in union wpa_event_data::ft_ies.
2704 */
11ef8d35
JM
2705 EVENT_FT_RESPONSE,
2706
2707 /**
2708 * EVENT_IBSS_RSN_START - Request RSN authentication in IBSS
2709 *
2710 * The driver can use this event to inform wpa_supplicant about a STA
2711 * in an IBSS with which protected frames could be exchanged. This
2712 * event starts RSN authentication with the other STA to authenticate
2713 * the STA and set up encryption keys with it.
2714 */
c2a04078
JM
2715 EVENT_IBSS_RSN_START,
2716
2717 /**
2718 * EVENT_AUTH - Authentication result
2719 *
2720 * This event should be called when authentication attempt has been
2721 * completed. This is only used if the driver supports separate
2722 * authentication step (struct wpa_driver_ops::authenticate).
2723 * Information about authentication result is included in
2724 * union wpa_event_data::auth.
2725 */
2726 EVENT_AUTH,
2727
2728 /**
2729 * EVENT_DEAUTH - Authentication lost
2730 *
2731 * This event should be called when authentication is lost either due
2732 * to receiving deauthenticate frame from the AP or when sending that
2733 * frame to the current AP.
1d041bec 2734 * In AP mode, union wpa_event_data::deauth_info is required.
c2a04078 2735 */
efa46078
JM
2736 EVENT_DEAUTH,
2737
2738 /**
2739 * EVENT_ASSOC_REJECT - Association rejected
2740 *
2741 * This event should be called when (re)association attempt has been
59ddf221 2742 * rejected by the AP. Information about the association response is
efa46078
JM
2743 * included in union wpa_event_data::assoc_reject.
2744 */
da1fb17c
JM
2745 EVENT_ASSOC_REJECT,
2746
2747 /**
2748 * EVENT_AUTH_TIMED_OUT - Authentication timed out
2749 */
2750 EVENT_AUTH_TIMED_OUT,
2751
2752 /**
2753 * EVENT_ASSOC_TIMED_OUT - Association timed out
2754 */
08fd8c15
JM
2755 EVENT_ASSOC_TIMED_OUT,
2756
2757 /**
2758 * EVENT_FT_RRB_RX - FT (IEEE 802.11r) RRB frame received
2759 */
fcf0f87d
JM
2760 EVENT_FT_RRB_RX,
2761
2762 /**
2763 * EVENT_WPS_BUTTON_PUSHED - Report hardware push button press for WPS
2764 */
f8b1f695
JM
2765 EVENT_WPS_BUTTON_PUSHED,
2766
2767 /**
2768 * EVENT_TX_STATUS - Report TX status
2769 */
2770 EVENT_TX_STATUS,
2771
2772 /**
2773 * EVENT_RX_FROM_UNKNOWN - Report RX from unknown STA
2774 */
2775 EVENT_RX_FROM_UNKNOWN,
2776
2777 /**
2778 * EVENT_RX_MGMT - Report RX of a management frame
2779 */
245519e0
JM
2780 EVENT_RX_MGMT,
2781
55777702
JM
2782 /**
2783 * EVENT_RX_ACTION - Action frame received
2784 *
2785 * This event is used to indicate when an Action frame has been
2786 * received. Information about the received frame is included in
2787 * union wpa_event_data::rx_action.
2788 */
2789 EVENT_RX_ACTION,
2790
2791 /**
2792 * EVENT_REMAIN_ON_CHANNEL - Remain-on-channel duration started
2793 *
2794 * This event is used to indicate when the driver has started the
2795 * requested remain-on-channel duration. Information about the
2796 * operation is included in union wpa_event_data::remain_on_channel.
2797 */
2798 EVENT_REMAIN_ON_CHANNEL,
2799
2800 /**
2801 * EVENT_CANCEL_REMAIN_ON_CHANNEL - Remain-on-channel timed out
2802 *
2803 * This event is used to indicate when the driver has completed
2804 * remain-on-channel duration, i.e., may noot be available on the
2805 * requested channel anymore. Information about the
2806 * operation is included in union wpa_event_data::remain_on_channel.
2807 */
2808 EVENT_CANCEL_REMAIN_ON_CHANNEL,
2809
245519e0
JM
2810 /**
2811 * EVENT_MLME_RX - Report reception of frame for MLME (test use only)
2812 *
2813 * This event is used only by driver_test.c and userspace MLME.
2814 */
a0e0d3bb
JM
2815 EVENT_MLME_RX,
2816
2817 /**
2818 * EVENT_RX_PROBE_REQ - Indicate received Probe Request frame
2819 *
2820 * This event is used to indicate when a Probe Request frame has been
2821 * received. Information about the received frame is included in
504e905c
JM
2822 * union wpa_event_data::rx_probe_req. The driver is required to report
2823 * these events only after successfully completed probe_req_report()
2824 * commands to request the events (i.e., report parameter is non-zero)
2825 * in station mode. In AP mode, Probe Request frames should always be
2826 * reported.
a0e0d3bb 2827 */
a70a5d6d
JM
2828 EVENT_RX_PROBE_REQ,
2829
2830 /**
2831 * EVENT_NEW_STA - New wired device noticed
2832 *
2833 * This event is used to indicate that a new device has been detected
2834 * in a network that does not use association-like functionality (i.e.,
2835 * mainly wired Ethernet). This can be used to start EAPOL
2836 * authenticator when receiving a frame from a device. The address of
2837 * the device is included in union wpa_event_data::new_sta.
2838 */
a8e0505b
JM
2839 EVENT_NEW_STA,
2840
2841 /**
2842 * EVENT_EAPOL_RX - Report received EAPOL frame
2843 *
2844 * When in AP mode with hostapd, this event is required to be used to
2845 * deliver the receive EAPOL frames from the driver. With
2846 * %wpa_supplicant, this event is used only if the send_eapol() handler
2847 * is used to override the use of l2_packet for EAPOL frame TX.
2848 */
b625473c
JM
2849 EVENT_EAPOL_RX,
2850
2851 /**
2852 * EVENT_SIGNAL_CHANGE - Indicate change in signal strength
2853 *
2854 * This event is used to indicate changes in the signal strength
2855 * observed in frames received from the current AP if signal strength
2856 * monitoring has been enabled with signal_monitor().
2857 */
8401a6b0
JM
2858 EVENT_SIGNAL_CHANGE,
2859
2860 /**
2861 * EVENT_INTERFACE_ENABLED - Notify that interface was enabled
2862 *
2863 * This event is used to indicate that the interface was enabled after
2864 * having been previously disabled, e.g., due to rfkill.
2865 */
2866 EVENT_INTERFACE_ENABLED,
2867
2868 /**
2869 * EVENT_INTERFACE_DISABLED - Notify that interface was disabled
2870 *
2871 * This event is used to indicate that the interface was disabled,
2872 * e.g., due to rfkill.
2873 */
b5c9da8d
JM
2874 EVENT_INTERFACE_DISABLED,
2875
2876 /**
2877 * EVENT_CHANNEL_LIST_CHANGED - Channel list changed
2878 *
2879 * This event is used to indicate that the channel list has changed,
2880 * e.g., because of a regulatory domain change triggered by scan
2881 * results including an AP advertising a country code.
2882 */
c973f386
JM
2883 EVENT_CHANNEL_LIST_CHANGED,
2884
2885 /**
2886 * EVENT_INTERFACE_UNAVAILABLE - Notify that interface is unavailable
2887 *
2888 * This event is used to indicate that the driver cannot maintain this
2889 * interface in its operation mode anymore. The most likely use for
2890 * this is to indicate that AP mode operation is not available due to
2891 * operating channel would need to be changed to a DFS channel when
2892 * the driver does not support radar detection and another virtual
2893 * interfaces caused the operating channel to change. Other similar
2894 * resource conflicts could also trigger this for station mode
2895 * interfaces.
2896 */
7cfc4ac3
AGS
2897 EVENT_INTERFACE_UNAVAILABLE,
2898
2899 /**
2900 * EVENT_BEST_CHANNEL
2901 *
2902 * Driver generates this event whenever it detects a better channel
2903 * (e.g., based on RSSI or channel use). This information can be used
2904 * to improve channel selection for a new AP/P2P group.
2905 */
7d878ca7
JM
2906 EVENT_BEST_CHANNEL,
2907
2908 /**
2909 * EVENT_UNPROT_DEAUTH - Unprotected Deauthentication frame received
2910 *
2911 * This event should be called when a Deauthentication frame is dropped
2912 * due to it not being protected (MFP/IEEE 802.11w).
2913 * union wpa_event_data::unprot_deauth is required to provide more
2914 * details of the frame.
2915 */
2916 EVENT_UNPROT_DEAUTH,
2917
2918 /**
2919 * EVENT_UNPROT_DISASSOC - Unprotected Disassociation frame received
2920 *
2921 * This event should be called when a Disassociation frame is dropped
2922 * due to it not being protected (MFP/IEEE 802.11w).
2923 * union wpa_event_data::unprot_disassoc is required to provide more
2924 * details of the frame.
2925 */
2926 EVENT_UNPROT_DISASSOC,
0d7e5a3a
JB
2927
2928 /**
2929 * EVENT_STATION_LOW_ACK
2930 *
2931 * Driver generates this event whenever it detected that a particular
2932 * station was lost. Detection can be through massive transmission
2933 * failures for example.
2934 */
3ac17eba
JM
2935 EVENT_STATION_LOW_ACK,
2936
2937 /**
2938 * EVENT_P2P_DEV_FOUND - Report a discovered P2P device
2939 *
2940 * This event is used only if the driver implements P2P management
2941 * internally. Event data is stored in
2942 * union wpa_event_data::p2p_dev_found.
2943 */
2944 EVENT_P2P_DEV_FOUND,
2945
2946 /**
2947 * EVENT_P2P_GO_NEG_REQ_RX - Report reception of GO Negotiation Request
2948 *
2949 * This event is used only if the driver implements P2P management
2950 * internally. Event data is stored in
2951 * union wpa_event_data::p2p_go_neg_req_rx.
2952 */
2953 EVENT_P2P_GO_NEG_REQ_RX,
2954
2955 /**
2956 * EVENT_P2P_GO_NEG_COMPLETED - Report completion of GO Negotiation
2957 *
2958 * This event is used only if the driver implements P2P management
2959 * internally. Event data is stored in
2960 * union wpa_event_data::p2p_go_neg_completed.
2961 */
2962 EVENT_P2P_GO_NEG_COMPLETED,
2963
2964 EVENT_P2P_PROV_DISC_REQUEST,
2965 EVENT_P2P_PROV_DISC_RESPONSE,
2966 EVENT_P2P_SD_REQUEST,
ea244d21
XC
2967 EVENT_P2P_SD_RESPONSE,
2968
2969 /**
2970 * EVENT_IBSS_PEER_LOST - IBSS peer not reachable anymore
2971 */
b14a210c
JB
2972 EVENT_IBSS_PEER_LOST,
2973
2974 /**
2975 * EVENT_DRIVER_GTK_REKEY - Device/driver did GTK rekey
2976 *
2977 * This event carries the new replay counter to notify wpa_supplicant
2978 * of the current EAPOL-Key Replay Counter in case the driver/firmware
2979 * completed Group Key Handshake while the host (including
2980 * wpa_supplicant was sleeping).
2981 */
cbdf3507
LC
2982 EVENT_DRIVER_GTK_REKEY,
2983
2984 /**
2985 * EVENT_SCHED_SCAN_STOPPED - Scheduled scan was stopped
2986 */
bcf24348
JB
2987 EVENT_SCHED_SCAN_STOPPED,
2988
2989 /**
2990 * EVENT_DRIVER_CLIENT_POLL_OK - Station responded to poll
2991 *
2992 * This event indicates that the station responded to the poll
2993 * initiated with @poll_client.
2994 */
dd840f79
JB
2995 EVENT_DRIVER_CLIENT_POLL_OK,
2996
2997 /**
2998 * EVENT_EAPOL_TX_STATUS - notify of EAPOL TX status
2999 */
1b487b8b
TP
3000 EVENT_EAPOL_TX_STATUS,
3001
3002 /**
3003 * EVENT_CH_SWITCH - AP or GO decided to switch channels
3004 *
3005 * Described in wpa_event_data.ch_switch
3006 * */
3007 EVENT_CH_SWITCH
9646a8ab 3008};
6fc6879b
JM
3009
3010
3011/**
3012 * union wpa_event_data - Additional data for wpa_supplicant_event() calls
3013 */
3014union wpa_event_data {
3015 /**
3016 * struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events
3017 *
3018 * This structure is optional for EVENT_ASSOC calls and required for
3019 * EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the
3020 * driver interface does not need to generate separate EVENT_ASSOCINFO
3021 * calls.
3022 */
3023 struct assoc_info {
39b08b5f
SP
3024 /**
3025 * reassoc - Flag to indicate association or reassociation
3026 */
3027 int reassoc;
3028
6fc6879b
JM
3029 /**
3030 * req_ies - (Re)Association Request IEs
3031 *
3032 * If the driver generates WPA/RSN IE, this event data must be
3033 * returned for WPA handshake to have needed information. If
3034 * wpa_supplicant-generated WPA/RSN IE is used, this
3035 * information event is optional.
3036 *
3037 * This should start with the first IE (fixed fields before IEs
3038 * are not included).
3039 */
1d041bec 3040 const u8 *req_ies;
6fc6879b
JM
3041
3042 /**
3043 * req_ies_len - Length of req_ies in bytes
3044 */
3045 size_t req_ies_len;
3046
3047 /**
3048 * resp_ies - (Re)Association Response IEs
3049 *
3050 * Optional association data from the driver. This data is not
3051 * required WPA, but may be useful for some protocols and as
3052 * such, should be reported if this is available to the driver
3053 * interface.
3054 *
3055 * This should start with the first IE (fixed fields before IEs
3056 * are not included).
3057 */
1d041bec 3058 const u8 *resp_ies;
6fc6879b
JM
3059
3060 /**
3061 * resp_ies_len - Length of resp_ies in bytes
3062 */
3063 size_t resp_ies_len;
3064
3065 /**
3066 * beacon_ies - Beacon or Probe Response IEs
3067 *
3068 * Optional Beacon/ProbeResp data: IEs included in Beacon or
3069 * Probe Response frames from the current AP (i.e., the one
3070 * that the client just associated with). This information is
3071 * used to update WPA/RSN IE for the AP. If this field is not
3072 * set, the results from previous scan will be used. If no
3073 * data for the new AP is found, scan results will be requested
3074 * again (without scan request). At this point, the driver is
3075 * expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is
3076 * used).
3077 *
3078 * This should start with the first IE (fixed fields before IEs
3079 * are not included).
3080 */
1d041bec 3081 const u8 *beacon_ies;
6fc6879b
JM
3082
3083 /**
3084 * beacon_ies_len - Length of beacon_ies */
3085 size_t beacon_ies_len;
4832ecd7
JM
3086
3087 /**
3088 * freq - Frequency of the operational channel in MHz
3089 */
3090 unsigned int freq;
1d041bec
JM
3091
3092 /**
3093 * addr - Station address (for AP mode)
3094 */
3095 const u8 *addr;
6fc6879b
JM
3096 } assoc_info;
3097
1d041bec
JM
3098 /**
3099 * struct disassoc_info - Data for EVENT_DISASSOC events
3100 */
3101 struct disassoc_info {
3102 /**
3103 * addr - Station address (for AP mode)
3104 */
3105 const u8 *addr;
0544b242
JM
3106
3107 /**
3108 * reason_code - Reason Code (host byte order) used in
3109 * Deauthentication frame
3110 */
3111 u16 reason_code;
75bde05d
JM
3112
3113 /**
3114 * ie - Optional IE(s) in Disassociation frame
3115 */
3116 const u8 *ie;
3117
3118 /**
3119 * ie_len - Length of ie buffer in octets
3120 */
3121 size_t ie_len;
3d9975d5
JM
3122
3123 /**
3124 * locally_generated - Whether the frame was locally generated
3125 */
3126 int locally_generated;
1d041bec
JM
3127 } disassoc_info;
3128
3129 /**
3130 * struct deauth_info - Data for EVENT_DEAUTH events
3131 */
3132 struct deauth_info {
3133 /**
3134 * addr - Station address (for AP mode)
3135 */
3136 const u8 *addr;
0544b242
JM
3137
3138 /**
3139 * reason_code - Reason Code (host byte order) used in
3140 * Deauthentication frame
3141 */
3142 u16 reason_code;
75bde05d
JM
3143
3144 /**
3145 * ie - Optional IE(s) in Deauthentication frame
3146 */
3147 const u8 *ie;
3148
3149 /**
3150 * ie_len - Length of ie buffer in octets
3151 */
3152 size_t ie_len;
3d9975d5
JM
3153
3154 /**
3155 * locally_generated - Whether the frame was locally generated
3156 */
3157 int locally_generated;
1d041bec
JM
3158 } deauth_info;
3159
6fc6879b
JM
3160 /**
3161 * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
3162 */
3163 struct michael_mic_failure {
3164 int unicast;
ad1e68e6 3165 const u8 *src;
6fc6879b
JM
3166 } michael_mic_failure;
3167
3168 /**
3169 * struct interface_status - Data for EVENT_INTERFACE_STATUS
3170 */
3171 struct interface_status {
3172 char ifname[100];
3173 enum {
3174 EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED
3175 } ievent;
3176 } interface_status;
3177
3178 /**
3179 * struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE
3180 */
3181 struct pmkid_candidate {
3182 /** BSSID of the PMKID candidate */
3183 u8 bssid[ETH_ALEN];
3184 /** Smaller the index, higher the priority */
3185 int index;
3186 /** Whether RSN IE includes pre-authenticate flag */
3187 int preauth;
3188 } pmkid_candidate;
3189
3190 /**
3191 * struct stkstart - Data for EVENT_STKSTART
3192 */
3193 struct stkstart {
3194 u8 peer[ETH_ALEN];
3195 } stkstart;
3196
281ff0aa
GP
3197 /**
3198 * struct tdls - Data for EVENT_TDLS
3199 */
3200 struct tdls {
3201 u8 peer[ETH_ALEN];
3202 enum {
3203 TDLS_REQUEST_SETUP,
3204 TDLS_REQUEST_TEARDOWN
3205 } oper;
3206 u16 reason_code; /* for teardown */
3207 } tdls;
3208
6fc6879b
JM
3209 /**
3210 * struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
3211 *
3212 * During FT (IEEE 802.11r) authentication sequence, the driver is
3213 * expected to use this event to report received FT IEs (MDIE, FTIE,
3214 * RSN IE, TIE, possible resource request) to the supplicant. The FT
3215 * IEs for the next message will be delivered through the
3216 * struct wpa_driver_ops::update_ft_ies() callback.
3217 */
3218 struct ft_ies {
3219 const u8 *ies;
3220 size_t ies_len;
3221 int ft_action;
3222 u8 target_ap[ETH_ALEN];
babfbf15
JM
3223 /** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
3224 const u8 *ric_ies;
3225 /** Length of ric_ies buffer in octets */
3226 size_t ric_ies_len;
6fc6879b 3227 } ft_ies;
11ef8d35
JM
3228
3229 /**
3230 * struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START
3231 */
3232 struct ibss_rsn_start {
3233 u8 peer[ETH_ALEN];
3234 } ibss_rsn_start;
c2a04078
JM
3235
3236 /**
3237 * struct auth_info - Data for EVENT_AUTH events
3238 */
3239 struct auth_info {
3240 u8 peer[ETH_ALEN];
a52eba0f 3241 u8 bssid[ETH_ALEN];
c2a04078 3242 u16 auth_type;
a52eba0f 3243 u16 auth_transaction;
c2a04078
JM
3244 u16 status_code;
3245 const u8 *ies;
3246 size_t ies_len;
3247 } auth;
efa46078
JM
3248
3249 /**
3250 * struct assoc_reject - Data for EVENT_ASSOC_REJECT events
3251 */
3252 struct assoc_reject {
59ddf221
JM
3253 /**
3254 * bssid - BSSID of the AP that rejected association
3255 */
3256 const u8 *bssid;
3257
efa46078
JM
3258 /**
3259 * resp_ies - (Re)Association Response IEs
3260 *
3261 * Optional association data from the driver. This data is not
3262 * required WPA, but may be useful for some protocols and as
3263 * such, should be reported if this is available to the driver
3264 * interface.
3265 *
3266 * This should start with the first IE (fixed fields before IEs
3267 * are not included).
3268 */
59ddf221 3269 const u8 *resp_ies;
efa46078
JM
3270
3271 /**
3272 * resp_ies_len - Length of resp_ies in bytes
3273 */
3274 size_t resp_ies_len;
3275
3276 /**
3277 * status_code - Status Code from (Re)association Response
3278 */
3279 u16 status_code;
3280 } assoc_reject;
da1fb17c
JM
3281
3282 struct timeout_event {
3283 u8 addr[ETH_ALEN];
3284 } timeout_event;
08fd8c15
JM
3285
3286 /**
3287 * struct ft_rrb_rx - Data for EVENT_FT_RRB_RX events
3288 */
3289 struct ft_rrb_rx {
3290 const u8 *src;
3291 const u8 *data;
3292 size_t data_len;
3293 } ft_rrb_rx;
f8b1f695
JM
3294
3295 /**
3296 * struct tx_status - Data for EVENT_TX_STATUS events
3297 */
3298 struct tx_status {
3299 u16 type;
3300 u16 stype;
3301 const u8 *dst;
3302 const u8 *data;
3303 size_t data_len;
3304 int ack;
3305 } tx_status;
3306
3307 /**
3308 * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
3309 */
3310 struct rx_from_unknown {
9b90955e
JB
3311 const u8 *bssid;
3312 const u8 *addr;
3313 int wds;
f8b1f695
JM
3314 } rx_from_unknown;
3315
3316 /**
3317 * struct rx_mgmt - Data for EVENT_RX_MGMT events
3318 */
3319 struct rx_mgmt {
b57e086c 3320 const u8 *frame;
f8b1f695 3321 size_t frame_len;
2a8b7416 3322 u32 datarate;
baf513d6 3323 int ssi_signal; /* dBm */
f8b1f695 3324 } rx_mgmt;
8d923a4a 3325
55777702
JM
3326 /**
3327 * struct rx_action - Data for EVENT_RX_ACTION events
3328 */
3329 struct rx_action {
e8828999
JM
3330 /**
3331 * da - Destination address of the received Action frame
3332 */
3333 const u8 *da;
3334
55777702
JM
3335 /**
3336 * sa - Source address of the received Action frame
3337 */
3338 const u8 *sa;
3339
e8828999
JM
3340 /**
3341 * bssid - Address 3 of the received Action frame
3342 */
3343 const u8 *bssid;
3344
55777702
JM
3345 /**
3346 * category - Action frame category
3347 */
3348 u8 category;
3349
3350 /**
3351 * data - Action frame body after category field
3352 */
3353 const u8 *data;
3354
3355 /**
3356 * len - Length of data in octets
3357 */
3358 size_t len;
3359
3360 /**
3361 * freq - Frequency (in MHz) on which the frame was received
3362 */
3363 int freq;
3364 } rx_action;
3365
3366 /**
3367 * struct remain_on_channel - Data for EVENT_REMAIN_ON_CHANNEL events
3368 *
3369 * This is also used with EVENT_CANCEL_REMAIN_ON_CHANNEL events.
3370 */
3371 struct remain_on_channel {
3372 /**
3373 * freq - Channel frequency in MHz
3374 */
3375 unsigned int freq;
3376
3377 /**
3378 * duration - Duration to remain on the channel in milliseconds
3379 */
3380 unsigned int duration;
3381 } remain_on_channel;
3382
8d923a4a
JM
3383 /**
3384 * struct scan_info - Optional data for EVENT_SCAN_RESULTS events
3385 * @aborted: Whether the scan was aborted
3386 * @freqs: Scanned frequencies in MHz (%NULL = all channels scanned)
3387 * @num_freqs: Number of entries in freqs array
3388 * @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard
3389 * SSID)
3390 * @num_ssids: Number of entries in ssids array
3391 */
3392 struct scan_info {
3393 int aborted;
3394 const int *freqs;
3395 size_t num_freqs;
3396 struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
3397 size_t num_ssids;
3398 } scan_info;
245519e0
JM
3399
3400 /**
3401 * struct mlme_rx - Data for EVENT_MLME_RX events
3402 */
3403 struct mlme_rx {
3404 const u8 *buf;
3405 size_t len;
3406 int freq;
3407 int channel;
3408 int ssi;
3409 } mlme_rx;
a0e0d3bb
JM
3410
3411 /**
3412 * struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events
3413 */
3414 struct rx_probe_req {
3415 /**
3416 * sa - Source address of the received Probe Request frame
3417 */
3418 const u8 *sa;
3419
04a85e44
JM
3420 /**
3421 * da - Destination address of the received Probe Request frame
3422 * or %NULL if not available
3423 */
3424 const u8 *da;
3425
3426 /**
3427 * bssid - BSSID of the received Probe Request frame or %NULL
3428 * if not available
3429 */
3430 const u8 *bssid;
3431
a0e0d3bb
JM
3432 /**
3433 * ie - IEs from the Probe Request body
3434 */
3435 const u8 *ie;
3436
3437 /**
3438 * ie_len - Length of ie buffer in octets
3439 */
3440 size_t ie_len;
baf513d6
JB
3441
3442 /**
3443 * signal - signal strength in dBm (or 0 if not available)
3444 */
3445 int ssi_signal;
a0e0d3bb 3446 } rx_probe_req;
a70a5d6d
JM
3447
3448 /**
3449 * struct new_sta - Data for EVENT_NEW_STA events
3450 */
3451 struct new_sta {
3452 const u8 *addr;
3453 } new_sta;
a8e0505b
JM
3454
3455 /**
3456 * struct eapol_rx - Data for EVENT_EAPOL_RX events
3457 */
3458 struct eapol_rx {
3459 const u8 *src;
3460 const u8 *data;
3461 size_t data_len;
3462 } eapol_rx;
b625473c
JM
3463
3464 /**
1c5c7273 3465 * signal_change - Data for EVENT_SIGNAL_CHANGE events
b625473c 3466 */
1c5c7273 3467 struct wpa_signal_info signal_change;
7cfc4ac3
AGS
3468
3469 /**
3470 * struct best_channel - Data for EVENT_BEST_CHANNEL events
3471 * @freq_24: Best 2.4 GHz band channel frequency in MHz
3472 * @freq_5: Best 5 GHz band channel frequency in MHz
3473 * @freq_overall: Best channel frequency in MHz
3474 *
3475 * 0 can be used to indicate no preference in either band.
3476 */
3477 struct best_channel {
3478 int freq_24;
3479 int freq_5;
3480 int freq_overall;
3481 } best_chan;
7d878ca7
JM
3482
3483 struct unprot_deauth {
3484 const u8 *sa;
3485 const u8 *da;
3486 u16 reason_code;
3487 } unprot_deauth;
3488
3489 struct unprot_disassoc {
3490 const u8 *sa;
3491 const u8 *da;
3492 u16 reason_code;
3493 } unprot_disassoc;
0d7e5a3a
JB
3494
3495 /**
3496 * struct low_ack - Data for EVENT_STATION_LOW_ACK events
3497 * @addr: station address
3498 */
3499 struct low_ack {
3500 u8 addr[ETH_ALEN];
3501 } low_ack;
3ac17eba
JM
3502
3503 /**
3504 * struct p2p_dev_found - Data for EVENT_P2P_DEV_FOUND
3505 */
3506 struct p2p_dev_found {
3507 const u8 *addr;
3508 const u8 *dev_addr;
3509 const u8 *pri_dev_type;
3510 const char *dev_name;
3511 u16 config_methods;
3512 u8 dev_capab;
3513 u8 group_capab;
3514 } p2p_dev_found;
3515
3516 /**
3517 * struct p2p_go_neg_req_rx - Data for EVENT_P2P_GO_NEG_REQ_RX
3518 */
3519 struct p2p_go_neg_req_rx {
3520 const u8 *src;
3521 u16 dev_passwd_id;
3522 } p2p_go_neg_req_rx;
3523
3524 /**
3525 * struct p2p_go_neg_completed - Data for EVENT_P2P_GO_NEG_COMPLETED
3526 */
3527 struct p2p_go_neg_completed {
3528 struct p2p_go_neg_results *res;
3529 } p2p_go_neg_completed;
3530
3531 struct p2p_prov_disc_req {
3532 const u8 *peer;
3533 u16 config_methods;
3534 const u8 *dev_addr;
3535 const u8 *pri_dev_type;
3536 const char *dev_name;
3537 u16 supp_config_methods;
3538 u8 dev_capab;
3539 u8 group_capab;
3540 } p2p_prov_disc_req;
3541
3542 struct p2p_prov_disc_resp {
3543 const u8 *peer;
3544 u16 config_methods;
3545 } p2p_prov_disc_resp;
3546
3547 struct p2p_sd_req {
3548 int freq;
3549 const u8 *sa;
3550 u8 dialog_token;
3551 u16 update_indic;
3552 const u8 *tlvs;
3553 size_t tlvs_len;
3554 } p2p_sd_req;
3555
3556 struct p2p_sd_resp {
3557 const u8 *sa;
3558 u16 update_indic;
3559 const u8 *tlvs;
3560 size_t tlvs_len;
3561 } p2p_sd_resp;
ea244d21
XC
3562
3563 /**
3564 * struct ibss_peer_lost - Data for EVENT_IBSS_PEER_LOST
3565 */
3566 struct ibss_peer_lost {
3567 u8 peer[ETH_ALEN];
3568 } ibss_peer_lost;
b14a210c
JB
3569
3570 /**
3571 * struct driver_gtk_rekey - Data for EVENT_DRIVER_GTK_REKEY
3572 */
3573 struct driver_gtk_rekey {
3574 const u8 *bssid;
3575 const u8 *replay_ctr;
3576 } driver_gtk_rekey;
bcf24348
JB
3577
3578 /**
3579 * struct client_poll - Data for EVENT_DRIVER_CLIENT_POLL_OK events
3580 * @addr: station address
3581 */
3582 struct client_poll {
3583 u8 addr[ETH_ALEN];
3584 } client_poll;
dd840f79
JB
3585
3586 /**
3587 * struct eapol_tx_status
3588 * @dst: Original destination
3589 * @data: Data starting with IEEE 802.1X header (!)
3590 * @data_len: Length of data
3591 * @ack: Indicates ack or lost frame
3592 *
3593 * This corresponds to hapd_send_eapol if the frame sent
3594 * there isn't just reported as EVENT_TX_STATUS.
3595 */
3596 struct eapol_tx_status {
3597 const u8 *dst;
3598 const u8 *data;
3599 int data_len;
3600 int ack;
3601 } eapol_tx_status;
1b487b8b
TP
3602
3603 /**
3604 * struct ch_switch
3605 * @freq: Frequency of new channel in MHz
3606 * @ht_enabled: Whether this is an HT channel
3607 * @ch_offset: Secondary channel offset
3608 */
3609 struct ch_switch {
3610 int freq;
3611 int ht_enabled;
3612 int ch_offset;
3613 } ch_switch;
6fc6879b
JM
3614};
3615
3616/**
3617 * wpa_supplicant_event - Report a driver event for wpa_supplicant
3618 * @ctx: Context pointer (wpa_s); this is the ctx variable registered
3619 * with struct wpa_driver_ops::init()
3620 * @event: event type (defined above)
3621 * @data: possible extra data for the event
3622 *
3623 * Driver wrapper code should call this function whenever an event is received
3624 * from the driver.
3625 */
9646a8ab 3626void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
6fc6879b
JM
3627 union wpa_event_data *data);
3628
c5121837 3629
1d041bec
JM
3630/*
3631 * The following inline functions are provided for convenience to simplify
3632 * event indication for some of the common events.
3633 */
3634
3635static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
39b08b5f 3636 size_t ielen, int reassoc)
1d041bec
JM
3637{
3638 union wpa_event_data event;
3639 os_memset(&event, 0, sizeof(event));
39b08b5f 3640 event.assoc_info.reassoc = reassoc;
1d041bec
JM
3641 event.assoc_info.req_ies = ie;
3642 event.assoc_info.req_ies_len = ielen;
3643 event.assoc_info.addr = addr;
3644 wpa_supplicant_event(ctx, EVENT_ASSOC, &event);
3645}
3646
3647static inline void drv_event_disassoc(void *ctx, const u8 *addr)
3648{
3649 union wpa_event_data event;
3650 os_memset(&event, 0, sizeof(event));
3651 event.disassoc_info.addr = addr;
3652 wpa_supplicant_event(ctx, EVENT_DISASSOC, &event);
3653}
c5121837 3654
baac6490
JM
3655static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
3656 size_t data_len)
3657{
3658 union wpa_event_data event;
3659 os_memset(&event, 0, sizeof(event));
3660 event.eapol_rx.src = src;
3661 event.eapol_rx.data = data;
3662 event.eapol_rx.data_len = data_len;
3663 wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
3664}
3665
aea855d7
JM
3666/* driver_common.c */
3667void wpa_scan_results_free(struct wpa_scan_results *res);
9e0e6902 3668
6c3771d7
BG
3669/* Convert wpa_event_type to a string for logging */
3670const char * event_to_string(enum wpa_event_type event);
3671
6fc6879b 3672#endif /* DRIVER_H */