1189251Ssam/*
2214734Srpaulo * Driver interface definition
3252726Srpaulo * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
4189251Ssam *
5252726Srpaulo * This software may be distributed under the terms of the BSD license.
6252726Srpaulo * See README for more details.
7189251Ssam *
8214734Srpaulo * This file defines a driver interface used by both %wpa_supplicant and
9214734Srpaulo * hostapd. The first part of the file defines data structures used in various
10214734Srpaulo * driver operations. This is followed by the struct wpa_driver_ops that each
11214734Srpaulo * driver wrapper will beed to define with callback functions for requesting
12214734Srpaulo * driver operations. After this, there are definitions for driver event
13214734Srpaulo * reporting with wpa_supplicant_event() and some convenience helper functions
14214734Srpaulo * that can be used to report events.
15189251Ssam */
16189251Ssam
17189251Ssam#ifndef DRIVER_H
18189251Ssam#define DRIVER_H
19189251Ssam
20214734Srpaulo#define WPA_SUPPLICANT_DRIVER_VERSION 4
21189251Ssam
22214734Srpaulo#include "common/defs.h"
23189251Ssam
24214734Srpaulo#define HOSTAPD_CHAN_DISABLED 0x00000001
25214734Srpaulo#define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002
26214734Srpaulo#define HOSTAPD_CHAN_NO_IBSS 0x00000004
27214734Srpaulo#define HOSTAPD_CHAN_RADAR 0x00000008
28252726Srpaulo#define HOSTAPD_CHAN_HT40PLUS 0x00000010
29252726Srpaulo#define HOSTAPD_CHAN_HT40MINUS 0x00000020
30252726Srpaulo#define HOSTAPD_CHAN_HT40 0x00000040
31189251Ssam
32214734Srpaulo/**
33214734Srpaulo * struct hostapd_channel_data - Channel information
34214734Srpaulo */
35214734Srpaulostruct hostapd_channel_data {
36214734Srpaulo	/**
37214734Srpaulo	 * chan - Channel number (IEEE 802.11)
38214734Srpaulo	 */
39214734Srpaulo	short chan;
40214734Srpaulo
41214734Srpaulo	/**
42214734Srpaulo	 * freq - Frequency in MHz
43214734Srpaulo	 */
44252726Srpaulo	int freq;
45214734Srpaulo
46214734Srpaulo	/**
47214734Srpaulo	 * flag - Channel flags (HOSTAPD_CHAN_*)
48214734Srpaulo	 */
49214734Srpaulo	int flag;
50214734Srpaulo
51214734Srpaulo	/**
52214734Srpaulo	 * max_tx_power - maximum transmit power in dBm
53214734Srpaulo	 */
54214734Srpaulo	u8 max_tx_power;
55214734Srpaulo};
56214734Srpaulo
57252726Srpaulo#define HOSTAPD_MODE_FLAG_HT_INFO_KNOWN BIT(0)
58252726Srpaulo
59214734Srpaulo/**
60214734Srpaulo * struct hostapd_hw_modes - Supported hardware mode information
61214734Srpaulo */
62214734Srpaulostruct hostapd_hw_modes {
63214734Srpaulo	/**
64214734Srpaulo	 * mode - Hardware mode
65214734Srpaulo	 */
66214734Srpaulo	enum hostapd_hw_mode mode;
67214734Srpaulo
68214734Srpaulo	/**
69214734Srpaulo	 * num_channels - Number of entries in the channels array
70214734Srpaulo	 */
71214734Srpaulo	int num_channels;
72214734Srpaulo
73214734Srpaulo	/**
74214734Srpaulo	 * channels - Array of supported channels
75214734Srpaulo	 */
76214734Srpaulo	struct hostapd_channel_data *channels;
77214734Srpaulo
78214734Srpaulo	/**
79214734Srpaulo	 * num_rates - Number of entries in the rates array
80214734Srpaulo	 */
81214734Srpaulo	int num_rates;
82214734Srpaulo
83214734Srpaulo	/**
84214734Srpaulo	 * rates - Array of supported rates in 100 kbps units
85214734Srpaulo	 */
86214734Srpaulo	int *rates;
87214734Srpaulo
88214734Srpaulo	/**
89214734Srpaulo	 * ht_capab - HT (IEEE 802.11n) capabilities
90214734Srpaulo	 */
91214734Srpaulo	u16 ht_capab;
92214734Srpaulo
93214734Srpaulo	/**
94214734Srpaulo	 * mcs_set - MCS (IEEE 802.11n) rate parameters
95214734Srpaulo	 */
96214734Srpaulo	u8 mcs_set[16];
97214734Srpaulo
98214734Srpaulo	/**
99214734Srpaulo	 * a_mpdu_params - A-MPDU (IEEE 802.11n) parameters
100214734Srpaulo	 */
101214734Srpaulo	u8 a_mpdu_params;
102252726Srpaulo
103252726Srpaulo	/**
104252726Srpaulo	 * vht_capab - VHT (IEEE 802.11ac) capabilities
105252726Srpaulo	 */
106252726Srpaulo	u32 vht_capab;
107252726Srpaulo
108252726Srpaulo	/**
109252726Srpaulo	 * vht_mcs_set - VHT MCS (IEEE 802.11ac) rate parameters
110252726Srpaulo	 */
111252726Srpaulo	u8 vht_mcs_set[8];
112252726Srpaulo
113252726Srpaulo	unsigned int flags; /* HOSTAPD_MODE_FLAG_* */
114214734Srpaulo};
115214734Srpaulo
116214734Srpaulo
117189251Ssam#define IEEE80211_MODE_INFRA	0
118189251Ssam#define IEEE80211_MODE_IBSS	1
119214734Srpaulo#define IEEE80211_MODE_AP	2
120189251Ssam
121189251Ssam#define IEEE80211_CAP_ESS	0x0001
122189251Ssam#define IEEE80211_CAP_IBSS	0x0002
123189251Ssam#define IEEE80211_CAP_PRIVACY	0x0010
124189251Ssam
125214734Srpaulo#define WPA_SCAN_QUAL_INVALID		BIT(0)
126214734Srpaulo#define WPA_SCAN_NOISE_INVALID		BIT(1)
127214734Srpaulo#define WPA_SCAN_LEVEL_INVALID		BIT(2)
128214734Srpaulo#define WPA_SCAN_LEVEL_DBM		BIT(3)
129214734Srpaulo#define WPA_SCAN_AUTHENTICATED		BIT(4)
130214734Srpaulo#define WPA_SCAN_ASSOCIATED		BIT(5)
131189251Ssam
132189251Ssam/**
133189251Ssam * struct wpa_scan_res - Scan result for an BSS/IBSS
134214734Srpaulo * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
135189251Ssam * @bssid: BSSID
136189251Ssam * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
137189251Ssam * @beacon_int: beacon interval in TUs (host byte order)
138189251Ssam * @caps: capability information field in host byte order
139189251Ssam * @qual: signal quality
140189251Ssam * @noise: noise level
141189251Ssam * @level: signal level
142189251Ssam * @tsf: Timestamp
143214734Srpaulo * @age: Age of the information in milliseconds (i.e., how many milliseconds
144214734Srpaulo * ago the last Beacon or Probe Response frame was received)
145189251Ssam * @ie_len: length of the following IE field in octets
146214734Srpaulo * @beacon_ie_len: length of the following Beacon IE field in octets
147189251Ssam *
148189251Ssam * This structure is used as a generic format for scan results from the
149189251Ssam * driver. Each driver interface implementation is responsible for converting
150189251Ssam * the driver or OS specific scan results into this format.
151189251Ssam *
152189251Ssam * If the driver does not support reporting all IEs, the IE data structure is
153189251Ssam * constructed of the IEs that are available. This field will also need to
154189251Ssam * include SSID in IE format. All drivers are encouraged to be extended to
155189251Ssam * report all IEs to make it easier to support future additions.
156189251Ssam */
157189251Ssamstruct wpa_scan_res {
158214734Srpaulo	unsigned int flags;
159189251Ssam	u8 bssid[ETH_ALEN];
160189251Ssam	int freq;
161189251Ssam	u16 beacon_int;
162189251Ssam	u16 caps;
163189251Ssam	int qual;
164189251Ssam	int noise;
165189251Ssam	int level;
166189251Ssam	u64 tsf;
167214734Srpaulo	unsigned int age;
168189251Ssam	size_t ie_len;
169214734Srpaulo	size_t beacon_ie_len;
170214734Srpaulo	/*
171214734Srpaulo	 * Followed by ie_len octets of IEs from Probe Response frame (or if
172214734Srpaulo	 * the driver does not indicate source of IEs, these may also be from
173214734Srpaulo	 * Beacon frame). After the first set of IEs, another set of IEs may
174214734Srpaulo	 * follow (with beacon_ie_len octets of data) if the driver provides
175214734Srpaulo	 * both IE sets.
176214734Srpaulo	 */
177189251Ssam};
178189251Ssam
179189251Ssam/**
180189251Ssam * struct wpa_scan_results - Scan results
181189251Ssam * @res: Array of pointers to allocated variable length scan result entries
182189251Ssam * @num: Number of entries in the scan result array
183189251Ssam */
184189251Ssamstruct wpa_scan_results {
185189251Ssam	struct wpa_scan_res **res;
186189251Ssam	size_t num;
187189251Ssam};
188189251Ssam
189189251Ssam/**
190189251Ssam * struct wpa_interface_info - Network interface information
191189251Ssam * @next: Pointer to the next interface or NULL if this is the last one
192189251Ssam * @ifname: Interface name that can be used with init() or init2()
193189251Ssam * @desc: Human readable adapter description (e.g., vendor/model) or NULL if
194189251Ssam *	not available
195209158Srpaulo * @drv_name: struct wpa_driver_ops::name (note: unlike other strings, this one
196189251Ssam *	is not an allocated copy, i.e., get_interfaces() caller will not free
197189251Ssam *	this)
198189251Ssam */
199189251Ssamstruct wpa_interface_info {
200189251Ssam	struct wpa_interface_info *next;
201189251Ssam	char *ifname;
202189251Ssam	char *desc;
203189251Ssam	const char *drv_name;
204189251Ssam};
205189251Ssam
206252726Srpaulo#define WPAS_MAX_SCAN_SSIDS 16
207214734Srpaulo
208189251Ssam/**
209214734Srpaulo * struct wpa_driver_scan_params - Scan parameters
210214734Srpaulo * Data for struct wpa_driver_ops::scan2().
211214734Srpaulo */
212214734Srpaulostruct wpa_driver_scan_params {
213214734Srpaulo	/**
214214734Srpaulo	 * ssids - SSIDs to scan for
215214734Srpaulo	 */
216214734Srpaulo	struct wpa_driver_scan_ssid {
217214734Srpaulo		/**
218214734Srpaulo		 * ssid - specific SSID to scan for (ProbeReq)
219214734Srpaulo		 * %NULL or zero-length SSID is used to indicate active scan
220214734Srpaulo		 * with wildcard SSID.
221214734Srpaulo		 */
222214734Srpaulo		const u8 *ssid;
223214734Srpaulo		/**
224214734Srpaulo		 * ssid_len: Length of the SSID in octets
225214734Srpaulo		 */
226214734Srpaulo		size_t ssid_len;
227214734Srpaulo	} ssids[WPAS_MAX_SCAN_SSIDS];
228214734Srpaulo
229214734Srpaulo	/**
230214734Srpaulo	 * num_ssids - Number of entries in ssids array
231214734Srpaulo	 * Zero indicates a request for a passive scan.
232214734Srpaulo	 */
233214734Srpaulo	size_t num_ssids;
234214734Srpaulo
235214734Srpaulo	/**
236214734Srpaulo	 * extra_ies - Extra IE(s) to add into Probe Request or %NULL
237214734Srpaulo	 */
238214734Srpaulo	const u8 *extra_ies;
239214734Srpaulo
240214734Srpaulo	/**
241214734Srpaulo	 * extra_ies_len - Length of extra_ies in octets
242214734Srpaulo	 */
243214734Srpaulo	size_t extra_ies_len;
244214734Srpaulo
245214734Srpaulo	/**
246214734Srpaulo	 * freqs - Array of frequencies to scan or %NULL for all frequencies
247214734Srpaulo	 *
248214734Srpaulo	 * The frequency is set in MHz. The array is zero-terminated.
249214734Srpaulo	 */
250214734Srpaulo	int *freqs;
251214734Srpaulo
252214734Srpaulo	/**
253214734Srpaulo	 * filter_ssids - Filter for reporting SSIDs
254214734Srpaulo	 *
255214734Srpaulo	 * This optional parameter can be used to request the driver wrapper to
256214734Srpaulo	 * filter scan results to include only the specified SSIDs. %NULL
257214734Srpaulo	 * indicates that no filtering is to be done. This can be used to
258214734Srpaulo	 * reduce memory needs for scan results in environments that have large
259214734Srpaulo	 * number of APs with different SSIDs.
260214734Srpaulo	 *
261214734Srpaulo	 * The driver wrapper is allowed to take this allocated buffer into its
262214734Srpaulo	 * own use by setting the pointer to %NULL. In that case, the driver
263214734Srpaulo	 * wrapper is responsible for freeing the buffer with os_free() once it
264214734Srpaulo	 * is not needed anymore.
265214734Srpaulo	 */
266214734Srpaulo	struct wpa_driver_scan_filter {
267214734Srpaulo		u8 ssid[32];
268214734Srpaulo		size_t ssid_len;
269214734Srpaulo	} *filter_ssids;
270214734Srpaulo
271214734Srpaulo	/**
272214734Srpaulo	 * num_filter_ssids - Number of entries in filter_ssids array
273214734Srpaulo	 */
274214734Srpaulo	size_t num_filter_ssids;
275252726Srpaulo
276252726Srpaulo	/**
277252726Srpaulo	 * filter_rssi - Filter by RSSI
278252726Srpaulo	 *
279252726Srpaulo	 * The driver may filter scan results in firmware to reduce host
280252726Srpaulo	 * wakeups and thereby save power. Specify the RSSI threshold in s32
281252726Srpaulo	 * dBm.
282252726Srpaulo	 */
283252726Srpaulo	s32 filter_rssi;
284252726Srpaulo
285252726Srpaulo	/**
286252726Srpaulo	 * p2p_probe - Used to disable CCK (802.11b) rates for P2P probes
287252726Srpaulo	 *
288252726Srpaulo	 * When set, the driver is expected to remove rates 1, 2, 5.5, and 11
289252726Srpaulo	 * Mbps from the support rates element(s) in the Probe Request frames
290252726Srpaulo	 * and not to transmit the frames at any of those rates.
291252726Srpaulo	 */
292252726Srpaulo	u8 p2p_probe;
293214734Srpaulo};
294214734Srpaulo
295214734Srpaulo/**
296214734Srpaulo * struct wpa_driver_auth_params - Authentication parameters
297214734Srpaulo * Data for struct wpa_driver_ops::authenticate().
298214734Srpaulo */
299214734Srpaulostruct wpa_driver_auth_params {
300214734Srpaulo	int freq;
301214734Srpaulo	const u8 *bssid;
302214734Srpaulo	const u8 *ssid;
303214734Srpaulo	size_t ssid_len;
304214734Srpaulo	int auth_alg;
305214734Srpaulo	const u8 *ie;
306214734Srpaulo	size_t ie_len;
307214734Srpaulo	const u8 *wep_key[4];
308214734Srpaulo	size_t wep_key_len[4];
309214734Srpaulo	int wep_tx_keyidx;
310214734Srpaulo	int local_state_change;
311252726Srpaulo
312252726Srpaulo	/**
313252726Srpaulo	 * p2p - Whether this connection is a P2P group
314252726Srpaulo	 */
315252726Srpaulo	int p2p;
316252726Srpaulo
317252726Srpaulo	const u8 *sae_data;
318252726Srpaulo	size_t sae_data_len;
319252726Srpaulo
320214734Srpaulo};
321214734Srpaulo
322252726Srpauloenum wps_mode {
323252726Srpaulo	WPS_MODE_NONE /* no WPS provisioning being used */,
324252726Srpaulo	WPS_MODE_OPEN /* WPS provisioning with AP that is in open mode */,
325252726Srpaulo	WPS_MODE_PRIVACY /* WPS provisioning with AP that is using protection
326252726Srpaulo			  */
327252726Srpaulo};
328252726Srpaulo
329214734Srpaulo/**
330189251Ssam * struct wpa_driver_associate_params - Association parameters
331189251Ssam * Data for struct wpa_driver_ops::associate().
332189251Ssam */
333189251Ssamstruct wpa_driver_associate_params {
334189251Ssam	/**
335189251Ssam	 * bssid - BSSID of the selected AP
336189251Ssam	 * This can be %NULL, if ap_scan=2 mode is used and the driver is
337189251Ssam	 * responsible for selecting with which BSS to associate. */
338189251Ssam	const u8 *bssid;
339189251Ssam
340189251Ssam	/**
341189251Ssam	 * ssid - The selected SSID
342189251Ssam	 */
343189251Ssam	const u8 *ssid;
344214734Srpaulo
345214734Srpaulo	/**
346214734Srpaulo	 * ssid_len - Length of the SSID (1..32)
347214734Srpaulo	 */
348189251Ssam	size_t ssid_len;
349189251Ssam
350189251Ssam	/**
351189251Ssam	 * freq - Frequency of the channel the selected AP is using
352189251Ssam	 * Frequency that the selected AP is using (in MHz as
353189251Ssam	 * reported in the scan results)
354189251Ssam	 */
355189251Ssam	int freq;
356189251Ssam
357189251Ssam	/**
358252726Srpaulo	 * bg_scan_period - Background scan period in seconds, 0 to disable
359252726Srpaulo	 * background scan, or -1 to indicate no change to default driver
360252726Srpaulo	 * configuration
361252726Srpaulo	 */
362252726Srpaulo	int bg_scan_period;
363252726Srpaulo
364252726Srpaulo	/**
365189251Ssam	 * wpa_ie - WPA information element for (Re)Association Request
366189251Ssam	 * WPA information element to be included in (Re)Association
367189251Ssam	 * Request (including information element id and length). Use
368189251Ssam	 * of this WPA IE is optional. If the driver generates the WPA
369189251Ssam	 * IE, it can use pairwise_suite, group_suite, and
370189251Ssam	 * key_mgmt_suite to select proper algorithms. In this case,
371189251Ssam	 * the driver has to notify wpa_supplicant about the used WPA
372189251Ssam	 * IE by generating an event that the interface code will
373189251Ssam	 * convert into EVENT_ASSOCINFO data (see below).
374189251Ssam	 *
375189251Ssam	 * When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE
376189251Ssam	 * instead. The driver can determine which version is used by
377189251Ssam	 * looking at the first byte of the IE (0xdd for WPA, 0x30 for
378189251Ssam	 * WPA2/RSN).
379189251Ssam	 *
380189251Ssam	 * When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE.
381189251Ssam	 */
382189251Ssam	const u8 *wpa_ie;
383214734Srpaulo
384189251Ssam	/**
385189251Ssam	 * wpa_ie_len - length of the wpa_ie
386189251Ssam	 */
387189251Ssam	size_t wpa_ie_len;
388189251Ssam
389214734Srpaulo	/**
390252726Srpaulo	 * wpa_proto - Bitfield of WPA_PROTO_* values to indicate WPA/WPA2
391252726Srpaulo	 */
392252726Srpaulo	unsigned int wpa_proto;
393252726Srpaulo
394252726Srpaulo	/**
395214734Srpaulo	 * pairwise_suite - Selected pairwise cipher suite
396214734Srpaulo	 *
397214734Srpaulo	 * This is usually ignored if @wpa_ie is used.
398214734Srpaulo	 */
399214734Srpaulo	enum wpa_cipher pairwise_suite;
400189251Ssam
401189251Ssam	/**
402214734Srpaulo	 * group_suite - Selected group cipher suite
403214734Srpaulo	 *
404214734Srpaulo	 * This is usually ignored if @wpa_ie is used.
405214734Srpaulo	 */
406214734Srpaulo	enum wpa_cipher group_suite;
407214734Srpaulo
408214734Srpaulo	/**
409214734Srpaulo	 * key_mgmt_suite - Selected key management suite
410214734Srpaulo	 *
411214734Srpaulo	 * This is usually ignored if @wpa_ie is used.
412214734Srpaulo	 */
413214734Srpaulo	enum wpa_key_mgmt key_mgmt_suite;
414214734Srpaulo
415214734Srpaulo	/**
416189251Ssam	 * auth_alg - Allowed authentication algorithms
417214734Srpaulo	 * Bit field of WPA_AUTH_ALG_*
418189251Ssam	 */
419189251Ssam	int auth_alg;
420189251Ssam
421189251Ssam	/**
422189251Ssam	 * mode - Operation mode (infra/ibss) IEEE80211_MODE_*
423189251Ssam	 */
424189251Ssam	int mode;
425189251Ssam
426189251Ssam	/**
427189251Ssam	 * wep_key - WEP keys for static WEP configuration
428189251Ssam	 */
429189251Ssam	const u8 *wep_key[4];
430189251Ssam
431189251Ssam	/**
432189251Ssam	 * wep_key_len - WEP key length for static WEP configuration
433189251Ssam	 */
434189251Ssam	size_t wep_key_len[4];
435189251Ssam
436189251Ssam	/**
437189251Ssam	 * wep_tx_keyidx - WEP TX key index for static WEP configuration
438189251Ssam	 */
439189251Ssam	int wep_tx_keyidx;
440189251Ssam
441189251Ssam	/**
442189251Ssam	 * mgmt_frame_protection - IEEE 802.11w management frame protection
443189251Ssam	 */
444214734Srpaulo	enum mfp_options mgmt_frame_protection;
445189251Ssam
446189251Ssam	/**
447189251Ssam	 * ft_ies - IEEE 802.11r / FT information elements
448189251Ssam	 * If the supplicant is using IEEE 802.11r (FT) and has the needed keys
449189251Ssam	 * for fast transition, this parameter is set to include the IEs that
450189251Ssam	 * are to be sent in the next FT Authentication Request message.
451189251Ssam	 * update_ft_ies() handler is called to update the IEs for further
452189251Ssam	 * FT messages in the sequence.
453189251Ssam	 *
454189251Ssam	 * The driver should use these IEs only if the target AP is advertising
455189251Ssam	 * the same mobility domain as the one included in the MDIE here.
456189251Ssam	 *
457189251Ssam	 * In ap_scan=2 mode, the driver can use these IEs when moving to a new
458189251Ssam	 * AP after the initial association. These IEs can only be used if the
459189251Ssam	 * target AP is advertising support for FT and is using the same MDIE
460189251Ssam	 * and SSID as the current AP.
461189251Ssam	 *
462189251Ssam	 * The driver is responsible for reporting the FT IEs received from the
463189251Ssam	 * AP's response using wpa_supplicant_event() with EVENT_FT_RESPONSE
464189251Ssam	 * type. update_ft_ies() handler will then be called with the FT IEs to
465189251Ssam	 * include in the next frame in the authentication sequence.
466189251Ssam	 */
467189251Ssam	const u8 *ft_ies;
468189251Ssam
469189251Ssam	/**
470189251Ssam	 * ft_ies_len - Length of ft_ies in bytes
471189251Ssam	 */
472189251Ssam	size_t ft_ies_len;
473189251Ssam
474189251Ssam	/**
475189251Ssam	 * ft_md - FT Mobility domain (6 octets) (also included inside ft_ies)
476189251Ssam	 *
477189251Ssam	 * This value is provided to allow the driver interface easier access
478189251Ssam	 * to the current mobility domain. This value is set to %NULL if no
479189251Ssam	 * mobility domain is currently active.
480189251Ssam	 */
481189251Ssam	const u8 *ft_md;
482189251Ssam
483189251Ssam	/**
484189251Ssam	 * passphrase - RSN passphrase for PSK
485189251Ssam	 *
486189251Ssam	 * This value is made available only for WPA/WPA2-Personal (PSK) and
487189251Ssam	 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
488189251Ssam	 * the 8..63 character ASCII passphrase, if available. Please note that
489189251Ssam	 * this can be %NULL if passphrase was not used to generate the PSK. In
490189251Ssam	 * that case, the psk field must be used to fetch the PSK.
491189251Ssam	 */
492189251Ssam	const char *passphrase;
493189251Ssam
494189251Ssam	/**
495189251Ssam	 * psk - RSN PSK (alternative for passphrase for PSK)
496189251Ssam	 *
497189251Ssam	 * This value is made available only for WPA/WPA2-Personal (PSK) and
498189251Ssam	 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
499189251Ssam	 * the 32-octet (256-bit) PSK, if available. The driver wrapper should
500189251Ssam	 * be prepared to handle %NULL value as an error.
501189251Ssam	 */
502189251Ssam	const u8 *psk;
503214734Srpaulo
504214734Srpaulo	/**
505214734Srpaulo	 * drop_unencrypted - Enable/disable unencrypted frame filtering
506214734Srpaulo	 *
507214734Srpaulo	 * Configure the driver to drop all non-EAPOL frames (both receive and
508214734Srpaulo	 * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
509214734Srpaulo	 * still be allowed for key negotiation.
510214734Srpaulo	 */
511214734Srpaulo	int drop_unencrypted;
512214734Srpaulo
513214734Srpaulo	/**
514214734Srpaulo	 * prev_bssid - Previously used BSSID in this ESS
515214734Srpaulo	 *
516214734Srpaulo	 * When not %NULL, this is a request to use reassociation instead of
517214734Srpaulo	 * association.
518214734Srpaulo	 */
519214734Srpaulo	const u8 *prev_bssid;
520252726Srpaulo
521252726Srpaulo	/**
522252726Srpaulo	 * wps - WPS mode
523252726Srpaulo	 *
524252726Srpaulo	 * If the driver needs to do special configuration for WPS association,
525252726Srpaulo	 * this variable provides more information on what type of association
526252726Srpaulo	 * is being requested. Most drivers should not need ot use this.
527252726Srpaulo	 */
528252726Srpaulo	enum wps_mode wps;
529252726Srpaulo
530252726Srpaulo	/**
531252726Srpaulo	 * p2p - Whether this connection is a P2P group
532252726Srpaulo	 */
533252726Srpaulo	int p2p;
534252726Srpaulo
535252726Srpaulo	/**
536252726Srpaulo	 * uapsd - UAPSD parameters for the network
537252726Srpaulo	 * -1 = do not change defaults
538252726Srpaulo	 * AP mode: 1 = enabled, 0 = disabled
539252726Srpaulo	 * STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE
540252726Srpaulo	 */
541252726Srpaulo	int uapsd;
542252726Srpaulo
543252726Srpaulo	/**
544252726Srpaulo	 * fixed_bssid - Whether to force this BSSID in IBSS mode
545252726Srpaulo	 * 1 = Fix this BSSID and prevent merges.
546252726Srpaulo	 * 0 = Do not fix BSSID.
547252726Srpaulo	 */
548252726Srpaulo	int fixed_bssid;
549252726Srpaulo
550252726Srpaulo	/**
551252726Srpaulo	 * disable_ht - Disable HT (IEEE 802.11n) for this connection
552252726Srpaulo	 */
553252726Srpaulo	int disable_ht;
554252726Srpaulo
555252726Srpaulo	/**
556252726Srpaulo	 * HT Capabilities over-rides. Only bits set in the mask will be used,
557252726Srpaulo	 * and not all values are used by the kernel anyway. Currently, MCS,
558252726Srpaulo	 * MPDU and MSDU fields are used.
559252726Srpaulo	 */
560252726Srpaulo	const u8 *htcaps;       /* struct ieee80211_ht_capabilities * */
561252726Srpaulo	const u8 *htcaps_mask;  /* struct ieee80211_ht_capabilities * */
562189251Ssam};
563189251Ssam
564252726Srpauloenum hide_ssid {
565252726Srpaulo	NO_SSID_HIDING,
566252726Srpaulo	HIDDEN_SSID_ZERO_LEN,
567252726Srpaulo	HIDDEN_SSID_ZERO_CONTENTS
568252726Srpaulo};
569252726Srpaulo
570252726Srpaulostruct wpa_driver_ap_params {
571252726Srpaulo	/**
572252726Srpaulo	 * head - Beacon head from IEEE 802.11 header to IEs before TIM IE
573252726Srpaulo	 */
574252726Srpaulo	const u8 *head;
575252726Srpaulo
576252726Srpaulo	/**
577252726Srpaulo	 * head_len - Length of the head buffer in octets
578252726Srpaulo	 */
579252726Srpaulo	size_t head_len;
580252726Srpaulo
581252726Srpaulo	/**
582252726Srpaulo	 * tail - Beacon tail following TIM IE
583252726Srpaulo	 */
584252726Srpaulo	const u8 *tail;
585252726Srpaulo
586252726Srpaulo	/**
587252726Srpaulo	 * tail_len - Length of the tail buffer in octets
588252726Srpaulo	 */
589252726Srpaulo	size_t tail_len;
590252726Srpaulo
591252726Srpaulo	/**
592252726Srpaulo	 * dtim_period - DTIM period
593252726Srpaulo	 */
594252726Srpaulo	int dtim_period;
595252726Srpaulo
596252726Srpaulo	/**
597252726Srpaulo	 * beacon_int - Beacon interval
598252726Srpaulo	 */
599252726Srpaulo	int beacon_int;
600252726Srpaulo
601252726Srpaulo	/**
602252726Srpaulo	 * basic_rates: -1 terminated array of basic rates in 100 kbps
603252726Srpaulo	 *
604252726Srpaulo	 * This parameter can be used to set a specific basic rate set for the
605252726Srpaulo	 * BSS. If %NULL, default basic rate set is used.
606252726Srpaulo	 */
607252726Srpaulo	int *basic_rates;
608252726Srpaulo
609252726Srpaulo	/**
610252726Srpaulo	 * proberesp - Probe Response template
611252726Srpaulo	 *
612252726Srpaulo	 * This is used by drivers that reply to Probe Requests internally in
613252726Srpaulo	 * AP mode and require the full Probe Response template.
614252726Srpaulo	 */
615252726Srpaulo	const u8 *proberesp;
616252726Srpaulo
617252726Srpaulo	/**
618252726Srpaulo	 * proberesp_len - Length of the proberesp buffer in octets
619252726Srpaulo	 */
620252726Srpaulo	size_t proberesp_len;
621252726Srpaulo
622252726Srpaulo	/**
623252726Srpaulo	 * ssid - The SSID to use in Beacon/Probe Response frames
624252726Srpaulo	 */
625252726Srpaulo	const u8 *ssid;
626252726Srpaulo
627252726Srpaulo	/**
628252726Srpaulo	 * ssid_len - Length of the SSID (1..32)
629252726Srpaulo	 */
630252726Srpaulo	size_t ssid_len;
631252726Srpaulo
632252726Srpaulo	/**
633252726Srpaulo	 * hide_ssid - Whether to hide the SSID
634252726Srpaulo	 */
635252726Srpaulo	enum hide_ssid hide_ssid;
636252726Srpaulo
637252726Srpaulo	/**
638252726Srpaulo	 * pairwise_ciphers - WPA_CIPHER_* bitfield
639252726Srpaulo	 */
640252726Srpaulo	unsigned int pairwise_ciphers;
641252726Srpaulo
642252726Srpaulo	/**
643252726Srpaulo	 * group_cipher - WPA_CIPHER_*
644252726Srpaulo	 */
645252726Srpaulo	unsigned int group_cipher;
646252726Srpaulo
647252726Srpaulo	/**
648252726Srpaulo	 * key_mgmt_suites - WPA_KEY_MGMT_* bitfield
649252726Srpaulo	 */
650252726Srpaulo	unsigned int key_mgmt_suites;
651252726Srpaulo
652252726Srpaulo	/**
653252726Srpaulo	 * auth_algs - WPA_AUTH_ALG_* bitfield
654252726Srpaulo	 */
655252726Srpaulo	unsigned int auth_algs;
656252726Srpaulo
657252726Srpaulo	/**
658252726Srpaulo	 * wpa_version - WPA_PROTO_* bitfield
659252726Srpaulo	 */
660252726Srpaulo	unsigned int wpa_version;
661252726Srpaulo
662252726Srpaulo	/**
663252726Srpaulo	 * privacy - Whether privacy is used in the BSS
664252726Srpaulo	 */
665252726Srpaulo	int privacy;
666252726Srpaulo
667252726Srpaulo	/**
668252726Srpaulo	 * beacon_ies - WPS/P2P IE(s) for Beacon frames
669252726Srpaulo	 *
670252726Srpaulo	 * This is used to add IEs like WPS IE and P2P IE by drivers that do
671252726Srpaulo	 * not use the full Beacon template.
672252726Srpaulo	 */
673252726Srpaulo	const struct wpabuf *beacon_ies;
674252726Srpaulo
675252726Srpaulo	/**
676252726Srpaulo	 * proberesp_ies - P2P/WPS IE(s) for Probe Response frames
677252726Srpaulo	 *
678252726Srpaulo	 * This is used to add IEs like WPS IE and P2P IE by drivers that
679252726Srpaulo	 * reply to Probe Request frames internally.
680252726Srpaulo	 */
681252726Srpaulo	const struct wpabuf *proberesp_ies;
682252726Srpaulo
683252726Srpaulo	/**
684252726Srpaulo	 * assocresp_ies - WPS IE(s) for (Re)Association Response frames
685252726Srpaulo	 *
686252726Srpaulo	 * This is used to add IEs like WPS IE by drivers that reply to
687252726Srpaulo	 * (Re)Association Request frames internally.
688252726Srpaulo	 */
689252726Srpaulo	const struct wpabuf *assocresp_ies;
690252726Srpaulo
691252726Srpaulo	/**
692252726Srpaulo	 * isolate - Whether to isolate frames between associated stations
693252726Srpaulo	 *
694252726Srpaulo	 * If this is non-zero, the AP is requested to disable forwarding of
695252726Srpaulo	 * frames between associated stations.
696252726Srpaulo	 */
697252726Srpaulo	int isolate;
698252726Srpaulo
699252726Srpaulo	/**
700252726Srpaulo	 * cts_protect - Whether CTS protection is enabled
701252726Srpaulo	 */
702252726Srpaulo	int cts_protect;
703252726Srpaulo
704252726Srpaulo	/**
705252726Srpaulo	 * preamble - Whether short preamble is enabled
706252726Srpaulo	 */
707252726Srpaulo	int preamble;
708252726Srpaulo
709252726Srpaulo	/**
710252726Srpaulo	 * short_slot_time - Whether short slot time is enabled
711252726Srpaulo	 *
712252726Srpaulo	 * 0 = short slot time disable, 1 = short slot time enabled, -1 = do
713252726Srpaulo	 * not set (e.g., when 802.11g mode is not in use)
714252726Srpaulo	 */
715252726Srpaulo	int short_slot_time;
716252726Srpaulo
717252726Srpaulo	/**
718252726Srpaulo	 * ht_opmode - HT operation mode or -1 if HT not in use
719252726Srpaulo	 */
720252726Srpaulo	int ht_opmode;
721252726Srpaulo
722252726Srpaulo	/**
723252726Srpaulo	 * interworking - Whether Interworking is enabled
724252726Srpaulo	 */
725252726Srpaulo	int interworking;
726252726Srpaulo
727252726Srpaulo	/**
728252726Srpaulo	 * hessid - Homogeneous ESS identifier or %NULL if not set
729252726Srpaulo	 */
730252726Srpaulo	const u8 *hessid;
731252726Srpaulo
732252726Srpaulo	/**
733252726Srpaulo	 * access_network_type - Access Network Type (0..15)
734252726Srpaulo	 *
735252726Srpaulo	 * This is used for filtering Probe Request frames when Interworking is
736252726Srpaulo	 * enabled.
737252726Srpaulo	 */
738252726Srpaulo	u8 access_network_type;
739252726Srpaulo
740252726Srpaulo	/**
741252726Srpaulo	 * ap_max_inactivity - Timeout in seconds to detect STA's inactivity
742252726Srpaulo	 *
743252726Srpaulo	 * This is used by driver which advertises this capability.
744252726Srpaulo	 */
745252726Srpaulo	int ap_max_inactivity;
746252726Srpaulo
747252726Srpaulo	/**
748252726Srpaulo	 * disable_dgaf - Whether group-addressed frames are disabled
749252726Srpaulo	 */
750252726Srpaulo	int disable_dgaf;
751252726Srpaulo};
752252726Srpaulo
753189251Ssam/**
754189251Ssam * struct wpa_driver_capa - Driver capability information
755189251Ssam */
756189251Ssamstruct wpa_driver_capa {
757189251Ssam#define WPA_DRIVER_CAPA_KEY_MGMT_WPA		0x00000001
758189251Ssam#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2		0x00000002
759189251Ssam#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK	0x00000004
760189251Ssam#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK	0x00000008
761189251Ssam#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE	0x00000010
762189251Ssam#define WPA_DRIVER_CAPA_KEY_MGMT_FT		0x00000020
763189251Ssam#define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK		0x00000040
764252726Srpaulo#define WPA_DRIVER_CAPA_KEY_MGMT_WAPI_PSK	0x00000080
765189251Ssam	unsigned int key_mgmt;
766189251Ssam
767189251Ssam#define WPA_DRIVER_CAPA_ENC_WEP40	0x00000001
768189251Ssam#define WPA_DRIVER_CAPA_ENC_WEP104	0x00000002
769189251Ssam#define WPA_DRIVER_CAPA_ENC_TKIP	0x00000004
770189251Ssam#define WPA_DRIVER_CAPA_ENC_CCMP	0x00000008
771252726Srpaulo#define WPA_DRIVER_CAPA_ENC_WEP128	0x00000010
772252726Srpaulo#define WPA_DRIVER_CAPA_ENC_GCMP	0x00000020
773189251Ssam	unsigned int enc;
774189251Ssam
775189251Ssam#define WPA_DRIVER_AUTH_OPEN		0x00000001
776189251Ssam#define WPA_DRIVER_AUTH_SHARED		0x00000002
777189251Ssam#define WPA_DRIVER_AUTH_LEAP		0x00000004
778189251Ssam	unsigned int auth;
779189251Ssam
780189251Ssam/* Driver generated WPA/RSN IE */
781189251Ssam#define WPA_DRIVER_FLAGS_DRIVER_IE	0x00000001
782214734Srpaulo/* Driver needs static WEP key setup after association command */
783189251Ssam#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
784252726Srpaulo/* unused: 0x00000004 */
785189251Ssam/* Driver takes care of RSN 4-way handshake internally; PMK is configured with
786189251Ssam * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
787189251Ssam#define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008
788214734Srpaulo#define WPA_DRIVER_FLAGS_WIRED		0x00000010
789214734Srpaulo/* Driver provides separate commands for authentication and association (SME in
790214734Srpaulo * wpa_supplicant). */
791214734Srpaulo#define WPA_DRIVER_FLAGS_SME		0x00000020
792214734Srpaulo/* Driver supports AP mode */
793214734Srpaulo#define WPA_DRIVER_FLAGS_AP		0x00000040
794214734Srpaulo/* Driver needs static WEP key setup after association has been completed */
795214734Srpaulo#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE	0x00000080
796252726Srpaulo/* Driver takes care of P2P management operations */
797252726Srpaulo#define WPA_DRIVER_FLAGS_P2P_MGMT	0x00000100
798252726Srpaulo/* Driver supports concurrent P2P operations */
799252726Srpaulo#define WPA_DRIVER_FLAGS_P2P_CONCURRENT	0x00000200
800252726Srpaulo/*
801252726Srpaulo * Driver uses the initial interface as a dedicated management interface, i.e.,
802252726Srpaulo * it cannot be used for P2P group operations or non-P2P purposes.
803252726Srpaulo */
804252726Srpaulo#define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE	0x00000400
805252726Srpaulo/* This interface is P2P capable (P2P Device, GO, or P2P Client */
806252726Srpaulo#define WPA_DRIVER_FLAGS_P2P_CAPABLE	0x00000800
807252726Srpaulo/* Driver supports concurrent operations on multiple channels */
808252726Srpaulo#define WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT	0x00001000
809252726Srpaulo/*
810252726Srpaulo * Driver uses the initial interface for P2P management interface and non-P2P
811252726Srpaulo * purposes (e.g., connect to infra AP), but this interface cannot be used for
812252726Srpaulo * P2P group operations.
813252726Srpaulo */
814252726Srpaulo#define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P		0x00002000
815252726Srpaulo/*
816252726Srpaulo * Driver is known to use sane error codes, i.e., when it indicates that
817252726Srpaulo * something (e.g., association) fails, there was indeed a failure and the
818252726Srpaulo * operation does not end up getting completed successfully later.
819252726Srpaulo */
820252726Srpaulo#define WPA_DRIVER_FLAGS_SANE_ERROR_CODES		0x00004000
821252726Srpaulo/* Driver supports off-channel TX */
822252726Srpaulo#define WPA_DRIVER_FLAGS_OFFCHANNEL_TX			0x00008000
823252726Srpaulo/* Driver indicates TX status events for EAPOL Data frames */
824252726Srpaulo#define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS		0x00010000
825252726Srpaulo/* Driver indicates TX status events for Deauth/Disassoc frames */
826252726Srpaulo#define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS		0x00020000
827252726Srpaulo/* Driver supports roaming (BSS selection) in firmware */
828252726Srpaulo#define WPA_DRIVER_FLAGS_BSS_SELECTION			0x00040000
829252726Srpaulo/* Driver supports operating as a TDLS peer */
830252726Srpaulo#define WPA_DRIVER_FLAGS_TDLS_SUPPORT			0x00080000
831252726Srpaulo/* Driver requires external TDLS setup/teardown/discovery */
832252726Srpaulo#define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP		0x00100000
833252726Srpaulo/* Driver indicates support for Probe Response offloading in AP mode */
834252726Srpaulo#define WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD		0x00200000
835252726Srpaulo/* Driver supports U-APSD in AP mode */
836252726Srpaulo#define WPA_DRIVER_FLAGS_AP_UAPSD			0x00400000
837252726Srpaulo/* Driver supports inactivity timer in AP mode */
838252726Srpaulo#define WPA_DRIVER_FLAGS_INACTIVITY_TIMER		0x00800000
839252726Srpaulo/* Driver expects user space implementation of MLME in AP mode */
840252726Srpaulo#define WPA_DRIVER_FLAGS_AP_MLME			0x01000000
841252726Srpaulo/* Driver supports SAE with user space SME */
842252726Srpaulo#define WPA_DRIVER_FLAGS_SAE				0x02000000
843252726Srpaulo/* Driver makes use of OBSS scan mechanism in wpa_supplicant */
844252726Srpaulo#define WPA_DRIVER_FLAGS_OBSS_SCAN			0x04000000
845189251Ssam	unsigned int flags;
846214734Srpaulo
847214734Srpaulo	int max_scan_ssids;
848252726Srpaulo	int max_sched_scan_ssids;
849252726Srpaulo	int sched_scan_supported;
850252726Srpaulo	int max_match_sets;
851214734Srpaulo
852214734Srpaulo	/**
853214734Srpaulo	 * max_remain_on_chan - Maximum remain-on-channel duration in msec
854214734Srpaulo	 */
855214734Srpaulo	unsigned int max_remain_on_chan;
856252726Srpaulo
857252726Srpaulo	/**
858252726Srpaulo	 * max_stations - Maximum number of associated stations the driver
859252726Srpaulo	 * supports in AP mode
860252726Srpaulo	 */
861252726Srpaulo	unsigned int max_stations;
862252726Srpaulo
863252726Srpaulo	/**
864252726Srpaulo	 * probe_resp_offloads - Bitmap of supported protocols by the driver
865252726Srpaulo	 * for Probe Response offloading.
866252726Srpaulo	 */
867252726Srpaulo/* Driver Probe Response offloading support for WPS ver. 1 */
868252726Srpaulo#define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS		0x00000001
869252726Srpaulo/* Driver Probe Response offloading support for WPS ver. 2 */
870252726Srpaulo#define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS2		0x00000002
871252726Srpaulo/* Driver Probe Response offloading support for P2P */
872252726Srpaulo#define WPA_DRIVER_PROBE_RESP_OFFLOAD_P2P		0x00000004
873252726Srpaulo/* Driver Probe Response offloading support for IEEE 802.11u (Interworking) */
874252726Srpaulo#define WPA_DRIVER_PROBE_RESP_OFFLOAD_INTERWORKING	0x00000008
875252726Srpaulo	unsigned int probe_resp_offloads;
876189251Ssam};
877189251Ssam
878189251Ssam
879214734Srpaulostruct hostapd_data;
880189251Ssam
881214734Srpaulostruct hostap_sta_driver_data {
882214734Srpaulo	unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
883214734Srpaulo	unsigned long current_tx_rate;
884214734Srpaulo	unsigned long inactive_msec;
885214734Srpaulo	unsigned long flags;
886214734Srpaulo	unsigned long num_ps_buf_frames;
887214734Srpaulo	unsigned long tx_retry_failed;
888214734Srpaulo	unsigned long tx_retry_count;
889214734Srpaulo	int last_rssi;
890214734Srpaulo	int last_ack_rssi;
891189251Ssam};
892189251Ssam
893214734Srpaulostruct hostapd_sta_add_params {
894214734Srpaulo	const u8 *addr;
895214734Srpaulo	u16 aid;
896214734Srpaulo	u16 capability;
897214734Srpaulo	const u8 *supp_rates;
898214734Srpaulo	size_t supp_rates_len;
899214734Srpaulo	u16 listen_interval;
900214734Srpaulo	const struct ieee80211_ht_capabilities *ht_capabilities;
901252726Srpaulo	u32 flags; /* bitmask of WPA_STA_* flags */
902252726Srpaulo	int set; /* Set STA parameters instead of add */
903252726Srpaulo	u8 qosinfo;
904214734Srpaulo};
905189251Ssam
906214734Srpaulostruct hostapd_freq_params {
907214734Srpaulo	int mode;
908214734Srpaulo	int freq;
909214734Srpaulo	int channel;
910214734Srpaulo	int ht_enabled;
911214734Srpaulo	int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
912214734Srpaulo				 * secondary channel below primary, 1 = HT40
913214734Srpaulo				 * enabled, secondary channel above primary */
914189251Ssam};
915189251Ssam
916214734Srpauloenum wpa_driver_if_type {
917214734Srpaulo	/**
918214734Srpaulo	 * WPA_IF_STATION - Station mode interface
919214734Srpaulo	 */
920214734Srpaulo	WPA_IF_STATION,
921189251Ssam
922214734Srpaulo	/**
923214734Srpaulo	 * WPA_IF_AP_VLAN - AP mode VLAN interface
924214734Srpaulo	 *
925214734Srpaulo	 * This interface shares its address and Beacon frame with the main
926214734Srpaulo	 * BSS.
927214734Srpaulo	 */
928214734Srpaulo	WPA_IF_AP_VLAN,
929214734Srpaulo
930214734Srpaulo	/**
931214734Srpaulo	 * WPA_IF_AP_BSS - AP mode BSS interface
932214734Srpaulo	 *
933214734Srpaulo	 * This interface has its own address and Beacon frame.
934214734Srpaulo	 */
935214734Srpaulo	WPA_IF_AP_BSS,
936252726Srpaulo
937252726Srpaulo	/**
938252726Srpaulo	 * WPA_IF_P2P_GO - P2P Group Owner
939252726Srpaulo	 */
940252726Srpaulo	WPA_IF_P2P_GO,
941252726Srpaulo
942252726Srpaulo	/**
943252726Srpaulo	 * WPA_IF_P2P_CLIENT - P2P Client
944252726Srpaulo	 */
945252726Srpaulo	WPA_IF_P2P_CLIENT,
946252726Srpaulo
947252726Srpaulo	/**
948252726Srpaulo	 * WPA_IF_P2P_GROUP - P2P Group interface (will become either
949252726Srpaulo	 * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known)
950252726Srpaulo	 */
951252726Srpaulo	WPA_IF_P2P_GROUP
952189251Ssam};
953189251Ssam
954214734Srpaulostruct wpa_init_params {
955252726Srpaulo	void *global_priv;
956214734Srpaulo	const u8 *bssid;
957214734Srpaulo	const char *ifname;
958214734Srpaulo	const u8 *ssid;
959214734Srpaulo	size_t ssid_len;
960214734Srpaulo	const char *test_socket;
961214734Srpaulo	int use_pae_group_addr;
962214734Srpaulo	char **bridge;
963214734Srpaulo	size_t num_bridge;
964189251Ssam
965214734Srpaulo	u8 *own_addr; /* buffer for writing own MAC address */
966189251Ssam};
967189251Ssam
968189251Ssam
969214734Srpaulostruct wpa_bss_params {
970214734Srpaulo	/** Interface name (for multi-SSID/VLAN support) */
971214734Srpaulo	const char *ifname;
972214734Srpaulo	/** Whether IEEE 802.1X or WPA/WPA2 is enabled */
973214734Srpaulo	int enabled;
974214734Srpaulo
975214734Srpaulo	int wpa;
976214734Srpaulo	int ieee802_1x;
977214734Srpaulo	int wpa_group;
978214734Srpaulo	int wpa_pairwise;
979214734Srpaulo	int wpa_key_mgmt;
980214734Srpaulo	int rsn_preauth;
981252726Srpaulo	enum mfp_options ieee80211w;
982214734Srpaulo};
983214734Srpaulo
984214734Srpaulo#define WPA_STA_AUTHORIZED BIT(0)
985214734Srpaulo#define WPA_STA_WMM BIT(1)
986214734Srpaulo#define WPA_STA_SHORT_PREAMBLE BIT(2)
987214734Srpaulo#define WPA_STA_MFP BIT(3)
988252726Srpaulo#define WPA_STA_TDLS_PEER BIT(4)
989214734Srpaulo
990189251Ssam/**
991252726Srpaulo * struct p2p_params - P2P parameters for driver-based P2P management
992252726Srpaulo */
993252726Srpaulostruct p2p_params {
994252726Srpaulo	const char *dev_name;
995252726Srpaulo	u8 pri_dev_type[8];
996252726Srpaulo#define DRV_MAX_SEC_DEV_TYPES 5
997252726Srpaulo	u8 sec_dev_type[DRV_MAX_SEC_DEV_TYPES][8];
998252726Srpaulo	size_t num_sec_dev_types;
999252726Srpaulo};
1000252726Srpaulo
1001252726Srpauloenum tdls_oper {
1002252726Srpaulo	TDLS_DISCOVERY_REQ,
1003252726Srpaulo	TDLS_SETUP,
1004252726Srpaulo	TDLS_TEARDOWN,
1005252726Srpaulo	TDLS_ENABLE_LINK,
1006252726Srpaulo	TDLS_DISABLE_LINK,
1007252726Srpaulo	TDLS_ENABLE,
1008252726Srpaulo	TDLS_DISABLE
1009252726Srpaulo};
1010252726Srpaulo
1011252726Srpauloenum wnm_oper {
1012252726Srpaulo	WNM_SLEEP_ENTER_CONFIRM,
1013252726Srpaulo	WNM_SLEEP_ENTER_FAIL,
1014252726Srpaulo	WNM_SLEEP_EXIT_CONFIRM,
1015252726Srpaulo	WNM_SLEEP_EXIT_FAIL,
1016252726Srpaulo	WNM_SLEEP_TFS_REQ_IE_ADD,   /* STA requests driver to add TFS req IE */
1017252726Srpaulo	WNM_SLEEP_TFS_REQ_IE_NONE,  /* STA requests empty TFS req IE */
1018252726Srpaulo	WNM_SLEEP_TFS_REQ_IE_SET,   /* AP requests driver to set TFS req IE for
1019252726Srpaulo				     * a STA */
1020252726Srpaulo	WNM_SLEEP_TFS_RESP_IE_ADD,  /* AP requests driver to add TFS resp IE
1021252726Srpaulo				     * for a STA */
1022252726Srpaulo	WNM_SLEEP_TFS_RESP_IE_NONE, /* AP requests empty TFS resp IE */
1023252726Srpaulo	WNM_SLEEP_TFS_RESP_IE_SET,  /* AP requests driver to set TFS resp IE
1024252726Srpaulo				     * for a STA */
1025252726Srpaulo	WNM_SLEEP_TFS_IE_DEL        /* AP delete the TFS IE */
1026252726Srpaulo};
1027252726Srpaulo
1028252726Srpaulo/**
1029252726Srpaulo * struct wpa_signal_info - Information about channel signal quality
1030252726Srpaulo */
1031252726Srpaulostruct wpa_signal_info {
1032252726Srpaulo	u32 frequency;
1033252726Srpaulo	int above_threshold;
1034252726Srpaulo	int current_signal;
1035252726Srpaulo	int current_noise;
1036252726Srpaulo	int current_txrate;
1037252726Srpaulo};
1038252726Srpaulo
1039252726Srpaulo/**
1040189251Ssam * struct wpa_driver_ops - Driver interface API definition
1041189251Ssam *
1042189251Ssam * This structure defines the API that each driver interface needs to implement
1043189251Ssam * for core wpa_supplicant code. All driver specific functionality is captured
1044189251Ssam * in this wrapper.
1045189251Ssam */
1046189251Ssamstruct wpa_driver_ops {
1047189251Ssam	/** Name of the driver interface */
1048189251Ssam	const char *name;
1049189251Ssam	/** One line description of the driver interface */
1050189251Ssam	const char *desc;
1051189251Ssam
1052189251Ssam	/**
1053189251Ssam	 * get_bssid - Get the current BSSID
1054189251Ssam	 * @priv: private driver interface data
1055189251Ssam	 * @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)
1056189251Ssam	 *
1057189251Ssam	 * Returns: 0 on success, -1 on failure
1058189251Ssam	 *
1059189251Ssam	 * Query kernel driver for the current BSSID and copy it to bssid.
1060189251Ssam	 * Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not
1061189251Ssam	 * associated.
1062189251Ssam	 */
1063189251Ssam	int (*get_bssid)(void *priv, u8 *bssid);
1064189251Ssam
1065189251Ssam	/**
1066189251Ssam	 * get_ssid - Get the current SSID
1067189251Ssam	 * @priv: private driver interface data
1068189251Ssam	 * @ssid: buffer for SSID (at least 32 bytes)
1069189251Ssam	 *
1070189251Ssam	 * Returns: Length of the SSID on success, -1 on failure
1071189251Ssam	 *
1072189251Ssam	 * Query kernel driver for the current SSID and copy it to ssid.
1073189251Ssam	 * Returning zero is recommended if the STA is not associated.
1074189251Ssam	 *
1075189251Ssam	 * Note: SSID is an array of octets, i.e., it is not nul terminated and
1076189251Ssam	 * can, at least in theory, contain control characters (including nul)
1077189251Ssam	 * and as such, should be processed as binary data, not a printable
1078189251Ssam	 * string.
1079189251Ssam	 */
1080189251Ssam	int (*get_ssid)(void *priv, u8 *ssid);
1081189251Ssam
1082189251Ssam	/**
1083189251Ssam	 * set_key - Configure encryption key
1084214734Srpaulo	 * @ifname: Interface name (for multi-SSID/VLAN support)
1085189251Ssam	 * @priv: private driver interface data
1086189251Ssam	 * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
1087252726Srpaulo	 *	%WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK,
1088252726Srpaulo	 *	%WPA_ALG_GCMP);
1089189251Ssam	 *	%WPA_ALG_NONE clears the key.
1090252726Srpaulo	 * @addr: Address of the peer STA (BSSID of the current AP when setting
1091252726Srpaulo	 *	pairwise key in station mode), ff:ff:ff:ff:ff:ff for
1092252726Srpaulo	 *	broadcast keys, %NULL for default keys that are used both for
1093252726Srpaulo	 *	broadcast and unicast; when clearing keys, %NULL is used to
1094252726Srpaulo	 *	indicate that both the broadcast-only and default key of the
1095252726Srpaulo	 *	specified key index is to be cleared
1096189251Ssam	 * @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
1097189251Ssam	 *	IGTK
1098189251Ssam	 * @set_tx: configure this key as the default Tx key (only used when
1099189251Ssam	 *	driver does not support separate unicast/individual key
1100189251Ssam	 * @seq: sequence number/packet number, seq_len octets, the next
1101189251Ssam	 *	packet number to be used for in replay protection; configured
1102189251Ssam	 *	for Rx keys (in most cases, this is only used with broadcast
1103252726Srpaulo	 *	keys and set to zero for unicast keys); %NULL if not set
1104189251Ssam	 * @seq_len: length of the seq, depends on the algorithm:
1105252726Srpaulo	 *	TKIP: 6 octets, CCMP/GCMP: 6 octets, IGTK: 6 octets
1106189251Ssam	 * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
1107189251Ssam	 *	8-byte Rx Mic Key
1108189251Ssam	 * @key_len: length of the key buffer in octets (WEP: 5 or 13,
1109252726Srpaulo	 *	TKIP: 32, CCMP/GCMP: 16, IGTK: 16)
1110189251Ssam	 *
1111189251Ssam	 * Returns: 0 on success, -1 on failure
1112189251Ssam	 *
1113189251Ssam	 * Configure the given key for the kernel driver. If the driver
1114189251Ssam	 * supports separate individual keys (4 default keys + 1 individual),
1115189251Ssam	 * addr can be used to determine whether the key is default or
1116189251Ssam	 * individual. If only 4 keys are supported, the default key with key
1117189251Ssam	 * index 0 is used as the individual key. STA must be configured to use
1118189251Ssam	 * it as the default Tx key (set_tx is set) and accept Rx for all the
1119189251Ssam	 * key indexes. In most cases, WPA uses only key indexes 1 and 2 for
1120189251Ssam	 * broadcast keys, so key index 0 is available for this kind of
1121189251Ssam	 * configuration.
1122189251Ssam	 *
1123189251Ssam	 * Please note that TKIP keys include separate TX and RX MIC keys and
1124189251Ssam	 * some drivers may expect them in different order than wpa_supplicant
1125189251Ssam	 * is using. If the TX/RX keys are swapped, all TKIP encrypted packets
1126252726Srpaulo	 * will trigger Michael MIC errors. This can be fixed by changing the
1127189251Ssam	 * order of MIC keys by swapping te bytes 16..23 and 24..31 of the key
1128189251Ssam	 * in driver_*.c set_key() implementation, see driver_ndis.c for an
1129189251Ssam	 * example on how this can be done.
1130189251Ssam	 */
1131214734Srpaulo	int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg,
1132214734Srpaulo		       const u8 *addr, int key_idx, int set_tx,
1133214734Srpaulo		       const u8 *seq, size_t seq_len,
1134189251Ssam		       const u8 *key, size_t key_len);
1135189251Ssam
1136189251Ssam	/**
1137189251Ssam	 * init - Initialize driver interface
1138189251Ssam	 * @ctx: context to be used when calling wpa_supplicant functions,
1139189251Ssam	 * e.g., wpa_supplicant_event()
1140189251Ssam	 * @ifname: interface name, e.g., wlan0
1141189251Ssam	 *
1142189251Ssam	 * Returns: Pointer to private data, %NULL on failure
1143189251Ssam	 *
1144189251Ssam	 * Initialize driver interface, including event processing for kernel
1145189251Ssam	 * driver events (e.g., associated, scan results, Michael MIC failure).
1146189251Ssam	 * This function can allocate a private configuration data area for
1147189251Ssam	 * @ctx, file descriptor, interface name, etc. information that may be
1148189251Ssam	 * needed in future driver operations. If this is not used, non-NULL
1149189251Ssam	 * value will need to be returned because %NULL is used to indicate
1150189251Ssam	 * failure. The returned value will be used as 'void *priv' data for
1151189251Ssam	 * all other driver_ops functions.
1152189251Ssam	 *
1153189251Ssam	 * The main event loop (eloop.c) of wpa_supplicant can be used to
1154189251Ssam	 * register callback for read sockets (eloop_register_read_sock()).
1155189251Ssam	 *
1156189251Ssam	 * See below for more information about events and
1157189251Ssam	 * wpa_supplicant_event() function.
1158189251Ssam	 */
1159189251Ssam	void * (*init)(void *ctx, const char *ifname);
1160189251Ssam
1161189251Ssam	/**
1162189251Ssam	 * deinit - Deinitialize driver interface
1163189251Ssam	 * @priv: private driver interface data from init()
1164189251Ssam	 *
1165189251Ssam	 * Shut down driver interface and processing of driver events. Free
1166189251Ssam	 * private data buffer if one was allocated in init() handler.
1167189251Ssam	 */
1168189251Ssam	void (*deinit)(void *priv);
1169189251Ssam
1170189251Ssam	/**
1171189251Ssam	 * set_param - Set driver configuration parameters
1172189251Ssam	 * @priv: private driver interface data from init()
1173189251Ssam	 * @param: driver specific configuration parameters
1174189251Ssam	 *
1175189251Ssam	 * Returns: 0 on success, -1 on failure
1176189251Ssam	 *
1177189251Ssam	 * Optional handler for notifying driver interface about configuration
1178189251Ssam	 * parameters (driver_param).
1179189251Ssam	 */
1180189251Ssam	int (*set_param)(void *priv, const char *param);
1181189251Ssam
1182189251Ssam	/**
1183189251Ssam	 * set_countermeasures - Enable/disable TKIP countermeasures
1184189251Ssam	 * @priv: private driver interface data
1185189251Ssam	 * @enabled: 1 = countermeasures enabled, 0 = disabled
1186189251Ssam	 *
1187189251Ssam	 * Returns: 0 on success, -1 on failure
1188189251Ssam	 *
1189189251Ssam	 * Configure TKIP countermeasures. When these are enabled, the driver
1190189251Ssam	 * should drop all received and queued frames that are using TKIP.
1191189251Ssam	 */
1192189251Ssam	int (*set_countermeasures)(void *priv, int enabled);
1193189251Ssam
1194189251Ssam	/**
1195189251Ssam	 * deauthenticate - Request driver to deauthenticate
1196189251Ssam	 * @priv: private driver interface data
1197189251Ssam	 * @addr: peer address (BSSID of the AP)
1198189251Ssam	 * @reason_code: 16-bit reason code to be sent in the deauthentication
1199189251Ssam	 *	frame
1200189251Ssam	 *
1201189251Ssam	 * Returns: 0 on success, -1 on failure
1202189251Ssam	 */
1203189251Ssam	int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
1204189251Ssam
1205189251Ssam	/**
1206189251Ssam	 * associate - Request driver to associate
1207189251Ssam	 * @priv: private driver interface data
1208189251Ssam	 * @params: association parameters
1209189251Ssam	 *
1210189251Ssam	 * Returns: 0 on success, -1 on failure
1211189251Ssam	 */
1212189251Ssam	int (*associate)(void *priv,
1213189251Ssam			 struct wpa_driver_associate_params *params);
1214189251Ssam
1215189251Ssam	/**
1216189251Ssam	 * add_pmkid - Add PMKSA cache entry to the driver
1217189251Ssam	 * @priv: private driver interface data
1218189251Ssam	 * @bssid: BSSID for the PMKSA cache entry
1219189251Ssam	 * @pmkid: PMKID for the PMKSA cache entry
1220189251Ssam	 *
1221189251Ssam	 * Returns: 0 on success, -1 on failure
1222189251Ssam	 *
1223189251Ssam	 * This function is called when a new PMK is received, as a result of
1224189251Ssam	 * either normal authentication or RSN pre-authentication.
1225189251Ssam	 *
1226189251Ssam	 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
1227189251Ssam	 * associate(), add_pmkid() can be used to add new PMKSA cache entries
1228189251Ssam	 * in the driver. If the driver uses wpa_ie from wpa_supplicant, this
1229189251Ssam	 * driver_ops function does not need to be implemented. Likewise, if
1230189251Ssam	 * the driver does not support WPA, this function is not needed.
1231189251Ssam	 */
1232189251Ssam	int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
1233189251Ssam
1234189251Ssam	/**
1235189251Ssam	 * remove_pmkid - Remove PMKSA cache entry to the driver
1236189251Ssam	 * @priv: private driver interface data
1237189251Ssam	 * @bssid: BSSID for the PMKSA cache entry
1238189251Ssam	 * @pmkid: PMKID for the PMKSA cache entry
1239189251Ssam	 *
1240189251Ssam	 * Returns: 0 on success, -1 on failure
1241189251Ssam	 *
1242189251Ssam	 * This function is called when the supplicant drops a PMKSA cache
1243189251Ssam	 * entry for any reason.
1244189251Ssam	 *
1245189251Ssam	 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
1246189251Ssam	 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
1247189251Ssam	 * between the driver and wpa_supplicant. If the driver uses wpa_ie
1248189251Ssam	 * from wpa_supplicant, this driver_ops function does not need to be
1249189251Ssam	 * implemented. Likewise, if the driver does not support WPA, this
1250189251Ssam	 * function is not needed.
1251189251Ssam	 */
1252189251Ssam	int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
1253189251Ssam
1254189251Ssam	/**
1255189251Ssam	 * flush_pmkid - Flush PMKSA cache
1256189251Ssam	 * @priv: private driver interface data
1257189251Ssam	 *
1258189251Ssam	 * Returns: 0 on success, -1 on failure
1259189251Ssam	 *
1260189251Ssam	 * This function is called when the supplicant drops all PMKSA cache
1261189251Ssam	 * entries for any reason.
1262189251Ssam	 *
1263189251Ssam	 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
1264189251Ssam	 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
1265189251Ssam	 * between the driver and wpa_supplicant. If the driver uses wpa_ie
1266189251Ssam	 * from wpa_supplicant, this driver_ops function does not need to be
1267189251Ssam	 * implemented. Likewise, if the driver does not support WPA, this
1268189251Ssam	 * function is not needed.
1269189251Ssam	 */
1270189251Ssam	int (*flush_pmkid)(void *priv);
1271189251Ssam
1272189251Ssam	/**
1273209158Srpaulo	 * get_capa - Get driver capabilities
1274189251Ssam	 * @priv: private driver interface data
1275189251Ssam	 *
1276189251Ssam	 * Returns: 0 on success, -1 on failure
1277189251Ssam	 *
1278189251Ssam	 * Get driver/firmware/hardware capabilities.
1279189251Ssam	 */
1280189251Ssam	int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
1281189251Ssam
1282189251Ssam	/**
1283189251Ssam	 * poll - Poll driver for association information
1284189251Ssam	 * @priv: private driver interface data
1285189251Ssam	 *
1286189251Ssam	 * This is an option callback that can be used when the driver does not
1287189251Ssam	 * provide event mechanism for association events. This is called when
1288189251Ssam	 * receiving WPA EAPOL-Key messages that require association
1289189251Ssam	 * information. The driver interface is supposed to generate associnfo
1290189251Ssam	 * event before returning from this callback function. In addition, the
1291189251Ssam	 * driver interface should generate an association event after having
1292189251Ssam	 * sent out associnfo.
1293189251Ssam	 */
1294189251Ssam	void (*poll)(void *priv);
1295189251Ssam
1296189251Ssam	/**
1297189251Ssam	 * get_ifname - Get interface name
1298189251Ssam	 * @priv: private driver interface data
1299189251Ssam	 *
1300189251Ssam	 * Returns: Pointer to the interface name. This can differ from the
1301189251Ssam	 * interface name used in init() call. Init() is called first.
1302189251Ssam	 *
1303189251Ssam	 * This optional function can be used to allow the driver interface to
1304189251Ssam	 * replace the interface name with something else, e.g., based on an
1305189251Ssam	 * interface mapping from a more descriptive name.
1306189251Ssam	 */
1307189251Ssam	const char * (*get_ifname)(void *priv);
1308189251Ssam
1309189251Ssam	/**
1310189251Ssam	 * get_mac_addr - Get own MAC address
1311189251Ssam	 * @priv: private driver interface data
1312189251Ssam	 *
1313189251Ssam	 * Returns: Pointer to own MAC address or %NULL on failure
1314189251Ssam	 *
1315189251Ssam	 * This optional function can be used to get the own MAC address of the
1316189251Ssam	 * device from the driver interface code. This is only needed if the
1317189251Ssam	 * l2_packet implementation for the OS does not provide easy access to
1318189251Ssam	 * a MAC address. */
1319189251Ssam	const u8 * (*get_mac_addr)(void *priv);
1320189251Ssam
1321189251Ssam	/**
1322189251Ssam	 * send_eapol - Optional function for sending EAPOL packets
1323189251Ssam	 * @priv: private driver interface data
1324189251Ssam	 * @dest: Destination MAC address
1325189251Ssam	 * @proto: Ethertype
1326189251Ssam	 * @data: EAPOL packet starting with IEEE 802.1X header
1327189251Ssam	 * @data_len: Size of the EAPOL packet
1328189251Ssam	 *
1329189251Ssam	 * Returns: 0 on success, -1 on failure
1330189251Ssam	 *
1331189251Ssam	 * This optional function can be used to override l2_packet operations
1332189251Ssam	 * with driver specific functionality. If this function pointer is set,
1333189251Ssam	 * l2_packet module is not used at all and the driver interface code is
1334189251Ssam	 * responsible for receiving and sending all EAPOL packets. The
1335214734Srpaulo	 * received EAPOL packets are sent to core code with EVENT_EAPOL_RX
1336214734Srpaulo	 * event. The driver interface is required to implement get_mac_addr()
1337214734Srpaulo	 * handler if send_eapol() is used.
1338189251Ssam	 */
1339189251Ssam	int (*send_eapol)(void *priv, const u8 *dest, u16 proto,
1340189251Ssam			  const u8 *data, size_t data_len);
1341189251Ssam
1342189251Ssam	/**
1343189251Ssam	 * set_operstate - Sets device operating state to DORMANT or UP
1344189251Ssam	 * @priv: private driver interface data
1345189251Ssam	 * @state: 0 = dormant, 1 = up
1346189251Ssam	 * Returns: 0 on success, -1 on failure
1347189251Ssam	 *
1348189251Ssam	 * This is an optional function that can be used on operating systems
1349189251Ssam	 * that support a concept of controlling network device state from user
1350189251Ssam	 * space applications. This function, if set, gets called with
1351189251Ssam	 * state = 1 when authentication has been completed and with state = 0
1352189251Ssam	 * when connection is lost.
1353189251Ssam	 */
1354189251Ssam	int (*set_operstate)(void *priv, int state);
1355189251Ssam
1356189251Ssam	/**
1357189251Ssam	 * mlme_setprotection - MLME-SETPROTECTION.request primitive
1358189251Ssam	 * @priv: Private driver interface data
1359189251Ssam	 * @addr: Address of the station for which to set protection (may be
1360189251Ssam	 * %NULL for group keys)
1361189251Ssam	 * @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_*
1362189251Ssam	 * @key_type: MLME_SETPROTECTION_KEY_TYPE_*
1363189251Ssam	 * Returns: 0 on success, -1 on failure
1364189251Ssam	 *
1365189251Ssam	 * This is an optional function that can be used to set the driver to
1366189251Ssam	 * require protection for Tx and/or Rx frames. This uses the layer
1367189251Ssam	 * interface defined in IEEE 802.11i-2004 clause 10.3.22.1
1368189251Ssam	 * (MLME-SETPROTECTION.request). Many drivers do not use explicit
1369189251Ssam	 * set protection operation; instead, they set protection implicitly
1370189251Ssam	 * based on configured keys.
1371189251Ssam	 */
1372189251Ssam	int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
1373189251Ssam				  int key_type);
1374189251Ssam
1375189251Ssam	/**
1376189251Ssam	 * get_hw_feature_data - Get hardware support data (channels and rates)
1377189251Ssam	 * @priv: Private driver interface data
1378189251Ssam	 * @num_modes: Variable for returning the number of returned modes
1379189251Ssam	 * flags: Variable for returning hardware feature flags
1380189251Ssam	 * Returns: Pointer to allocated hardware data on success or %NULL on
1381189251Ssam	 * failure. Caller is responsible for freeing this.
1382189251Ssam	 */
1383214734Srpaulo	struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
1384214734Srpaulo							 u16 *num_modes,
1385214734Srpaulo							 u16 *flags);
1386189251Ssam
1387189251Ssam	/**
1388189251Ssam	 * send_mlme - Send management frame from MLME
1389189251Ssam	 * @priv: Private driver interface data
1390189251Ssam	 * @data: IEEE 802.11 management frame with IEEE 802.11 header
1391189251Ssam	 * @data_len: Size of the management frame
1392252726Srpaulo	 * @noack: Do not wait for this frame to be acked (disable retries)
1393189251Ssam	 * Returns: 0 on success, -1 on failure
1394189251Ssam	 */
1395252726Srpaulo	int (*send_mlme)(void *priv, const u8 *data, size_t data_len,
1396252726Srpaulo			 int noack);
1397189251Ssam
1398189251Ssam	/**
1399189251Ssam	 * update_ft_ies - Update FT (IEEE 802.11r) IEs
1400189251Ssam	 * @priv: Private driver interface data
1401189251Ssam	 * @md: Mobility domain (2 octets) (also included inside ies)
1402189251Ssam	 * @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs
1403189251Ssam	 * @ies_len: Length of FT IEs in bytes
1404189251Ssam	 * Returns: 0 on success, -1 on failure
1405189251Ssam	 *
1406189251Ssam	 * The supplicant uses this callback to let the driver know that keying
1407189251Ssam	 * material for FT is available and that the driver can use the
1408189251Ssam	 * provided IEs in the next message in FT authentication sequence.
1409189251Ssam	 *
1410189251Ssam	 * This function is only needed for driver that support IEEE 802.11r
1411189251Ssam	 * (Fast BSS Transition).
1412189251Ssam	 */
1413189251Ssam	int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies,
1414189251Ssam			     size_t ies_len);
1415189251Ssam
1416189251Ssam	/**
1417189251Ssam	 * send_ft_action - Send FT Action frame (IEEE 802.11r)
1418189251Ssam	 * @priv: Private driver interface data
1419189251Ssam	 * @action: Action field value
1420189251Ssam	 * @target_ap: Target AP address
1421189251Ssam	 * @ies: FT IEs (MDIE, FTIE, ...) (FT Request action frame body)
1422189251Ssam	 * @ies_len: Length of FT IEs in bytes
1423189251Ssam	 * Returns: 0 on success, -1 on failure
1424189251Ssam	 *
1425189251Ssam	 * The supplicant uses this callback to request the driver to transmit
1426189251Ssam	 * an FT Action frame (action category 6) for over-the-DS fast BSS
1427189251Ssam	 * transition.
1428189251Ssam	 */
1429189251Ssam	int (*send_ft_action)(void *priv, u8 action, const u8 *target_ap,
1430189251Ssam			      const u8 *ies, size_t ies_len);
1431189251Ssam
1432189251Ssam	/**
1433189251Ssam	 * get_scan_results2 - Fetch the latest scan results
1434189251Ssam	 * @priv: private driver interface data
1435189251Ssam	 *
1436189251Ssam	 * Returns: Allocated buffer of scan results (caller is responsible for
1437189251Ssam	 * freeing the data structure) on success, NULL on failure
1438189251Ssam	 */
1439189251Ssam	 struct wpa_scan_results * (*get_scan_results2)(void *priv);
1440189251Ssam
1441189251Ssam	/**
1442189251Ssam	 * set_country - Set country
1443189251Ssam	 * @priv: Private driver interface data
1444189251Ssam	 * @alpha2: country to which to switch to
1445189251Ssam	 * Returns: 0 on success, -1 on failure
1446189251Ssam	 *
1447189251Ssam	 * This function is for drivers which support some form
1448189251Ssam	 * of setting a regulatory domain.
1449189251Ssam	 */
1450189251Ssam	int (*set_country)(void *priv, const char *alpha2);
1451189251Ssam
1452189251Ssam	/**
1453189251Ssam	 * global_init - Global driver initialization
1454189251Ssam	 * Returns: Pointer to private data (global), %NULL on failure
1455189251Ssam	 *
1456189251Ssam	 * This optional function is called to initialize the driver wrapper
1457189251Ssam	 * for global data, i.e., data that applies to all interfaces. If this
1458189251Ssam	 * function is implemented, global_deinit() will also need to be
1459189251Ssam	 * implemented to free the private data. The driver will also likely
1460189251Ssam	 * use init2() function instead of init() to get the pointer to global
1461189251Ssam	 * data available to per-interface initializer.
1462189251Ssam	 */
1463189251Ssam	void * (*global_init)(void);
1464189251Ssam
1465189251Ssam	/**
1466189251Ssam	 * global_deinit - Global driver deinitialization
1467189251Ssam	 * @priv: private driver global data from global_init()
1468189251Ssam	 *
1469189251Ssam	 * Terminate any global driver related functionality and free the
1470189251Ssam	 * global data structure.
1471189251Ssam	 */
1472189251Ssam	void (*global_deinit)(void *priv);
1473189251Ssam
1474189251Ssam	/**
1475189251Ssam	 * init2 - Initialize driver interface (with global data)
1476189251Ssam	 * @ctx: context to be used when calling wpa_supplicant functions,
1477189251Ssam	 * e.g., wpa_supplicant_event()
1478189251Ssam	 * @ifname: interface name, e.g., wlan0
1479189251Ssam	 * @global_priv: private driver global data from global_init()
1480189251Ssam	 * Returns: Pointer to private data, %NULL on failure
1481189251Ssam	 *
1482189251Ssam	 * This function can be used instead of init() if the driver wrapper
1483189251Ssam	 * uses global data.
1484189251Ssam	 */
1485189251Ssam	void * (*init2)(void *ctx, const char *ifname, void *global_priv);
1486189251Ssam
1487189251Ssam	/**
1488189251Ssam	 * get_interfaces - Get information about available interfaces
1489189251Ssam	 * @global_priv: private driver global data from global_init()
1490189251Ssam	 * Returns: Allocated buffer of interface information (caller is
1491189251Ssam	 * responsible for freeing the data structure) on success, NULL on
1492189251Ssam	 * failure
1493189251Ssam	 */
1494189251Ssam	struct wpa_interface_info * (*get_interfaces)(void *global_priv);
1495214734Srpaulo
1496214734Srpaulo	/**
1497214734Srpaulo	 * scan2 - Request the driver to initiate scan
1498214734Srpaulo	 * @priv: private driver interface data
1499214734Srpaulo	 * @params: Scan parameters
1500214734Srpaulo	 *
1501214734Srpaulo	 * Returns: 0 on success, -1 on failure
1502214734Srpaulo	 *
1503214734Srpaulo	 * Once the scan results are ready, the driver should report scan
1504214734Srpaulo	 * results event for wpa_supplicant which will eventually request the
1505214734Srpaulo	 * results with wpa_driver_get_scan_results2().
1506214734Srpaulo	 */
1507214734Srpaulo	int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
1508214734Srpaulo
1509214734Srpaulo	/**
1510214734Srpaulo	 * authenticate - Request driver to authenticate
1511214734Srpaulo	 * @priv: private driver interface data
1512214734Srpaulo	 * @params: authentication parameters
1513214734Srpaulo	 * Returns: 0 on success, -1 on failure
1514214734Srpaulo	 *
1515214734Srpaulo	 * This is an optional function that can be used with drivers that
1516214734Srpaulo	 * support separate authentication and association steps, i.e., when
1517214734Srpaulo	 * wpa_supplicant can act as the SME. If not implemented, associate()
1518214734Srpaulo	 * function is expected to take care of IEEE 802.11 authentication,
1519214734Srpaulo	 * too.
1520214734Srpaulo	 */
1521214734Srpaulo	int (*authenticate)(void *priv,
1522214734Srpaulo			    struct wpa_driver_auth_params *params);
1523214734Srpaulo
1524214734Srpaulo	/**
1525252726Srpaulo	 * set_ap - Set Beacon and Probe Response information for AP mode
1526214734Srpaulo	 * @priv: Private driver interface data
1527252726Srpaulo	 * @params: Parameters to use in AP mode
1528214734Srpaulo	 *
1529252726Srpaulo	 * This function is used to configure Beacon template and/or extra IEs
1530252726Srpaulo	 * to add for Beacon and Probe Response frames for the driver in
1531214734Srpaulo	 * AP mode. The driver is responsible for building the full Beacon
1532214734Srpaulo	 * frame by concatenating the head part with TIM IE generated by the
1533252726Srpaulo	 * driver/firmware and finishing with the tail part. Depending on the
1534252726Srpaulo	 * driver architectue, this can be done either by using the full
1535252726Srpaulo	 * template or the set of additional IEs (e.g., WPS and P2P IE).
1536252726Srpaulo	 * Similarly, Probe Response processing depends on the driver design.
1537252726Srpaulo	 * If the driver (or firmware) takes care of replying to Probe Request
1538252726Srpaulo	 * frames, the extra IEs provided here needs to be added to the Probe
1539252726Srpaulo	 * Response frames.
1540252726Srpaulo	 *
1541252726Srpaulo	 * Returns: 0 on success, -1 on failure
1542214734Srpaulo	 */
1543252726Srpaulo	int (*set_ap)(void *priv, struct wpa_driver_ap_params *params);
1544214734Srpaulo
1545214734Srpaulo	/**
1546214734Srpaulo	 * hapd_init - Initialize driver interface (hostapd only)
1547214734Srpaulo	 * @hapd: Pointer to hostapd context
1548214734Srpaulo	 * @params: Configuration for the driver wrapper
1549214734Srpaulo	 * Returns: Pointer to private data, %NULL on failure
1550214734Srpaulo	 *
1551214734Srpaulo	 * This function is used instead of init() or init2() when the driver
1552252726Srpaulo	 * wrapper is used with hostapd.
1553214734Srpaulo	 */
1554214734Srpaulo	void * (*hapd_init)(struct hostapd_data *hapd,
1555214734Srpaulo			    struct wpa_init_params *params);
1556214734Srpaulo
1557214734Srpaulo	/**
1558214734Srpaulo	 * hapd_deinit - Deinitialize driver interface (hostapd only)
1559214734Srpaulo	 * @priv: Private driver interface data from hapd_init()
1560214734Srpaulo	 */
1561214734Srpaulo	void (*hapd_deinit)(void *priv);
1562214734Srpaulo
1563214734Srpaulo	/**
1564214734Srpaulo	 * set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
1565214734Srpaulo	 * @priv: Private driver interface data
1566214734Srpaulo	 * @params: BSS parameters
1567214734Srpaulo	 * Returns: 0 on success, -1 on failure
1568214734Srpaulo	 *
1569214734Srpaulo	 * This is an optional function to configure the kernel driver to
1570214734Srpaulo	 * enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
1571214734Srpaulo	 * can be left undefined (set to %NULL) if IEEE 802.1X support is
1572252726Srpaulo	 * always enabled and the driver uses set_ap() to set WPA/RSN IE
1573214734Srpaulo	 * for Beacon frames.
1574252726Srpaulo	 *
1575252726Srpaulo	 * DEPRECATED - use set_ap() instead
1576214734Srpaulo	 */
1577214734Srpaulo	int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
1578214734Srpaulo
1579214734Srpaulo	/**
1580214734Srpaulo	 * set_privacy - Enable/disable privacy (AP only)
1581214734Srpaulo	 * @priv: Private driver interface data
1582214734Srpaulo	 * @enabled: 1 = privacy enabled, 0 = disabled
1583214734Srpaulo	 * Returns: 0 on success, -1 on failure
1584214734Srpaulo	 *
1585214734Srpaulo	 * This is an optional function to configure privacy field in the
1586214734Srpaulo	 * kernel driver for Beacon frames. This can be left undefined (set to
1587252726Srpaulo	 * %NULL) if the driver uses the Beacon template from set_ap().
1588252726Srpaulo	 *
1589252726Srpaulo	 * DEPRECATED - use set_ap() instead
1590214734Srpaulo	 */
1591214734Srpaulo	int (*set_privacy)(void *priv, int enabled);
1592214734Srpaulo
1593214734Srpaulo	/**
1594214734Srpaulo	 * get_seqnum - Fetch the current TSC/packet number (AP only)
1595214734Srpaulo	 * @ifname: The interface name (main or virtual)
1596214734Srpaulo	 * @priv: Private driver interface data
1597214734Srpaulo	 * @addr: MAC address of the station or %NULL for group keys
1598214734Srpaulo	 * @idx: Key index
1599214734Srpaulo	 * @seq: Buffer for returning the latest used TSC/packet number
1600214734Srpaulo	 * Returns: 0 on success, -1 on failure
1601214734Srpaulo	 *
1602214734Srpaulo	 * This function is used to fetch the last used TSC/packet number for
1603252726Srpaulo	 * a TKIP, CCMP, GCMP, or BIP/IGTK key. It is mainly used with group
1604252726Srpaulo	 * keys, so there is no strict requirement on implementing support for
1605252726Srpaulo	 * unicast keys (i.e., addr != %NULL).
1606214734Srpaulo	 */
1607214734Srpaulo	int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
1608214734Srpaulo			  int idx, u8 *seq);
1609214734Srpaulo
1610214734Srpaulo	/**
1611214734Srpaulo	 * flush - Flush all association stations (AP only)
1612214734Srpaulo	 * @priv: Private driver interface data
1613214734Srpaulo	 * Returns: 0 on success, -1 on failure
1614214734Srpaulo	 *
1615214734Srpaulo	 * This function requests the driver to disassociate all associated
1616214734Srpaulo	 * stations. This function does not need to be implemented if the
1617214734Srpaulo	 * driver does not process association frames internally.
1618214734Srpaulo	 */
1619214734Srpaulo	int (*flush)(void *priv);
1620214734Srpaulo
1621214734Srpaulo	/**
1622214734Srpaulo	 * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP)
1623214734Srpaulo	 * @priv: Private driver interface data
1624214734Srpaulo	 * @elem: Information elements
1625214734Srpaulo	 * @elem_len: Length of the elem buffer in octets
1626214734Srpaulo	 * Returns: 0 on success, -1 on failure
1627214734Srpaulo	 *
1628214734Srpaulo	 * This is an optional function to add information elements in the
1629214734Srpaulo	 * kernel driver for Beacon and Probe Response frames. This can be left
1630214734Srpaulo	 * undefined (set to %NULL) if the driver uses the Beacon template from
1631252726Srpaulo	 * set_ap().
1632252726Srpaulo	 *
1633252726Srpaulo	 * DEPRECATED - use set_ap() instead
1634214734Srpaulo	 */
1635214734Srpaulo	int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
1636214734Srpaulo
1637214734Srpaulo	/**
1638252726Srpaulo	 * read_sta_data - Fetch station data
1639214734Srpaulo	 * @priv: Private driver interface data
1640214734Srpaulo	 * @data: Buffer for returning station information
1641214734Srpaulo	 * @addr: MAC address of the station
1642214734Srpaulo	 * Returns: 0 on success, -1 on failure
1643214734Srpaulo	 */
1644214734Srpaulo	int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
1645214734Srpaulo			     const u8 *addr);
1646214734Srpaulo
1647214734Srpaulo	/**
1648214734Srpaulo	 * hapd_send_eapol - Send an EAPOL packet (AP only)
1649214734Srpaulo	 * @priv: private driver interface data
1650214734Srpaulo	 * @addr: Destination MAC address
1651214734Srpaulo	 * @data: EAPOL packet starting with IEEE 802.1X header
1652214734Srpaulo	 * @data_len: Length of the EAPOL packet in octets
1653214734Srpaulo	 * @encrypt: Whether the frame should be encrypted
1654214734Srpaulo	 * @own_addr: Source MAC address
1655252726Srpaulo	 * @flags: WPA_STA_* flags for the destination station
1656214734Srpaulo	 *
1657214734Srpaulo	 * Returns: 0 on success, -1 on failure
1658214734Srpaulo	 */
1659214734Srpaulo	int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
1660214734Srpaulo			       size_t data_len, int encrypt,
1661252726Srpaulo			       const u8 *own_addr, u32 flags);
1662214734Srpaulo
1663214734Srpaulo	/**
1664214734Srpaulo	 * sta_deauth - Deauthenticate a station (AP only)
1665214734Srpaulo	 * @priv: Private driver interface data
1666214734Srpaulo	 * @own_addr: Source address and BSSID for the Deauthentication frame
1667214734Srpaulo	 * @addr: MAC address of the station to deauthenticate
1668214734Srpaulo	 * @reason: Reason code for the Deauthentiation frame
1669214734Srpaulo	 * Returns: 0 on success, -1 on failure
1670214734Srpaulo	 *
1671214734Srpaulo	 * This function requests a specific station to be deauthenticated and
1672214734Srpaulo	 * a Deauthentication frame to be sent to it.
1673214734Srpaulo	 */
1674214734Srpaulo	int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
1675214734Srpaulo			  int reason);
1676214734Srpaulo
1677214734Srpaulo	/**
1678214734Srpaulo	 * sta_disassoc - Disassociate a station (AP only)
1679214734Srpaulo	 * @priv: Private driver interface data
1680214734Srpaulo	 * @own_addr: Source address and BSSID for the Disassociation frame
1681214734Srpaulo	 * @addr: MAC address of the station to disassociate
1682214734Srpaulo	 * @reason: Reason code for the Disassociation frame
1683214734Srpaulo	 * Returns: 0 on success, -1 on failure
1684214734Srpaulo	 *
1685214734Srpaulo	 * This function requests a specific station to be disassociated and
1686214734Srpaulo	 * a Disassociation frame to be sent to it.
1687214734Srpaulo	 */
1688214734Srpaulo	int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
1689214734Srpaulo			    int reason);
1690214734Srpaulo
1691214734Srpaulo	/**
1692214734Srpaulo	 * sta_remove - Remove a station entry (AP only)
1693214734Srpaulo	 * @priv: Private driver interface data
1694214734Srpaulo	 * @addr: MAC address of the station to be removed
1695214734Srpaulo	 * Returns: 0 on success, -1 on failure
1696214734Srpaulo	 */
1697214734Srpaulo	int (*sta_remove)(void *priv, const u8 *addr);
1698214734Srpaulo
1699214734Srpaulo	/**
1700214734Srpaulo	 * hapd_get_ssid - Get the current SSID (AP only)
1701214734Srpaulo	 * @priv: Private driver interface data
1702214734Srpaulo	 * @buf: Buffer for returning the SSID
1703214734Srpaulo	 * @len: Maximum length of the buffer
1704214734Srpaulo	 * Returns: Length of the SSID on success, -1 on failure
1705214734Srpaulo	 *
1706214734Srpaulo	 * This function need not be implemented if the driver uses Beacon
1707252726Srpaulo	 * template from set_ap() and does not reply to Probe Request frames.
1708214734Srpaulo	 */
1709214734Srpaulo	int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
1710214734Srpaulo
1711214734Srpaulo	/**
1712214734Srpaulo	 * hapd_set_ssid - Set SSID (AP only)
1713214734Srpaulo	 * @priv: Private driver interface data
1714214734Srpaulo	 * @buf: SSID
1715214734Srpaulo	 * @len: Length of the SSID in octets
1716214734Srpaulo	 * Returns: 0 on success, -1 on failure
1717252726Srpaulo	 *
1718252726Srpaulo	 * DEPRECATED - use set_ap() instead
1719214734Srpaulo	 */
1720214734Srpaulo	int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
1721214734Srpaulo
1722214734Srpaulo	/**
1723214734Srpaulo	 * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP)
1724214734Srpaulo	 * @priv: Private driver interface data
1725214734Srpaulo	 * @enabled: 1 = countermeasures enabled, 0 = disabled
1726214734Srpaulo	 * Returns: 0 on success, -1 on failure
1727214734Srpaulo	 *
1728214734Srpaulo	 * This need not be implemented if the driver does not take care of
1729214734Srpaulo	 * association processing.
1730214734Srpaulo	 */
1731214734Srpaulo	int (*hapd_set_countermeasures)(void *priv, int enabled);
1732214734Srpaulo
1733214734Srpaulo	/**
1734214734Srpaulo	 * sta_add - Add a station entry
1735214734Srpaulo	 * @priv: Private driver interface data
1736214734Srpaulo	 * @params: Station parameters
1737214734Srpaulo	 * Returns: 0 on success, -1 on failure
1738214734Srpaulo	 *
1739214734Srpaulo	 * This function is used to add a station entry to the driver once the
1740214734Srpaulo	 * station has completed association. This is only used if the driver
1741214734Srpaulo	 * does not take care of association processing.
1742252726Srpaulo	 *
1743252726Srpaulo	 * With TDLS, this function is also used to add or set (params->set 1)
1744252726Srpaulo	 * TDLS peer entries.
1745214734Srpaulo	 */
1746214734Srpaulo	int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
1747214734Srpaulo
1748214734Srpaulo	/**
1749214734Srpaulo	 * get_inact_sec - Get station inactivity duration (AP only)
1750214734Srpaulo	 * @priv: Private driver interface data
1751214734Srpaulo	 * @addr: Station address
1752214734Srpaulo	 * Returns: Number of seconds station has been inactive, -1 on failure
1753214734Srpaulo	 */
1754214734Srpaulo	int (*get_inact_sec)(void *priv, const u8 *addr);
1755214734Srpaulo
1756214734Srpaulo	/**
1757214734Srpaulo	 * sta_clear_stats - Clear station statistics (AP only)
1758214734Srpaulo	 * @priv: Private driver interface data
1759214734Srpaulo	 * @addr: Station address
1760214734Srpaulo	 * Returns: 0 on success, -1 on failure
1761214734Srpaulo	 */
1762214734Srpaulo	int (*sta_clear_stats)(void *priv, const u8 *addr);
1763214734Srpaulo
1764214734Srpaulo	/**
1765214734Srpaulo	 * set_freq - Set channel/frequency (AP only)
1766214734Srpaulo	 * @priv: Private driver interface data
1767214734Srpaulo	 * @freq: Channel parameters
1768214734Srpaulo	 * Returns: 0 on success, -1 on failure
1769214734Srpaulo	 */
1770214734Srpaulo	int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
1771214734Srpaulo
1772214734Srpaulo	/**
1773214734Srpaulo	 * set_rts - Set RTS threshold
1774214734Srpaulo	 * @priv: Private driver interface data
1775214734Srpaulo	 * @rts: RTS threshold in octets
1776214734Srpaulo	 * Returns: 0 on success, -1 on failure
1777214734Srpaulo	 */
1778214734Srpaulo	int (*set_rts)(void *priv, int rts);
1779214734Srpaulo
1780214734Srpaulo	/**
1781214734Srpaulo	 * set_frag - Set fragmentation threshold
1782214734Srpaulo	 * @priv: Private driver interface data
1783214734Srpaulo	 * @frag: Fragmentation threshold in octets
1784214734Srpaulo	 * Returns: 0 on success, -1 on failure
1785214734Srpaulo	 */
1786214734Srpaulo	int (*set_frag)(void *priv, int frag);
1787214734Srpaulo
1788214734Srpaulo	/**
1789214734Srpaulo	 * sta_set_flags - Set station flags (AP only)
1790214734Srpaulo	 * @priv: Private driver interface data
1791214734Srpaulo	 * @addr: Station address
1792214734Srpaulo	 * @total_flags: Bitmap of all WPA_STA_* flags currently set
1793214734Srpaulo	 * @flags_or: Bitmap of WPA_STA_* flags to add
1794214734Srpaulo	 * @flags_and: Bitmap of WPA_STA_* flags to us as a mask
1795214734Srpaulo	 * Returns: 0 on success, -1 on failure
1796214734Srpaulo	 */
1797214734Srpaulo	int (*sta_set_flags)(void *priv, const u8 *addr,
1798214734Srpaulo			     int total_flags, int flags_or, int flags_and);
1799214734Srpaulo
1800214734Srpaulo	/**
1801214734Srpaulo	 * set_tx_queue_params - Set TX queue parameters
1802214734Srpaulo	 * @priv: Private driver interface data
1803252726Srpaulo	 * @queue: Queue number (0 = VO, 1 = VI, 2 = BE, 3 = BK)
1804214734Srpaulo	 * @aifs: AIFS
1805214734Srpaulo	 * @cw_min: cwMin
1806214734Srpaulo	 * @cw_max: cwMax
1807214734Srpaulo	 * @burst_time: Maximum length for bursting in 0.1 msec units
1808214734Srpaulo	 */
1809214734Srpaulo	int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
1810214734Srpaulo				   int cw_max, int burst_time);
1811214734Srpaulo
1812214734Srpaulo	/**
1813214734Srpaulo	 * if_add - Add a virtual interface
1814214734Srpaulo	 * @priv: Private driver interface data
1815214734Srpaulo	 * @type: Interface type
1816214734Srpaulo	 * @ifname: Interface name for the new virtual interface
1817214734Srpaulo	 * @addr: Local address to use for the interface or %NULL to use the
1818214734Srpaulo	 *	parent interface address
1819214734Srpaulo	 * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces
1820214734Srpaulo	 * @drv_priv: Pointer for overwriting the driver context or %NULL if
1821214734Srpaulo	 *	not allowed (applies only to %WPA_IF_AP_BSS type)
1822214734Srpaulo	 * @force_ifname: Buffer for returning an interface name that the
1823214734Srpaulo	 *	driver ended up using if it differs from the requested ifname
1824214734Srpaulo	 * @if_addr: Buffer for returning the allocated interface address
1825214734Srpaulo	 *	(this may differ from the requested addr if the driver cannot
1826214734Srpaulo	 *	change interface address)
1827252726Srpaulo	 * @bridge: Bridge interface to use or %NULL if no bridge configured
1828214734Srpaulo	 * Returns: 0 on success, -1 on failure
1829214734Srpaulo	 */
1830214734Srpaulo	int (*if_add)(void *priv, enum wpa_driver_if_type type,
1831214734Srpaulo		      const char *ifname, const u8 *addr, void *bss_ctx,
1832252726Srpaulo		      void **drv_priv, char *force_ifname, u8 *if_addr,
1833252726Srpaulo		      const char *bridge);
1834214734Srpaulo
1835214734Srpaulo	/**
1836214734Srpaulo	 * if_remove - Remove a virtual interface
1837214734Srpaulo	 * @priv: Private driver interface data
1838214734Srpaulo	 * @type: Interface type
1839214734Srpaulo	 * @ifname: Interface name of the virtual interface to be removed
1840214734Srpaulo	 * Returns: 0 on success, -1 on failure
1841214734Srpaulo	 */
1842214734Srpaulo	int (*if_remove)(void *priv, enum wpa_driver_if_type type,
1843214734Srpaulo			 const char *ifname);
1844214734Srpaulo
1845214734Srpaulo	/**
1846214734Srpaulo	 * set_sta_vlan - Bind a station into a specific interface (AP only)
1847214734Srpaulo	 * @priv: Private driver interface data
1848214734Srpaulo	 * @ifname: Interface (main or virtual BSS or VLAN)
1849214734Srpaulo	 * @addr: MAC address of the associated station
1850214734Srpaulo	 * @vlan_id: VLAN ID
1851214734Srpaulo	 * Returns: 0 on success, -1 on failure
1852214734Srpaulo	 *
1853214734Srpaulo	 * This function is used to bind a station to a specific virtual
1854214734Srpaulo	 * interface. It is only used if when virtual interfaces are supported,
1855214734Srpaulo	 * e.g., to assign stations to different VLAN interfaces based on
1856214734Srpaulo	 * information from a RADIUS server. This allows separate broadcast
1857214734Srpaulo	 * domains to be used with a single BSS.
1858214734Srpaulo	 */
1859214734Srpaulo	int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
1860214734Srpaulo			    int vlan_id);
1861214734Srpaulo
1862214734Srpaulo	/**
1863214734Srpaulo	 * commit - Optional commit changes handler (AP only)
1864214734Srpaulo	 * @priv: driver private data
1865214734Srpaulo	 * Returns: 0 on success, -1 on failure
1866214734Srpaulo	 *
1867214734Srpaulo	 * This optional handler function can be registered if the driver
1868214734Srpaulo	 * interface implementation needs to commit changes (e.g., by setting
1869214734Srpaulo	 * network interface up) at the end of initial configuration. If set,
1870214734Srpaulo	 * this handler will be called after initial setup has been completed.
1871214734Srpaulo	 */
1872214734Srpaulo	int (*commit)(void *priv);
1873214734Srpaulo
1874214734Srpaulo	/**
1875214734Srpaulo	 * send_ether - Send an ethernet packet (AP only)
1876214734Srpaulo	 * @priv: private driver interface data
1877214734Srpaulo	 * @dst: Destination MAC address
1878214734Srpaulo	 * @src: Source MAC address
1879214734Srpaulo	 * @proto: Ethertype
1880214734Srpaulo	 * @data: EAPOL packet starting with IEEE 802.1X header
1881214734Srpaulo	 * @data_len: Length of the EAPOL packet in octets
1882214734Srpaulo	 * Returns: 0 on success, -1 on failure
1883214734Srpaulo	 */
1884214734Srpaulo	int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
1885214734Srpaulo			  const u8 *data, size_t data_len);
1886214734Srpaulo
1887214734Srpaulo	/**
1888214734Srpaulo	 * set_radius_acl_auth - Notification of RADIUS ACL change
1889214734Srpaulo	 * @priv: Private driver interface data
1890214734Srpaulo	 * @mac: MAC address of the station
1891214734Srpaulo	 * @accepted: Whether the station was accepted
1892214734Srpaulo	 * @session_timeout: Session timeout for the station
1893214734Srpaulo	 * Returns: 0 on success, -1 on failure
1894214734Srpaulo	 */
1895214734Srpaulo	int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
1896214734Srpaulo				   u32 session_timeout);
1897214734Srpaulo
1898214734Srpaulo	/**
1899214734Srpaulo	 * set_radius_acl_expire - Notification of RADIUS ACL expiration
1900214734Srpaulo	 * @priv: Private driver interface data
1901214734Srpaulo	 * @mac: MAC address of the station
1902214734Srpaulo	 * Returns: 0 on success, -1 on failure
1903214734Srpaulo	 */
1904214734Srpaulo	int (*set_radius_acl_expire)(void *priv, const u8 *mac);
1905214734Srpaulo
1906214734Srpaulo	/**
1907214734Srpaulo	 * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP)
1908214734Srpaulo	 * @priv: Private driver interface data
1909214734Srpaulo	 * @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s)
1910214734Srpaulo	 * @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove
1911214734Srpaulo	 *	extra IE(s)
1912252726Srpaulo	 * @assocresp: WPS IE(s) for (Re)Association Response frames or %NULL
1913252726Srpaulo	 *	to remove extra IE(s)
1914214734Srpaulo	 * Returns: 0 on success, -1 on failure
1915214734Srpaulo	 *
1916214734Srpaulo	 * This is an optional function to add WPS IE in the kernel driver for
1917214734Srpaulo	 * Beacon and Probe Response frames. This can be left undefined (set
1918252726Srpaulo	 * to %NULL) if the driver uses the Beacon template from set_ap()
1919252726Srpaulo	 * and does not process Probe Request frames. If the driver takes care
1920252726Srpaulo	 * of (Re)Association frame processing, the assocresp buffer includes
1921252726Srpaulo	 * WPS IE(s) that need to be added to (Re)Association Response frames
1922252726Srpaulo	 * whenever a (Re)Association Request frame indicated use of WPS.
1923252726Srpaulo	 *
1924252726Srpaulo	 * This will also be used to add P2P IE(s) into Beacon/Probe Response
1925252726Srpaulo	 * frames when operating as a GO. The driver is responsible for adding
1926252726Srpaulo	 * timing related attributes (e.g., NoA) in addition to the IEs
1927252726Srpaulo	 * included here by appending them after these buffers. This call is
1928252726Srpaulo	 * also used to provide Probe Response IEs for P2P Listen state
1929252726Srpaulo	 * operations for drivers that generate the Probe Response frames
1930252726Srpaulo	 * internally.
1931252726Srpaulo	 *
1932252726Srpaulo	 * DEPRECATED - use set_ap() instead
1933214734Srpaulo	 */
1934214734Srpaulo	int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
1935252726Srpaulo			     const struct wpabuf *proberesp,
1936252726Srpaulo			     const struct wpabuf *assocresp);
1937214734Srpaulo
1938214734Srpaulo	/**
1939214734Srpaulo	 * set_supp_port - Set IEEE 802.1X Supplicant Port status
1940214734Srpaulo	 * @priv: Private driver interface data
1941214734Srpaulo	 * @authorized: Whether the port is authorized
1942214734Srpaulo	 * Returns: 0 on success, -1 on failure
1943214734Srpaulo	 */
1944214734Srpaulo	int (*set_supp_port)(void *priv, int authorized);
1945214734Srpaulo
1946214734Srpaulo	/**
1947214734Srpaulo	 * set_wds_sta - Bind a station into a 4-address WDS (AP only)
1948214734Srpaulo	 * @priv: Private driver interface data
1949214734Srpaulo	 * @addr: MAC address of the associated station
1950214734Srpaulo	 * @aid: Association ID
1951214734Srpaulo	 * @val: 1 = bind to 4-address WDS; 0 = unbind
1952252726Srpaulo	 * @bridge_ifname: Bridge interface to use for the WDS station or %NULL
1953252726Srpaulo	 *	to indicate that bridge is not to be used
1954214734Srpaulo	 * Returns: 0 on success, -1 on failure
1955214734Srpaulo	 */
1956252726Srpaulo	int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
1957252726Srpaulo	                   const char *bridge_ifname);
1958214734Srpaulo
1959214734Srpaulo	/**
1960214734Srpaulo	 * send_action - Transmit an Action frame
1961214734Srpaulo	 * @priv: Private driver interface data
1962214734Srpaulo	 * @freq: Frequency (in MHz) of the channel
1963252726Srpaulo	 * @wait: Time to wait off-channel for a response (in ms), or zero
1964214734Srpaulo	 * @dst: Destination MAC address (Address 1)
1965214734Srpaulo	 * @src: Source MAC address (Address 2)
1966214734Srpaulo	 * @bssid: BSSID (Address 3)
1967214734Srpaulo	 * @data: Frame body
1968214734Srpaulo	 * @data_len: data length in octets
1969252726Srpaulo	 @ @no_cck: Whether CCK rates must not be used to transmit this frame
1970214734Srpaulo	 * Returns: 0 on success, -1 on failure
1971214734Srpaulo	 *
1972214734Srpaulo	 * This command can be used to request the driver to transmit an action
1973252726Srpaulo	 * frame to the specified destination.
1974252726Srpaulo	 *
1975252726Srpaulo	 * If the %WPA_DRIVER_FLAGS_OFFCHANNEL_TX flag is set, the frame will
1976252726Srpaulo	 * be transmitted on the given channel and the device will wait for a
1977252726Srpaulo	 * response on that channel for the given wait time.
1978252726Srpaulo	 *
1979252726Srpaulo	 * If the flag is not set, the wait time will be ignored. In this case,
1980252726Srpaulo	 * if a remain-on-channel duration is in progress, the frame must be
1981252726Srpaulo	 * transmitted on that channel; alternatively the frame may be sent on
1982252726Srpaulo	 * the current operational channel (if in associated state in station
1983252726Srpaulo	 * mode or while operating as an AP.)
1984214734Srpaulo	 */
1985252726Srpaulo	int (*send_action)(void *priv, unsigned int freq, unsigned int wait,
1986214734Srpaulo			   const u8 *dst, const u8 *src, const u8 *bssid,
1987252726Srpaulo			   const u8 *data, size_t data_len, int no_cck);
1988214734Srpaulo
1989214734Srpaulo	/**
1990252726Srpaulo	 * send_action_cancel_wait - Cancel action frame TX wait
1991252726Srpaulo	 * @priv: Private driver interface data
1992252726Srpaulo	 *
1993252726Srpaulo	 * This command cancels the wait time associated with sending an action
1994252726Srpaulo	 * frame. It is only available when %WPA_DRIVER_FLAGS_OFFCHANNEL_TX is
1995252726Srpaulo	 * set in the driver flags.
1996252726Srpaulo	 */
1997252726Srpaulo	void (*send_action_cancel_wait)(void *priv);
1998252726Srpaulo
1999252726Srpaulo	/**
2000214734Srpaulo	 * remain_on_channel - Remain awake on a channel
2001214734Srpaulo	 * @priv: Private driver interface data
2002214734Srpaulo	 * @freq: Frequency (in MHz) of the channel
2003214734Srpaulo	 * @duration: Duration in milliseconds
2004214734Srpaulo	 * Returns: 0 on success, -1 on failure
2005214734Srpaulo	 *
2006214734Srpaulo	 * This command is used to request the driver to remain awake on the
2007214734Srpaulo	 * specified channel for the specified duration and report received
2008214734Srpaulo	 * Action frames with EVENT_RX_ACTION events. Optionally, received
2009214734Srpaulo	 * Probe Request frames may also be requested to be reported by calling
2010214734Srpaulo	 * probe_req_report(). These will be reported with EVENT_RX_PROBE_REQ.
2011214734Srpaulo	 *
2012214734Srpaulo	 * The driver may not be at the requested channel when this function
2013214734Srpaulo	 * returns, i.e., the return code is only indicating whether the
2014214734Srpaulo	 * request was accepted. The caller will need to wait until the
2015214734Srpaulo	 * EVENT_REMAIN_ON_CHANNEL event indicates that the driver has
2016214734Srpaulo	 * completed the channel change. This may take some time due to other
2017214734Srpaulo	 * need for the radio and the caller should be prepared to timing out
2018214734Srpaulo	 * its wait since there are no guarantees on when this request can be
2019214734Srpaulo	 * executed.
2020214734Srpaulo	 */
2021214734Srpaulo	int (*remain_on_channel)(void *priv, unsigned int freq,
2022214734Srpaulo				 unsigned int duration);
2023214734Srpaulo
2024214734Srpaulo	/**
2025214734Srpaulo	 * cancel_remain_on_channel - Cancel remain-on-channel operation
2026214734Srpaulo	 * @priv: Private driver interface data
2027214734Srpaulo	 *
2028214734Srpaulo	 * This command can be used to cancel a remain-on-channel operation
2029214734Srpaulo	 * before its originally requested duration has passed. This could be
2030214734Srpaulo	 * used, e.g., when remain_on_channel() is used to request extra time
2031214734Srpaulo	 * to receive a response to an Action frame and the response is
2032214734Srpaulo	 * received when there is still unneeded time remaining on the
2033214734Srpaulo	 * remain-on-channel operation.
2034214734Srpaulo	 */
2035214734Srpaulo	int (*cancel_remain_on_channel)(void *priv);
2036214734Srpaulo
2037214734Srpaulo	/**
2038214734Srpaulo	 * probe_req_report - Request Probe Request frames to be indicated
2039214734Srpaulo	 * @priv: Private driver interface data
2040214734Srpaulo	 * @report: Whether to report received Probe Request frames
2041214734Srpaulo	 * Returns: 0 on success, -1 on failure (or if not supported)
2042214734Srpaulo	 *
2043214734Srpaulo	 * This command can be used to request the driver to indicate when
2044214734Srpaulo	 * Probe Request frames are received with EVENT_RX_PROBE_REQ events.
2045214734Srpaulo	 * Since this operation may require extra resources, e.g., due to less
2046214734Srpaulo	 * optimal hardware/firmware RX filtering, many drivers may disable
2047214734Srpaulo	 * Probe Request reporting at least in station mode. This command is
2048214734Srpaulo	 * used to notify the driver when the Probe Request frames need to be
2049214734Srpaulo	 * reported, e.g., during remain-on-channel operations.
2050214734Srpaulo	 */
2051214734Srpaulo	int (*probe_req_report)(void *priv, int report);
2052214734Srpaulo
2053214734Srpaulo	/**
2054252726Srpaulo	 * deinit_ap - Deinitialize AP mode
2055214734Srpaulo	 * @priv: Private driver interface data
2056214734Srpaulo	 * Returns: 0 on success, -1 on failure (or if not supported)
2057214734Srpaulo	 *
2058252726Srpaulo	 * This optional function can be used to disable AP mode related
2059252726Srpaulo	 * configuration and change the driver mode to station mode to allow
2060252726Srpaulo	 * normal station operations like scanning to be completed.
2061214734Srpaulo	 */
2062252726Srpaulo	int (*deinit_ap)(void *priv);
2063214734Srpaulo
2064214734Srpaulo	/**
2065252726Srpaulo	 * deinit_p2p_cli - Deinitialize P2P client mode
2066214734Srpaulo	 * @priv: Private driver interface data
2067214734Srpaulo	 * Returns: 0 on success, -1 on failure (or if not supported)
2068214734Srpaulo	 *
2069252726Srpaulo	 * This optional function can be used to disable P2P client mode. It
2070252726Srpaulo	 * can be used to change the interface type back to station mode.
2071214734Srpaulo	 */
2072252726Srpaulo	int (*deinit_p2p_cli)(void *priv);
2073214734Srpaulo
2074214734Srpaulo	/**
2075214734Srpaulo	 * suspend - Notification on system suspend/hibernate event
2076214734Srpaulo	 * @priv: Private driver interface data
2077214734Srpaulo	 */
2078214734Srpaulo	void (*suspend)(void *priv);
2079214734Srpaulo
2080214734Srpaulo	/**
2081214734Srpaulo	 * resume - Notification on system resume/thaw event
2082214734Srpaulo	 * @priv: Private driver interface data
2083214734Srpaulo	 */
2084214734Srpaulo	void (*resume)(void *priv);
2085214734Srpaulo
2086214734Srpaulo	/**
2087214734Srpaulo	 * signal_monitor - Set signal monitoring parameters
2088214734Srpaulo	 * @priv: Private driver interface data
2089214734Srpaulo	 * @threshold: Threshold value for signal change events; 0 = disabled
2090214734Srpaulo	 * @hysteresis: Minimum change in signal strength before indicating a
2091214734Srpaulo	 *	new event
2092214734Srpaulo	 * Returns: 0 on success, -1 on failure (or if not supported)
2093214734Srpaulo	 *
2094214734Srpaulo	 * This function can be used to configure monitoring of signal strength
2095214734Srpaulo	 * with the current AP. Whenever signal strength drops below the
2096214734Srpaulo	 * %threshold value or increases above it, EVENT_SIGNAL_CHANGE event
2097214734Srpaulo	 * should be generated assuming the signal strength has changed at
2098214734Srpaulo	 * least %hysteresis from the previously indicated signal change event.
2099214734Srpaulo	 */
2100214734Srpaulo	int (*signal_monitor)(void *priv, int threshold, int hysteresis);
2101214734Srpaulo
2102214734Srpaulo	/**
2103214734Srpaulo	 * send_frame - Send IEEE 802.11 frame (testing use only)
2104214734Srpaulo	 * @priv: Private driver interface data
2105214734Srpaulo	 * @data: IEEE 802.11 frame with IEEE 802.11 header
2106214734Srpaulo	 * @data_len: Size of the frame
2107214734Srpaulo	 * @encrypt: Whether to encrypt the frame (if keys are set)
2108214734Srpaulo	 * Returns: 0 on success, -1 on failure
2109214734Srpaulo	 *
2110214734Srpaulo	 * This function is only used for debugging purposes and is not
2111214734Srpaulo	 * required to be implemented for normal operations.
2112214734Srpaulo	 */
2113214734Srpaulo	int (*send_frame)(void *priv, const u8 *data, size_t data_len,
2114214734Srpaulo			  int encrypt);
2115252726Srpaulo
2116252726Srpaulo	/**
2117252726Srpaulo	 * shared_freq - Get operating frequency of shared interface(s)
2118252726Srpaulo	 * @priv: Private driver interface data
2119252726Srpaulo	 * Returns: Operating frequency in MHz, 0 if no shared operation in
2120252726Srpaulo	 * use, or -1 on failure
2121252726Srpaulo	 *
2122252726Srpaulo	 * This command can be used to request the current operating frequency
2123252726Srpaulo	 * of any virtual interface that shares the same radio to provide
2124252726Srpaulo	 * information for channel selection for other virtual interfaces.
2125252726Srpaulo	 */
2126252726Srpaulo	int (*shared_freq)(void *priv);
2127252726Srpaulo
2128252726Srpaulo	/**
2129252726Srpaulo	 * get_noa - Get current Notice of Absence attribute payload
2130252726Srpaulo	 * @priv: Private driver interface data
2131252726Srpaulo	 * @buf: Buffer for returning NoA
2132252726Srpaulo	 * @buf_len: Buffer length in octets
2133252726Srpaulo	 * Returns: Number of octets used in buf, 0 to indicate no NoA is being
2134252726Srpaulo	 * advertized, or -1 on failure
2135252726Srpaulo	 *
2136252726Srpaulo	 * This function is used to fetch the current Notice of Absence
2137252726Srpaulo	 * attribute value from GO.
2138252726Srpaulo	 */
2139252726Srpaulo	int (*get_noa)(void *priv, u8 *buf, size_t buf_len);
2140252726Srpaulo
2141252726Srpaulo	/**
2142252726Srpaulo	 * set_noa - Set Notice of Absence parameters for GO (testing)
2143252726Srpaulo	 * @priv: Private driver interface data
2144252726Srpaulo	 * @count: Count
2145252726Srpaulo	 * @start: Start time in ms from next TBTT
2146252726Srpaulo	 * @duration: Duration in ms
2147252726Srpaulo	 * Returns: 0 on success or -1 on failure
2148252726Srpaulo	 *
2149252726Srpaulo	 * This function is used to set Notice of Absence parameters for GO. It
2150252726Srpaulo	 * is used only for testing. To disable NoA, all parameters are set to
2151252726Srpaulo	 * 0.
2152252726Srpaulo	 */
2153252726Srpaulo	int (*set_noa)(void *priv, u8 count, int start, int duration);
2154252726Srpaulo
2155252726Srpaulo	/**
2156252726Srpaulo	 * set_p2p_powersave - Set P2P power save options
2157252726Srpaulo	 * @priv: Private driver interface data
2158252726Srpaulo	 * @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change
2159252726Srpaulo	 * @opp_ps: 0 = disable, 1 = enable, -1 = no change
2160252726Srpaulo	 * @ctwindow: 0.. = change (msec), -1 = no change
2161252726Srpaulo	 * Returns: 0 on success or -1 on failure
2162252726Srpaulo	 */
2163252726Srpaulo	int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
2164252726Srpaulo				 int ctwindow);
2165252726Srpaulo
2166252726Srpaulo	/**
2167252726Srpaulo	 * ampdu - Enable/disable aggregation
2168252726Srpaulo	 * @priv: Private driver interface data
2169252726Srpaulo	 * @ampdu: 1/0 = enable/disable A-MPDU aggregation
2170252726Srpaulo	 * Returns: 0 on success or -1 on failure
2171252726Srpaulo	 */
2172252726Srpaulo	int (*ampdu)(void *priv, int ampdu);
2173252726Srpaulo
2174252726Srpaulo	/**
2175252726Srpaulo	 * get_radio_name - Get physical radio name for the device
2176252726Srpaulo	 * @priv: Private driver interface data
2177252726Srpaulo	 * Returns: Radio name or %NULL if not known
2178252726Srpaulo	 *
2179252726Srpaulo	 * The returned data must not be modified by the caller. It is assumed
2180252726Srpaulo	 * that any interface that has the same radio name as another is
2181252726Srpaulo	 * sharing the same physical radio. This information can be used to
2182252726Srpaulo	 * share scan results etc. information between the virtual interfaces
2183252726Srpaulo	 * to speed up various operations.
2184252726Srpaulo	 */
2185252726Srpaulo	const char * (*get_radio_name)(void *priv);
2186252726Srpaulo
2187252726Srpaulo	/**
2188252726Srpaulo	 * p2p_find - Start P2P Device Discovery
2189252726Srpaulo	 * @priv: Private driver interface data
2190252726Srpaulo	 * @timeout: Timeout for find operation in seconds or 0 for no timeout
2191252726Srpaulo	 * @type: Device Discovery type (enum p2p_discovery_type)
2192252726Srpaulo	 * Returns: 0 on success, -1 on failure
2193252726Srpaulo	 *
2194252726Srpaulo	 * This function is only used if the driver implements P2P management,
2195252726Srpaulo	 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2196252726Srpaulo	 * struct wpa_driver_capa.
2197252726Srpaulo	 */
2198252726Srpaulo	int (*p2p_find)(void *priv, unsigned int timeout, int type);
2199252726Srpaulo
2200252726Srpaulo	/**
2201252726Srpaulo	 * p2p_stop_find - Stop P2P Device Discovery
2202252726Srpaulo	 * @priv: Private driver interface data
2203252726Srpaulo	 * Returns: 0 on success, -1 on failure
2204252726Srpaulo	 *
2205252726Srpaulo	 * This function is only used if the driver implements P2P management,
2206252726Srpaulo	 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2207252726Srpaulo	 * struct wpa_driver_capa.
2208252726Srpaulo	 */
2209252726Srpaulo	int (*p2p_stop_find)(void *priv);
2210252726Srpaulo
2211252726Srpaulo	/**
2212252726Srpaulo	 * p2p_listen - Start P2P Listen state for specified duration
2213252726Srpaulo	 * @priv: Private driver interface data
2214252726Srpaulo	 * @timeout: Listen state duration in milliseconds
2215252726Srpaulo	 * Returns: 0 on success, -1 on failure
2216252726Srpaulo	 *
2217252726Srpaulo	 * This function can be used to request the P2P module to keep the
2218252726Srpaulo	 * device discoverable on the listen channel for an extended set of
2219252726Srpaulo	 * time. At least in its current form, this is mainly used for testing
2220252726Srpaulo	 * purposes and may not be of much use for normal P2P operations.
2221252726Srpaulo	 *
2222252726Srpaulo	 * This function is only used if the driver implements P2P management,
2223252726Srpaulo	 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2224252726Srpaulo	 * struct wpa_driver_capa.
2225252726Srpaulo	 */
2226252726Srpaulo	int (*p2p_listen)(void *priv, unsigned int timeout);
2227252726Srpaulo
2228252726Srpaulo	/**
2229252726Srpaulo	 * p2p_connect - Start P2P group formation (GO negotiation)
2230252726Srpaulo	 * @priv: Private driver interface data
2231252726Srpaulo	 * @peer_addr: MAC address of the peer P2P client
2232252726Srpaulo	 * @wps_method: enum p2p_wps_method value indicating config method
2233252726Srpaulo	 * @go_intent: Local GO intent value (1..15)
2234252726Srpaulo	 * @own_interface_addr: Intended interface address to use with the
2235252726Srpaulo	 *	group
2236252726Srpaulo	 * @force_freq: The only allowed channel frequency in MHz or 0
2237252726Srpaulo	 * @persistent_group: Whether to create persistent group
2238252726Srpaulo	 * Returns: 0 on success, -1 on failure
2239252726Srpaulo	 *
2240252726Srpaulo	 * This function is only used if the driver implements P2P management,
2241252726Srpaulo	 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2242252726Srpaulo	 * struct wpa_driver_capa.
2243252726Srpaulo	 */
2244252726Srpaulo	int (*p2p_connect)(void *priv, const u8 *peer_addr, int wps_method,
2245252726Srpaulo			   int go_intent, const u8 *own_interface_addr,
2246252726Srpaulo			   unsigned int force_freq, int persistent_group);
2247252726Srpaulo
2248252726Srpaulo	/**
2249252726Srpaulo	 * wps_success_cb - Report successfully completed WPS provisioning
2250252726Srpaulo	 * @priv: Private driver interface data
2251252726Srpaulo	 * @peer_addr: Peer address
2252252726Srpaulo	 * Returns: 0 on success, -1 on failure
2253252726Srpaulo	 *
2254252726Srpaulo	 * This function is used to report successfully completed WPS
2255252726Srpaulo	 * provisioning during group formation in both GO/Registrar and
2256252726Srpaulo	 * client/Enrollee roles.
2257252726Srpaulo	 *
2258252726Srpaulo	 * This function is only used if the driver implements P2P management,
2259252726Srpaulo	 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2260252726Srpaulo	 * struct wpa_driver_capa.
2261252726Srpaulo	 */
2262252726Srpaulo	int (*wps_success_cb)(void *priv, const u8 *peer_addr);
2263252726Srpaulo
2264252726Srpaulo	/**
2265252726Srpaulo	 * p2p_group_formation_failed - Report failed WPS provisioning
2266252726Srpaulo	 * @priv: Private driver interface data
2267252726Srpaulo	 * Returns: 0 on success, -1 on failure
2268252726Srpaulo	 *
2269252726Srpaulo	 * This function is used to report failed group formation. This can
2270252726Srpaulo	 * happen either due to failed WPS provisioning or due to 15 second
2271252726Srpaulo	 * timeout during the provisioning phase.
2272252726Srpaulo	 *
2273252726Srpaulo	 * This function is only used if the driver implements P2P management,
2274252726Srpaulo	 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2275252726Srpaulo	 * struct wpa_driver_capa.
2276252726Srpaulo	 */
2277252726Srpaulo	int (*p2p_group_formation_failed)(void *priv);
2278252726Srpaulo
2279252726Srpaulo	/**
2280252726Srpaulo	 * p2p_set_params - Set P2P parameters
2281252726Srpaulo	 * @priv: Private driver interface data
2282252726Srpaulo	 * @params: P2P parameters
2283252726Srpaulo	 * Returns: 0 on success, -1 on failure
2284252726Srpaulo	 *
2285252726Srpaulo	 * This function is only used if the driver implements P2P management,
2286252726Srpaulo	 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2287252726Srpaulo	 * struct wpa_driver_capa.
2288252726Srpaulo	 */
2289252726Srpaulo	int (*p2p_set_params)(void *priv, const struct p2p_params *params);
2290252726Srpaulo
2291252726Srpaulo	/**
2292252726Srpaulo	 * p2p_prov_disc_req - Send Provision Discovery Request
2293252726Srpaulo	 * @priv: Private driver interface data
2294252726Srpaulo	 * @peer_addr: MAC address of the peer P2P client
2295252726Srpaulo	 * @config_methods: WPS Config Methods value (only one bit set)
2296252726Srpaulo	 * Returns: 0 on success, -1 on failure
2297252726Srpaulo	 *
2298252726Srpaulo	 * This function can be used to request a discovered P2P peer to
2299252726Srpaulo	 * display a PIN (config_methods = WPS_CONFIG_DISPLAY) or be prepared
2300252726Srpaulo	 * to enter a PIN from us (config_methods = WPS_CONFIG_KEYPAD). The
2301252726Srpaulo	 * Provision Discovery Request frame is transmitted once immediately
2302252726Srpaulo	 * and if no response is received, the frame will be sent again
2303252726Srpaulo	 * whenever the target device is discovered during device dsicovery
2304252726Srpaulo	 * (start with a p2p_find() call). Response from the peer is indicated
2305252726Srpaulo	 * with the EVENT_P2P_PROV_DISC_RESPONSE event.
2306252726Srpaulo	 *
2307252726Srpaulo	 * This function is only used if the driver implements P2P management,
2308252726Srpaulo	 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2309252726Srpaulo	 * struct wpa_driver_capa.
2310252726Srpaulo	 */
2311252726Srpaulo	int (*p2p_prov_disc_req)(void *priv, const u8 *peer_addr,
2312252726Srpaulo				 u16 config_methods, int join);
2313252726Srpaulo
2314252726Srpaulo	/**
2315252726Srpaulo	 * p2p_sd_request - Schedule a service discovery query
2316252726Srpaulo	 * @priv: Private driver interface data
2317252726Srpaulo	 * @dst: Destination peer or %NULL to apply for all peers
2318252726Srpaulo	 * @tlvs: P2P Service Query TLV(s)
2319252726Srpaulo	 * Returns: Reference to the query or 0 on failure
2320252726Srpaulo	 *
2321252726Srpaulo	 * Response to the query is indicated with the
2322252726Srpaulo	 * EVENT_P2P_SD_RESPONSE driver event.
2323252726Srpaulo	 *
2324252726Srpaulo	 * This function is only used if the driver implements P2P management,
2325252726Srpaulo	 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2326252726Srpaulo	 * struct wpa_driver_capa.
2327252726Srpaulo	 */
2328252726Srpaulo	u64 (*p2p_sd_request)(void *priv, const u8 *dst,
2329252726Srpaulo			      const struct wpabuf *tlvs);
2330252726Srpaulo
2331252726Srpaulo	/**
2332252726Srpaulo	 * p2p_sd_cancel_request - Cancel a pending service discovery query
2333252726Srpaulo	 * @priv: Private driver interface data
2334252726Srpaulo	 * @req: Query reference from p2p_sd_request()
2335252726Srpaulo	 * Returns: 0 on success, -1 on failure
2336252726Srpaulo	 *
2337252726Srpaulo	 * This function is only used if the driver implements P2P management,
2338252726Srpaulo	 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2339252726Srpaulo	 * struct wpa_driver_capa.
2340252726Srpaulo	 */
2341252726Srpaulo	int (*p2p_sd_cancel_request)(void *priv, u64 req);
2342252726Srpaulo
2343252726Srpaulo	/**
2344252726Srpaulo	 * p2p_sd_response - Send response to a service discovery query
2345252726Srpaulo	 * @priv: Private driver interface data
2346252726Srpaulo	 * @freq: Frequency from EVENT_P2P_SD_REQUEST event
2347252726Srpaulo	 * @dst: Destination address from EVENT_P2P_SD_REQUEST event
2348252726Srpaulo	 * @dialog_token: Dialog token from EVENT_P2P_SD_REQUEST event
2349252726Srpaulo	 * @resp_tlvs: P2P Service Response TLV(s)
2350252726Srpaulo	 * Returns: 0 on success, -1 on failure
2351252726Srpaulo	 *
2352252726Srpaulo	 * This function is called as a response to the request indicated with
2353252726Srpaulo	 * the EVENT_P2P_SD_REQUEST driver event.
2354252726Srpaulo	 *
2355252726Srpaulo	 * This function is only used if the driver implements P2P management,
2356252726Srpaulo	 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2357252726Srpaulo	 * struct wpa_driver_capa.
2358252726Srpaulo	 */
2359252726Srpaulo	int (*p2p_sd_response)(void *priv, int freq, const u8 *dst,
2360252726Srpaulo			       u8 dialog_token,
2361252726Srpaulo			       const struct wpabuf *resp_tlvs);
2362252726Srpaulo
2363252726Srpaulo	/**
2364252726Srpaulo	 * p2p_service_update - Indicate a change in local services
2365252726Srpaulo	 * @priv: Private driver interface data
2366252726Srpaulo	 * Returns: 0 on success, -1 on failure
2367252726Srpaulo	 *
2368252726Srpaulo	 * This function needs to be called whenever there is a change in
2369252726Srpaulo	 * availability of the local services. This will increment the
2370252726Srpaulo	 * Service Update Indicator value which will be used in SD Request and
2371252726Srpaulo	 * Response frames.
2372252726Srpaulo	 *
2373252726Srpaulo	 * This function is only used if the driver implements P2P management,
2374252726Srpaulo	 * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
2375252726Srpaulo	 * struct wpa_driver_capa.
2376252726Srpaulo	 */
2377252726Srpaulo	int (*p2p_service_update)(void *priv);
2378252726Srpaulo
2379252726Srpaulo	/**
2380252726Srpaulo	 * p2p_reject - Reject peer device (explicitly block connections)
2381252726Srpaulo	 * @priv: Private driver interface data
2382252726Srpaulo	 * @addr: MAC address of the peer
2383252726Srpaulo	 * Returns: 0 on success, -1 on failure
2384252726Srpaulo	 */
2385252726Srpaulo	int (*p2p_reject)(void *priv, const u8 *addr);
2386252726Srpaulo
2387252726Srpaulo	/**
2388252726Srpaulo	 * p2p_invite - Invite a P2P Device into a group
2389252726Srpaulo	 * @priv: Private driver interface data
2390252726Srpaulo	 * @peer: Device Address of the peer P2P Device
2391252726Srpaulo	 * @role: Local role in the group
2392252726Srpaulo	 * @bssid: Group BSSID or %NULL if not known
2393252726Srpaulo	 * @ssid: Group SSID
2394252726Srpaulo	 * @ssid_len: Length of ssid in octets
2395252726Srpaulo	 * @go_dev_addr: Forced GO Device Address or %NULL if none
2396252726Srpaulo	 * @persistent_group: Whether this is to reinvoke a persistent group
2397252726Srpaulo	 * Returns: 0 on success, -1 on failure
2398252726Srpaulo	 */
2399252726Srpaulo	int (*p2p_invite)(void *priv, const u8 *peer, int role,
2400252726Srpaulo			  const u8 *bssid, const u8 *ssid, size_t ssid_len,
2401252726Srpaulo			  const u8 *go_dev_addr, int persistent_group);
2402252726Srpaulo
2403252726Srpaulo	/**
2404252726Srpaulo	 * send_tdls_mgmt - for sending TDLS management packets
2405252726Srpaulo	 * @priv: private driver interface data
2406252726Srpaulo	 * @dst: Destination (peer) MAC address
2407252726Srpaulo	 * @action_code: TDLS action code for the mssage
2408252726Srpaulo	 * @dialog_token: Dialog Token to use in the message (if needed)
2409252726Srpaulo	 * @status_code: Status Code or Reason Code to use (if needed)
2410252726Srpaulo	 * @buf: TDLS IEs to add to the message
2411252726Srpaulo	 * @len: Length of buf in octets
2412252726Srpaulo	 * Returns: 0 on success, negative (<0) on failure
2413252726Srpaulo	 *
2414252726Srpaulo	 * This optional function can be used to send packet to driver which is
2415252726Srpaulo	 * responsible for receiving and sending all TDLS packets.
2416252726Srpaulo	 */
2417252726Srpaulo	int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
2418252726Srpaulo			      u8 dialog_token, u16 status_code,
2419252726Srpaulo			      const u8 *buf, size_t len);
2420252726Srpaulo
2421252726Srpaulo	/**
2422252726Srpaulo	 * tdls_oper - Ask the driver to perform high-level TDLS operations
2423252726Srpaulo	 * @priv: Private driver interface data
2424252726Srpaulo	 * @oper: TDLS high-level operation. See %enum tdls_oper
2425252726Srpaulo	 * @peer: Destination (peer) MAC address
2426252726Srpaulo	 * Returns: 0 on success, negative (<0) on failure
2427252726Srpaulo	 *
2428252726Srpaulo	 * This optional function can be used to send high-level TDLS commands
2429252726Srpaulo	 * to the driver.
2430252726Srpaulo	 */
2431252726Srpaulo	int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
2432252726Srpaulo
2433252726Srpaulo	/**
2434252726Srpaulo	 * wnm_oper - Notify driver of the WNM frame reception
2435252726Srpaulo	 * @priv: Private driver interface data
2436252726Srpaulo	 * @oper: WNM operation. See %enum wnm_oper
2437252726Srpaulo	 * @peer: Destination (peer) MAC address
2438252726Srpaulo	 * @buf: Buffer for the driver to fill in (for getting IE)
2439252726Srpaulo	 * @buf_len: Return the len of buf
2440252726Srpaulo	 * Returns: 0 on success, negative (<0) on failure
2441252726Srpaulo	 */
2442252726Srpaulo	int (*wnm_oper)(void *priv, enum wnm_oper oper, const u8 *peer,
2443252726Srpaulo			u8 *buf, u16 *buf_len);
2444252726Srpaulo
2445252726Srpaulo	/**
2446252726Srpaulo	 * signal_poll - Get current connection information
2447252726Srpaulo	 * @priv: Private driver interface data
2448252726Srpaulo	 * @signal_info: Connection info structure
2449252726Srpaulo         */
2450252726Srpaulo	int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
2451252726Srpaulo
2452252726Srpaulo	/**
2453252726Srpaulo	 * set_authmode - Set authentication algorithm(s) for static WEP
2454252726Srpaulo	 * @priv: Private driver interface data
2455252726Srpaulo	 * @authmode: 1=Open System, 2=Shared Key, 3=both
2456252726Srpaulo	 * Returns: 0 on success, -1 on failure
2457252726Srpaulo	 *
2458252726Srpaulo	 * This function can be used to set authentication algorithms for AP
2459252726Srpaulo	 * mode when static WEP is used. If the driver uses user space MLME/SME
2460252726Srpaulo	 * implementation, there is no need to implement this function.
2461252726Srpaulo	 *
2462252726Srpaulo	 * DEPRECATED - use set_ap() instead
2463252726Srpaulo	 */
2464252726Srpaulo	int (*set_authmode)(void *priv, int authmode);
2465252726Srpaulo
2466252726Srpaulo	/**
2467252726Srpaulo	 * set_rekey_info - Set rekey information
2468252726Srpaulo	 * @priv: Private driver interface data
2469252726Srpaulo	 * @kek: Current KEK
2470252726Srpaulo	 * @kck: Current KCK
2471252726Srpaulo	 * @replay_ctr: Current EAPOL-Key Replay Counter
2472252726Srpaulo	 *
2473252726Srpaulo	 * This optional function can be used to provide information for the
2474252726Srpaulo	 * driver/firmware to process EAPOL-Key frames in Group Key Handshake
2475252726Srpaulo	 * while the host (including wpa_supplicant) is sleeping.
2476252726Srpaulo	 */
2477252726Srpaulo	void (*set_rekey_info)(void *priv, const u8 *kek, const u8 *kck,
2478252726Srpaulo			       const u8 *replay_ctr);
2479252726Srpaulo
2480252726Srpaulo	/**
2481252726Srpaulo	 * sta_assoc - Station association indication
2482252726Srpaulo	 * @priv: Private driver interface data
2483252726Srpaulo	 * @own_addr: Source address and BSSID for association frame
2484252726Srpaulo	 * @addr: MAC address of the station to associate
2485252726Srpaulo	 * @reassoc: flag to indicate re-association
2486252726Srpaulo	 * @status: association response status code
2487252726Srpaulo	 * @ie: assoc response ie buffer
2488252726Srpaulo	 * @len: ie buffer length
2489252726Srpaulo	 * Returns: 0 on success, -1 on failure
2490252726Srpaulo	 *
2491252726Srpaulo	 * This function indicates the driver to send (Re)Association
2492252726Srpaulo	 * Response frame to the station.
2493252726Srpaulo	 */
2494252726Srpaulo	 int (*sta_assoc)(void *priv, const u8 *own_addr, const u8 *addr,
2495252726Srpaulo			  int reassoc, u16 status, const u8 *ie, size_t len);
2496252726Srpaulo
2497252726Srpaulo	/**
2498252726Srpaulo	 * sta_auth - Station authentication indication
2499252726Srpaulo	 * @priv: Private driver interface data
2500252726Srpaulo	 * @own_addr: Source address and BSSID for authentication frame
2501252726Srpaulo	 * @addr: MAC address of the station to associate
2502252726Srpaulo	 * @seq: authentication sequence number
2503252726Srpaulo	 * @status: authentication response status code
2504252726Srpaulo	 * @ie: authentication frame ie buffer
2505252726Srpaulo	 * @len: ie buffer length
2506252726Srpaulo	 *
2507252726Srpaulo	 * This function indicates the driver to send Authentication frame
2508252726Srpaulo	 * to the station.
2509252726Srpaulo	 */
2510252726Srpaulo	 int (*sta_auth)(void *priv, const u8 *own_addr, const u8 *addr,
2511252726Srpaulo			 u16 seq, u16 status, const u8 *ie, size_t len);
2512252726Srpaulo
2513252726Srpaulo	/**
2514252726Srpaulo	 * add_tspec - Add traffic stream
2515252726Srpaulo	 * @priv: Private driver interface data
2516252726Srpaulo	 * @addr: MAC address of the station to associate
2517252726Srpaulo	 * @tspec_ie: tspec ie buffer
2518252726Srpaulo	 * @tspec_ielen: tspec ie length
2519252726Srpaulo	 * Returns: 0 on success, -1 on failure
2520252726Srpaulo	 *
2521252726Srpaulo	 * This function adds the traffic steam for the station
2522252726Srpaulo	 * and fills the medium_time in tspec_ie.
2523252726Srpaulo	 */
2524252726Srpaulo	 int (*add_tspec)(void *priv, const u8 *addr, u8 *tspec_ie,
2525252726Srpaulo			  size_t tspec_ielen);
2526252726Srpaulo
2527252726Srpaulo	/**
2528252726Srpaulo	 * add_sta_node - Add a station node in the driver
2529252726Srpaulo	 * @priv: Private driver interface data
2530252726Srpaulo	 * @addr: MAC address of the station to add
2531252726Srpaulo	 * @auth_alg: authentication algorithm used by the station
2532252726Srpaulo	 * Returns: 0 on success, -1 on failure
2533252726Srpaulo	 *
2534252726Srpaulo	 * This function adds the station node in the driver, when
2535252726Srpaulo	 * the station gets added by FT-over-DS.
2536252726Srpaulo	 */
2537252726Srpaulo	int (*add_sta_node)(void *priv, const u8 *addr, u16 auth_alg);
2538252726Srpaulo
2539252726Srpaulo	/**
2540252726Srpaulo	 * sched_scan - Request the driver to initiate scheduled scan
2541252726Srpaulo	 * @priv: Private driver interface data
2542252726Srpaulo	 * @params: Scan parameters
2543252726Srpaulo	 * @interval: Interval between scan cycles in milliseconds
2544252726Srpaulo	 * Returns: 0 on success, -1 on failure
2545252726Srpaulo	 *
2546252726Srpaulo	 * This operation should be used for scheduled scan offload to
2547252726Srpaulo	 * the hardware. Every time scan results are available, the
2548252726Srpaulo	 * driver should report scan results event for wpa_supplicant
2549252726Srpaulo	 * which will eventually request the results with
2550252726Srpaulo	 * wpa_driver_get_scan_results2(). This operation is optional
2551252726Srpaulo	 * and if not provided or if it returns -1, we fall back to
2552252726Srpaulo	 * normal host-scheduled scans.
2553252726Srpaulo	 */
2554252726Srpaulo	int (*sched_scan)(void *priv, struct wpa_driver_scan_params *params,
2555252726Srpaulo			  u32 interval);
2556252726Srpaulo
2557252726Srpaulo	/**
2558252726Srpaulo	 * stop_sched_scan - Request the driver to stop a scheduled scan
2559252726Srpaulo	 * @priv: Private driver interface data
2560252726Srpaulo	 * Returns: 0 on success, -1 on failure
2561252726Srpaulo	 *
2562252726Srpaulo	 * This should cause the scheduled scan to be stopped and
2563252726Srpaulo	 * results should stop being sent. Must be supported if
2564252726Srpaulo	 * sched_scan is supported.
2565252726Srpaulo	 */
2566252726Srpaulo	int (*stop_sched_scan)(void *priv);
2567252726Srpaulo
2568252726Srpaulo	/**
2569252726Srpaulo	 * poll_client - Probe (null data or such) the given station
2570252726Srpaulo	 * @priv: Private driver interface data
2571252726Srpaulo	 * @own_addr: MAC address of sending interface
2572252726Srpaulo	 * @addr: MAC address of the station to probe
2573252726Srpaulo	 * @qos: Indicates whether station is QoS station
2574252726Srpaulo	 *
2575252726Srpaulo	 * This function is used to verify whether an associated station is
2576252726Srpaulo	 * still present. This function does not need to be implemented if the
2577252726Srpaulo	 * driver provides such inactivity polling mechanism.
2578252726Srpaulo	 */
2579252726Srpaulo	void (*poll_client)(void *priv, const u8 *own_addr,
2580252726Srpaulo			    const u8 *addr, int qos);
2581252726Srpaulo
2582252726Srpaulo	/**
2583252726Srpaulo	 * radio_disable - Disable/enable radio
2584252726Srpaulo	 * @priv: Private driver interface data
2585252726Srpaulo	 * @disabled: 1=disable 0=enable radio
2586252726Srpaulo	 * Returns: 0 on success, -1 on failure
2587252726Srpaulo	 *
2588252726Srpaulo	 * This optional command is for testing purposes. It can be used to
2589252726Srpaulo	 * disable the radio on a testbed device to simulate out-of-radio-range
2590252726Srpaulo	 * conditions.
2591252726Srpaulo	 */
2592252726Srpaulo	int (*radio_disable)(void *priv, int disabled);
2593252726Srpaulo
2594252726Srpaulo	/**
2595252726Srpaulo	 * switch_channel - Announce channel switch and migrate the GO to the
2596252726Srpaulo	 * given frequency
2597252726Srpaulo	 * @priv: Private driver interface data
2598252726Srpaulo	 * @freq: Frequency in MHz
2599252726Srpaulo	 * Returns: 0 on success, -1 on failure
2600252726Srpaulo	 *
2601252726Srpaulo	 * This function is used to move the GO to the legacy STA channel to
2602252726Srpaulo	 * avoid frequency conflict in single channel concurrency.
2603252726Srpaulo	 */
2604252726Srpaulo	int (*switch_channel)(void *priv, unsigned int freq);
2605189251Ssam};
2606189251Ssam
2607189251Ssam
2608189251Ssam/**
2609189251Ssam * enum wpa_event_type - Event type for wpa_supplicant_event() calls
2610189251Ssam */
2611214734Srpauloenum wpa_event_type {
2612189251Ssam	/**
2613189251Ssam	 * EVENT_ASSOC - Association completed
2614189251Ssam	 *
2615189251Ssam	 * This event needs to be delivered when the driver completes IEEE
2616189251Ssam	 * 802.11 association or reassociation successfully.
2617189251Ssam	 * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
2618189251Ssam	 * after this event has been generated. In addition, optional
2619189251Ssam	 * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
2620189251Ssam	 * more information about the association. If the driver interface gets
2621189251Ssam	 * both of these events at the same time, it can also include the
2622189251Ssam	 * assoc_info data in EVENT_ASSOC call.
2623189251Ssam	 */
2624189251Ssam	EVENT_ASSOC,
2625189251Ssam
2626189251Ssam	/**
2627189251Ssam	 * EVENT_DISASSOC - Association lost
2628189251Ssam	 *
2629189251Ssam	 * This event should be called when association is lost either due to
2630189251Ssam	 * receiving deauthenticate or disassociate frame from the AP or when
2631214734Srpaulo	 * sending either of these frames to the current AP. If the driver
2632214734Srpaulo	 * supports separate deauthentication event, EVENT_DISASSOC should only
2633214734Srpaulo	 * be used for disassociation and EVENT_DEAUTH for deauthentication.
2634214734Srpaulo	 * In AP mode, union wpa_event_data::disassoc_info is required.
2635189251Ssam	 */
2636189251Ssam	EVENT_DISASSOC,
2637189251Ssam
2638189251Ssam	/**
2639189251Ssam	 * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
2640189251Ssam	 *
2641189251Ssam	 * This event must be delivered when a Michael MIC error is detected by
2642189251Ssam	 * the local driver. Additional data for event processing is
2643189251Ssam	 * provided with union wpa_event_data::michael_mic_failure. This
2644189251Ssam	 * information is used to request new encyption key and to initiate
2645189251Ssam	 * TKIP countermeasures if needed.
2646189251Ssam	 */
2647189251Ssam	EVENT_MICHAEL_MIC_FAILURE,
2648189251Ssam
2649189251Ssam	/**
2650189251Ssam	 * EVENT_SCAN_RESULTS - Scan results available
2651189251Ssam	 *
2652189251Ssam	 * This event must be called whenever scan results are available to be
2653189251Ssam	 * fetched with struct wpa_driver_ops::get_scan_results(). This event
2654189251Ssam	 * is expected to be used some time after struct wpa_driver_ops::scan()
2655189251Ssam	 * is called. If the driver provides an unsolicited event when the scan
2656189251Ssam	 * has been completed, this event can be used to trigger
2657189251Ssam	 * EVENT_SCAN_RESULTS call. If such event is not available from the
2658189251Ssam	 * driver, the driver wrapper code is expected to use a registered
2659189251Ssam	 * timeout to generate EVENT_SCAN_RESULTS call after the time that the
2660214734Srpaulo	 * scan is expected to be completed. Optional information about
2661214734Srpaulo	 * completed scan can be provided with union wpa_event_data::scan_info.
2662189251Ssam	 */
2663189251Ssam	EVENT_SCAN_RESULTS,
2664189251Ssam
2665189251Ssam	/**
2666189251Ssam	 * EVENT_ASSOCINFO - Report optional extra information for association
2667189251Ssam	 *
2668189251Ssam	 * This event can be used to report extra association information for
2669189251Ssam	 * EVENT_ASSOC processing. This extra information includes IEs from
2670189251Ssam	 * association frames and Beacon/Probe Response frames in union
2671189251Ssam	 * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
2672189251Ssam	 * EVENT_ASSOC. Alternatively, the driver interface can include
2673189251Ssam	 * assoc_info data in the EVENT_ASSOC call if it has all the
2674189251Ssam	 * information available at the same point.
2675189251Ssam	 */
2676189251Ssam	EVENT_ASSOCINFO,
2677189251Ssam
2678189251Ssam	/**
2679189251Ssam	 * EVENT_INTERFACE_STATUS - Report interface status changes
2680189251Ssam	 *
2681189251Ssam	 * This optional event can be used to report changes in interface
2682189251Ssam	 * status (interface added/removed) using union
2683189251Ssam	 * wpa_event_data::interface_status. This can be used to trigger
2684189251Ssam	 * wpa_supplicant to stop and re-start processing for the interface,
2685189251Ssam	 * e.g., when a cardbus card is ejected/inserted.
2686189251Ssam	 */
2687189251Ssam	EVENT_INTERFACE_STATUS,
2688189251Ssam
2689189251Ssam	/**
2690189251Ssam	 * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
2691189251Ssam	 *
2692189251Ssam	 * This event can be used to inform wpa_supplicant about candidates for
2693189251Ssam	 * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
2694189251Ssam	 * for scan request (ap_scan=2 mode), this event is required for
2695189251Ssam	 * pre-authentication. If wpa_supplicant is performing scan request
2696189251Ssam	 * (ap_scan=1), this event is optional since scan results can be used
2697189251Ssam	 * to add pre-authentication candidates. union
2698189251Ssam	 * wpa_event_data::pmkid_candidate is used to report the BSSID of the
2699189251Ssam	 * candidate and priority of the candidate, e.g., based on the signal
2700189251Ssam	 * strength, in order to try to pre-authenticate first with candidates
2701189251Ssam	 * that are most likely targets for re-association.
2702189251Ssam	 *
2703189251Ssam	 * EVENT_PMKID_CANDIDATE can be called whenever the driver has updates
2704189251Ssam	 * on the candidate list. In addition, it can be called for the current
2705189251Ssam	 * AP and APs that have existing PMKSA cache entries. wpa_supplicant
2706189251Ssam	 * will automatically skip pre-authentication in cases where a valid
2707189251Ssam	 * PMKSA exists. When more than one candidate exists, this event should
2708189251Ssam	 * be generated once for each candidate.
2709189251Ssam	 *
2710189251Ssam	 * Driver will be notified about successful pre-authentication with
2711189251Ssam	 * struct wpa_driver_ops::add_pmkid() calls.
2712189251Ssam	 */
2713189251Ssam	EVENT_PMKID_CANDIDATE,
2714189251Ssam
2715189251Ssam	/**
2716189251Ssam	 * EVENT_STKSTART - Request STK handshake (MLME-STKSTART.request)
2717189251Ssam	 *
2718189251Ssam	 * This event can be used to inform wpa_supplicant about desire to set
2719189251Ssam	 * up secure direct link connection between two stations as defined in
2720189251Ssam	 * IEEE 802.11e with a new PeerKey mechanism that replaced the original
2721189251Ssam	 * STAKey negotiation. The caller will need to set peer address for the
2722189251Ssam	 * event.
2723189251Ssam	 */
2724189251Ssam	EVENT_STKSTART,
2725189251Ssam
2726189251Ssam	/**
2727252726Srpaulo	 * EVENT_TDLS - Request TDLS operation
2728252726Srpaulo	 *
2729252726Srpaulo	 * This event can be used to request a TDLS operation to be performed.
2730252726Srpaulo	 */
2731252726Srpaulo	EVENT_TDLS,
2732252726Srpaulo
2733252726Srpaulo	/**
2734189251Ssam	 * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
2735189251Ssam	 *
2736189251Ssam	 * The driver is expected to report the received FT IEs from
2737189251Ssam	 * FT authentication sequence from the AP. The FT IEs are included in
2738189251Ssam	 * the extra information in union wpa_event_data::ft_ies.
2739189251Ssam	 */
2740214734Srpaulo	EVENT_FT_RESPONSE,
2741189251Ssam
2742214734Srpaulo	/**
2743214734Srpaulo	 * EVENT_IBSS_RSN_START - Request RSN authentication in IBSS
2744214734Srpaulo	 *
2745214734Srpaulo	 * The driver can use this event to inform wpa_supplicant about a STA
2746214734Srpaulo	 * in an IBSS with which protected frames could be exchanged. This
2747214734Srpaulo	 * event starts RSN authentication with the other STA to authenticate
2748214734Srpaulo	 * the STA and set up encryption keys with it.
2749214734Srpaulo	 */
2750214734Srpaulo	EVENT_IBSS_RSN_START,
2751189251Ssam
2752214734Srpaulo	/**
2753214734Srpaulo	 * EVENT_AUTH - Authentication result
2754214734Srpaulo	 *
2755214734Srpaulo	 * This event should be called when authentication attempt has been
2756214734Srpaulo	 * completed. This is only used if the driver supports separate
2757214734Srpaulo	 * authentication step (struct wpa_driver_ops::authenticate).
2758214734Srpaulo	 * Information about authentication result is included in
2759214734Srpaulo	 * union wpa_event_data::auth.
2760214734Srpaulo	 */
2761214734Srpaulo	EVENT_AUTH,
2762214734Srpaulo
2763214734Srpaulo	/**
2764214734Srpaulo	 * EVENT_DEAUTH - Authentication lost
2765214734Srpaulo	 *
2766214734Srpaulo	 * This event should be called when authentication is lost either due
2767214734Srpaulo	 * to receiving deauthenticate frame from the AP or when sending that
2768214734Srpaulo	 * frame to the current AP.
2769214734Srpaulo	 * In AP mode, union wpa_event_data::deauth_info is required.
2770214734Srpaulo	 */
2771214734Srpaulo	EVENT_DEAUTH,
2772214734Srpaulo
2773214734Srpaulo	/**
2774214734Srpaulo	 * EVENT_ASSOC_REJECT - Association rejected
2775214734Srpaulo	 *
2776214734Srpaulo	 * This event should be called when (re)association attempt has been
2777252726Srpaulo	 * rejected by the AP. Information about the association response is
2778214734Srpaulo	 * included in union wpa_event_data::assoc_reject.
2779214734Srpaulo	 */
2780214734Srpaulo	EVENT_ASSOC_REJECT,
2781214734Srpaulo
2782214734Srpaulo	/**
2783214734Srpaulo	 * EVENT_AUTH_TIMED_OUT - Authentication timed out
2784214734Srpaulo	 */
2785214734Srpaulo	EVENT_AUTH_TIMED_OUT,
2786214734Srpaulo
2787214734Srpaulo	/**
2788214734Srpaulo	 * EVENT_ASSOC_TIMED_OUT - Association timed out
2789214734Srpaulo	 */
2790214734Srpaulo	EVENT_ASSOC_TIMED_OUT,
2791214734Srpaulo
2792214734Srpaulo	/**
2793214734Srpaulo	 * EVENT_FT_RRB_RX - FT (IEEE 802.11r) RRB frame received
2794214734Srpaulo	 */
2795214734Srpaulo	EVENT_FT_RRB_RX,
2796214734Srpaulo
2797214734Srpaulo	/**
2798214734Srpaulo	 * EVENT_WPS_BUTTON_PUSHED - Report hardware push button press for WPS
2799214734Srpaulo	 */
2800214734Srpaulo	EVENT_WPS_BUTTON_PUSHED,
2801214734Srpaulo
2802214734Srpaulo	/**
2803214734Srpaulo	 * EVENT_TX_STATUS - Report TX status
2804214734Srpaulo	 */
2805214734Srpaulo	EVENT_TX_STATUS,
2806214734Srpaulo
2807214734Srpaulo	/**
2808214734Srpaulo	 * EVENT_RX_FROM_UNKNOWN - Report RX from unknown STA
2809214734Srpaulo	 */
2810214734Srpaulo	EVENT_RX_FROM_UNKNOWN,
2811214734Srpaulo
2812214734Srpaulo	/**
2813214734Srpaulo	 * EVENT_RX_MGMT - Report RX of a management frame
2814214734Srpaulo	 */
2815214734Srpaulo	EVENT_RX_MGMT,
2816214734Srpaulo
2817214734Srpaulo	/**
2818214734Srpaulo	 * EVENT_RX_ACTION - Action frame received
2819214734Srpaulo	 *
2820214734Srpaulo	 * This event is used to indicate when an Action frame has been
2821214734Srpaulo	 * received. Information about the received frame is included in
2822214734Srpaulo	 * union wpa_event_data::rx_action.
2823214734Srpaulo	 */
2824214734Srpaulo	EVENT_RX_ACTION,
2825214734Srpaulo
2826214734Srpaulo	/**
2827214734Srpaulo	 * EVENT_REMAIN_ON_CHANNEL - Remain-on-channel duration started
2828214734Srpaulo	 *
2829214734Srpaulo	 * This event is used to indicate when the driver has started the
2830214734Srpaulo	 * requested remain-on-channel duration. Information about the
2831214734Srpaulo	 * operation is included in union wpa_event_data::remain_on_channel.
2832214734Srpaulo	 */
2833214734Srpaulo	EVENT_REMAIN_ON_CHANNEL,
2834214734Srpaulo
2835214734Srpaulo	/**
2836214734Srpaulo	 * EVENT_CANCEL_REMAIN_ON_CHANNEL - Remain-on-channel timed out
2837214734Srpaulo	 *
2838214734Srpaulo	 * This event is used to indicate when the driver has completed
2839214734Srpaulo	 * remain-on-channel duration, i.e., may noot be available on the
2840214734Srpaulo	 * requested channel anymore. Information about the
2841214734Srpaulo	 * operation is included in union wpa_event_data::remain_on_channel.
2842214734Srpaulo	 */
2843214734Srpaulo	EVENT_CANCEL_REMAIN_ON_CHANNEL,
2844214734Srpaulo
2845214734Srpaulo	/**
2846214734Srpaulo	 * EVENT_MLME_RX - Report reception of frame for MLME (test use only)
2847214734Srpaulo	 *
2848214734Srpaulo	 * This event is used only by driver_test.c and userspace MLME.
2849214734Srpaulo	 */
2850214734Srpaulo	EVENT_MLME_RX,
2851214734Srpaulo
2852214734Srpaulo	/**
2853214734Srpaulo	 * EVENT_RX_PROBE_REQ - Indicate received Probe Request frame
2854214734Srpaulo	 *
2855214734Srpaulo	 * This event is used to indicate when a Probe Request frame has been
2856214734Srpaulo	 * received. Information about the received frame is included in
2857214734Srpaulo	 * union wpa_event_data::rx_probe_req. The driver is required to report
2858214734Srpaulo	 * these events only after successfully completed probe_req_report()
2859214734Srpaulo	 * commands to request the events (i.e., report parameter is non-zero)
2860214734Srpaulo	 * in station mode. In AP mode, Probe Request frames should always be
2861214734Srpaulo	 * reported.
2862214734Srpaulo	 */
2863214734Srpaulo	EVENT_RX_PROBE_REQ,
2864214734Srpaulo
2865214734Srpaulo	/**
2866214734Srpaulo	 * EVENT_NEW_STA - New wired device noticed
2867214734Srpaulo	 *
2868214734Srpaulo	 * This event is used to indicate that a new device has been detected
2869214734Srpaulo	 * in a network that does not use association-like functionality (i.e.,
2870214734Srpaulo	 * mainly wired Ethernet). This can be used to start EAPOL
2871214734Srpaulo	 * authenticator when receiving a frame from a device. The address of
2872214734Srpaulo	 * the device is included in union wpa_event_data::new_sta.
2873214734Srpaulo	 */
2874214734Srpaulo	EVENT_NEW_STA,
2875214734Srpaulo
2876214734Srpaulo	/**
2877214734Srpaulo	 * EVENT_EAPOL_RX - Report received EAPOL frame
2878214734Srpaulo	 *
2879214734Srpaulo	 * When in AP mode with hostapd, this event is required to be used to
2880214734Srpaulo	 * deliver the receive EAPOL frames from the driver. With
2881214734Srpaulo	 * %wpa_supplicant, this event is used only if the send_eapol() handler
2882214734Srpaulo	 * is used to override the use of l2_packet for EAPOL frame TX.
2883214734Srpaulo	 */
2884214734Srpaulo	EVENT_EAPOL_RX,
2885214734Srpaulo
2886214734Srpaulo	/**
2887214734Srpaulo	 * EVENT_SIGNAL_CHANGE - Indicate change in signal strength
2888214734Srpaulo	 *
2889214734Srpaulo	 * This event is used to indicate changes in the signal strength
2890214734Srpaulo	 * observed in frames received from the current AP if signal strength
2891214734Srpaulo	 * monitoring has been enabled with signal_monitor().
2892214734Srpaulo	 */
2893252726Srpaulo	EVENT_SIGNAL_CHANGE,
2894252726Srpaulo
2895252726Srpaulo	/**
2896252726Srpaulo	 * EVENT_INTERFACE_ENABLED - Notify that interface was enabled
2897252726Srpaulo	 *
2898252726Srpaulo	 * This event is used to indicate that the interface was enabled after
2899252726Srpaulo	 * having been previously disabled, e.g., due to rfkill.
2900252726Srpaulo	 */
2901252726Srpaulo	EVENT_INTERFACE_ENABLED,
2902252726Srpaulo
2903252726Srpaulo	/**
2904252726Srpaulo	 * EVENT_INTERFACE_DISABLED - Notify that interface was disabled
2905252726Srpaulo	 *
2906252726Srpaulo	 * This event is used to indicate that the interface was disabled,
2907252726Srpaulo	 * e.g., due to rfkill.
2908252726Srpaulo	 */
2909252726Srpaulo	EVENT_INTERFACE_DISABLED,
2910252726Srpaulo
2911252726Srpaulo	/**
2912252726Srpaulo	 * EVENT_CHANNEL_LIST_CHANGED - Channel list changed
2913252726Srpaulo	 *
2914252726Srpaulo	 * This event is used to indicate that the channel list has changed,
2915252726Srpaulo	 * e.g., because of a regulatory domain change triggered by scan
2916252726Srpaulo	 * results including an AP advertising a country code.
2917252726Srpaulo	 */
2918252726Srpaulo	EVENT_CHANNEL_LIST_CHANGED,
2919252726Srpaulo
2920252726Srpaulo	/**
2921252726Srpaulo	 * EVENT_INTERFACE_UNAVAILABLE - Notify that interface is unavailable
2922252726Srpaulo	 *
2923252726Srpaulo	 * This event is used to indicate that the driver cannot maintain this
2924252726Srpaulo	 * interface in its operation mode anymore. The most likely use for
2925252726Srpaulo	 * this is to indicate that AP mode operation is not available due to
2926252726Srpaulo	 * operating channel would need to be changed to a DFS channel when
2927252726Srpaulo	 * the driver does not support radar detection and another virtual
2928252726Srpaulo	 * interfaces caused the operating channel to change. Other similar
2929252726Srpaulo	 * resource conflicts could also trigger this for station mode
2930252726Srpaulo	 * interfaces.
2931252726Srpaulo	 */
2932252726Srpaulo	EVENT_INTERFACE_UNAVAILABLE,
2933252726Srpaulo
2934252726Srpaulo	/**
2935252726Srpaulo	 * EVENT_BEST_CHANNEL
2936252726Srpaulo	 *
2937252726Srpaulo	 * Driver generates this event whenever it detects a better channel
2938252726Srpaulo	 * (e.g., based on RSSI or channel use). This information can be used
2939252726Srpaulo	 * to improve channel selection for a new AP/P2P group.
2940252726Srpaulo	 */
2941252726Srpaulo	EVENT_BEST_CHANNEL,
2942252726Srpaulo
2943252726Srpaulo	/**
2944252726Srpaulo	 * EVENT_UNPROT_DEAUTH - Unprotected Deauthentication frame received
2945252726Srpaulo	 *
2946252726Srpaulo	 * This event should be called when a Deauthentication frame is dropped
2947252726Srpaulo	 * due to it not being protected (MFP/IEEE 802.11w).
2948252726Srpaulo	 * union wpa_event_data::unprot_deauth is required to provide more
2949252726Srpaulo	 * details of the frame.
2950252726Srpaulo	 */
2951252726Srpaulo	EVENT_UNPROT_DEAUTH,
2952252726Srpaulo
2953252726Srpaulo	/**
2954252726Srpaulo	 * EVENT_UNPROT_DISASSOC - Unprotected Disassociation frame received
2955252726Srpaulo	 *
2956252726Srpaulo	 * This event should be called when a Disassociation frame is dropped
2957252726Srpaulo	 * due to it not being protected (MFP/IEEE 802.11w).
2958252726Srpaulo	 * union wpa_event_data::unprot_disassoc is required to provide more
2959252726Srpaulo	 * details of the frame.
2960252726Srpaulo	 */
2961252726Srpaulo	EVENT_UNPROT_DISASSOC,
2962252726Srpaulo
2963252726Srpaulo	/**
2964252726Srpaulo	 * EVENT_STATION_LOW_ACK
2965252726Srpaulo	 *
2966252726Srpaulo	 * Driver generates this event whenever it detected that a particular
2967252726Srpaulo	 * station was lost. Detection can be through massive transmission
2968252726Srpaulo	 * failures for example.
2969252726Srpaulo	 */
2970252726Srpaulo	EVENT_STATION_LOW_ACK,
2971252726Srpaulo
2972252726Srpaulo	/**
2973252726Srpaulo	 * EVENT_P2P_DEV_FOUND - Report a discovered P2P device
2974252726Srpaulo	 *
2975252726Srpaulo	 * This event is used only if the driver implements P2P management
2976252726Srpaulo	 * internally. Event data is stored in
2977252726Srpaulo	 * union wpa_event_data::p2p_dev_found.
2978252726Srpaulo	 */
2979252726Srpaulo	EVENT_P2P_DEV_FOUND,
2980252726Srpaulo
2981252726Srpaulo	/**
2982252726Srpaulo	 * EVENT_P2P_GO_NEG_REQ_RX - Report reception of GO Negotiation Request
2983252726Srpaulo	 *
2984252726Srpaulo	 * This event is used only if the driver implements P2P management
2985252726Srpaulo	 * internally. Event data is stored in
2986252726Srpaulo	 * union wpa_event_data::p2p_go_neg_req_rx.
2987252726Srpaulo	 */
2988252726Srpaulo	EVENT_P2P_GO_NEG_REQ_RX,
2989252726Srpaulo
2990252726Srpaulo	/**
2991252726Srpaulo	 * EVENT_P2P_GO_NEG_COMPLETED - Report completion of GO Negotiation
2992252726Srpaulo	 *
2993252726Srpaulo	 * This event is used only if the driver implements P2P management
2994252726Srpaulo	 * internally. Event data is stored in
2995252726Srpaulo	 * union wpa_event_data::p2p_go_neg_completed.
2996252726Srpaulo	 */
2997252726Srpaulo	EVENT_P2P_GO_NEG_COMPLETED,
2998252726Srpaulo
2999252726Srpaulo	EVENT_P2P_PROV_DISC_REQUEST,
3000252726Srpaulo	EVENT_P2P_PROV_DISC_RESPONSE,
3001252726Srpaulo	EVENT_P2P_SD_REQUEST,
3002252726Srpaulo	EVENT_P2P_SD_RESPONSE,
3003252726Srpaulo
3004252726Srpaulo	/**
3005252726Srpaulo	 * EVENT_IBSS_PEER_LOST - IBSS peer not reachable anymore
3006252726Srpaulo	 */
3007252726Srpaulo	EVENT_IBSS_PEER_LOST,
3008252726Srpaulo
3009252726Srpaulo	/**
3010252726Srpaulo	 * EVENT_DRIVER_GTK_REKEY - Device/driver did GTK rekey
3011252726Srpaulo	 *
3012252726Srpaulo	 * This event carries the new replay counter to notify wpa_supplicant
3013252726Srpaulo	 * of the current EAPOL-Key Replay Counter in case the driver/firmware
3014252726Srpaulo	 * completed Group Key Handshake while the host (including
3015252726Srpaulo	 * wpa_supplicant was sleeping).
3016252726Srpaulo	 */
3017252726Srpaulo	EVENT_DRIVER_GTK_REKEY,
3018252726Srpaulo
3019252726Srpaulo	/**
3020252726Srpaulo	 * EVENT_SCHED_SCAN_STOPPED - Scheduled scan was stopped
3021252726Srpaulo	 */
3022252726Srpaulo	EVENT_SCHED_SCAN_STOPPED,
3023252726Srpaulo
3024252726Srpaulo	/**
3025252726Srpaulo	 * EVENT_DRIVER_CLIENT_POLL_OK - Station responded to poll
3026252726Srpaulo	 *
3027252726Srpaulo	 * This event indicates that the station responded to the poll
3028252726Srpaulo	 * initiated with @poll_client.
3029252726Srpaulo	 */
3030252726Srpaulo	EVENT_DRIVER_CLIENT_POLL_OK,
3031252726Srpaulo
3032252726Srpaulo	/**
3033252726Srpaulo	 * EVENT_EAPOL_TX_STATUS - notify of EAPOL TX status
3034252726Srpaulo	 */
3035252726Srpaulo	EVENT_EAPOL_TX_STATUS,
3036252726Srpaulo
3037252726Srpaulo	/**
3038252726Srpaulo	 * EVENT_CH_SWITCH - AP or GO decided to switch channels
3039252726Srpaulo	 *
3040252726Srpaulo	 * Described in wpa_event_data.ch_switch
3041252726Srpaulo	 * */
3042252726Srpaulo	EVENT_CH_SWITCH,
3043252726Srpaulo
3044252726Srpaulo	/**
3045252726Srpaulo	 * EVENT_WNM - Request WNM operation
3046252726Srpaulo	 *
3047252726Srpaulo	 * This event can be used to request a WNM operation to be performed.
3048252726Srpaulo	 */
3049252726Srpaulo	EVENT_WNM
3050214734Srpaulo};
3051214734Srpaulo
3052214734Srpaulo
3053189251Ssam/**
3054189251Ssam * union wpa_event_data - Additional data for wpa_supplicant_event() calls
3055189251Ssam */
3056189251Ssamunion wpa_event_data {
3057189251Ssam	/**
3058189251Ssam	 * struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events
3059189251Ssam	 *
3060189251Ssam	 * This structure is optional for EVENT_ASSOC calls and required for
3061189251Ssam	 * EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the
3062189251Ssam	 * driver interface does not need to generate separate EVENT_ASSOCINFO
3063189251Ssam	 * calls.
3064189251Ssam	 */
3065189251Ssam	struct assoc_info {
3066189251Ssam		/**
3067252726Srpaulo		 * reassoc - Flag to indicate association or reassociation
3068252726Srpaulo		 */
3069252726Srpaulo		int reassoc;
3070252726Srpaulo
3071252726Srpaulo		/**
3072189251Ssam		 * req_ies - (Re)Association Request IEs
3073189251Ssam		 *
3074189251Ssam		 * If the driver generates WPA/RSN IE, this event data must be
3075189251Ssam		 * returned for WPA handshake to have needed information. If
3076189251Ssam		 * wpa_supplicant-generated WPA/RSN IE is used, this
3077189251Ssam		 * information event is optional.
3078189251Ssam		 *
3079189251Ssam		 * This should start with the first IE (fixed fields before IEs
3080189251Ssam		 * are not included).
3081189251Ssam		 */
3082214734Srpaulo		const u8 *req_ies;
3083189251Ssam
3084189251Ssam		/**
3085189251Ssam		 * req_ies_len - Length of req_ies in bytes
3086189251Ssam		 */
3087189251Ssam		size_t req_ies_len;
3088189251Ssam
3089189251Ssam		/**
3090189251Ssam		 * resp_ies - (Re)Association Response IEs
3091189251Ssam		 *
3092189251Ssam		 * Optional association data from the driver. This data is not
3093189251Ssam		 * required WPA, but may be useful for some protocols and as
3094189251Ssam		 * such, should be reported if this is available to the driver
3095189251Ssam		 * interface.
3096189251Ssam		 *
3097189251Ssam		 * This should start with the first IE (fixed fields before IEs
3098189251Ssam		 * are not included).
3099189251Ssam		 */
3100214734Srpaulo		const u8 *resp_ies;
3101189251Ssam
3102189251Ssam		/**
3103189251Ssam		 * resp_ies_len - Length of resp_ies in bytes
3104189251Ssam		 */
3105189251Ssam		size_t resp_ies_len;
3106189251Ssam
3107189251Ssam		/**
3108189251Ssam		 * beacon_ies - Beacon or Probe Response IEs
3109189251Ssam		 *
3110189251Ssam		 * Optional Beacon/ProbeResp data: IEs included in Beacon or
3111189251Ssam		 * Probe Response frames from the current AP (i.e., the one
3112189251Ssam		 * that the client just associated with). This information is
3113189251Ssam		 * used to update WPA/RSN IE for the AP. If this field is not
3114189251Ssam		 * set, the results from previous scan will be used. If no
3115189251Ssam		 * data for the new AP is found, scan results will be requested
3116189251Ssam		 * again (without scan request). At this point, the driver is
3117189251Ssam		 * expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is
3118189251Ssam		 * used).
3119189251Ssam		 *
3120189251Ssam		 * This should start with the first IE (fixed fields before IEs
3121189251Ssam		 * are not included).
3122189251Ssam		 */
3123214734Srpaulo		const u8 *beacon_ies;
3124189251Ssam
3125189251Ssam		/**
3126189251Ssam		 * beacon_ies_len - Length of beacon_ies */
3127189251Ssam		size_t beacon_ies_len;
3128214734Srpaulo
3129214734Srpaulo		/**
3130214734Srpaulo		 * freq - Frequency of the operational channel in MHz
3131214734Srpaulo		 */
3132214734Srpaulo		unsigned int freq;
3133214734Srpaulo
3134214734Srpaulo		/**
3135214734Srpaulo		 * addr - Station address (for AP mode)
3136214734Srpaulo		 */
3137214734Srpaulo		const u8 *addr;
3138189251Ssam	} assoc_info;
3139189251Ssam
3140189251Ssam	/**
3141214734Srpaulo	 * struct disassoc_info - Data for EVENT_DISASSOC events
3142214734Srpaulo	 */
3143214734Srpaulo	struct disassoc_info {
3144214734Srpaulo		/**
3145214734Srpaulo		 * addr - Station address (for AP mode)
3146214734Srpaulo		 */
3147214734Srpaulo		const u8 *addr;
3148214734Srpaulo
3149214734Srpaulo		/**
3150214734Srpaulo		 * reason_code - Reason Code (host byte order) used in
3151214734Srpaulo		 *	Deauthentication frame
3152214734Srpaulo		 */
3153214734Srpaulo		u16 reason_code;
3154252726Srpaulo
3155252726Srpaulo		/**
3156252726Srpaulo		 * ie - Optional IE(s) in Disassociation frame
3157252726Srpaulo		 */
3158252726Srpaulo		const u8 *ie;
3159252726Srpaulo
3160252726Srpaulo		/**
3161252726Srpaulo		 * ie_len - Length of ie buffer in octets
3162252726Srpaulo		 */
3163252726Srpaulo		size_t ie_len;
3164252726Srpaulo
3165252726Srpaulo		/**
3166252726Srpaulo		 * locally_generated - Whether the frame was locally generated
3167252726Srpaulo		 */
3168252726Srpaulo		int locally_generated;
3169214734Srpaulo	} disassoc_info;
3170214734Srpaulo
3171214734Srpaulo	/**
3172214734Srpaulo	 * struct deauth_info - Data for EVENT_DEAUTH events
3173214734Srpaulo	 */
3174214734Srpaulo	struct deauth_info {
3175214734Srpaulo		/**
3176214734Srpaulo		 * addr - Station address (for AP mode)
3177214734Srpaulo		 */
3178214734Srpaulo		const u8 *addr;
3179214734Srpaulo
3180214734Srpaulo		/**
3181214734Srpaulo		 * reason_code - Reason Code (host byte order) used in
3182214734Srpaulo		 *	Deauthentication frame
3183214734Srpaulo		 */
3184214734Srpaulo		u16 reason_code;
3185252726Srpaulo
3186252726Srpaulo		/**
3187252726Srpaulo		 * ie - Optional IE(s) in Deauthentication frame
3188252726Srpaulo		 */
3189252726Srpaulo		const u8 *ie;
3190252726Srpaulo
3191252726Srpaulo		/**
3192252726Srpaulo		 * ie_len - Length of ie buffer in octets
3193252726Srpaulo		 */
3194252726Srpaulo		size_t ie_len;
3195252726Srpaulo
3196252726Srpaulo		/**
3197252726Srpaulo		 * locally_generated - Whether the frame was locally generated
3198252726Srpaulo		 */
3199252726Srpaulo		int locally_generated;
3200214734Srpaulo	} deauth_info;
3201214734Srpaulo
3202214734Srpaulo	/**
3203189251Ssam	 * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
3204189251Ssam	 */
3205189251Ssam	struct michael_mic_failure {
3206189251Ssam		int unicast;
3207214734Srpaulo		const u8 *src;
3208189251Ssam	} michael_mic_failure;
3209189251Ssam
3210189251Ssam	/**
3211189251Ssam	 * struct interface_status - Data for EVENT_INTERFACE_STATUS
3212189251Ssam	 */
3213189251Ssam	struct interface_status {
3214189251Ssam		char ifname[100];
3215189251Ssam		enum {
3216189251Ssam			EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED
3217189251Ssam		} ievent;
3218189251Ssam	} interface_status;
3219189251Ssam
3220189251Ssam	/**
3221189251Ssam	 * struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE
3222189251Ssam	 */
3223189251Ssam	struct pmkid_candidate {
3224189251Ssam		/** BSSID of the PMKID candidate */
3225189251Ssam		u8 bssid[ETH_ALEN];
3226189251Ssam		/** Smaller the index, higher the priority */
3227189251Ssam		int index;
3228189251Ssam		/** Whether RSN IE includes pre-authenticate flag */
3229189251Ssam		int preauth;
3230189251Ssam	} pmkid_candidate;
3231189251Ssam
3232189251Ssam	/**
3233189251Ssam	 * struct stkstart - Data for EVENT_STKSTART
3234189251Ssam	 */
3235189251Ssam	struct stkstart {
3236189251Ssam		u8 peer[ETH_ALEN];
3237189251Ssam	} stkstart;
3238189251Ssam
3239189251Ssam	/**
3240252726Srpaulo	 * struct tdls - Data for EVENT_TDLS
3241252726Srpaulo	 */
3242252726Srpaulo	struct tdls {
3243252726Srpaulo		u8 peer[ETH_ALEN];
3244252726Srpaulo		enum {
3245252726Srpaulo			TDLS_REQUEST_SETUP,
3246252726Srpaulo			TDLS_REQUEST_TEARDOWN
3247252726Srpaulo		} oper;
3248252726Srpaulo		u16 reason_code; /* for teardown */
3249252726Srpaulo	} tdls;
3250252726Srpaulo
3251252726Srpaulo	/**
3252252726Srpaulo	 * struct wnm - Data for EVENT_WNM
3253252726Srpaulo	 */
3254252726Srpaulo	struct wnm {
3255252726Srpaulo		u8 addr[ETH_ALEN];
3256252726Srpaulo		enum {
3257252726Srpaulo			WNM_OPER_SLEEP,
3258252726Srpaulo		} oper;
3259252726Srpaulo		enum {
3260252726Srpaulo			WNM_SLEEP_ENTER,
3261252726Srpaulo			WNM_SLEEP_EXIT
3262252726Srpaulo		} sleep_action;
3263252726Srpaulo		int sleep_intval;
3264252726Srpaulo		u16 reason_code;
3265252726Srpaulo		u8 *buf;
3266252726Srpaulo		u16 buf_len;
3267252726Srpaulo	} wnm;
3268252726Srpaulo
3269252726Srpaulo	/**
3270189251Ssam	 * struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
3271189251Ssam	 *
3272189251Ssam	 * During FT (IEEE 802.11r) authentication sequence, the driver is
3273189251Ssam	 * expected to use this event to report received FT IEs (MDIE, FTIE,
3274189251Ssam	 * RSN IE, TIE, possible resource request) to the supplicant. The FT
3275189251Ssam	 * IEs for the next message will be delivered through the
3276189251Ssam	 * struct wpa_driver_ops::update_ft_ies() callback.
3277189251Ssam	 */
3278189251Ssam	struct ft_ies {
3279189251Ssam		const u8 *ies;
3280189251Ssam		size_t ies_len;
3281189251Ssam		int ft_action;
3282189251Ssam		u8 target_ap[ETH_ALEN];
3283214734Srpaulo		/** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
3284214734Srpaulo		const u8 *ric_ies;
3285214734Srpaulo		/** Length of ric_ies buffer in octets */
3286214734Srpaulo		size_t ric_ies_len;
3287189251Ssam	} ft_ies;
3288214734Srpaulo
3289214734Srpaulo	/**
3290214734Srpaulo	 * struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START
3291214734Srpaulo	 */
3292214734Srpaulo	struct ibss_rsn_start {
3293214734Srpaulo		u8 peer[ETH_ALEN];
3294214734Srpaulo	} ibss_rsn_start;
3295214734Srpaulo
3296214734Srpaulo	/**
3297214734Srpaulo	 * struct auth_info - Data for EVENT_AUTH events
3298214734Srpaulo	 */
3299214734Srpaulo	struct auth_info {
3300214734Srpaulo		u8 peer[ETH_ALEN];
3301252726Srpaulo		u8 bssid[ETH_ALEN];
3302214734Srpaulo		u16 auth_type;
3303252726Srpaulo		u16 auth_transaction;
3304214734Srpaulo		u16 status_code;
3305214734Srpaulo		const u8 *ies;
3306214734Srpaulo		size_t ies_len;
3307214734Srpaulo	} auth;
3308214734Srpaulo
3309214734Srpaulo	/**
3310214734Srpaulo	 * struct assoc_reject - Data for EVENT_ASSOC_REJECT events
3311214734Srpaulo	 */
3312214734Srpaulo	struct assoc_reject {
3313214734Srpaulo		/**
3314252726Srpaulo		 * bssid - BSSID of the AP that rejected association
3315252726Srpaulo		 */
3316252726Srpaulo		const u8 *bssid;
3317252726Srpaulo
3318252726Srpaulo		/**
3319214734Srpaulo		 * resp_ies - (Re)Association Response IEs
3320214734Srpaulo		 *
3321214734Srpaulo		 * Optional association data from the driver. This data is not
3322214734Srpaulo		 * required WPA, but may be useful for some protocols and as
3323214734Srpaulo		 * such, should be reported if this is available to the driver
3324214734Srpaulo		 * interface.
3325214734Srpaulo		 *
3326214734Srpaulo		 * This should start with the first IE (fixed fields before IEs
3327214734Srpaulo		 * are not included).
3328214734Srpaulo		 */
3329252726Srpaulo		const u8 *resp_ies;
3330214734Srpaulo
3331214734Srpaulo		/**
3332214734Srpaulo		 * resp_ies_len - Length of resp_ies in bytes
3333214734Srpaulo		 */
3334214734Srpaulo		size_t resp_ies_len;
3335214734Srpaulo
3336214734Srpaulo		/**
3337214734Srpaulo		 * status_code - Status Code from (Re)association Response
3338214734Srpaulo		 */
3339214734Srpaulo		u16 status_code;
3340214734Srpaulo	} assoc_reject;
3341214734Srpaulo
3342214734Srpaulo	struct timeout_event {
3343214734Srpaulo		u8 addr[ETH_ALEN];
3344214734Srpaulo	} timeout_event;
3345214734Srpaulo
3346214734Srpaulo	/**
3347214734Srpaulo	 * struct ft_rrb_rx - Data for EVENT_FT_RRB_RX events
3348214734Srpaulo	 */
3349214734Srpaulo	struct ft_rrb_rx {
3350214734Srpaulo		const u8 *src;
3351214734Srpaulo		const u8 *data;
3352214734Srpaulo		size_t data_len;
3353214734Srpaulo	} ft_rrb_rx;
3354214734Srpaulo
3355214734Srpaulo	/**
3356214734Srpaulo	 * struct tx_status - Data for EVENT_TX_STATUS events
3357214734Srpaulo	 */
3358214734Srpaulo	struct tx_status {
3359214734Srpaulo		u16 type;
3360214734Srpaulo		u16 stype;
3361214734Srpaulo		const u8 *dst;
3362214734Srpaulo		const u8 *data;
3363214734Srpaulo		size_t data_len;
3364214734Srpaulo		int ack;
3365214734Srpaulo	} tx_status;
3366214734Srpaulo
3367214734Srpaulo	/**
3368214734Srpaulo	 * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
3369214734Srpaulo	 */
3370214734Srpaulo	struct rx_from_unknown {
3371252726Srpaulo		const u8 *bssid;
3372252726Srpaulo		const u8 *addr;
3373252726Srpaulo		int wds;
3374214734Srpaulo	} rx_from_unknown;
3375214734Srpaulo
3376214734Srpaulo	/**
3377214734Srpaulo	 * struct rx_mgmt - Data for EVENT_RX_MGMT events
3378214734Srpaulo	 */
3379214734Srpaulo	struct rx_mgmt {
3380214734Srpaulo		const u8 *frame;
3381214734Srpaulo		size_t frame_len;
3382214734Srpaulo		u32 datarate;
3383252726Srpaulo		int ssi_signal; /* dBm */
3384214734Srpaulo	} rx_mgmt;
3385214734Srpaulo
3386214734Srpaulo	/**
3387214734Srpaulo	 * struct rx_action - Data for EVENT_RX_ACTION events
3388214734Srpaulo	 */
3389214734Srpaulo	struct rx_action {
3390214734Srpaulo		/**
3391214734Srpaulo		 * da - Destination address of the received Action frame
3392214734Srpaulo		 */
3393214734Srpaulo		const u8 *da;
3394214734Srpaulo
3395214734Srpaulo		/**
3396214734Srpaulo		 * sa - Source address of the received Action frame
3397214734Srpaulo		 */
3398214734Srpaulo		const u8 *sa;
3399214734Srpaulo
3400214734Srpaulo		/**
3401214734Srpaulo		 * bssid - Address 3 of the received Action frame
3402214734Srpaulo		 */
3403214734Srpaulo		const u8 *bssid;
3404214734Srpaulo
3405214734Srpaulo		/**
3406214734Srpaulo		 * category - Action frame category
3407214734Srpaulo		 */
3408214734Srpaulo		u8 category;
3409214734Srpaulo
3410214734Srpaulo		/**
3411214734Srpaulo		 * data - Action frame body after category field
3412214734Srpaulo		 */
3413214734Srpaulo		const u8 *data;
3414214734Srpaulo
3415214734Srpaulo		/**
3416214734Srpaulo		 * len - Length of data in octets
3417214734Srpaulo		 */
3418214734Srpaulo		size_t len;
3419214734Srpaulo
3420214734Srpaulo		/**
3421214734Srpaulo		 * freq - Frequency (in MHz) on which the frame was received
3422214734Srpaulo		 */
3423214734Srpaulo		int freq;
3424214734Srpaulo	} rx_action;
3425214734Srpaulo
3426214734Srpaulo	/**
3427214734Srpaulo	 * struct remain_on_channel - Data for EVENT_REMAIN_ON_CHANNEL events
3428214734Srpaulo	 *
3429214734Srpaulo	 * This is also used with EVENT_CANCEL_REMAIN_ON_CHANNEL events.
3430214734Srpaulo	 */
3431214734Srpaulo	struct remain_on_channel {
3432214734Srpaulo		/**
3433214734Srpaulo		 * freq - Channel frequency in MHz
3434214734Srpaulo		 */
3435214734Srpaulo		unsigned int freq;
3436214734Srpaulo
3437214734Srpaulo		/**
3438214734Srpaulo		 * duration - Duration to remain on the channel in milliseconds
3439214734Srpaulo		 */
3440214734Srpaulo		unsigned int duration;
3441214734Srpaulo	} remain_on_channel;
3442214734Srpaulo
3443214734Srpaulo	/**
3444214734Srpaulo	 * struct scan_info - Optional data for EVENT_SCAN_RESULTS events
3445214734Srpaulo	 * @aborted: Whether the scan was aborted
3446214734Srpaulo	 * @freqs: Scanned frequencies in MHz (%NULL = all channels scanned)
3447214734Srpaulo	 * @num_freqs: Number of entries in freqs array
3448214734Srpaulo	 * @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard
3449214734Srpaulo	 *	SSID)
3450214734Srpaulo	 * @num_ssids: Number of entries in ssids array
3451214734Srpaulo	 */
3452214734Srpaulo	struct scan_info {
3453214734Srpaulo		int aborted;
3454214734Srpaulo		const int *freqs;
3455214734Srpaulo		size_t num_freqs;
3456214734Srpaulo		struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
3457214734Srpaulo		size_t num_ssids;
3458214734Srpaulo	} scan_info;
3459214734Srpaulo
3460214734Srpaulo	/**
3461214734Srpaulo	 * struct mlme_rx - Data for EVENT_MLME_RX events
3462214734Srpaulo	 */
3463214734Srpaulo	struct mlme_rx {
3464214734Srpaulo		const u8 *buf;
3465214734Srpaulo		size_t len;
3466214734Srpaulo		int freq;
3467214734Srpaulo		int channel;
3468214734Srpaulo		int ssi;
3469214734Srpaulo	} mlme_rx;
3470214734Srpaulo
3471214734Srpaulo	/**
3472214734Srpaulo	 * struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events
3473214734Srpaulo	 */
3474214734Srpaulo	struct rx_probe_req {
3475214734Srpaulo		/**
3476214734Srpaulo		 * sa - Source address of the received Probe Request frame
3477214734Srpaulo		 */
3478214734Srpaulo		const u8 *sa;
3479214734Srpaulo
3480214734Srpaulo		/**
3481252726Srpaulo		 * da - Destination address of the received Probe Request frame
3482252726Srpaulo		 *	or %NULL if not available
3483252726Srpaulo		 */
3484252726Srpaulo		const u8 *da;
3485252726Srpaulo
3486252726Srpaulo		/**
3487252726Srpaulo		 * bssid - BSSID of the received Probe Request frame or %NULL
3488252726Srpaulo		 *	if not available
3489252726Srpaulo		 */
3490252726Srpaulo		const u8 *bssid;
3491252726Srpaulo
3492252726Srpaulo		/**
3493214734Srpaulo		 * ie - IEs from the Probe Request body
3494214734Srpaulo		 */
3495214734Srpaulo		const u8 *ie;
3496214734Srpaulo
3497214734Srpaulo		/**
3498214734Srpaulo		 * ie_len - Length of ie buffer in octets
3499214734Srpaulo		 */
3500214734Srpaulo		size_t ie_len;
3501252726Srpaulo
3502252726Srpaulo		/**
3503252726Srpaulo		 * signal - signal strength in dBm (or 0 if not available)
3504252726Srpaulo		 */
3505252726Srpaulo		int ssi_signal;
3506214734Srpaulo	} rx_probe_req;
3507214734Srpaulo
3508214734Srpaulo	/**
3509214734Srpaulo	 * struct new_sta - Data for EVENT_NEW_STA events
3510214734Srpaulo	 */
3511214734Srpaulo	struct new_sta {
3512214734Srpaulo		const u8 *addr;
3513214734Srpaulo	} new_sta;
3514214734Srpaulo
3515214734Srpaulo	/**
3516214734Srpaulo	 * struct eapol_rx - Data for EVENT_EAPOL_RX events
3517214734Srpaulo	 */
3518214734Srpaulo	struct eapol_rx {
3519214734Srpaulo		const u8 *src;
3520214734Srpaulo		const u8 *data;
3521214734Srpaulo		size_t data_len;
3522214734Srpaulo	} eapol_rx;
3523214734Srpaulo
3524214734Srpaulo	/**
3525252726Srpaulo	 * signal_change - Data for EVENT_SIGNAL_CHANGE events
3526214734Srpaulo	 */
3527252726Srpaulo	struct wpa_signal_info signal_change;
3528252726Srpaulo
3529252726Srpaulo	/**
3530252726Srpaulo	 * struct best_channel - Data for EVENT_BEST_CHANNEL events
3531252726Srpaulo	 * @freq_24: Best 2.4 GHz band channel frequency in MHz
3532252726Srpaulo	 * @freq_5: Best 5 GHz band channel frequency in MHz
3533252726Srpaulo	 * @freq_overall: Best channel frequency in MHz
3534252726Srpaulo	 *
3535252726Srpaulo	 * 0 can be used to indicate no preference in either band.
3536252726Srpaulo	 */
3537252726Srpaulo	struct best_channel {
3538252726Srpaulo		int freq_24;
3539252726Srpaulo		int freq_5;
3540252726Srpaulo		int freq_overall;
3541252726Srpaulo	} best_chan;
3542252726Srpaulo
3543252726Srpaulo	struct unprot_deauth {
3544252726Srpaulo		const u8 *sa;
3545252726Srpaulo		const u8 *da;
3546252726Srpaulo		u16 reason_code;
3547252726Srpaulo	} unprot_deauth;
3548252726Srpaulo
3549252726Srpaulo	struct unprot_disassoc {
3550252726Srpaulo		const u8 *sa;
3551252726Srpaulo		const u8 *da;
3552252726Srpaulo		u16 reason_code;
3553252726Srpaulo	} unprot_disassoc;
3554252726Srpaulo
3555252726Srpaulo	/**
3556252726Srpaulo	 * struct low_ack - Data for EVENT_STATION_LOW_ACK events
3557252726Srpaulo	 * @addr: station address
3558252726Srpaulo	 */
3559252726Srpaulo	struct low_ack {
3560252726Srpaulo		u8 addr[ETH_ALEN];
3561252726Srpaulo	} low_ack;
3562252726Srpaulo
3563252726Srpaulo	/**
3564252726Srpaulo	 * struct p2p_dev_found - Data for EVENT_P2P_DEV_FOUND
3565252726Srpaulo	 */
3566252726Srpaulo	struct p2p_dev_found {
3567252726Srpaulo		const u8 *addr;
3568252726Srpaulo		const u8 *dev_addr;
3569252726Srpaulo		const u8 *pri_dev_type;
3570252726Srpaulo		const char *dev_name;
3571252726Srpaulo		u16 config_methods;
3572252726Srpaulo		u8 dev_capab;
3573252726Srpaulo		u8 group_capab;
3574252726Srpaulo	} p2p_dev_found;
3575252726Srpaulo
3576252726Srpaulo	/**
3577252726Srpaulo	 * struct p2p_go_neg_req_rx - Data for EVENT_P2P_GO_NEG_REQ_RX
3578252726Srpaulo	 */
3579252726Srpaulo	struct p2p_go_neg_req_rx {
3580252726Srpaulo		const u8 *src;
3581252726Srpaulo		u16 dev_passwd_id;
3582252726Srpaulo	} p2p_go_neg_req_rx;
3583252726Srpaulo
3584252726Srpaulo	/**
3585252726Srpaulo	 * struct p2p_go_neg_completed - Data for EVENT_P2P_GO_NEG_COMPLETED
3586252726Srpaulo	 */
3587252726Srpaulo	struct p2p_go_neg_completed {
3588252726Srpaulo		struct p2p_go_neg_results *res;
3589252726Srpaulo	} p2p_go_neg_completed;
3590252726Srpaulo
3591252726Srpaulo	struct p2p_prov_disc_req {
3592252726Srpaulo		const u8 *peer;
3593252726Srpaulo		u16 config_methods;
3594252726Srpaulo		const u8 *dev_addr;
3595252726Srpaulo		const u8 *pri_dev_type;
3596252726Srpaulo		const char *dev_name;
3597252726Srpaulo		u16 supp_config_methods;
3598252726Srpaulo		u8 dev_capab;
3599252726Srpaulo		u8 group_capab;
3600252726Srpaulo	} p2p_prov_disc_req;
3601252726Srpaulo
3602252726Srpaulo	struct p2p_prov_disc_resp {
3603252726Srpaulo		const u8 *peer;
3604252726Srpaulo		u16 config_methods;
3605252726Srpaulo	} p2p_prov_disc_resp;
3606252726Srpaulo
3607252726Srpaulo	struct p2p_sd_req {
3608252726Srpaulo		int freq;
3609252726Srpaulo		const u8 *sa;
3610252726Srpaulo		u8 dialog_token;
3611252726Srpaulo		u16 update_indic;
3612252726Srpaulo		const u8 *tlvs;
3613252726Srpaulo		size_t tlvs_len;
3614252726Srpaulo	} p2p_sd_req;
3615252726Srpaulo
3616252726Srpaulo	struct p2p_sd_resp {
3617252726Srpaulo		const u8 *sa;
3618252726Srpaulo		u16 update_indic;
3619252726Srpaulo		const u8 *tlvs;
3620252726Srpaulo		size_t tlvs_len;
3621252726Srpaulo	} p2p_sd_resp;
3622252726Srpaulo
3623252726Srpaulo	/**
3624252726Srpaulo	 * struct ibss_peer_lost - Data for EVENT_IBSS_PEER_LOST
3625252726Srpaulo	 */
3626252726Srpaulo	struct ibss_peer_lost {
3627252726Srpaulo		u8 peer[ETH_ALEN];
3628252726Srpaulo	} ibss_peer_lost;
3629252726Srpaulo
3630252726Srpaulo	/**
3631252726Srpaulo	 * struct driver_gtk_rekey - Data for EVENT_DRIVER_GTK_REKEY
3632252726Srpaulo	 */
3633252726Srpaulo	struct driver_gtk_rekey {
3634252726Srpaulo		const u8 *bssid;
3635252726Srpaulo		const u8 *replay_ctr;
3636252726Srpaulo	} driver_gtk_rekey;
3637252726Srpaulo
3638252726Srpaulo	/**
3639252726Srpaulo	 * struct client_poll - Data for EVENT_DRIVER_CLIENT_POLL_OK events
3640252726Srpaulo	 * @addr: station address
3641252726Srpaulo	 */
3642252726Srpaulo	struct client_poll {
3643252726Srpaulo		u8 addr[ETH_ALEN];
3644252726Srpaulo	} client_poll;
3645252726Srpaulo
3646252726Srpaulo	/**
3647252726Srpaulo	 * struct eapol_tx_status
3648252726Srpaulo	 * @dst: Original destination
3649252726Srpaulo	 * @data: Data starting with IEEE 802.1X header (!)
3650252726Srpaulo	 * @data_len: Length of data
3651252726Srpaulo	 * @ack: Indicates ack or lost frame
3652252726Srpaulo	 *
3653252726Srpaulo	 * This corresponds to hapd_send_eapol if the frame sent
3654252726Srpaulo	 * there isn't just reported as EVENT_TX_STATUS.
3655252726Srpaulo	 */
3656252726Srpaulo	struct eapol_tx_status {
3657252726Srpaulo		const u8 *dst;
3658252726Srpaulo		const u8 *data;
3659252726Srpaulo		int data_len;
3660252726Srpaulo		int ack;
3661252726Srpaulo	} eapol_tx_status;
3662252726Srpaulo
3663252726Srpaulo	/**
3664252726Srpaulo	 * struct ch_switch
3665252726Srpaulo	 * @freq: Frequency of new channel in MHz
3666252726Srpaulo	 * @ht_enabled: Whether this is an HT channel
3667252726Srpaulo	 * @ch_offset: Secondary channel offset
3668252726Srpaulo	 */
3669252726Srpaulo	struct ch_switch {
3670252726Srpaulo		int freq;
3671252726Srpaulo		int ht_enabled;
3672252726Srpaulo		int ch_offset;
3673252726Srpaulo	} ch_switch;
3674189251Ssam};
3675189251Ssam
3676189251Ssam/**
3677189251Ssam * wpa_supplicant_event - Report a driver event for wpa_supplicant
3678189251Ssam * @ctx: Context pointer (wpa_s); this is the ctx variable registered
3679189251Ssam *	with struct wpa_driver_ops::init()
3680189251Ssam * @event: event type (defined above)
3681189251Ssam * @data: possible extra data for the event
3682189251Ssam *
3683189251Ssam * Driver wrapper code should call this function whenever an event is received
3684189251Ssam * from the driver.
3685189251Ssam */
3686214734Srpaulovoid wpa_supplicant_event(void *ctx, enum wpa_event_type event,
3687189251Ssam			  union wpa_event_data *data);
3688189251Ssam
3689214734Srpaulo
3690214734Srpaulo/*
3691214734Srpaulo * The following inline functions are provided for convenience to simplify
3692214734Srpaulo * event indication for some of the common events.
3693189251Ssam */
3694189251Ssam
3695214734Srpaulostatic inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
3696252726Srpaulo				   size_t ielen, int reassoc)
3697214734Srpaulo{
3698214734Srpaulo	union wpa_event_data event;
3699214734Srpaulo	os_memset(&event, 0, sizeof(event));
3700252726Srpaulo	event.assoc_info.reassoc = reassoc;
3701214734Srpaulo	event.assoc_info.req_ies = ie;
3702214734Srpaulo	event.assoc_info.req_ies_len = ielen;
3703214734Srpaulo	event.assoc_info.addr = addr;
3704214734Srpaulo	wpa_supplicant_event(ctx, EVENT_ASSOC, &event);
3705214734Srpaulo}
3706189251Ssam
3707214734Srpaulostatic inline void drv_event_disassoc(void *ctx, const u8 *addr)
3708214734Srpaulo{
3709214734Srpaulo	union wpa_event_data event;
3710214734Srpaulo	os_memset(&event, 0, sizeof(event));
3711214734Srpaulo	event.disassoc_info.addr = addr;
3712214734Srpaulo	wpa_supplicant_event(ctx, EVENT_DISASSOC, &event);
3713214734Srpaulo}
3714189251Ssam
3715214734Srpaulostatic inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
3716214734Srpaulo				      size_t data_len)
3717214734Srpaulo{
3718214734Srpaulo	union wpa_event_data event;
3719214734Srpaulo	os_memset(&event, 0, sizeof(event));
3720214734Srpaulo	event.eapol_rx.src = src;
3721214734Srpaulo	event.eapol_rx.data = data;
3722214734Srpaulo	event.eapol_rx.data_len = data_len;
3723214734Srpaulo	wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
3724214734Srpaulo}
3725214734Srpaulo
3726252726Srpaulo/* driver_common.c */
3727252726Srpaulovoid wpa_scan_results_free(struct wpa_scan_results *res);
3728252726Srpaulo
3729252726Srpaulo/* Convert wpa_event_type to a string for logging */
3730252726Srpauloconst char * event_to_string(enum wpa_event_type event);
3731252726Srpaulo
3732189251Ssam#endif /* DRIVER_H */
3733