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