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