1189251Ssam/* 2214734Srpaulo * Driver interface definition 3214734Srpaulo * Copyright (c) 2003-2010, Jouni Malinen <j@w1.fi> 4189251Ssam * 5189251Ssam * This program is free software; you can redistribute it and/or modify 6189251Ssam * it under the terms of the GNU General Public License version 2 as 7189251Ssam * published by the Free Software Foundation. 8189251Ssam * 9189251Ssam * Alternatively, this software may be distributed under the terms of BSD 10189251Ssam * license. 11189251Ssam * 12189251Ssam * See README and COPYING for more details. 13214734Srpaulo * 14214734Srpaulo * This file defines a driver interface used by both %wpa_supplicant and 15214734Srpaulo * hostapd. The first part of the file defines data structures used in various 16214734Srpaulo * driver operations. This is followed by the struct wpa_driver_ops that each 17214734Srpaulo * driver wrapper will beed to define with callback functions for requesting 18214734Srpaulo * driver operations. After this, there are definitions for driver event 19214734Srpaulo * reporting with wpa_supplicant_event() and some convenience helper functions 20214734Srpaulo * that can be used to report events. 21189251Ssam */ 22189251Ssam 23189251Ssam#ifndef DRIVER_H 24189251Ssam#define DRIVER_H 25189251Ssam 26214734Srpaulo#define WPA_SUPPLICANT_DRIVER_VERSION 4 27189251Ssam 28214734Srpaulo#include "common/defs.h" 29189251Ssam 30214734Srpaulo#define HOSTAPD_CHAN_DISABLED 0x00000001 31214734Srpaulo#define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002 32214734Srpaulo#define HOSTAPD_CHAN_NO_IBSS 0x00000004 33214734Srpaulo#define HOSTAPD_CHAN_RADAR 0x00000008 34189251Ssam 35214734Srpaulo/** 36214734Srpaulo * struct hostapd_channel_data - Channel information 37214734Srpaulo */ 38214734Srpaulostruct hostapd_channel_data { 39214734Srpaulo /** 40214734Srpaulo * chan - Channel number (IEEE 802.11) 41214734Srpaulo */ 42214734Srpaulo short chan; 43214734Srpaulo 44214734Srpaulo /** 45214734Srpaulo * freq - Frequency in MHz 46214734Srpaulo */ 47214734Srpaulo short freq; 48214734Srpaulo 49214734Srpaulo /** 50214734Srpaulo * flag - Channel flags (HOSTAPD_CHAN_*) 51214734Srpaulo */ 52214734Srpaulo int flag; 53214734Srpaulo 54214734Srpaulo /** 55214734Srpaulo * max_tx_power - maximum transmit power in dBm 56214734Srpaulo */ 57214734Srpaulo u8 max_tx_power; 58214734Srpaulo}; 59214734Srpaulo 60214734Srpaulo/** 61214734Srpaulo * struct hostapd_hw_modes - Supported hardware mode information 62214734Srpaulo */ 63214734Srpaulostruct hostapd_hw_modes { 64214734Srpaulo /** 65214734Srpaulo * mode - Hardware mode 66214734Srpaulo */ 67214734Srpaulo enum hostapd_hw_mode mode; 68214734Srpaulo 69214734Srpaulo /** 70214734Srpaulo * num_channels - Number of entries in the channels array 71214734Srpaulo */ 72214734Srpaulo int num_channels; 73214734Srpaulo 74214734Srpaulo /** 75214734Srpaulo * channels - Array of supported channels 76214734Srpaulo */ 77214734Srpaulo struct hostapd_channel_data *channels; 78214734Srpaulo 79214734Srpaulo /** 80214734Srpaulo * num_rates - Number of entries in the rates array 81214734Srpaulo */ 82214734Srpaulo int num_rates; 83214734Srpaulo 84214734Srpaulo /** 85214734Srpaulo * rates - Array of supported rates in 100 kbps units 86214734Srpaulo */ 87214734Srpaulo int *rates; 88214734Srpaulo 89214734Srpaulo /** 90214734Srpaulo * ht_capab - HT (IEEE 802.11n) capabilities 91214734Srpaulo */ 92214734Srpaulo u16 ht_capab; 93214734Srpaulo 94214734Srpaulo /** 95214734Srpaulo * mcs_set - MCS (IEEE 802.11n) rate parameters 96214734Srpaulo */ 97214734Srpaulo u8 mcs_set[16]; 98214734Srpaulo 99214734Srpaulo /** 100214734Srpaulo * a_mpdu_params - A-MPDU (IEEE 802.11n) parameters 101214734Srpaulo */ 102214734Srpaulo u8 a_mpdu_params; 103214734Srpaulo}; 104214734Srpaulo 105214734Srpaulo 106189251Ssam#define IEEE80211_MODE_INFRA 0 107189251Ssam#define IEEE80211_MODE_IBSS 1 108214734Srpaulo#define IEEE80211_MODE_AP 2 109189251Ssam 110189251Ssam#define IEEE80211_CAP_ESS 0x0001 111189251Ssam#define IEEE80211_CAP_IBSS 0x0002 112189251Ssam#define IEEE80211_CAP_PRIVACY 0x0010 113189251Ssam 114214734Srpaulo#define WPA_SCAN_QUAL_INVALID BIT(0) 115214734Srpaulo#define WPA_SCAN_NOISE_INVALID BIT(1) 116214734Srpaulo#define WPA_SCAN_LEVEL_INVALID BIT(2) 117214734Srpaulo#define WPA_SCAN_LEVEL_DBM BIT(3) 118214734Srpaulo#define WPA_SCAN_AUTHENTICATED BIT(4) 119214734Srpaulo#define WPA_SCAN_ASSOCIATED BIT(5) 120189251Ssam 121189251Ssam/** 122189251Ssam * struct wpa_scan_res - Scan result for an BSS/IBSS 123214734Srpaulo * @flags: information flags about the BSS/IBSS (WPA_SCAN_*) 124189251Ssam * @bssid: BSSID 125189251Ssam * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1) 126189251Ssam * @beacon_int: beacon interval in TUs (host byte order) 127189251Ssam * @caps: capability information field in host byte order 128189251Ssam * @qual: signal quality 129189251Ssam * @noise: noise level 130189251Ssam * @level: signal level 131189251Ssam * @tsf: Timestamp 132214734Srpaulo * @age: Age of the information in milliseconds (i.e., how many milliseconds 133214734Srpaulo * ago the last Beacon or Probe Response frame was received) 134189251Ssam * @ie_len: length of the following IE field in octets 135214734Srpaulo * @beacon_ie_len: length of the following Beacon IE field in octets 136189251Ssam * 137189251Ssam * This structure is used as a generic format for scan results from the 138189251Ssam * driver. Each driver interface implementation is responsible for converting 139189251Ssam * the driver or OS specific scan results into this format. 140189251Ssam * 141189251Ssam * If the driver does not support reporting all IEs, the IE data structure is 142189251Ssam * constructed of the IEs that are available. This field will also need to 143189251Ssam * include SSID in IE format. All drivers are encouraged to be extended to 144189251Ssam * report all IEs to make it easier to support future additions. 145189251Ssam */ 146189251Ssamstruct wpa_scan_res { 147214734Srpaulo unsigned int flags; 148189251Ssam u8 bssid[ETH_ALEN]; 149189251Ssam int freq; 150189251Ssam u16 beacon_int; 151189251Ssam u16 caps; 152189251Ssam int qual; 153189251Ssam int noise; 154189251Ssam int level; 155189251Ssam u64 tsf; 156214734Srpaulo unsigned int age; 157189251Ssam size_t ie_len; 158214734Srpaulo size_t beacon_ie_len; 159214734Srpaulo /* 160214734Srpaulo * Followed by ie_len octets of IEs from Probe Response frame (or if 161214734Srpaulo * the driver does not indicate source of IEs, these may also be from 162214734Srpaulo * Beacon frame). After the first set of IEs, another set of IEs may 163214734Srpaulo * follow (with beacon_ie_len octets of data) if the driver provides 164214734Srpaulo * both IE sets. 165214734Srpaulo */ 166189251Ssam}; 167189251Ssam 168189251Ssam/** 169189251Ssam * struct wpa_scan_results - Scan results 170189251Ssam * @res: Array of pointers to allocated variable length scan result entries 171189251Ssam * @num: Number of entries in the scan result array 172189251Ssam */ 173189251Ssamstruct wpa_scan_results { 174189251Ssam struct wpa_scan_res **res; 175189251Ssam size_t num; 176189251Ssam}; 177189251Ssam 178189251Ssam/** 179189251Ssam * struct wpa_interface_info - Network interface information 180189251Ssam * @next: Pointer to the next interface or NULL if this is the last one 181189251Ssam * @ifname: Interface name that can be used with init() or init2() 182189251Ssam * @desc: Human readable adapter description (e.g., vendor/model) or NULL if 183189251Ssam * not available 184209158Srpaulo * @drv_name: struct wpa_driver_ops::name (note: unlike other strings, this one 185189251Ssam * is not an allocated copy, i.e., get_interfaces() caller will not free 186189251Ssam * this) 187189251Ssam */ 188189251Ssamstruct wpa_interface_info { 189189251Ssam struct wpa_interface_info *next; 190189251Ssam char *ifname; 191189251Ssam char *desc; 192189251Ssam const char *drv_name; 193189251Ssam}; 194189251Ssam 195214734Srpaulo#define WPAS_MAX_SCAN_SSIDS 4 196214734Srpaulo 197189251Ssam/** 198214734Srpaulo * struct wpa_driver_scan_params - Scan parameters 199214734Srpaulo * Data for struct wpa_driver_ops::scan2(). 200214734Srpaulo */ 201214734Srpaulostruct wpa_driver_scan_params { 202214734Srpaulo /** 203214734Srpaulo * ssids - SSIDs to scan for 204214734Srpaulo */ 205214734Srpaulo struct wpa_driver_scan_ssid { 206214734Srpaulo /** 207214734Srpaulo * ssid - specific SSID to scan for (ProbeReq) 208214734Srpaulo * %NULL or zero-length SSID is used to indicate active scan 209214734Srpaulo * with wildcard SSID. 210214734Srpaulo */ 211214734Srpaulo const u8 *ssid; 212214734Srpaulo /** 213214734Srpaulo * ssid_len: Length of the SSID in octets 214214734Srpaulo */ 215214734Srpaulo size_t ssid_len; 216214734Srpaulo } ssids[WPAS_MAX_SCAN_SSIDS]; 217214734Srpaulo 218214734Srpaulo /** 219214734Srpaulo * num_ssids - Number of entries in ssids array 220214734Srpaulo * Zero indicates a request for a passive scan. 221214734Srpaulo */ 222214734Srpaulo size_t num_ssids; 223214734Srpaulo 224214734Srpaulo /** 225214734Srpaulo * extra_ies - Extra IE(s) to add into Probe Request or %NULL 226214734Srpaulo */ 227214734Srpaulo const u8 *extra_ies; 228214734Srpaulo 229214734Srpaulo /** 230214734Srpaulo * extra_ies_len - Length of extra_ies in octets 231214734Srpaulo */ 232214734Srpaulo size_t extra_ies_len; 233214734Srpaulo 234214734Srpaulo /** 235214734Srpaulo * freqs - Array of frequencies to scan or %NULL for all frequencies 236214734Srpaulo * 237214734Srpaulo * The frequency is set in MHz. The array is zero-terminated. 238214734Srpaulo */ 239214734Srpaulo int *freqs; 240214734Srpaulo 241214734Srpaulo /** 242214734Srpaulo * filter_ssids - Filter for reporting SSIDs 243214734Srpaulo * 244214734Srpaulo * This optional parameter can be used to request the driver wrapper to 245214734Srpaulo * filter scan results to include only the specified SSIDs. %NULL 246214734Srpaulo * indicates that no filtering is to be done. This can be used to 247214734Srpaulo * reduce memory needs for scan results in environments that have large 248214734Srpaulo * number of APs with different SSIDs. 249214734Srpaulo * 250214734Srpaulo * The driver wrapper is allowed to take this allocated buffer into its 251214734Srpaulo * own use by setting the pointer to %NULL. In that case, the driver 252214734Srpaulo * wrapper is responsible for freeing the buffer with os_free() once it 253214734Srpaulo * is not needed anymore. 254214734Srpaulo */ 255214734Srpaulo struct wpa_driver_scan_filter { 256214734Srpaulo u8 ssid[32]; 257214734Srpaulo size_t ssid_len; 258214734Srpaulo } *filter_ssids; 259214734Srpaulo 260214734Srpaulo /** 261214734Srpaulo * num_filter_ssids - Number of entries in filter_ssids array 262214734Srpaulo */ 263214734Srpaulo size_t num_filter_ssids; 264214734Srpaulo}; 265214734Srpaulo 266214734Srpaulo/** 267214734Srpaulo * struct wpa_driver_auth_params - Authentication parameters 268214734Srpaulo * Data for struct wpa_driver_ops::authenticate(). 269214734Srpaulo */ 270214734Srpaulostruct wpa_driver_auth_params { 271214734Srpaulo int freq; 272214734Srpaulo const u8 *bssid; 273214734Srpaulo const u8 *ssid; 274214734Srpaulo size_t ssid_len; 275214734Srpaulo int auth_alg; 276214734Srpaulo const u8 *ie; 277214734Srpaulo size_t ie_len; 278214734Srpaulo const u8 *wep_key[4]; 279214734Srpaulo size_t wep_key_len[4]; 280214734Srpaulo int wep_tx_keyidx; 281214734Srpaulo int local_state_change; 282214734Srpaulo}; 283214734Srpaulo 284214734Srpaulo/** 285189251Ssam * struct wpa_driver_associate_params - Association parameters 286189251Ssam * Data for struct wpa_driver_ops::associate(). 287189251Ssam */ 288189251Ssamstruct wpa_driver_associate_params { 289189251Ssam /** 290189251Ssam * bssid - BSSID of the selected AP 291189251Ssam * This can be %NULL, if ap_scan=2 mode is used and the driver is 292189251Ssam * responsible for selecting with which BSS to associate. */ 293189251Ssam const u8 *bssid; 294189251Ssam 295189251Ssam /** 296189251Ssam * ssid - The selected SSID 297189251Ssam */ 298189251Ssam const u8 *ssid; 299214734Srpaulo 300214734Srpaulo /** 301214734Srpaulo * ssid_len - Length of the SSID (1..32) 302214734Srpaulo */ 303189251Ssam size_t ssid_len; 304189251Ssam 305189251Ssam /** 306189251Ssam * freq - Frequency of the channel the selected AP is using 307189251Ssam * Frequency that the selected AP is using (in MHz as 308189251Ssam * reported in the scan results) 309189251Ssam */ 310189251Ssam int freq; 311189251Ssam 312189251Ssam /** 313189251Ssam * wpa_ie - WPA information element for (Re)Association Request 314189251Ssam * WPA information element to be included in (Re)Association 315189251Ssam * Request (including information element id and length). Use 316189251Ssam * of this WPA IE is optional. If the driver generates the WPA 317189251Ssam * IE, it can use pairwise_suite, group_suite, and 318189251Ssam * key_mgmt_suite to select proper algorithms. In this case, 319189251Ssam * the driver has to notify wpa_supplicant about the used WPA 320189251Ssam * IE by generating an event that the interface code will 321189251Ssam * convert into EVENT_ASSOCINFO data (see below). 322189251Ssam * 323189251Ssam * When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE 324189251Ssam * instead. The driver can determine which version is used by 325189251Ssam * looking at the first byte of the IE (0xdd for WPA, 0x30 for 326189251Ssam * WPA2/RSN). 327189251Ssam * 328189251Ssam * When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE. 329189251Ssam */ 330189251Ssam const u8 *wpa_ie; 331214734Srpaulo 332189251Ssam /** 333189251Ssam * wpa_ie_len - length of the wpa_ie 334189251Ssam */ 335189251Ssam size_t wpa_ie_len; 336189251Ssam 337214734Srpaulo /** 338214734Srpaulo * pairwise_suite - Selected pairwise cipher suite 339214734Srpaulo * 340214734Srpaulo * This is usually ignored if @wpa_ie is used. 341214734Srpaulo */ 342214734Srpaulo enum wpa_cipher pairwise_suite; 343189251Ssam 344189251Ssam /** 345214734Srpaulo * group_suite - Selected group cipher suite 346214734Srpaulo * 347214734Srpaulo * This is usually ignored if @wpa_ie is used. 348214734Srpaulo */ 349214734Srpaulo enum wpa_cipher group_suite; 350214734Srpaulo 351214734Srpaulo /** 352214734Srpaulo * key_mgmt_suite - Selected key management suite 353214734Srpaulo * 354214734Srpaulo * This is usually ignored if @wpa_ie is used. 355214734Srpaulo */ 356214734Srpaulo enum wpa_key_mgmt key_mgmt_suite; 357214734Srpaulo 358214734Srpaulo /** 359189251Ssam * auth_alg - Allowed authentication algorithms 360214734Srpaulo * Bit field of WPA_AUTH_ALG_* 361189251Ssam */ 362189251Ssam int auth_alg; 363189251Ssam 364189251Ssam /** 365189251Ssam * mode - Operation mode (infra/ibss) IEEE80211_MODE_* 366189251Ssam */ 367189251Ssam int mode; 368189251Ssam 369189251Ssam /** 370189251Ssam * wep_key - WEP keys for static WEP configuration 371189251Ssam */ 372189251Ssam const u8 *wep_key[4]; 373189251Ssam 374189251Ssam /** 375189251Ssam * wep_key_len - WEP key length for static WEP configuration 376189251Ssam */ 377189251Ssam size_t wep_key_len[4]; 378189251Ssam 379189251Ssam /** 380189251Ssam * wep_tx_keyidx - WEP TX key index for static WEP configuration 381189251Ssam */ 382189251Ssam int wep_tx_keyidx; 383189251Ssam 384189251Ssam /** 385189251Ssam * mgmt_frame_protection - IEEE 802.11w management frame protection 386189251Ssam */ 387214734Srpaulo enum mfp_options mgmt_frame_protection; 388189251Ssam 389189251Ssam /** 390189251Ssam * ft_ies - IEEE 802.11r / FT information elements 391189251Ssam * If the supplicant is using IEEE 802.11r (FT) and has the needed keys 392189251Ssam * for fast transition, this parameter is set to include the IEs that 393189251Ssam * are to be sent in the next FT Authentication Request message. 394189251Ssam * update_ft_ies() handler is called to update the IEs for further 395189251Ssam * FT messages in the sequence. 396189251Ssam * 397189251Ssam * The driver should use these IEs only if the target AP is advertising 398189251Ssam * the same mobility domain as the one included in the MDIE here. 399189251Ssam * 400189251Ssam * In ap_scan=2 mode, the driver can use these IEs when moving to a new 401189251Ssam * AP after the initial association. These IEs can only be used if the 402189251Ssam * target AP is advertising support for FT and is using the same MDIE 403189251Ssam * and SSID as the current AP. 404189251Ssam * 405189251Ssam * The driver is responsible for reporting the FT IEs received from the 406189251Ssam * AP's response using wpa_supplicant_event() with EVENT_FT_RESPONSE 407189251Ssam * type. update_ft_ies() handler will then be called with the FT IEs to 408189251Ssam * include in the next frame in the authentication sequence. 409189251Ssam */ 410189251Ssam const u8 *ft_ies; 411189251Ssam 412189251Ssam /** 413189251Ssam * ft_ies_len - Length of ft_ies in bytes 414189251Ssam */ 415189251Ssam size_t ft_ies_len; 416189251Ssam 417189251Ssam /** 418189251Ssam * ft_md - FT Mobility domain (6 octets) (also included inside ft_ies) 419189251Ssam * 420189251Ssam * This value is provided to allow the driver interface easier access 421189251Ssam * to the current mobility domain. This value is set to %NULL if no 422189251Ssam * mobility domain is currently active. 423189251Ssam */ 424189251Ssam const u8 *ft_md; 425189251Ssam 426189251Ssam /** 427189251Ssam * passphrase - RSN passphrase for PSK 428189251Ssam * 429189251Ssam * This value is made available only for WPA/WPA2-Personal (PSK) and 430189251Ssam * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is 431189251Ssam * the 8..63 character ASCII passphrase, if available. Please note that 432189251Ssam * this can be %NULL if passphrase was not used to generate the PSK. In 433189251Ssam * that case, the psk field must be used to fetch the PSK. 434189251Ssam */ 435189251Ssam const char *passphrase; 436189251Ssam 437189251Ssam /** 438189251Ssam * psk - RSN PSK (alternative for passphrase for PSK) 439189251Ssam * 440189251Ssam * This value is made available only for WPA/WPA2-Personal (PSK) and 441189251Ssam * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is 442189251Ssam * the 32-octet (256-bit) PSK, if available. The driver wrapper should 443189251Ssam * be prepared to handle %NULL value as an error. 444189251Ssam */ 445189251Ssam const u8 *psk; 446214734Srpaulo 447214734Srpaulo /** 448214734Srpaulo * drop_unencrypted - Enable/disable unencrypted frame filtering 449214734Srpaulo * 450214734Srpaulo * Configure the driver to drop all non-EAPOL frames (both receive and 451214734Srpaulo * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must 452214734Srpaulo * still be allowed for key negotiation. 453214734Srpaulo */ 454214734Srpaulo int drop_unencrypted; 455214734Srpaulo 456214734Srpaulo /** 457214734Srpaulo * prev_bssid - Previously used BSSID in this ESS 458214734Srpaulo * 459214734Srpaulo * When not %NULL, this is a request to use reassociation instead of 460214734Srpaulo * association. 461214734Srpaulo */ 462214734Srpaulo const u8 *prev_bssid; 463189251Ssam}; 464189251Ssam 465189251Ssam/** 466189251Ssam * struct wpa_driver_capa - Driver capability information 467189251Ssam */ 468189251Ssamstruct wpa_driver_capa { 469189251Ssam#define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001 470189251Ssam#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002 471189251Ssam#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004 472189251Ssam#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008 473189251Ssam#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010 474189251Ssam#define WPA_DRIVER_CAPA_KEY_MGMT_FT 0x00000020 475189251Ssam#define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK 0x00000040 476189251Ssam unsigned int key_mgmt; 477189251Ssam 478189251Ssam#define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001 479189251Ssam#define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002 480189251Ssam#define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004 481189251Ssam#define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008 482189251Ssam unsigned int enc; 483189251Ssam 484189251Ssam#define WPA_DRIVER_AUTH_OPEN 0x00000001 485189251Ssam#define WPA_DRIVER_AUTH_SHARED 0x00000002 486189251Ssam#define WPA_DRIVER_AUTH_LEAP 0x00000004 487189251Ssam unsigned int auth; 488189251Ssam 489189251Ssam/* Driver generated WPA/RSN IE */ 490189251Ssam#define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001 491214734Srpaulo/* Driver needs static WEP key setup after association command */ 492189251Ssam#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002 493189251Ssam#define WPA_DRIVER_FLAGS_USER_SPACE_MLME 0x00000004 494189251Ssam/* Driver takes care of RSN 4-way handshake internally; PMK is configured with 495189251Ssam * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */ 496189251Ssam#define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008 497214734Srpaulo#define WPA_DRIVER_FLAGS_WIRED 0x00000010 498214734Srpaulo/* Driver provides separate commands for authentication and association (SME in 499214734Srpaulo * wpa_supplicant). */ 500214734Srpaulo#define WPA_DRIVER_FLAGS_SME 0x00000020 501214734Srpaulo/* Driver supports AP mode */ 502214734Srpaulo#define WPA_DRIVER_FLAGS_AP 0x00000040 503214734Srpaulo/* Driver needs static WEP key setup after association has been completed */ 504214734Srpaulo#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080 505189251Ssam unsigned int flags; 506214734Srpaulo 507214734Srpaulo int max_scan_ssids; 508214734Srpaulo 509214734Srpaulo /** 510214734Srpaulo * max_remain_on_chan - Maximum remain-on-channel duration in msec 511214734Srpaulo */ 512214734Srpaulo unsigned int max_remain_on_chan; 513189251Ssam}; 514189251Ssam 515189251Ssam 516214734Srpaulostruct hostapd_data; 517189251Ssam 518214734Srpaulostruct hostap_sta_driver_data { 519214734Srpaulo unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes; 520214734Srpaulo unsigned long current_tx_rate; 521214734Srpaulo unsigned long inactive_msec; 522214734Srpaulo unsigned long flags; 523214734Srpaulo unsigned long num_ps_buf_frames; 524214734Srpaulo unsigned long tx_retry_failed; 525214734Srpaulo unsigned long tx_retry_count; 526214734Srpaulo int last_rssi; 527214734Srpaulo int last_ack_rssi; 528189251Ssam}; 529189251Ssam 530214734Srpaulostruct hostapd_sta_add_params { 531214734Srpaulo const u8 *addr; 532214734Srpaulo u16 aid; 533214734Srpaulo u16 capability; 534214734Srpaulo const u8 *supp_rates; 535214734Srpaulo size_t supp_rates_len; 536214734Srpaulo u16 listen_interval; 537214734Srpaulo const struct ieee80211_ht_capabilities *ht_capabilities; 538214734Srpaulo}; 539189251Ssam 540214734Srpaulostruct hostapd_freq_params { 541214734Srpaulo int mode; 542214734Srpaulo int freq; 543214734Srpaulo int channel; 544214734Srpaulo int ht_enabled; 545214734Srpaulo int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled, 546214734Srpaulo * secondary channel below primary, 1 = HT40 547214734Srpaulo * enabled, secondary channel above primary */ 548189251Ssam}; 549189251Ssam 550214734Srpauloenum wpa_driver_if_type { 551214734Srpaulo /** 552214734Srpaulo * WPA_IF_STATION - Station mode interface 553214734Srpaulo */ 554214734Srpaulo WPA_IF_STATION, 555189251Ssam 556214734Srpaulo /** 557214734Srpaulo * WPA_IF_AP_VLAN - AP mode VLAN interface 558214734Srpaulo * 559214734Srpaulo * This interface shares its address and Beacon frame with the main 560214734Srpaulo * BSS. 561214734Srpaulo */ 562214734Srpaulo WPA_IF_AP_VLAN, 563214734Srpaulo 564214734Srpaulo /** 565214734Srpaulo * WPA_IF_AP_BSS - AP mode BSS interface 566214734Srpaulo * 567214734Srpaulo * This interface has its own address and Beacon frame. 568214734Srpaulo */ 569214734Srpaulo WPA_IF_AP_BSS, 570189251Ssam}; 571189251Ssam 572214734Srpaulostruct wpa_init_params { 573214734Srpaulo const u8 *bssid; 574214734Srpaulo const char *ifname; 575214734Srpaulo const u8 *ssid; 576214734Srpaulo size_t ssid_len; 577214734Srpaulo const char *test_socket; 578214734Srpaulo int use_pae_group_addr; 579214734Srpaulo char **bridge; 580214734Srpaulo size_t num_bridge; 581189251Ssam 582214734Srpaulo u8 *own_addr; /* buffer for writing own MAC address */ 583189251Ssam}; 584189251Ssam 585189251Ssam 586214734Srpaulostruct wpa_bss_params { 587214734Srpaulo /** Interface name (for multi-SSID/VLAN support) */ 588214734Srpaulo const char *ifname; 589214734Srpaulo /** Whether IEEE 802.1X or WPA/WPA2 is enabled */ 590214734Srpaulo int enabled; 591214734Srpaulo 592214734Srpaulo int wpa; 593214734Srpaulo int ieee802_1x; 594214734Srpaulo int wpa_group; 595214734Srpaulo int wpa_pairwise; 596214734Srpaulo int wpa_key_mgmt; 597214734Srpaulo int rsn_preauth; 598214734Srpaulo}; 599214734Srpaulo 600214734Srpaulo#define WPA_STA_AUTHORIZED BIT(0) 601214734Srpaulo#define WPA_STA_WMM BIT(1) 602214734Srpaulo#define WPA_STA_SHORT_PREAMBLE BIT(2) 603214734Srpaulo#define WPA_STA_MFP BIT(3) 604214734Srpaulo 605189251Ssam/** 606189251Ssam * struct wpa_driver_ops - Driver interface API definition 607189251Ssam * 608189251Ssam * This structure defines the API that each driver interface needs to implement 609189251Ssam * for core wpa_supplicant code. All driver specific functionality is captured 610189251Ssam * in this wrapper. 611189251Ssam */ 612189251Ssamstruct wpa_driver_ops { 613189251Ssam /** Name of the driver interface */ 614189251Ssam const char *name; 615189251Ssam /** One line description of the driver interface */ 616189251Ssam const char *desc; 617189251Ssam 618189251Ssam /** 619189251Ssam * get_bssid - Get the current BSSID 620189251Ssam * @priv: private driver interface data 621189251Ssam * @bssid: buffer for BSSID (ETH_ALEN = 6 bytes) 622189251Ssam * 623189251Ssam * Returns: 0 on success, -1 on failure 624189251Ssam * 625189251Ssam * Query kernel driver for the current BSSID and copy it to bssid. 626189251Ssam * Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not 627189251Ssam * associated. 628189251Ssam */ 629189251Ssam int (*get_bssid)(void *priv, u8 *bssid); 630189251Ssam 631189251Ssam /** 632189251Ssam * get_ssid - Get the current SSID 633189251Ssam * @priv: private driver interface data 634189251Ssam * @ssid: buffer for SSID (at least 32 bytes) 635189251Ssam * 636189251Ssam * Returns: Length of the SSID on success, -1 on failure 637189251Ssam * 638189251Ssam * Query kernel driver for the current SSID and copy it to ssid. 639189251Ssam * Returning zero is recommended if the STA is not associated. 640189251Ssam * 641189251Ssam * Note: SSID is an array of octets, i.e., it is not nul terminated and 642189251Ssam * can, at least in theory, contain control characters (including nul) 643189251Ssam * and as such, should be processed as binary data, not a printable 644189251Ssam * string. 645189251Ssam */ 646189251Ssam int (*get_ssid)(void *priv, u8 *ssid); 647189251Ssam 648189251Ssam /** 649189251Ssam * set_key - Configure encryption key 650214734Srpaulo * @ifname: Interface name (for multi-SSID/VLAN support) 651189251Ssam * @priv: private driver interface data 652189251Ssam * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP, 653189251Ssam * %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK); 654189251Ssam * %WPA_ALG_NONE clears the key. 655189251Ssam * @addr: address of the peer STA or ff:ff:ff:ff:ff:ff for 656189251Ssam * broadcast/default keys 657189251Ssam * @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for 658189251Ssam * IGTK 659189251Ssam * @set_tx: configure this key as the default Tx key (only used when 660189251Ssam * driver does not support separate unicast/individual key 661189251Ssam * @seq: sequence number/packet number, seq_len octets, the next 662189251Ssam * packet number to be used for in replay protection; configured 663189251Ssam * for Rx keys (in most cases, this is only used with broadcast 664189251Ssam * keys and set to zero for unicast keys) 665189251Ssam * @seq_len: length of the seq, depends on the algorithm: 666189251Ssam * TKIP: 6 octets, CCMP: 6 octets, IGTK: 6 octets 667189251Ssam * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key, 668189251Ssam * 8-byte Rx Mic Key 669189251Ssam * @key_len: length of the key buffer in octets (WEP: 5 or 13, 670189251Ssam * TKIP: 32, CCMP: 16, IGTK: 16) 671189251Ssam * 672189251Ssam * Returns: 0 on success, -1 on failure 673189251Ssam * 674189251Ssam * Configure the given key for the kernel driver. If the driver 675189251Ssam * supports separate individual keys (4 default keys + 1 individual), 676189251Ssam * addr can be used to determine whether the key is default or 677189251Ssam * individual. If only 4 keys are supported, the default key with key 678189251Ssam * index 0 is used as the individual key. STA must be configured to use 679189251Ssam * it as the default Tx key (set_tx is set) and accept Rx for all the 680189251Ssam * key indexes. In most cases, WPA uses only key indexes 1 and 2 for 681189251Ssam * broadcast keys, so key index 0 is available for this kind of 682189251Ssam * configuration. 683189251Ssam * 684189251Ssam * Please note that TKIP keys include separate TX and RX MIC keys and 685189251Ssam * some drivers may expect them in different order than wpa_supplicant 686189251Ssam * is using. If the TX/RX keys are swapped, all TKIP encrypted packets 687189251Ssam * will tricker Michael MIC errors. This can be fixed by changing the 688189251Ssam * order of MIC keys by swapping te bytes 16..23 and 24..31 of the key 689189251Ssam * in driver_*.c set_key() implementation, see driver_ndis.c for an 690189251Ssam * example on how this can be done. 691189251Ssam */ 692214734Srpaulo int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg, 693214734Srpaulo const u8 *addr, int key_idx, int set_tx, 694214734Srpaulo const u8 *seq, size_t seq_len, 695189251Ssam const u8 *key, size_t key_len); 696189251Ssam 697189251Ssam /** 698189251Ssam * init - Initialize driver interface 699189251Ssam * @ctx: context to be used when calling wpa_supplicant functions, 700189251Ssam * e.g., wpa_supplicant_event() 701189251Ssam * @ifname: interface name, e.g., wlan0 702189251Ssam * 703189251Ssam * Returns: Pointer to private data, %NULL on failure 704189251Ssam * 705189251Ssam * Initialize driver interface, including event processing for kernel 706189251Ssam * driver events (e.g., associated, scan results, Michael MIC failure). 707189251Ssam * This function can allocate a private configuration data area for 708189251Ssam * @ctx, file descriptor, interface name, etc. information that may be 709189251Ssam * needed in future driver operations. If this is not used, non-NULL 710189251Ssam * value will need to be returned because %NULL is used to indicate 711189251Ssam * failure. The returned value will be used as 'void *priv' data for 712189251Ssam * all other driver_ops functions. 713189251Ssam * 714189251Ssam * The main event loop (eloop.c) of wpa_supplicant can be used to 715189251Ssam * register callback for read sockets (eloop_register_read_sock()). 716189251Ssam * 717189251Ssam * See below for more information about events and 718189251Ssam * wpa_supplicant_event() function. 719189251Ssam */ 720189251Ssam void * (*init)(void *ctx, const char *ifname); 721189251Ssam 722189251Ssam /** 723189251Ssam * deinit - Deinitialize driver interface 724189251Ssam * @priv: private driver interface data from init() 725189251Ssam * 726189251Ssam * Shut down driver interface and processing of driver events. Free 727189251Ssam * private data buffer if one was allocated in init() handler. 728189251Ssam */ 729189251Ssam void (*deinit)(void *priv); 730189251Ssam 731189251Ssam /** 732189251Ssam * set_param - Set driver configuration parameters 733189251Ssam * @priv: private driver interface data from init() 734189251Ssam * @param: driver specific configuration parameters 735189251Ssam * 736189251Ssam * Returns: 0 on success, -1 on failure 737189251Ssam * 738189251Ssam * Optional handler for notifying driver interface about configuration 739189251Ssam * parameters (driver_param). 740189251Ssam */ 741189251Ssam int (*set_param)(void *priv, const char *param); 742189251Ssam 743189251Ssam /** 744189251Ssam * set_countermeasures - Enable/disable TKIP countermeasures 745189251Ssam * @priv: private driver interface data 746189251Ssam * @enabled: 1 = countermeasures enabled, 0 = disabled 747189251Ssam * 748189251Ssam * Returns: 0 on success, -1 on failure 749189251Ssam * 750189251Ssam * Configure TKIP countermeasures. When these are enabled, the driver 751189251Ssam * should drop all received and queued frames that are using TKIP. 752189251Ssam */ 753189251Ssam int (*set_countermeasures)(void *priv, int enabled); 754189251Ssam 755189251Ssam /** 756189251Ssam * deauthenticate - Request driver to deauthenticate 757189251Ssam * @priv: private driver interface data 758189251Ssam * @addr: peer address (BSSID of the AP) 759189251Ssam * @reason_code: 16-bit reason code to be sent in the deauthentication 760189251Ssam * frame 761189251Ssam * 762189251Ssam * Returns: 0 on success, -1 on failure 763189251Ssam */ 764189251Ssam int (*deauthenticate)(void *priv, const u8 *addr, int reason_code); 765189251Ssam 766189251Ssam /** 767189251Ssam * disassociate - Request driver to disassociate 768189251Ssam * @priv: private driver interface data 769189251Ssam * @addr: peer address (BSSID of the AP) 770189251Ssam * @reason_code: 16-bit reason code to be sent in the disassociation 771189251Ssam * frame 772189251Ssam * 773189251Ssam * Returns: 0 on success, -1 on failure 774189251Ssam */ 775189251Ssam int (*disassociate)(void *priv, const u8 *addr, int reason_code); 776189251Ssam 777189251Ssam /** 778189251Ssam * associate - Request driver to associate 779189251Ssam * @priv: private driver interface data 780189251Ssam * @params: association parameters 781189251Ssam * 782189251Ssam * Returns: 0 on success, -1 on failure 783189251Ssam */ 784189251Ssam int (*associate)(void *priv, 785189251Ssam struct wpa_driver_associate_params *params); 786189251Ssam 787189251Ssam /** 788189251Ssam * add_pmkid - Add PMKSA cache entry to the driver 789189251Ssam * @priv: private driver interface data 790189251Ssam * @bssid: BSSID for the PMKSA cache entry 791189251Ssam * @pmkid: PMKID for the PMKSA cache entry 792189251Ssam * 793189251Ssam * Returns: 0 on success, -1 on failure 794189251Ssam * 795189251Ssam * This function is called when a new PMK is received, as a result of 796189251Ssam * either normal authentication or RSN pre-authentication. 797189251Ssam * 798189251Ssam * If the driver generates RSN IE, i.e., it does not use wpa_ie in 799189251Ssam * associate(), add_pmkid() can be used to add new PMKSA cache entries 800189251Ssam * in the driver. If the driver uses wpa_ie from wpa_supplicant, this 801189251Ssam * driver_ops function does not need to be implemented. Likewise, if 802189251Ssam * the driver does not support WPA, this function is not needed. 803189251Ssam */ 804189251Ssam int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid); 805189251Ssam 806189251Ssam /** 807189251Ssam * remove_pmkid - Remove PMKSA cache entry to the driver 808189251Ssam * @priv: private driver interface data 809189251Ssam * @bssid: BSSID for the PMKSA cache entry 810189251Ssam * @pmkid: PMKID for the PMKSA cache entry 811189251Ssam * 812189251Ssam * Returns: 0 on success, -1 on failure 813189251Ssam * 814189251Ssam * This function is called when the supplicant drops a PMKSA cache 815189251Ssam * entry for any reason. 816189251Ssam * 817189251Ssam * If the driver generates RSN IE, i.e., it does not use wpa_ie in 818189251Ssam * associate(), remove_pmkid() can be used to synchronize PMKSA caches 819189251Ssam * between the driver and wpa_supplicant. If the driver uses wpa_ie 820189251Ssam * from wpa_supplicant, this driver_ops function does not need to be 821189251Ssam * implemented. Likewise, if the driver does not support WPA, this 822189251Ssam * function is not needed. 823189251Ssam */ 824189251Ssam int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid); 825189251Ssam 826189251Ssam /** 827189251Ssam * flush_pmkid - Flush PMKSA cache 828189251Ssam * @priv: private driver interface data 829189251Ssam * 830189251Ssam * Returns: 0 on success, -1 on failure 831189251Ssam * 832189251Ssam * This function is called when the supplicant drops all PMKSA cache 833189251Ssam * entries for any reason. 834189251Ssam * 835189251Ssam * If the driver generates RSN IE, i.e., it does not use wpa_ie in 836189251Ssam * associate(), remove_pmkid() can be used to synchronize PMKSA caches 837189251Ssam * between the driver and wpa_supplicant. If the driver uses wpa_ie 838189251Ssam * from wpa_supplicant, this driver_ops function does not need to be 839189251Ssam * implemented. Likewise, if the driver does not support WPA, this 840189251Ssam * function is not needed. 841189251Ssam */ 842189251Ssam int (*flush_pmkid)(void *priv); 843189251Ssam 844189251Ssam /** 845209158Srpaulo * get_capa - Get driver capabilities 846189251Ssam * @priv: private driver interface data 847189251Ssam * 848189251Ssam * Returns: 0 on success, -1 on failure 849189251Ssam * 850189251Ssam * Get driver/firmware/hardware capabilities. 851189251Ssam */ 852189251Ssam int (*get_capa)(void *priv, struct wpa_driver_capa *capa); 853189251Ssam 854189251Ssam /** 855189251Ssam * poll - Poll driver for association information 856189251Ssam * @priv: private driver interface data 857189251Ssam * 858189251Ssam * This is an option callback that can be used when the driver does not 859189251Ssam * provide event mechanism for association events. This is called when 860189251Ssam * receiving WPA EAPOL-Key messages that require association 861189251Ssam * information. The driver interface is supposed to generate associnfo 862189251Ssam * event before returning from this callback function. In addition, the 863189251Ssam * driver interface should generate an association event after having 864189251Ssam * sent out associnfo. 865189251Ssam */ 866189251Ssam void (*poll)(void *priv); 867189251Ssam 868189251Ssam /** 869189251Ssam * get_ifname - Get interface name 870189251Ssam * @priv: private driver interface data 871189251Ssam * 872189251Ssam * Returns: Pointer to the interface name. This can differ from the 873189251Ssam * interface name used in init() call. Init() is called first. 874189251Ssam * 875189251Ssam * This optional function can be used to allow the driver interface to 876189251Ssam * replace the interface name with something else, e.g., based on an 877189251Ssam * interface mapping from a more descriptive name. 878189251Ssam */ 879189251Ssam const char * (*get_ifname)(void *priv); 880189251Ssam 881189251Ssam /** 882189251Ssam * get_mac_addr - Get own MAC address 883189251Ssam * @priv: private driver interface data 884189251Ssam * 885189251Ssam * Returns: Pointer to own MAC address or %NULL on failure 886189251Ssam * 887189251Ssam * This optional function can be used to get the own MAC address of the 888189251Ssam * device from the driver interface code. This is only needed if the 889189251Ssam * l2_packet implementation for the OS does not provide easy access to 890189251Ssam * a MAC address. */ 891189251Ssam const u8 * (*get_mac_addr)(void *priv); 892189251Ssam 893189251Ssam /** 894189251Ssam * send_eapol - Optional function for sending EAPOL packets 895189251Ssam * @priv: private driver interface data 896189251Ssam * @dest: Destination MAC address 897189251Ssam * @proto: Ethertype 898189251Ssam * @data: EAPOL packet starting with IEEE 802.1X header 899189251Ssam * @data_len: Size of the EAPOL packet 900189251Ssam * 901189251Ssam * Returns: 0 on success, -1 on failure 902189251Ssam * 903189251Ssam * This optional function can be used to override l2_packet operations 904189251Ssam * with driver specific functionality. If this function pointer is set, 905189251Ssam * l2_packet module is not used at all and the driver interface code is 906189251Ssam * responsible for receiving and sending all EAPOL packets. The 907214734Srpaulo * received EAPOL packets are sent to core code with EVENT_EAPOL_RX 908214734Srpaulo * event. The driver interface is required to implement get_mac_addr() 909214734Srpaulo * handler if send_eapol() is used. 910189251Ssam */ 911189251Ssam int (*send_eapol)(void *priv, const u8 *dest, u16 proto, 912189251Ssam const u8 *data, size_t data_len); 913189251Ssam 914189251Ssam /** 915189251Ssam * set_operstate - Sets device operating state to DORMANT or UP 916189251Ssam * @priv: private driver interface data 917189251Ssam * @state: 0 = dormant, 1 = up 918189251Ssam * Returns: 0 on success, -1 on failure 919189251Ssam * 920189251Ssam * This is an optional function that can be used on operating systems 921189251Ssam * that support a concept of controlling network device state from user 922189251Ssam * space applications. This function, if set, gets called with 923189251Ssam * state = 1 when authentication has been completed and with state = 0 924189251Ssam * when connection is lost. 925189251Ssam */ 926189251Ssam int (*set_operstate)(void *priv, int state); 927189251Ssam 928189251Ssam /** 929189251Ssam * mlme_setprotection - MLME-SETPROTECTION.request primitive 930189251Ssam * @priv: Private driver interface data 931189251Ssam * @addr: Address of the station for which to set protection (may be 932189251Ssam * %NULL for group keys) 933189251Ssam * @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_* 934189251Ssam * @key_type: MLME_SETPROTECTION_KEY_TYPE_* 935189251Ssam * Returns: 0 on success, -1 on failure 936189251Ssam * 937189251Ssam * This is an optional function that can be used to set the driver to 938189251Ssam * require protection for Tx and/or Rx frames. This uses the layer 939189251Ssam * interface defined in IEEE 802.11i-2004 clause 10.3.22.1 940189251Ssam * (MLME-SETPROTECTION.request). Many drivers do not use explicit 941189251Ssam * set protection operation; instead, they set protection implicitly 942189251Ssam * based on configured keys. 943189251Ssam */ 944189251Ssam int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type, 945189251Ssam int key_type); 946189251Ssam 947189251Ssam /** 948189251Ssam * get_hw_feature_data - Get hardware support data (channels and rates) 949189251Ssam * @priv: Private driver interface data 950189251Ssam * @num_modes: Variable for returning the number of returned modes 951189251Ssam * flags: Variable for returning hardware feature flags 952189251Ssam * Returns: Pointer to allocated hardware data on success or %NULL on 953189251Ssam * failure. Caller is responsible for freeing this. 954189251Ssam * 955189251Ssam * This function is only needed for drivers that export MLME 956214734Srpaulo * (management frame processing) to %wpa_supplicant or hostapd. 957189251Ssam */ 958214734Srpaulo struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv, 959214734Srpaulo u16 *num_modes, 960214734Srpaulo u16 *flags); 961189251Ssam 962189251Ssam /** 963189251Ssam * set_channel - Set channel 964189251Ssam * @priv: Private driver interface data 965214734Srpaulo * @phymode: HOSTAPD_MODE_IEEE80211B, .. 966189251Ssam * @chan: IEEE 802.11 channel number 967189251Ssam * @freq: Frequency of the channel in MHz 968189251Ssam * Returns: 0 on success, -1 on failure 969189251Ssam * 970189251Ssam * This function is only needed for drivers that export MLME 971189251Ssam * (management frame processing) to wpa_supplicant. 972189251Ssam */ 973214734Srpaulo int (*set_channel)(void *priv, enum hostapd_hw_mode phymode, int chan, 974189251Ssam int freq); 975189251Ssam 976189251Ssam /** 977189251Ssam * set_ssid - Set SSID 978189251Ssam * @priv: Private driver interface data 979189251Ssam * @ssid: SSID 980189251Ssam * @ssid_len: SSID length 981189251Ssam * Returns: 0 on success, -1 on failure 982189251Ssam * 983189251Ssam * This function is only needed for drivers that export MLME 984189251Ssam * (management frame processing) to wpa_supplicant. 985189251Ssam */ 986189251Ssam int (*set_ssid)(void *priv, const u8 *ssid, size_t ssid_len); 987189251Ssam 988189251Ssam /** 989189251Ssam * set_bssid - Set BSSID 990189251Ssam * @priv: Private driver interface data 991189251Ssam * @bssid: BSSID 992189251Ssam * Returns: 0 on success, -1 on failure 993189251Ssam * 994189251Ssam * This function is only needed for drivers that export MLME 995189251Ssam * (management frame processing) to wpa_supplicant. 996189251Ssam */ 997189251Ssam int (*set_bssid)(void *priv, const u8 *bssid); 998189251Ssam 999189251Ssam /** 1000189251Ssam * send_mlme - Send management frame from MLME 1001189251Ssam * @priv: Private driver interface data 1002189251Ssam * @data: IEEE 802.11 management frame with IEEE 802.11 header 1003189251Ssam * @data_len: Size of the management frame 1004189251Ssam * Returns: 0 on success, -1 on failure 1005189251Ssam * 1006189251Ssam * This function is only needed for drivers that export MLME 1007189251Ssam * (management frame processing) to wpa_supplicant. 1008189251Ssam */ 1009189251Ssam int (*send_mlme)(void *priv, const u8 *data, size_t data_len); 1010189251Ssam 1011189251Ssam /** 1012189251Ssam * mlme_add_sta - Add a STA entry into the driver/netstack 1013189251Ssam * @priv: Private driver interface data 1014189251Ssam * @addr: MAC address of the STA (e.g., BSSID of the AP) 1015189251Ssam * @supp_rates: Supported rate set (from (Re)AssocResp); in IEEE 802.11 1016189251Ssam * format (one octet per rate, 1 = 0.5 Mbps) 1017189251Ssam * @supp_rates_len: Number of entries in supp_rates 1018189251Ssam * Returns: 0 on success, -1 on failure 1019189251Ssam * 1020189251Ssam * This function is only needed for drivers that export MLME 1021189251Ssam * (management frame processing) to wpa_supplicant. When the MLME code 1022189251Ssam * completes association with an AP, this function is called to 1023189251Ssam * configure the driver/netstack with a STA entry for data frame 1024189251Ssam * processing (TX rate control, encryption/decryption). 1025189251Ssam */ 1026189251Ssam int (*mlme_add_sta)(void *priv, const u8 *addr, const u8 *supp_rates, 1027189251Ssam size_t supp_rates_len); 1028189251Ssam 1029189251Ssam /** 1030189251Ssam * mlme_remove_sta - Remove a STA entry from the driver/netstack 1031189251Ssam * @priv: Private driver interface data 1032189251Ssam * @addr: MAC address of the STA (e.g., BSSID of the AP) 1033189251Ssam * Returns: 0 on success, -1 on failure 1034189251Ssam * 1035189251Ssam * This function is only needed for drivers that export MLME 1036189251Ssam * (management frame processing) to wpa_supplicant. 1037189251Ssam */ 1038189251Ssam int (*mlme_remove_sta)(void *priv, const u8 *addr); 1039189251Ssam 1040189251Ssam /** 1041189251Ssam * update_ft_ies - Update FT (IEEE 802.11r) IEs 1042189251Ssam * @priv: Private driver interface data 1043189251Ssam * @md: Mobility domain (2 octets) (also included inside ies) 1044189251Ssam * @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs 1045189251Ssam * @ies_len: Length of FT IEs in bytes 1046189251Ssam * Returns: 0 on success, -1 on failure 1047189251Ssam * 1048189251Ssam * The supplicant uses this callback to let the driver know that keying 1049189251Ssam * material for FT is available and that the driver can use the 1050189251Ssam * provided IEs in the next message in FT authentication sequence. 1051189251Ssam * 1052189251Ssam * This function is only needed for driver that support IEEE 802.11r 1053189251Ssam * (Fast BSS Transition). 1054189251Ssam */ 1055189251Ssam int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies, 1056189251Ssam size_t ies_len); 1057189251Ssam 1058189251Ssam /** 1059189251Ssam * send_ft_action - Send FT Action frame (IEEE 802.11r) 1060189251Ssam * @priv: Private driver interface data 1061189251Ssam * @action: Action field value 1062189251Ssam * @target_ap: Target AP address 1063189251Ssam * @ies: FT IEs (MDIE, FTIE, ...) (FT Request action frame body) 1064189251Ssam * @ies_len: Length of FT IEs in bytes 1065189251Ssam * Returns: 0 on success, -1 on failure 1066189251Ssam * 1067189251Ssam * The supplicant uses this callback to request the driver to transmit 1068189251Ssam * an FT Action frame (action category 6) for over-the-DS fast BSS 1069189251Ssam * transition. 1070189251Ssam */ 1071189251Ssam int (*send_ft_action)(void *priv, u8 action, const u8 *target_ap, 1072189251Ssam const u8 *ies, size_t ies_len); 1073189251Ssam 1074189251Ssam /** 1075189251Ssam * get_scan_results2 - Fetch the latest scan results 1076189251Ssam * @priv: private driver interface data 1077189251Ssam * 1078189251Ssam * Returns: Allocated buffer of scan results (caller is responsible for 1079189251Ssam * freeing the data structure) on success, NULL on failure 1080189251Ssam */ 1081189251Ssam struct wpa_scan_results * (*get_scan_results2)(void *priv); 1082189251Ssam 1083189251Ssam /** 1084189251Ssam * set_country - Set country 1085189251Ssam * @priv: Private driver interface data 1086189251Ssam * @alpha2: country to which to switch to 1087189251Ssam * Returns: 0 on success, -1 on failure 1088189251Ssam * 1089189251Ssam * This function is for drivers which support some form 1090189251Ssam * of setting a regulatory domain. 1091189251Ssam */ 1092189251Ssam int (*set_country)(void *priv, const char *alpha2); 1093189251Ssam 1094189251Ssam /** 1095189251Ssam * global_init - Global driver initialization 1096189251Ssam * Returns: Pointer to private data (global), %NULL on failure 1097189251Ssam * 1098189251Ssam * This optional function is called to initialize the driver wrapper 1099189251Ssam * for global data, i.e., data that applies to all interfaces. If this 1100189251Ssam * function is implemented, global_deinit() will also need to be 1101189251Ssam * implemented to free the private data. The driver will also likely 1102189251Ssam * use init2() function instead of init() to get the pointer to global 1103189251Ssam * data available to per-interface initializer. 1104189251Ssam */ 1105189251Ssam void * (*global_init)(void); 1106189251Ssam 1107189251Ssam /** 1108189251Ssam * global_deinit - Global driver deinitialization 1109189251Ssam * @priv: private driver global data from global_init() 1110189251Ssam * 1111189251Ssam * Terminate any global driver related functionality and free the 1112189251Ssam * global data structure. 1113189251Ssam */ 1114189251Ssam void (*global_deinit)(void *priv); 1115189251Ssam 1116189251Ssam /** 1117189251Ssam * init2 - Initialize driver interface (with global data) 1118189251Ssam * @ctx: context to be used when calling wpa_supplicant functions, 1119189251Ssam * e.g., wpa_supplicant_event() 1120189251Ssam * @ifname: interface name, e.g., wlan0 1121189251Ssam * @global_priv: private driver global data from global_init() 1122189251Ssam * Returns: Pointer to private data, %NULL on failure 1123189251Ssam * 1124189251Ssam * This function can be used instead of init() if the driver wrapper 1125189251Ssam * uses global data. 1126189251Ssam */ 1127189251Ssam void * (*init2)(void *ctx, const char *ifname, void *global_priv); 1128189251Ssam 1129189251Ssam /** 1130189251Ssam * get_interfaces - Get information about available interfaces 1131189251Ssam * @global_priv: private driver global data from global_init() 1132189251Ssam * Returns: Allocated buffer of interface information (caller is 1133189251Ssam * responsible for freeing the data structure) on success, NULL on 1134189251Ssam * failure 1135189251Ssam */ 1136189251Ssam struct wpa_interface_info * (*get_interfaces)(void *global_priv); 1137214734Srpaulo 1138214734Srpaulo /** 1139214734Srpaulo * scan2 - Request the driver to initiate scan 1140214734Srpaulo * @priv: private driver interface data 1141214734Srpaulo * @params: Scan parameters 1142214734Srpaulo * 1143214734Srpaulo * Returns: 0 on success, -1 on failure 1144214734Srpaulo * 1145214734Srpaulo * Once the scan results are ready, the driver should report scan 1146214734Srpaulo * results event for wpa_supplicant which will eventually request the 1147214734Srpaulo * results with wpa_driver_get_scan_results2(). 1148214734Srpaulo */ 1149214734Srpaulo int (*scan2)(void *priv, struct wpa_driver_scan_params *params); 1150214734Srpaulo 1151214734Srpaulo /** 1152214734Srpaulo * authenticate - Request driver to authenticate 1153214734Srpaulo * @priv: private driver interface data 1154214734Srpaulo * @params: authentication parameters 1155214734Srpaulo * Returns: 0 on success, -1 on failure 1156214734Srpaulo * 1157214734Srpaulo * This is an optional function that can be used with drivers that 1158214734Srpaulo * support separate authentication and association steps, i.e., when 1159214734Srpaulo * wpa_supplicant can act as the SME. If not implemented, associate() 1160214734Srpaulo * function is expected to take care of IEEE 802.11 authentication, 1161214734Srpaulo * too. 1162214734Srpaulo */ 1163214734Srpaulo int (*authenticate)(void *priv, 1164214734Srpaulo struct wpa_driver_auth_params *params); 1165214734Srpaulo 1166214734Srpaulo /** 1167214734Srpaulo * set_beacon - Set Beacon frame template 1168214734Srpaulo * @priv: Private driver interface data 1169214734Srpaulo * @head: Beacon head from IEEE 802.11 header to IEs before TIM IE 1170214734Srpaulo * @head_len: Length of the head buffer in octets 1171214734Srpaulo * @tail: Beacon tail following TIM IE 1172214734Srpaulo * @tail_len: Length of the tail buffer in octets 1173214734Srpaulo * @dtim_period: DTIM period 1174214734Srpaulo * @beacon_int: Beacon interval 1175214734Srpaulo * Returns: 0 on success, -1 on failure 1176214734Srpaulo * 1177214734Srpaulo * This function is used to configure Beacon template for the driver in 1178214734Srpaulo * AP mode. The driver is responsible for building the full Beacon 1179214734Srpaulo * frame by concatenating the head part with TIM IE generated by the 1180214734Srpaulo * driver/firmware and finishing with the tail part. 1181214734Srpaulo */ 1182214734Srpaulo int (*set_beacon)(void *priv, const u8 *head, size_t head_len, 1183214734Srpaulo const u8 *tail, size_t tail_len, int dtim_period, 1184214734Srpaulo int beacon_int); 1185214734Srpaulo 1186214734Srpaulo /** 1187214734Srpaulo * hapd_init - Initialize driver interface (hostapd only) 1188214734Srpaulo * @hapd: Pointer to hostapd context 1189214734Srpaulo * @params: Configuration for the driver wrapper 1190214734Srpaulo * Returns: Pointer to private data, %NULL on failure 1191214734Srpaulo * 1192214734Srpaulo * This function is used instead of init() or init2() when the driver 1193214734Srpaulo * wrapper is used withh hostapd. 1194214734Srpaulo */ 1195214734Srpaulo void * (*hapd_init)(struct hostapd_data *hapd, 1196214734Srpaulo struct wpa_init_params *params); 1197214734Srpaulo 1198214734Srpaulo /** 1199214734Srpaulo * hapd_deinit - Deinitialize driver interface (hostapd only) 1200214734Srpaulo * @priv: Private driver interface data from hapd_init() 1201214734Srpaulo */ 1202214734Srpaulo void (*hapd_deinit)(void *priv); 1203214734Srpaulo 1204214734Srpaulo /** 1205214734Srpaulo * set_ieee8021x - Enable/disable IEEE 802.1X support (AP only) 1206214734Srpaulo * @priv: Private driver interface data 1207214734Srpaulo * @params: BSS parameters 1208214734Srpaulo * Returns: 0 on success, -1 on failure 1209214734Srpaulo * 1210214734Srpaulo * This is an optional function to configure the kernel driver to 1211214734Srpaulo * enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This 1212214734Srpaulo * can be left undefined (set to %NULL) if IEEE 802.1X support is 1213214734Srpaulo * always enabled and the driver uses set_beacon() to set WPA/RSN IE 1214214734Srpaulo * for Beacon frames. 1215214734Srpaulo */ 1216214734Srpaulo int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params); 1217214734Srpaulo 1218214734Srpaulo /** 1219214734Srpaulo * set_privacy - Enable/disable privacy (AP only) 1220214734Srpaulo * @priv: Private driver interface data 1221214734Srpaulo * @enabled: 1 = privacy enabled, 0 = disabled 1222214734Srpaulo * Returns: 0 on success, -1 on failure 1223214734Srpaulo * 1224214734Srpaulo * This is an optional function to configure privacy field in the 1225214734Srpaulo * kernel driver for Beacon frames. This can be left undefined (set to 1226214734Srpaulo * %NULL) if the driver uses the Beacon template from set_beacon(). 1227214734Srpaulo */ 1228214734Srpaulo int (*set_privacy)(void *priv, int enabled); 1229214734Srpaulo 1230214734Srpaulo /** 1231214734Srpaulo * get_seqnum - Fetch the current TSC/packet number (AP only) 1232214734Srpaulo * @ifname: The interface name (main or virtual) 1233214734Srpaulo * @priv: Private driver interface data 1234214734Srpaulo * @addr: MAC address of the station or %NULL for group keys 1235214734Srpaulo * @idx: Key index 1236214734Srpaulo * @seq: Buffer for returning the latest used TSC/packet number 1237214734Srpaulo * Returns: 0 on success, -1 on failure 1238214734Srpaulo * 1239214734Srpaulo * This function is used to fetch the last used TSC/packet number for 1240214734Srpaulo * a TKIP, CCMP, or BIP/IGTK key. It is mainly used with group keys, so 1241214734Srpaulo * there is no strict requirement on implementing support for unicast 1242214734Srpaulo * keys (i.e., addr != %NULL). 1243214734Srpaulo */ 1244214734Srpaulo int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr, 1245214734Srpaulo int idx, u8 *seq); 1246214734Srpaulo 1247214734Srpaulo /** 1248214734Srpaulo * flush - Flush all association stations (AP only) 1249214734Srpaulo * @priv: Private driver interface data 1250214734Srpaulo * Returns: 0 on success, -1 on failure 1251214734Srpaulo * 1252214734Srpaulo * This function requests the driver to disassociate all associated 1253214734Srpaulo * stations. This function does not need to be implemented if the 1254214734Srpaulo * driver does not process association frames internally. 1255214734Srpaulo */ 1256214734Srpaulo int (*flush)(void *priv); 1257214734Srpaulo 1258214734Srpaulo /** 1259214734Srpaulo * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP) 1260214734Srpaulo * @priv: Private driver interface data 1261214734Srpaulo * @elem: Information elements 1262214734Srpaulo * @elem_len: Length of the elem buffer in octets 1263214734Srpaulo * Returns: 0 on success, -1 on failure 1264214734Srpaulo * 1265214734Srpaulo * This is an optional function to add information elements in the 1266214734Srpaulo * kernel driver for Beacon and Probe Response frames. This can be left 1267214734Srpaulo * undefined (set to %NULL) if the driver uses the Beacon template from 1268214734Srpaulo * set_beacon(). 1269214734Srpaulo */ 1270214734Srpaulo int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len); 1271214734Srpaulo 1272214734Srpaulo /** 1273214734Srpaulo * read_sta_data - Fetch station data (AP only) 1274214734Srpaulo * @priv: Private driver interface data 1275214734Srpaulo * @data: Buffer for returning station information 1276214734Srpaulo * @addr: MAC address of the station 1277214734Srpaulo * Returns: 0 on success, -1 on failure 1278214734Srpaulo */ 1279214734Srpaulo int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data, 1280214734Srpaulo const u8 *addr); 1281214734Srpaulo 1282214734Srpaulo /** 1283214734Srpaulo * hapd_send_eapol - Send an EAPOL packet (AP only) 1284214734Srpaulo * @priv: private driver interface data 1285214734Srpaulo * @addr: Destination MAC address 1286214734Srpaulo * @data: EAPOL packet starting with IEEE 802.1X header 1287214734Srpaulo * @data_len: Length of the EAPOL packet in octets 1288214734Srpaulo * @encrypt: Whether the frame should be encrypted 1289214734Srpaulo * @own_addr: Source MAC address 1290214734Srpaulo * 1291214734Srpaulo * Returns: 0 on success, -1 on failure 1292214734Srpaulo */ 1293214734Srpaulo int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data, 1294214734Srpaulo size_t data_len, int encrypt, 1295214734Srpaulo const u8 *own_addr); 1296214734Srpaulo 1297214734Srpaulo /** 1298214734Srpaulo * sta_deauth - Deauthenticate a station (AP only) 1299214734Srpaulo * @priv: Private driver interface data 1300214734Srpaulo * @own_addr: Source address and BSSID for the Deauthentication frame 1301214734Srpaulo * @addr: MAC address of the station to deauthenticate 1302214734Srpaulo * @reason: Reason code for the Deauthentiation frame 1303214734Srpaulo * Returns: 0 on success, -1 on failure 1304214734Srpaulo * 1305214734Srpaulo * This function requests a specific station to be deauthenticated and 1306214734Srpaulo * a Deauthentication frame to be sent to it. 1307214734Srpaulo */ 1308214734Srpaulo int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr, 1309214734Srpaulo int reason); 1310214734Srpaulo 1311214734Srpaulo /** 1312214734Srpaulo * sta_disassoc - Disassociate a station (AP only) 1313214734Srpaulo * @priv: Private driver interface data 1314214734Srpaulo * @own_addr: Source address and BSSID for the Disassociation frame 1315214734Srpaulo * @addr: MAC address of the station to disassociate 1316214734Srpaulo * @reason: Reason code for the Disassociation frame 1317214734Srpaulo * Returns: 0 on success, -1 on failure 1318214734Srpaulo * 1319214734Srpaulo * This function requests a specific station to be disassociated and 1320214734Srpaulo * a Disassociation frame to be sent to it. 1321214734Srpaulo */ 1322214734Srpaulo int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr, 1323214734Srpaulo int reason); 1324214734Srpaulo 1325214734Srpaulo /** 1326214734Srpaulo * sta_remove - Remove a station entry (AP only) 1327214734Srpaulo * @priv: Private driver interface data 1328214734Srpaulo * @addr: MAC address of the station to be removed 1329214734Srpaulo * Returns: 0 on success, -1 on failure 1330214734Srpaulo */ 1331214734Srpaulo int (*sta_remove)(void *priv, const u8 *addr); 1332214734Srpaulo 1333214734Srpaulo /** 1334214734Srpaulo * hapd_get_ssid - Get the current SSID (AP only) 1335214734Srpaulo * @priv: Private driver interface data 1336214734Srpaulo * @buf: Buffer for returning the SSID 1337214734Srpaulo * @len: Maximum length of the buffer 1338214734Srpaulo * Returns: Length of the SSID on success, -1 on failure 1339214734Srpaulo * 1340214734Srpaulo * This function need not be implemented if the driver uses Beacon 1341214734Srpaulo * template from set_beacon() and does not reply to Probe Request 1342214734Srpaulo * frames. 1343214734Srpaulo */ 1344214734Srpaulo int (*hapd_get_ssid)(void *priv, u8 *buf, int len); 1345214734Srpaulo 1346214734Srpaulo /** 1347214734Srpaulo * hapd_set_ssid - Set SSID (AP only) 1348214734Srpaulo * @priv: Private driver interface data 1349214734Srpaulo * @buf: SSID 1350214734Srpaulo * @len: Length of the SSID in octets 1351214734Srpaulo * Returns: 0 on success, -1 on failure 1352214734Srpaulo */ 1353214734Srpaulo int (*hapd_set_ssid)(void *priv, const u8 *buf, int len); 1354214734Srpaulo 1355214734Srpaulo /** 1356214734Srpaulo * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP) 1357214734Srpaulo * @priv: Private driver interface data 1358214734Srpaulo * @enabled: 1 = countermeasures enabled, 0 = disabled 1359214734Srpaulo * Returns: 0 on success, -1 on failure 1360214734Srpaulo * 1361214734Srpaulo * This need not be implemented if the driver does not take care of 1362214734Srpaulo * association processing. 1363214734Srpaulo */ 1364214734Srpaulo int (*hapd_set_countermeasures)(void *priv, int enabled); 1365214734Srpaulo 1366214734Srpaulo /** 1367214734Srpaulo * sta_add - Add a station entry 1368214734Srpaulo * @priv: Private driver interface data 1369214734Srpaulo * @params: Station parameters 1370214734Srpaulo * Returns: 0 on success, -1 on failure 1371214734Srpaulo * 1372214734Srpaulo * This function is used to add a station entry to the driver once the 1373214734Srpaulo * station has completed association. This is only used if the driver 1374214734Srpaulo * does not take care of association processing. 1375214734Srpaulo */ 1376214734Srpaulo int (*sta_add)(void *priv, struct hostapd_sta_add_params *params); 1377214734Srpaulo 1378214734Srpaulo /** 1379214734Srpaulo * get_inact_sec - Get station inactivity duration (AP only) 1380214734Srpaulo * @priv: Private driver interface data 1381214734Srpaulo * @addr: Station address 1382214734Srpaulo * Returns: Number of seconds station has been inactive, -1 on failure 1383214734Srpaulo */ 1384214734Srpaulo int (*get_inact_sec)(void *priv, const u8 *addr); 1385214734Srpaulo 1386214734Srpaulo /** 1387214734Srpaulo * sta_clear_stats - Clear station statistics (AP only) 1388214734Srpaulo * @priv: Private driver interface data 1389214734Srpaulo * @addr: Station address 1390214734Srpaulo * Returns: 0 on success, -1 on failure 1391214734Srpaulo */ 1392214734Srpaulo int (*sta_clear_stats)(void *priv, const u8 *addr); 1393214734Srpaulo 1394214734Srpaulo /** 1395214734Srpaulo * set_freq - Set channel/frequency (AP only) 1396214734Srpaulo * @priv: Private driver interface data 1397214734Srpaulo * @freq: Channel parameters 1398214734Srpaulo * Returns: 0 on success, -1 on failure 1399214734Srpaulo */ 1400214734Srpaulo int (*set_freq)(void *priv, struct hostapd_freq_params *freq); 1401214734Srpaulo 1402214734Srpaulo /** 1403214734Srpaulo * set_rts - Set RTS threshold 1404214734Srpaulo * @priv: Private driver interface data 1405214734Srpaulo * @rts: RTS threshold in octets 1406214734Srpaulo * Returns: 0 on success, -1 on failure 1407214734Srpaulo */ 1408214734Srpaulo int (*set_rts)(void *priv, int rts); 1409214734Srpaulo 1410214734Srpaulo /** 1411214734Srpaulo * set_frag - Set fragmentation threshold 1412214734Srpaulo * @priv: Private driver interface data 1413214734Srpaulo * @frag: Fragmentation threshold in octets 1414214734Srpaulo * Returns: 0 on success, -1 on failure 1415214734Srpaulo */ 1416214734Srpaulo int (*set_frag)(void *priv, int frag); 1417214734Srpaulo 1418214734Srpaulo /** 1419214734Srpaulo * sta_set_flags - Set station flags (AP only) 1420214734Srpaulo * @priv: Private driver interface data 1421214734Srpaulo * @addr: Station address 1422214734Srpaulo * @total_flags: Bitmap of all WPA_STA_* flags currently set 1423214734Srpaulo * @flags_or: Bitmap of WPA_STA_* flags to add 1424214734Srpaulo * @flags_and: Bitmap of WPA_STA_* flags to us as a mask 1425214734Srpaulo * Returns: 0 on success, -1 on failure 1426214734Srpaulo */ 1427214734Srpaulo int (*sta_set_flags)(void *priv, const u8 *addr, 1428214734Srpaulo int total_flags, int flags_or, int flags_and); 1429214734Srpaulo 1430214734Srpaulo /** 1431214734Srpaulo * set_rate_sets - Set supported and basic rate sets (AP only) 1432214734Srpaulo * @priv: Private driver interface data 1433214734Srpaulo * @supp_rates: -1 terminated array of supported rates in 100 kbps 1434214734Srpaulo * @basic_rates: -1 terminated array of basic rates in 100 kbps 1435214734Srpaulo * @mode: hardware mode (HOSTAPD_MODE_*) 1436214734Srpaulo * Returns: 0 on success, -1 on failure 1437214734Srpaulo */ 1438214734Srpaulo int (*set_rate_sets)(void *priv, int *supp_rates, int *basic_rates, 1439214734Srpaulo int mode); 1440214734Srpaulo 1441214734Srpaulo /** 1442214734Srpaulo * set_cts_protect - Set CTS protection mode (AP only) 1443214734Srpaulo * @priv: Private driver interface data 1444214734Srpaulo * @value: Whether CTS protection is enabled 1445214734Srpaulo * Returns: 0 on success, -1 on failure 1446214734Srpaulo */ 1447214734Srpaulo int (*set_cts_protect)(void *priv, int value); 1448214734Srpaulo 1449214734Srpaulo /** 1450214734Srpaulo * set_preamble - Set preamble mode (AP only) 1451214734Srpaulo * @priv: Private driver interface data 1452214734Srpaulo * @value: Whether short preamble is enabled 1453214734Srpaulo * Returns: 0 on success, -1 on failure 1454214734Srpaulo */ 1455214734Srpaulo int (*set_preamble)(void *priv, int value); 1456214734Srpaulo 1457214734Srpaulo /** 1458214734Srpaulo * set_short_slot_time - Set short slot time (AP only) 1459214734Srpaulo * @priv: Private driver interface data 1460214734Srpaulo * @value: Whether short slot time is enabled 1461214734Srpaulo * Returns: 0 on success, -1 on failure 1462214734Srpaulo */ 1463214734Srpaulo int (*set_short_slot_time)(void *priv, int value); 1464214734Srpaulo 1465214734Srpaulo /** 1466214734Srpaulo * set_tx_queue_params - Set TX queue parameters 1467214734Srpaulo * @priv: Private driver interface data 1468214734Srpaulo * @queue: Queue number 1469214734Srpaulo * @aifs: AIFS 1470214734Srpaulo * @cw_min: cwMin 1471214734Srpaulo * @cw_max: cwMax 1472214734Srpaulo * @burst_time: Maximum length for bursting in 0.1 msec units 1473214734Srpaulo */ 1474214734Srpaulo int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min, 1475214734Srpaulo int cw_max, int burst_time); 1476214734Srpaulo 1477214734Srpaulo /** 1478214734Srpaulo * valid_bss_mask - Validate BSSID mask 1479214734Srpaulo * @priv: Private driver interface data 1480214734Srpaulo * @addr: Address 1481214734Srpaulo * @mask: Mask 1482214734Srpaulo * Returns: 0 if mask is valid, -1 if mask is not valid, 1 if mask can 1483214734Srpaulo * be used, but the main interface address must be the first address in 1484214734Srpaulo * the block if mask is applied 1485214734Srpaulo */ 1486214734Srpaulo int (*valid_bss_mask)(void *priv, const u8 *addr, const u8 *mask); 1487214734Srpaulo 1488214734Srpaulo /** 1489214734Srpaulo * if_add - Add a virtual interface 1490214734Srpaulo * @priv: Private driver interface data 1491214734Srpaulo * @type: Interface type 1492214734Srpaulo * @ifname: Interface name for the new virtual interface 1493214734Srpaulo * @addr: Local address to use for the interface or %NULL to use the 1494214734Srpaulo * parent interface address 1495214734Srpaulo * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces 1496214734Srpaulo * @drv_priv: Pointer for overwriting the driver context or %NULL if 1497214734Srpaulo * not allowed (applies only to %WPA_IF_AP_BSS type) 1498214734Srpaulo * @force_ifname: Buffer for returning an interface name that the 1499214734Srpaulo * driver ended up using if it differs from the requested ifname 1500214734Srpaulo * @if_addr: Buffer for returning the allocated interface address 1501214734Srpaulo * (this may differ from the requested addr if the driver cannot 1502214734Srpaulo * change interface address) 1503214734Srpaulo * Returns: 0 on success, -1 on failure 1504214734Srpaulo */ 1505214734Srpaulo int (*if_add)(void *priv, enum wpa_driver_if_type type, 1506214734Srpaulo const char *ifname, const u8 *addr, void *bss_ctx, 1507214734Srpaulo void **drv_priv, char *force_ifname, u8 *if_addr); 1508214734Srpaulo 1509214734Srpaulo /** 1510214734Srpaulo * if_remove - Remove a virtual interface 1511214734Srpaulo * @priv: Private driver interface data 1512214734Srpaulo * @type: Interface type 1513214734Srpaulo * @ifname: Interface name of the virtual interface to be removed 1514214734Srpaulo * Returns: 0 on success, -1 on failure 1515214734Srpaulo */ 1516214734Srpaulo int (*if_remove)(void *priv, enum wpa_driver_if_type type, 1517214734Srpaulo const char *ifname); 1518214734Srpaulo 1519214734Srpaulo /** 1520214734Srpaulo * set_sta_vlan - Bind a station into a specific interface (AP only) 1521214734Srpaulo * @priv: Private driver interface data 1522214734Srpaulo * @ifname: Interface (main or virtual BSS or VLAN) 1523214734Srpaulo * @addr: MAC address of the associated station 1524214734Srpaulo * @vlan_id: VLAN ID 1525214734Srpaulo * Returns: 0 on success, -1 on failure 1526214734Srpaulo * 1527214734Srpaulo * This function is used to bind a station to a specific virtual 1528214734Srpaulo * interface. It is only used if when virtual interfaces are supported, 1529214734Srpaulo * e.g., to assign stations to different VLAN interfaces based on 1530214734Srpaulo * information from a RADIUS server. This allows separate broadcast 1531214734Srpaulo * domains to be used with a single BSS. 1532214734Srpaulo */ 1533214734Srpaulo int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname, 1534214734Srpaulo int vlan_id); 1535214734Srpaulo 1536214734Srpaulo /** 1537214734Srpaulo * commit - Optional commit changes handler (AP only) 1538214734Srpaulo * @priv: driver private data 1539214734Srpaulo * Returns: 0 on success, -1 on failure 1540214734Srpaulo * 1541214734Srpaulo * This optional handler function can be registered if the driver 1542214734Srpaulo * interface implementation needs to commit changes (e.g., by setting 1543214734Srpaulo * network interface up) at the end of initial configuration. If set, 1544214734Srpaulo * this handler will be called after initial setup has been completed. 1545214734Srpaulo */ 1546214734Srpaulo int (*commit)(void *priv); 1547214734Srpaulo 1548214734Srpaulo /** 1549214734Srpaulo * send_ether - Send an ethernet packet (AP only) 1550214734Srpaulo * @priv: private driver interface data 1551214734Srpaulo * @dst: Destination MAC address 1552214734Srpaulo * @src: Source MAC address 1553214734Srpaulo * @proto: Ethertype 1554214734Srpaulo * @data: EAPOL packet starting with IEEE 802.1X header 1555214734Srpaulo * @data_len: Length of the EAPOL packet in octets 1556214734Srpaulo * Returns: 0 on success, -1 on failure 1557214734Srpaulo */ 1558214734Srpaulo int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto, 1559214734Srpaulo const u8 *data, size_t data_len); 1560214734Srpaulo 1561214734Srpaulo /** 1562214734Srpaulo * set_radius_acl_auth - Notification of RADIUS ACL change 1563214734Srpaulo * @priv: Private driver interface data 1564214734Srpaulo * @mac: MAC address of the station 1565214734Srpaulo * @accepted: Whether the station was accepted 1566214734Srpaulo * @session_timeout: Session timeout for the station 1567214734Srpaulo * Returns: 0 on success, -1 on failure 1568214734Srpaulo */ 1569214734Srpaulo int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted, 1570214734Srpaulo u32 session_timeout); 1571214734Srpaulo 1572214734Srpaulo /** 1573214734Srpaulo * set_radius_acl_expire - Notification of RADIUS ACL expiration 1574214734Srpaulo * @priv: Private driver interface data 1575214734Srpaulo * @mac: MAC address of the station 1576214734Srpaulo * Returns: 0 on success, -1 on failure 1577214734Srpaulo */ 1578214734Srpaulo int (*set_radius_acl_expire)(void *priv, const u8 *mac); 1579214734Srpaulo 1580214734Srpaulo /** 1581214734Srpaulo * set_ht_params - Set HT parameters (AP only) 1582214734Srpaulo * @priv: Private driver interface data 1583214734Srpaulo * @ht_capab: HT Capabilities IE 1584214734Srpaulo * @ht_capab_len: Length of ht_capab in octets 1585214734Srpaulo * @ht_oper: HT Operation IE 1586214734Srpaulo * @ht_oper_len: Length of ht_oper in octets 1587214734Srpaulo * Returns: 0 on success, -1 on failure 1588214734Srpaulo */ 1589214734Srpaulo int (*set_ht_params)(void *priv, 1590214734Srpaulo const u8 *ht_capab, size_t ht_capab_len, 1591214734Srpaulo const u8 *ht_oper, size_t ht_oper_len); 1592214734Srpaulo 1593214734Srpaulo /** 1594214734Srpaulo * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP) 1595214734Srpaulo * @priv: Private driver interface data 1596214734Srpaulo * @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s) 1597214734Srpaulo * @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove 1598214734Srpaulo * extra IE(s) 1599214734Srpaulo * Returns: 0 on success, -1 on failure 1600214734Srpaulo * 1601214734Srpaulo * This is an optional function to add WPS IE in the kernel driver for 1602214734Srpaulo * Beacon and Probe Response frames. This can be left undefined (set 1603214734Srpaulo * to %NULL) if the driver uses the Beacon template from set_beacon() 1604214734Srpaulo * and does not process Probe Request frames. 1605214734Srpaulo */ 1606214734Srpaulo int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon, 1607214734Srpaulo const struct wpabuf *proberesp); 1608214734Srpaulo 1609214734Srpaulo /** 1610214734Srpaulo * set_supp_port - Set IEEE 802.1X Supplicant Port status 1611214734Srpaulo * @priv: Private driver interface data 1612214734Srpaulo * @authorized: Whether the port is authorized 1613214734Srpaulo * Returns: 0 on success, -1 on failure 1614214734Srpaulo */ 1615214734Srpaulo int (*set_supp_port)(void *priv, int authorized); 1616214734Srpaulo 1617214734Srpaulo /** 1618214734Srpaulo * set_wds_sta - Bind a station into a 4-address WDS (AP only) 1619214734Srpaulo * @priv: Private driver interface data 1620214734Srpaulo * @addr: MAC address of the associated station 1621214734Srpaulo * @aid: Association ID 1622214734Srpaulo * @val: 1 = bind to 4-address WDS; 0 = unbind 1623214734Srpaulo * Returns: 0 on success, -1 on failure 1624214734Srpaulo */ 1625214734Srpaulo int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val); 1626214734Srpaulo 1627214734Srpaulo /** 1628214734Srpaulo * send_action - Transmit an Action frame 1629214734Srpaulo * @priv: Private driver interface data 1630214734Srpaulo * @freq: Frequency (in MHz) of the channel 1631214734Srpaulo * @dst: Destination MAC address (Address 1) 1632214734Srpaulo * @src: Source MAC address (Address 2) 1633214734Srpaulo * @bssid: BSSID (Address 3) 1634214734Srpaulo * @data: Frame body 1635214734Srpaulo * @data_len: data length in octets 1636214734Srpaulo * Returns: 0 on success, -1 on failure 1637214734Srpaulo * 1638214734Srpaulo * This command can be used to request the driver to transmit an action 1639214734Srpaulo * frame to the specified destination. If a remain-on-channel duration 1640214734Srpaulo * is in progress, the frame is transmitted on that channel. Otherwise, 1641214734Srpaulo * the frame is transmitted on the current operational channel if in 1642214734Srpaulo * associated state in station mode or if operating as an AP. If none 1643214734Srpaulo * of these conditions is in effect, send_action() cannot be used. 1644214734Srpaulo */ 1645214734Srpaulo int (*send_action)(void *priv, unsigned int freq, 1646214734Srpaulo const u8 *dst, const u8 *src, const u8 *bssid, 1647214734Srpaulo const u8 *data, size_t data_len); 1648214734Srpaulo 1649214734Srpaulo /** 1650214734Srpaulo * remain_on_channel - Remain awake on a channel 1651214734Srpaulo * @priv: Private driver interface data 1652214734Srpaulo * @freq: Frequency (in MHz) of the channel 1653214734Srpaulo * @duration: Duration in milliseconds 1654214734Srpaulo * Returns: 0 on success, -1 on failure 1655214734Srpaulo * 1656214734Srpaulo * This command is used to request the driver to remain awake on the 1657214734Srpaulo * specified channel for the specified duration and report received 1658214734Srpaulo * Action frames with EVENT_RX_ACTION events. Optionally, received 1659214734Srpaulo * Probe Request frames may also be requested to be reported by calling 1660214734Srpaulo * probe_req_report(). These will be reported with EVENT_RX_PROBE_REQ. 1661214734Srpaulo * 1662214734Srpaulo * The driver may not be at the requested channel when this function 1663214734Srpaulo * returns, i.e., the return code is only indicating whether the 1664214734Srpaulo * request was accepted. The caller will need to wait until the 1665214734Srpaulo * EVENT_REMAIN_ON_CHANNEL event indicates that the driver has 1666214734Srpaulo * completed the channel change. This may take some time due to other 1667214734Srpaulo * need for the radio and the caller should be prepared to timing out 1668214734Srpaulo * its wait since there are no guarantees on when this request can be 1669214734Srpaulo * executed. 1670214734Srpaulo */ 1671214734Srpaulo int (*remain_on_channel)(void *priv, unsigned int freq, 1672214734Srpaulo unsigned int duration); 1673214734Srpaulo 1674214734Srpaulo /** 1675214734Srpaulo * cancel_remain_on_channel - Cancel remain-on-channel operation 1676214734Srpaulo * @priv: Private driver interface data 1677214734Srpaulo * 1678214734Srpaulo * This command can be used to cancel a remain-on-channel operation 1679214734Srpaulo * before its originally requested duration has passed. This could be 1680214734Srpaulo * used, e.g., when remain_on_channel() is used to request extra time 1681214734Srpaulo * to receive a response to an Action frame and the response is 1682214734Srpaulo * received when there is still unneeded time remaining on the 1683214734Srpaulo * remain-on-channel operation. 1684214734Srpaulo */ 1685214734Srpaulo int (*cancel_remain_on_channel)(void *priv); 1686214734Srpaulo 1687214734Srpaulo /** 1688214734Srpaulo * probe_req_report - Request Probe Request frames to be indicated 1689214734Srpaulo * @priv: Private driver interface data 1690214734Srpaulo * @report: Whether to report received Probe Request frames 1691214734Srpaulo * Returns: 0 on success, -1 on failure (or if not supported) 1692214734Srpaulo * 1693214734Srpaulo * This command can be used to request the driver to indicate when 1694214734Srpaulo * Probe Request frames are received with EVENT_RX_PROBE_REQ events. 1695214734Srpaulo * Since this operation may require extra resources, e.g., due to less 1696214734Srpaulo * optimal hardware/firmware RX filtering, many drivers may disable 1697214734Srpaulo * Probe Request reporting at least in station mode. This command is 1698214734Srpaulo * used to notify the driver when the Probe Request frames need to be 1699214734Srpaulo * reported, e.g., during remain-on-channel operations. 1700214734Srpaulo */ 1701214734Srpaulo int (*probe_req_report)(void *priv, int report); 1702214734Srpaulo 1703214734Srpaulo /** 1704214734Srpaulo * disable_11b_rates - Set whether IEEE 802.11b rates are used for TX 1705214734Srpaulo * @priv: Private driver interface data 1706214734Srpaulo * @disabled: Whether IEEE 802.11b rates are disabled 1707214734Srpaulo * Returns: 0 on success, -1 on failure (or if not supported) 1708214734Srpaulo * 1709214734Srpaulo * This command is used to disable IEEE 802.11b rates (1, 2, 5.5, and 1710214734Srpaulo * 11 Mbps) as TX rates for data and management frames. This can be 1711214734Srpaulo * used to optimize channel use when there is no need to support IEEE 1712214734Srpaulo * 802.11b-only devices. 1713214734Srpaulo */ 1714214734Srpaulo int (*disable_11b_rates)(void *priv, int disabled); 1715214734Srpaulo 1716214734Srpaulo /** 1717214734Srpaulo * deinit_ap - Deinitialize AP mode 1718214734Srpaulo * @priv: Private driver interface data 1719214734Srpaulo * Returns: 0 on success, -1 on failure (or if not supported) 1720214734Srpaulo * 1721214734Srpaulo * This optional function can be used to disable AP mode related 1722214734Srpaulo * configuration and change the driver mode to station mode to allow 1723214734Srpaulo * normal station operations like scanning to be completed. 1724214734Srpaulo */ 1725214734Srpaulo int (*deinit_ap)(void *priv); 1726214734Srpaulo 1727214734Srpaulo /** 1728214734Srpaulo * suspend - Notification on system suspend/hibernate event 1729214734Srpaulo * @priv: Private driver interface data 1730214734Srpaulo */ 1731214734Srpaulo void (*suspend)(void *priv); 1732214734Srpaulo 1733214734Srpaulo /** 1734214734Srpaulo * resume - Notification on system resume/thaw event 1735214734Srpaulo * @priv: Private driver interface data 1736214734Srpaulo */ 1737214734Srpaulo void (*resume)(void *priv); 1738214734Srpaulo 1739214734Srpaulo /** 1740214734Srpaulo * signal_monitor - Set signal monitoring parameters 1741214734Srpaulo * @priv: Private driver interface data 1742214734Srpaulo * @threshold: Threshold value for signal change events; 0 = disabled 1743214734Srpaulo * @hysteresis: Minimum change in signal strength before indicating a 1744214734Srpaulo * new event 1745214734Srpaulo * Returns: 0 on success, -1 on failure (or if not supported) 1746214734Srpaulo * 1747214734Srpaulo * This function can be used to configure monitoring of signal strength 1748214734Srpaulo * with the current AP. Whenever signal strength drops below the 1749214734Srpaulo * %threshold value or increases above it, EVENT_SIGNAL_CHANGE event 1750214734Srpaulo * should be generated assuming the signal strength has changed at 1751214734Srpaulo * least %hysteresis from the previously indicated signal change event. 1752214734Srpaulo */ 1753214734Srpaulo int (*signal_monitor)(void *priv, int threshold, int hysteresis); 1754214734Srpaulo 1755214734Srpaulo /** 1756214734Srpaulo * send_frame - Send IEEE 802.11 frame (testing use only) 1757214734Srpaulo * @priv: Private driver interface data 1758214734Srpaulo * @data: IEEE 802.11 frame with IEEE 802.11 header 1759214734Srpaulo * @data_len: Size of the frame 1760214734Srpaulo * @encrypt: Whether to encrypt the frame (if keys are set) 1761214734Srpaulo * Returns: 0 on success, -1 on failure 1762214734Srpaulo * 1763214734Srpaulo * This function is only used for debugging purposes and is not 1764214734Srpaulo * required to be implemented for normal operations. 1765214734Srpaulo */ 1766214734Srpaulo int (*send_frame)(void *priv, const u8 *data, size_t data_len, 1767214734Srpaulo int encrypt); 1768189251Ssam}; 1769189251Ssam 1770189251Ssam 1771189251Ssam/** 1772189251Ssam * enum wpa_event_type - Event type for wpa_supplicant_event() calls 1773189251Ssam */ 1774214734Srpauloenum wpa_event_type { 1775189251Ssam /** 1776189251Ssam * EVENT_ASSOC - Association completed 1777189251Ssam * 1778189251Ssam * This event needs to be delivered when the driver completes IEEE 1779189251Ssam * 802.11 association or reassociation successfully. 1780189251Ssam * wpa_driver_ops::get_bssid() is expected to provide the current BSSID 1781189251Ssam * after this event has been generated. In addition, optional 1782189251Ssam * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide 1783189251Ssam * more information about the association. If the driver interface gets 1784189251Ssam * both of these events at the same time, it can also include the 1785189251Ssam * assoc_info data in EVENT_ASSOC call. 1786189251Ssam */ 1787189251Ssam EVENT_ASSOC, 1788189251Ssam 1789189251Ssam /** 1790189251Ssam * EVENT_DISASSOC - Association lost 1791189251Ssam * 1792189251Ssam * This event should be called when association is lost either due to 1793189251Ssam * receiving deauthenticate or disassociate frame from the AP or when 1794214734Srpaulo * sending either of these frames to the current AP. If the driver 1795214734Srpaulo * supports separate deauthentication event, EVENT_DISASSOC should only 1796214734Srpaulo * be used for disassociation and EVENT_DEAUTH for deauthentication. 1797214734Srpaulo * In AP mode, union wpa_event_data::disassoc_info is required. 1798189251Ssam */ 1799189251Ssam EVENT_DISASSOC, 1800189251Ssam 1801189251Ssam /** 1802189251Ssam * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected 1803189251Ssam * 1804189251Ssam * This event must be delivered when a Michael MIC error is detected by 1805189251Ssam * the local driver. Additional data for event processing is 1806189251Ssam * provided with union wpa_event_data::michael_mic_failure. This 1807189251Ssam * information is used to request new encyption key and to initiate 1808189251Ssam * TKIP countermeasures if needed. 1809189251Ssam */ 1810189251Ssam EVENT_MICHAEL_MIC_FAILURE, 1811189251Ssam 1812189251Ssam /** 1813189251Ssam * EVENT_SCAN_RESULTS - Scan results available 1814189251Ssam * 1815189251Ssam * This event must be called whenever scan results are available to be 1816189251Ssam * fetched with struct wpa_driver_ops::get_scan_results(). This event 1817189251Ssam * is expected to be used some time after struct wpa_driver_ops::scan() 1818189251Ssam * is called. If the driver provides an unsolicited event when the scan 1819189251Ssam * has been completed, this event can be used to trigger 1820189251Ssam * EVENT_SCAN_RESULTS call. If such event is not available from the 1821189251Ssam * driver, the driver wrapper code is expected to use a registered 1822189251Ssam * timeout to generate EVENT_SCAN_RESULTS call after the time that the 1823214734Srpaulo * scan is expected to be completed. Optional information about 1824214734Srpaulo * completed scan can be provided with union wpa_event_data::scan_info. 1825189251Ssam */ 1826189251Ssam EVENT_SCAN_RESULTS, 1827189251Ssam 1828189251Ssam /** 1829189251Ssam * EVENT_ASSOCINFO - Report optional extra information for association 1830189251Ssam * 1831189251Ssam * This event can be used to report extra association information for 1832189251Ssam * EVENT_ASSOC processing. This extra information includes IEs from 1833189251Ssam * association frames and Beacon/Probe Response frames in union 1834189251Ssam * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before 1835189251Ssam * EVENT_ASSOC. Alternatively, the driver interface can include 1836189251Ssam * assoc_info data in the EVENT_ASSOC call if it has all the 1837189251Ssam * information available at the same point. 1838189251Ssam */ 1839189251Ssam EVENT_ASSOCINFO, 1840189251Ssam 1841189251Ssam /** 1842189251Ssam * EVENT_INTERFACE_STATUS - Report interface status changes 1843189251Ssam * 1844189251Ssam * This optional event can be used to report changes in interface 1845189251Ssam * status (interface added/removed) using union 1846189251Ssam * wpa_event_data::interface_status. This can be used to trigger 1847189251Ssam * wpa_supplicant to stop and re-start processing for the interface, 1848189251Ssam * e.g., when a cardbus card is ejected/inserted. 1849189251Ssam */ 1850189251Ssam EVENT_INTERFACE_STATUS, 1851189251Ssam 1852189251Ssam /** 1853189251Ssam * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication 1854189251Ssam * 1855189251Ssam * This event can be used to inform wpa_supplicant about candidates for 1856189251Ssam * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible 1857189251Ssam * for scan request (ap_scan=2 mode), this event is required for 1858189251Ssam * pre-authentication. If wpa_supplicant is performing scan request 1859189251Ssam * (ap_scan=1), this event is optional since scan results can be used 1860189251Ssam * to add pre-authentication candidates. union 1861189251Ssam * wpa_event_data::pmkid_candidate is used to report the BSSID of the 1862189251Ssam * candidate and priority of the candidate, e.g., based on the signal 1863189251Ssam * strength, in order to try to pre-authenticate first with candidates 1864189251Ssam * that are most likely targets for re-association. 1865189251Ssam * 1866189251Ssam * EVENT_PMKID_CANDIDATE can be called whenever the driver has updates 1867189251Ssam * on the candidate list. In addition, it can be called for the current 1868189251Ssam * AP and APs that have existing PMKSA cache entries. wpa_supplicant 1869189251Ssam * will automatically skip pre-authentication in cases where a valid 1870189251Ssam * PMKSA exists. When more than one candidate exists, this event should 1871189251Ssam * be generated once for each candidate. 1872189251Ssam * 1873189251Ssam * Driver will be notified about successful pre-authentication with 1874189251Ssam * struct wpa_driver_ops::add_pmkid() calls. 1875189251Ssam */ 1876189251Ssam EVENT_PMKID_CANDIDATE, 1877189251Ssam 1878189251Ssam /** 1879189251Ssam * EVENT_STKSTART - Request STK handshake (MLME-STKSTART.request) 1880189251Ssam * 1881189251Ssam * This event can be used to inform wpa_supplicant about desire to set 1882189251Ssam * up secure direct link connection between two stations as defined in 1883189251Ssam * IEEE 802.11e with a new PeerKey mechanism that replaced the original 1884189251Ssam * STAKey negotiation. The caller will need to set peer address for the 1885189251Ssam * event. 1886189251Ssam */ 1887189251Ssam EVENT_STKSTART, 1888189251Ssam 1889189251Ssam /** 1890189251Ssam * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs 1891189251Ssam * 1892189251Ssam * The driver is expected to report the received FT IEs from 1893189251Ssam * FT authentication sequence from the AP. The FT IEs are included in 1894189251Ssam * the extra information in union wpa_event_data::ft_ies. 1895189251Ssam */ 1896214734Srpaulo EVENT_FT_RESPONSE, 1897189251Ssam 1898214734Srpaulo /** 1899214734Srpaulo * EVENT_IBSS_RSN_START - Request RSN authentication in IBSS 1900214734Srpaulo * 1901214734Srpaulo * The driver can use this event to inform wpa_supplicant about a STA 1902214734Srpaulo * in an IBSS with which protected frames could be exchanged. This 1903214734Srpaulo * event starts RSN authentication with the other STA to authenticate 1904214734Srpaulo * the STA and set up encryption keys with it. 1905214734Srpaulo */ 1906214734Srpaulo EVENT_IBSS_RSN_START, 1907189251Ssam 1908214734Srpaulo /** 1909214734Srpaulo * EVENT_AUTH - Authentication result 1910214734Srpaulo * 1911214734Srpaulo * This event should be called when authentication attempt has been 1912214734Srpaulo * completed. This is only used if the driver supports separate 1913214734Srpaulo * authentication step (struct wpa_driver_ops::authenticate). 1914214734Srpaulo * Information about authentication result is included in 1915214734Srpaulo * union wpa_event_data::auth. 1916214734Srpaulo */ 1917214734Srpaulo EVENT_AUTH, 1918214734Srpaulo 1919214734Srpaulo /** 1920214734Srpaulo * EVENT_DEAUTH - Authentication lost 1921214734Srpaulo * 1922214734Srpaulo * This event should be called when authentication is lost either due 1923214734Srpaulo * to receiving deauthenticate frame from the AP or when sending that 1924214734Srpaulo * frame to the current AP. 1925214734Srpaulo * In AP mode, union wpa_event_data::deauth_info is required. 1926214734Srpaulo */ 1927214734Srpaulo EVENT_DEAUTH, 1928214734Srpaulo 1929214734Srpaulo /** 1930214734Srpaulo * EVENT_ASSOC_REJECT - Association rejected 1931214734Srpaulo * 1932214734Srpaulo * This event should be called when (re)association attempt has been 1933214734Srpaulo * rejected by the AP. Information about authentication result is 1934214734Srpaulo * included in union wpa_event_data::assoc_reject. 1935214734Srpaulo */ 1936214734Srpaulo EVENT_ASSOC_REJECT, 1937214734Srpaulo 1938214734Srpaulo /** 1939214734Srpaulo * EVENT_AUTH_TIMED_OUT - Authentication timed out 1940214734Srpaulo */ 1941214734Srpaulo EVENT_AUTH_TIMED_OUT, 1942214734Srpaulo 1943214734Srpaulo /** 1944214734Srpaulo * EVENT_ASSOC_TIMED_OUT - Association timed out 1945214734Srpaulo */ 1946214734Srpaulo EVENT_ASSOC_TIMED_OUT, 1947214734Srpaulo 1948214734Srpaulo /** 1949214734Srpaulo * EVENT_FT_RRB_RX - FT (IEEE 802.11r) RRB frame received 1950214734Srpaulo */ 1951214734Srpaulo EVENT_FT_RRB_RX, 1952214734Srpaulo 1953214734Srpaulo /** 1954214734Srpaulo * EVENT_WPS_BUTTON_PUSHED - Report hardware push button press for WPS 1955214734Srpaulo */ 1956214734Srpaulo EVENT_WPS_BUTTON_PUSHED, 1957214734Srpaulo 1958214734Srpaulo /** 1959214734Srpaulo * EVENT_TX_STATUS - Report TX status 1960214734Srpaulo */ 1961214734Srpaulo EVENT_TX_STATUS, 1962214734Srpaulo 1963214734Srpaulo /** 1964214734Srpaulo * EVENT_RX_FROM_UNKNOWN - Report RX from unknown STA 1965214734Srpaulo */ 1966214734Srpaulo EVENT_RX_FROM_UNKNOWN, 1967214734Srpaulo 1968214734Srpaulo /** 1969214734Srpaulo * EVENT_RX_MGMT - Report RX of a management frame 1970214734Srpaulo */ 1971214734Srpaulo EVENT_RX_MGMT, 1972214734Srpaulo 1973214734Srpaulo /** 1974214734Srpaulo * EVENT_RX_ACTION - Action frame received 1975214734Srpaulo * 1976214734Srpaulo * This event is used to indicate when an Action frame has been 1977214734Srpaulo * received. Information about the received frame is included in 1978214734Srpaulo * union wpa_event_data::rx_action. 1979214734Srpaulo */ 1980214734Srpaulo EVENT_RX_ACTION, 1981214734Srpaulo 1982214734Srpaulo /** 1983214734Srpaulo * EVENT_REMAIN_ON_CHANNEL - Remain-on-channel duration started 1984214734Srpaulo * 1985214734Srpaulo * This event is used to indicate when the driver has started the 1986214734Srpaulo * requested remain-on-channel duration. Information about the 1987214734Srpaulo * operation is included in union wpa_event_data::remain_on_channel. 1988214734Srpaulo */ 1989214734Srpaulo EVENT_REMAIN_ON_CHANNEL, 1990214734Srpaulo 1991214734Srpaulo /** 1992214734Srpaulo * EVENT_CANCEL_REMAIN_ON_CHANNEL - Remain-on-channel timed out 1993214734Srpaulo * 1994214734Srpaulo * This event is used to indicate when the driver has completed 1995214734Srpaulo * remain-on-channel duration, i.e., may noot be available on the 1996214734Srpaulo * requested channel anymore. Information about the 1997214734Srpaulo * operation is included in union wpa_event_data::remain_on_channel. 1998214734Srpaulo */ 1999214734Srpaulo EVENT_CANCEL_REMAIN_ON_CHANNEL, 2000214734Srpaulo 2001214734Srpaulo /** 2002214734Srpaulo * EVENT_MLME_RX - Report reception of frame for MLME (test use only) 2003214734Srpaulo * 2004214734Srpaulo * This event is used only by driver_test.c and userspace MLME. 2005214734Srpaulo */ 2006214734Srpaulo EVENT_MLME_RX, 2007214734Srpaulo 2008214734Srpaulo /** 2009214734Srpaulo * EVENT_RX_PROBE_REQ - Indicate received Probe Request frame 2010214734Srpaulo * 2011214734Srpaulo * This event is used to indicate when a Probe Request frame has been 2012214734Srpaulo * received. Information about the received frame is included in 2013214734Srpaulo * union wpa_event_data::rx_probe_req. The driver is required to report 2014214734Srpaulo * these events only after successfully completed probe_req_report() 2015214734Srpaulo * commands to request the events (i.e., report parameter is non-zero) 2016214734Srpaulo * in station mode. In AP mode, Probe Request frames should always be 2017214734Srpaulo * reported. 2018214734Srpaulo */ 2019214734Srpaulo EVENT_RX_PROBE_REQ, 2020214734Srpaulo 2021214734Srpaulo /** 2022214734Srpaulo * EVENT_NEW_STA - New wired device noticed 2023214734Srpaulo * 2024214734Srpaulo * This event is used to indicate that a new device has been detected 2025214734Srpaulo * in a network that does not use association-like functionality (i.e., 2026214734Srpaulo * mainly wired Ethernet). This can be used to start EAPOL 2027214734Srpaulo * authenticator when receiving a frame from a device. The address of 2028214734Srpaulo * the device is included in union wpa_event_data::new_sta. 2029214734Srpaulo */ 2030214734Srpaulo EVENT_NEW_STA, 2031214734Srpaulo 2032214734Srpaulo /** 2033214734Srpaulo * EVENT_EAPOL_RX - Report received EAPOL frame 2034214734Srpaulo * 2035214734Srpaulo * When in AP mode with hostapd, this event is required to be used to 2036214734Srpaulo * deliver the receive EAPOL frames from the driver. With 2037214734Srpaulo * %wpa_supplicant, this event is used only if the send_eapol() handler 2038214734Srpaulo * is used to override the use of l2_packet for EAPOL frame TX. 2039214734Srpaulo */ 2040214734Srpaulo EVENT_EAPOL_RX, 2041214734Srpaulo 2042214734Srpaulo /** 2043214734Srpaulo * EVENT_SIGNAL_CHANGE - Indicate change in signal strength 2044214734Srpaulo * 2045214734Srpaulo * This event is used to indicate changes in the signal strength 2046214734Srpaulo * observed in frames received from the current AP if signal strength 2047214734Srpaulo * monitoring has been enabled with signal_monitor(). 2048214734Srpaulo */ 2049214734Srpaulo EVENT_SIGNAL_CHANGE 2050214734Srpaulo}; 2051214734Srpaulo 2052214734Srpaulo 2053189251Ssam/** 2054189251Ssam * union wpa_event_data - Additional data for wpa_supplicant_event() calls 2055189251Ssam */ 2056189251Ssamunion wpa_event_data { 2057189251Ssam /** 2058189251Ssam * struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events 2059189251Ssam * 2060189251Ssam * This structure is optional for EVENT_ASSOC calls and required for 2061189251Ssam * EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the 2062189251Ssam * driver interface does not need to generate separate EVENT_ASSOCINFO 2063189251Ssam * calls. 2064189251Ssam */ 2065189251Ssam struct assoc_info { 2066189251Ssam /** 2067189251Ssam * req_ies - (Re)Association Request IEs 2068189251Ssam * 2069189251Ssam * If the driver generates WPA/RSN IE, this event data must be 2070189251Ssam * returned for WPA handshake to have needed information. If 2071189251Ssam * wpa_supplicant-generated WPA/RSN IE is used, this 2072189251Ssam * information event is optional. 2073189251Ssam * 2074189251Ssam * This should start with the first IE (fixed fields before IEs 2075189251Ssam * are not included). 2076189251Ssam */ 2077214734Srpaulo const u8 *req_ies; 2078189251Ssam 2079189251Ssam /** 2080189251Ssam * req_ies_len - Length of req_ies in bytes 2081189251Ssam */ 2082189251Ssam size_t req_ies_len; 2083189251Ssam 2084189251Ssam /** 2085189251Ssam * resp_ies - (Re)Association Response IEs 2086189251Ssam * 2087189251Ssam * Optional association data from the driver. This data is not 2088189251Ssam * required WPA, but may be useful for some protocols and as 2089189251Ssam * such, should be reported if this is available to the driver 2090189251Ssam * interface. 2091189251Ssam * 2092189251Ssam * This should start with the first IE (fixed fields before IEs 2093189251Ssam * are not included). 2094189251Ssam */ 2095214734Srpaulo const u8 *resp_ies; 2096189251Ssam 2097189251Ssam /** 2098189251Ssam * resp_ies_len - Length of resp_ies in bytes 2099189251Ssam */ 2100189251Ssam size_t resp_ies_len; 2101189251Ssam 2102189251Ssam /** 2103189251Ssam * beacon_ies - Beacon or Probe Response IEs 2104189251Ssam * 2105189251Ssam * Optional Beacon/ProbeResp data: IEs included in Beacon or 2106189251Ssam * Probe Response frames from the current AP (i.e., the one 2107189251Ssam * that the client just associated with). This information is 2108189251Ssam * used to update WPA/RSN IE for the AP. If this field is not 2109189251Ssam * set, the results from previous scan will be used. If no 2110189251Ssam * data for the new AP is found, scan results will be requested 2111189251Ssam * again (without scan request). At this point, the driver is 2112189251Ssam * expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is 2113189251Ssam * used). 2114189251Ssam * 2115189251Ssam * This should start with the first IE (fixed fields before IEs 2116189251Ssam * are not included). 2117189251Ssam */ 2118214734Srpaulo const u8 *beacon_ies; 2119189251Ssam 2120189251Ssam /** 2121189251Ssam * beacon_ies_len - Length of beacon_ies */ 2122189251Ssam size_t beacon_ies_len; 2123214734Srpaulo 2124214734Srpaulo /** 2125214734Srpaulo * freq - Frequency of the operational channel in MHz 2126214734Srpaulo */ 2127214734Srpaulo unsigned int freq; 2128214734Srpaulo 2129214734Srpaulo /** 2130214734Srpaulo * addr - Station address (for AP mode) 2131214734Srpaulo */ 2132214734Srpaulo const u8 *addr; 2133189251Ssam } assoc_info; 2134189251Ssam 2135189251Ssam /** 2136214734Srpaulo * struct disassoc_info - Data for EVENT_DISASSOC events 2137214734Srpaulo */ 2138214734Srpaulo struct disassoc_info { 2139214734Srpaulo /** 2140214734Srpaulo * addr - Station address (for AP mode) 2141214734Srpaulo */ 2142214734Srpaulo const u8 *addr; 2143214734Srpaulo 2144214734Srpaulo /** 2145214734Srpaulo * reason_code - Reason Code (host byte order) used in 2146214734Srpaulo * Deauthentication frame 2147214734Srpaulo */ 2148214734Srpaulo u16 reason_code; 2149214734Srpaulo } disassoc_info; 2150214734Srpaulo 2151214734Srpaulo /** 2152214734Srpaulo * struct deauth_info - Data for EVENT_DEAUTH events 2153214734Srpaulo */ 2154214734Srpaulo struct deauth_info { 2155214734Srpaulo /** 2156214734Srpaulo * addr - Station address (for AP mode) 2157214734Srpaulo */ 2158214734Srpaulo const u8 *addr; 2159214734Srpaulo 2160214734Srpaulo /** 2161214734Srpaulo * reason_code - Reason Code (host byte order) used in 2162214734Srpaulo * Deauthentication frame 2163214734Srpaulo */ 2164214734Srpaulo u16 reason_code; 2165214734Srpaulo } deauth_info; 2166214734Srpaulo 2167214734Srpaulo /** 2168189251Ssam * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE 2169189251Ssam */ 2170189251Ssam struct michael_mic_failure { 2171189251Ssam int unicast; 2172214734Srpaulo const u8 *src; 2173189251Ssam } michael_mic_failure; 2174189251Ssam 2175189251Ssam /** 2176189251Ssam * struct interface_status - Data for EVENT_INTERFACE_STATUS 2177189251Ssam */ 2178189251Ssam struct interface_status { 2179189251Ssam char ifname[100]; 2180189251Ssam enum { 2181189251Ssam EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED 2182189251Ssam } ievent; 2183189251Ssam } interface_status; 2184189251Ssam 2185189251Ssam /** 2186189251Ssam * struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE 2187189251Ssam */ 2188189251Ssam struct pmkid_candidate { 2189189251Ssam /** BSSID of the PMKID candidate */ 2190189251Ssam u8 bssid[ETH_ALEN]; 2191189251Ssam /** Smaller the index, higher the priority */ 2192189251Ssam int index; 2193189251Ssam /** Whether RSN IE includes pre-authenticate flag */ 2194189251Ssam int preauth; 2195189251Ssam } pmkid_candidate; 2196189251Ssam 2197189251Ssam /** 2198189251Ssam * struct stkstart - Data for EVENT_STKSTART 2199189251Ssam */ 2200189251Ssam struct stkstart { 2201189251Ssam u8 peer[ETH_ALEN]; 2202189251Ssam } stkstart; 2203189251Ssam 2204189251Ssam /** 2205189251Ssam * struct ft_ies - FT information elements (EVENT_FT_RESPONSE) 2206189251Ssam * 2207189251Ssam * During FT (IEEE 802.11r) authentication sequence, the driver is 2208189251Ssam * expected to use this event to report received FT IEs (MDIE, FTIE, 2209189251Ssam * RSN IE, TIE, possible resource request) to the supplicant. The FT 2210189251Ssam * IEs for the next message will be delivered through the 2211189251Ssam * struct wpa_driver_ops::update_ft_ies() callback. 2212189251Ssam */ 2213189251Ssam struct ft_ies { 2214189251Ssam const u8 *ies; 2215189251Ssam size_t ies_len; 2216189251Ssam int ft_action; 2217189251Ssam u8 target_ap[ETH_ALEN]; 2218214734Srpaulo /** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */ 2219214734Srpaulo const u8 *ric_ies; 2220214734Srpaulo /** Length of ric_ies buffer in octets */ 2221214734Srpaulo size_t ric_ies_len; 2222189251Ssam } ft_ies; 2223214734Srpaulo 2224214734Srpaulo /** 2225214734Srpaulo * struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START 2226214734Srpaulo */ 2227214734Srpaulo struct ibss_rsn_start { 2228214734Srpaulo u8 peer[ETH_ALEN]; 2229214734Srpaulo } ibss_rsn_start; 2230214734Srpaulo 2231214734Srpaulo /** 2232214734Srpaulo * struct auth_info - Data for EVENT_AUTH events 2233214734Srpaulo */ 2234214734Srpaulo struct auth_info { 2235214734Srpaulo u8 peer[ETH_ALEN]; 2236214734Srpaulo u16 auth_type; 2237214734Srpaulo u16 status_code; 2238214734Srpaulo const u8 *ies; 2239214734Srpaulo size_t ies_len; 2240214734Srpaulo } auth; 2241214734Srpaulo 2242214734Srpaulo /** 2243214734Srpaulo * struct assoc_reject - Data for EVENT_ASSOC_REJECT events 2244214734Srpaulo */ 2245214734Srpaulo struct assoc_reject { 2246214734Srpaulo /** 2247214734Srpaulo * resp_ies - (Re)Association Response IEs 2248214734Srpaulo * 2249214734Srpaulo * Optional association data from the driver. This data is not 2250214734Srpaulo * required WPA, but may be useful for some protocols and as 2251214734Srpaulo * such, should be reported if this is available to the driver 2252214734Srpaulo * interface. 2253214734Srpaulo * 2254214734Srpaulo * This should start with the first IE (fixed fields before IEs 2255214734Srpaulo * are not included). 2256214734Srpaulo */ 2257214734Srpaulo u8 *resp_ies; 2258214734Srpaulo 2259214734Srpaulo /** 2260214734Srpaulo * resp_ies_len - Length of resp_ies in bytes 2261214734Srpaulo */ 2262214734Srpaulo size_t resp_ies_len; 2263214734Srpaulo 2264214734Srpaulo /** 2265214734Srpaulo * status_code - Status Code from (Re)association Response 2266214734Srpaulo */ 2267214734Srpaulo u16 status_code; 2268214734Srpaulo } assoc_reject; 2269214734Srpaulo 2270214734Srpaulo struct timeout_event { 2271214734Srpaulo u8 addr[ETH_ALEN]; 2272214734Srpaulo } timeout_event; 2273214734Srpaulo 2274214734Srpaulo /** 2275214734Srpaulo * struct ft_rrb_rx - Data for EVENT_FT_RRB_RX events 2276214734Srpaulo */ 2277214734Srpaulo struct ft_rrb_rx { 2278214734Srpaulo const u8 *src; 2279214734Srpaulo const u8 *data; 2280214734Srpaulo size_t data_len; 2281214734Srpaulo } ft_rrb_rx; 2282214734Srpaulo 2283214734Srpaulo /** 2284214734Srpaulo * struct tx_status - Data for EVENT_TX_STATUS events 2285214734Srpaulo */ 2286214734Srpaulo struct tx_status { 2287214734Srpaulo u16 type; 2288214734Srpaulo u16 stype; 2289214734Srpaulo const u8 *dst; 2290214734Srpaulo const u8 *data; 2291214734Srpaulo size_t data_len; 2292214734Srpaulo int ack; 2293214734Srpaulo } tx_status; 2294214734Srpaulo 2295214734Srpaulo /** 2296214734Srpaulo * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events 2297214734Srpaulo */ 2298214734Srpaulo struct rx_from_unknown { 2299214734Srpaulo const u8 *frame; 2300214734Srpaulo size_t len; 2301214734Srpaulo } rx_from_unknown; 2302214734Srpaulo 2303214734Srpaulo /** 2304214734Srpaulo * struct rx_mgmt - Data for EVENT_RX_MGMT events 2305214734Srpaulo */ 2306214734Srpaulo struct rx_mgmt { 2307214734Srpaulo const u8 *frame; 2308214734Srpaulo size_t frame_len; 2309214734Srpaulo u32 datarate; 2310214734Srpaulo u32 ssi_signal; 2311214734Srpaulo } rx_mgmt; 2312214734Srpaulo 2313214734Srpaulo /** 2314214734Srpaulo * struct rx_action - Data for EVENT_RX_ACTION events 2315214734Srpaulo */ 2316214734Srpaulo struct rx_action { 2317214734Srpaulo /** 2318214734Srpaulo * da - Destination address of the received Action frame 2319214734Srpaulo */ 2320214734Srpaulo const u8 *da; 2321214734Srpaulo 2322214734Srpaulo /** 2323214734Srpaulo * sa - Source address of the received Action frame 2324214734Srpaulo */ 2325214734Srpaulo const u8 *sa; 2326214734Srpaulo 2327214734Srpaulo /** 2328214734Srpaulo * bssid - Address 3 of the received Action frame 2329214734Srpaulo */ 2330214734Srpaulo const u8 *bssid; 2331214734Srpaulo 2332214734Srpaulo /** 2333214734Srpaulo * category - Action frame category 2334214734Srpaulo */ 2335214734Srpaulo u8 category; 2336214734Srpaulo 2337214734Srpaulo /** 2338214734Srpaulo * data - Action frame body after category field 2339214734Srpaulo */ 2340214734Srpaulo const u8 *data; 2341214734Srpaulo 2342214734Srpaulo /** 2343214734Srpaulo * len - Length of data in octets 2344214734Srpaulo */ 2345214734Srpaulo size_t len; 2346214734Srpaulo 2347214734Srpaulo /** 2348214734Srpaulo * freq - Frequency (in MHz) on which the frame was received 2349214734Srpaulo */ 2350214734Srpaulo int freq; 2351214734Srpaulo } rx_action; 2352214734Srpaulo 2353214734Srpaulo /** 2354214734Srpaulo * struct remain_on_channel - Data for EVENT_REMAIN_ON_CHANNEL events 2355214734Srpaulo * 2356214734Srpaulo * This is also used with EVENT_CANCEL_REMAIN_ON_CHANNEL events. 2357214734Srpaulo */ 2358214734Srpaulo struct remain_on_channel { 2359214734Srpaulo /** 2360214734Srpaulo * freq - Channel frequency in MHz 2361214734Srpaulo */ 2362214734Srpaulo unsigned int freq; 2363214734Srpaulo 2364214734Srpaulo /** 2365214734Srpaulo * duration - Duration to remain on the channel in milliseconds 2366214734Srpaulo */ 2367214734Srpaulo unsigned int duration; 2368214734Srpaulo } remain_on_channel; 2369214734Srpaulo 2370214734Srpaulo /** 2371214734Srpaulo * struct scan_info - Optional data for EVENT_SCAN_RESULTS events 2372214734Srpaulo * @aborted: Whether the scan was aborted 2373214734Srpaulo * @freqs: Scanned frequencies in MHz (%NULL = all channels scanned) 2374214734Srpaulo * @num_freqs: Number of entries in freqs array 2375214734Srpaulo * @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard 2376214734Srpaulo * SSID) 2377214734Srpaulo * @num_ssids: Number of entries in ssids array 2378214734Srpaulo */ 2379214734Srpaulo struct scan_info { 2380214734Srpaulo int aborted; 2381214734Srpaulo const int *freqs; 2382214734Srpaulo size_t num_freqs; 2383214734Srpaulo struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS]; 2384214734Srpaulo size_t num_ssids; 2385214734Srpaulo } scan_info; 2386214734Srpaulo 2387214734Srpaulo /** 2388214734Srpaulo * struct mlme_rx - Data for EVENT_MLME_RX events 2389214734Srpaulo */ 2390214734Srpaulo struct mlme_rx { 2391214734Srpaulo const u8 *buf; 2392214734Srpaulo size_t len; 2393214734Srpaulo int freq; 2394214734Srpaulo int channel; 2395214734Srpaulo int ssi; 2396214734Srpaulo } mlme_rx; 2397214734Srpaulo 2398214734Srpaulo /** 2399214734Srpaulo * struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events 2400214734Srpaulo */ 2401214734Srpaulo struct rx_probe_req { 2402214734Srpaulo /** 2403214734Srpaulo * sa - Source address of the received Probe Request frame 2404214734Srpaulo */ 2405214734Srpaulo const u8 *sa; 2406214734Srpaulo 2407214734Srpaulo /** 2408214734Srpaulo * ie - IEs from the Probe Request body 2409214734Srpaulo */ 2410214734Srpaulo const u8 *ie; 2411214734Srpaulo 2412214734Srpaulo /** 2413214734Srpaulo * ie_len - Length of ie buffer in octets 2414214734Srpaulo */ 2415214734Srpaulo size_t ie_len; 2416214734Srpaulo } rx_probe_req; 2417214734Srpaulo 2418214734Srpaulo /** 2419214734Srpaulo * struct new_sta - Data for EVENT_NEW_STA events 2420214734Srpaulo */ 2421214734Srpaulo struct new_sta { 2422214734Srpaulo const u8 *addr; 2423214734Srpaulo } new_sta; 2424214734Srpaulo 2425214734Srpaulo /** 2426214734Srpaulo * struct eapol_rx - Data for EVENT_EAPOL_RX events 2427214734Srpaulo */ 2428214734Srpaulo struct eapol_rx { 2429214734Srpaulo const u8 *src; 2430214734Srpaulo const u8 *data; 2431214734Srpaulo size_t data_len; 2432214734Srpaulo } eapol_rx; 2433214734Srpaulo 2434214734Srpaulo /** 2435214734Srpaulo * struct signal_change - Data for EVENT_SIGNAL_CHANGE events 2436214734Srpaulo */ 2437214734Srpaulo struct signal_change { 2438214734Srpaulo int above_threshold; 2439214734Srpaulo } signal_change; 2440189251Ssam}; 2441189251Ssam 2442189251Ssam/** 2443189251Ssam * wpa_supplicant_event - Report a driver event for wpa_supplicant 2444189251Ssam * @ctx: Context pointer (wpa_s); this is the ctx variable registered 2445189251Ssam * with struct wpa_driver_ops::init() 2446189251Ssam * @event: event type (defined above) 2447189251Ssam * @data: possible extra data for the event 2448189251Ssam * 2449189251Ssam * Driver wrapper code should call this function whenever an event is received 2450189251Ssam * from the driver. 2451189251Ssam */ 2452214734Srpaulovoid wpa_supplicant_event(void *ctx, enum wpa_event_type event, 2453189251Ssam union wpa_event_data *data); 2454189251Ssam 2455214734Srpaulo 2456214734Srpaulo/* 2457214734Srpaulo * The following inline functions are provided for convenience to simplify 2458214734Srpaulo * event indication for some of the common events. 2459189251Ssam */ 2460189251Ssam 2461214734Srpaulostatic inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie, 2462214734Srpaulo size_t ielen) 2463214734Srpaulo{ 2464214734Srpaulo union wpa_event_data event; 2465214734Srpaulo os_memset(&event, 0, sizeof(event)); 2466214734Srpaulo event.assoc_info.req_ies = ie; 2467214734Srpaulo event.assoc_info.req_ies_len = ielen; 2468214734Srpaulo event.assoc_info.addr = addr; 2469214734Srpaulo wpa_supplicant_event(ctx, EVENT_ASSOC, &event); 2470214734Srpaulo} 2471189251Ssam 2472214734Srpaulostatic inline void drv_event_disassoc(void *ctx, const u8 *addr) 2473214734Srpaulo{ 2474214734Srpaulo union wpa_event_data event; 2475214734Srpaulo os_memset(&event, 0, sizeof(event)); 2476214734Srpaulo event.disassoc_info.addr = addr; 2477214734Srpaulo wpa_supplicant_event(ctx, EVENT_DISASSOC, &event); 2478214734Srpaulo} 2479189251Ssam 2480214734Srpaulostatic inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data, 2481214734Srpaulo size_t data_len) 2482214734Srpaulo{ 2483214734Srpaulo union wpa_event_data event; 2484214734Srpaulo os_memset(&event, 0, sizeof(event)); 2485214734Srpaulo event.eapol_rx.src = src; 2486214734Srpaulo event.eapol_rx.data = data; 2487214734Srpaulo event.eapol_rx.data_len = data_len; 2488214734Srpaulo wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event); 2489214734Srpaulo} 2490214734Srpaulo 2491189251Ssam#endif /* DRIVER_H */ 2492