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