2 * WPA Supplicant - driver interface definition
3 * Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
18 #define WPA_SUPPLICANT_DRIVER_VERSION 4
22 #define HOSTAPD_CHAN_DISABLED 0x00000001
23 #define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002
24 #define HOSTAPD_CHAN_NO_IBSS 0x00000004
25 #define HOSTAPD_CHAN_RADAR 0x00000008
27 struct hostapd_channel_data
{
28 short chan
; /* channel number (IEEE 802.11) */
29 short freq
; /* frequency in MHz */
30 int flag
; /* flag for hostapd use (HOSTAPD_CHAN_*) */
31 u8 max_tx_power
; /* maximum transmit power in dBm */
34 #define HOSTAPD_RATE_ERP 0x00000001
35 #define HOSTAPD_RATE_BASIC 0x00000002
36 #define HOSTAPD_RATE_PREAMBLE2 0x00000004
37 #define HOSTAPD_RATE_SUPPORTED 0x00000010
38 #define HOSTAPD_RATE_OFDM 0x00000020
39 #define HOSTAPD_RATE_CCK 0x00000040
40 #define HOSTAPD_RATE_MANDATORY 0x00000100
42 struct hostapd_rate_data
{
43 int rate
; /* rate in 100 kbps */
44 int flags
; /* HOSTAPD_RATE_ flags */
47 struct hostapd_hw_modes
{
50 struct hostapd_channel_data
*channels
;
52 struct hostapd_rate_data
*rates
;
58 #define AUTH_ALG_OPEN_SYSTEM 0x01
59 #define AUTH_ALG_SHARED_KEY 0x02
60 #define AUTH_ALG_LEAP 0x04
61 #define AUTH_ALG_FT 0x08
63 #define IEEE80211_MODE_INFRA 0
64 #define IEEE80211_MODE_IBSS 1
65 #define IEEE80211_MODE_AP 2
67 #define IEEE80211_CAP_ESS 0x0001
68 #define IEEE80211_CAP_IBSS 0x0002
69 #define IEEE80211_CAP_PRIVACY 0x0010
71 #define WPA_SCAN_QUAL_INVALID BIT(0)
72 #define WPA_SCAN_NOISE_INVALID BIT(1)
73 #define WPA_SCAN_LEVEL_INVALID BIT(2)
74 #define WPA_SCAN_LEVEL_DBM BIT(3)
77 * struct wpa_scan_res - Scan result for an BSS/IBSS
78 * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
80 * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
81 * @beacon_int: beacon interval in TUs (host byte order)
82 * @caps: capability information field in host byte order
83 * @qual: signal quality
85 * @level: signal level
87 * @age: Age of the information in milliseconds (i.e., how many milliseconds
88 * ago the last Beacon or Probe Response frame was received)
89 * @ie_len: length of the following IE field in octets
91 * This structure is used as a generic format for scan results from the
92 * driver. Each driver interface implementation is responsible for converting
93 * the driver or OS specific scan results into this format.
95 * If the driver does not support reporting all IEs, the IE data structure is
96 * constructed of the IEs that are available. This field will also need to
97 * include SSID in IE format. All drivers are encouraged to be extended to
98 * report all IEs to make it easier to support future additions.
100 struct wpa_scan_res
{
112 /* followed by ie_len octets of IEs */
116 * struct wpa_scan_results - Scan results
117 * @res: Array of pointers to allocated variable length scan result entries
118 * @num: Number of entries in the scan result array
120 struct wpa_scan_results
{
121 struct wpa_scan_res
**res
;
126 * struct wpa_interface_info - Network interface information
127 * @next: Pointer to the next interface or NULL if this is the last one
128 * @ifname: Interface name that can be used with init() or init2()
129 * @desc: Human readable adapter description (e.g., vendor/model) or NULL if
131 * @drv_bame: struct wpa_driver_ops::name (note: unlike other strings, this one
132 * is not an allocated copy, i.e., get_interfaces() caller will not free
135 struct wpa_interface_info
{
136 struct wpa_interface_info
*next
;
139 const char *drv_name
;
142 #define WPAS_MAX_SCAN_SSIDS 4
145 * struct wpa_driver_scan_params - Scan parameters
146 * Data for struct wpa_driver_ops::scan2().
148 struct wpa_driver_scan_params
{
150 * ssids - SSIDs to scan for
152 struct wpa_driver_scan_ssid
{
154 * ssid - specific SSID to scan for (ProbeReq)
155 * %NULL or zero-length SSID is used to indicate active scan
156 * with wildcard SSID.
160 * ssid_len: Length of the SSID in octets
163 } ssids
[WPAS_MAX_SCAN_SSIDS
];
166 * num_ssids - Number of entries in ssids array
167 * Zero indicates a request for a passive scan.
172 * extra_ies - Extra IE(s) to add into Probe Request or %NULL
177 * extra_ies_len - Length of extra_ies in octets
179 size_t extra_ies_len
;
182 * freqs - Array of frequencies to scan or %NULL for all frequencies
184 * The frequency is set in MHz. The array is zero-terminated.
190 * struct wpa_driver_auth_params - Authentication parameters
191 * Data for struct wpa_driver_ops::authenticate().
193 struct wpa_driver_auth_params
{
201 const u8
*wep_key
[4];
202 size_t wep_key_len
[4];
207 * struct wpa_driver_associate_params - Association parameters
208 * Data for struct wpa_driver_ops::associate().
210 struct wpa_driver_associate_params
{
212 * bssid - BSSID of the selected AP
213 * This can be %NULL, if ap_scan=2 mode is used and the driver is
214 * responsible for selecting with which BSS to associate. */
218 * ssid - The selected SSID
224 * freq - Frequency of the channel the selected AP is using
225 * Frequency that the selected AP is using (in MHz as
226 * reported in the scan results)
231 * wpa_ie - WPA information element for (Re)Association Request
232 * WPA information element to be included in (Re)Association
233 * Request (including information element id and length). Use
234 * of this WPA IE is optional. If the driver generates the WPA
235 * IE, it can use pairwise_suite, group_suite, and
236 * key_mgmt_suite to select proper algorithms. In this case,
237 * the driver has to notify wpa_supplicant about the used WPA
238 * IE by generating an event that the interface code will
239 * convert into EVENT_ASSOCINFO data (see below).
241 * When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE
242 * instead. The driver can determine which version is used by
243 * looking at the first byte of the IE (0xdd for WPA, 0x30 for
246 * When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE.
250 * wpa_ie_len - length of the wpa_ie
254 /* The selected pairwise/group cipher and key management
255 * suites. These are usually ignored if @wpa_ie is used. */
256 wpa_cipher pairwise_suite
;
257 wpa_cipher group_suite
;
258 wpa_key_mgmt key_mgmt_suite
;
261 * auth_alg - Allowed authentication algorithms
262 * Bit field of AUTH_ALG_*
267 * mode - Operation mode (infra/ibss) IEEE80211_MODE_*
272 * wep_key - WEP keys for static WEP configuration
274 const u8
*wep_key
[4];
277 * wep_key_len - WEP key length for static WEP configuration
279 size_t wep_key_len
[4];
282 * wep_tx_keyidx - WEP TX key index for static WEP configuration
287 * mgmt_frame_protection - IEEE 802.11w management frame protection
290 NO_MGMT_FRAME_PROTECTION
,
291 MGMT_FRAME_PROTECTION_OPTIONAL
,
292 MGMT_FRAME_PROTECTION_REQUIRED
293 } mgmt_frame_protection
;
296 * ft_ies - IEEE 802.11r / FT information elements
297 * If the supplicant is using IEEE 802.11r (FT) and has the needed keys
298 * for fast transition, this parameter is set to include the IEs that
299 * are to be sent in the next FT Authentication Request message.
300 * update_ft_ies() handler is called to update the IEs for further
301 * FT messages in the sequence.
303 * The driver should use these IEs only if the target AP is advertising
304 * the same mobility domain as the one included in the MDIE here.
306 * In ap_scan=2 mode, the driver can use these IEs when moving to a new
307 * AP after the initial association. These IEs can only be used if the
308 * target AP is advertising support for FT and is using the same MDIE
309 * and SSID as the current AP.
311 * The driver is responsible for reporting the FT IEs received from the
312 * AP's response using wpa_supplicant_event() with EVENT_FT_RESPONSE
313 * type. update_ft_ies() handler will then be called with the FT IEs to
314 * include in the next frame in the authentication sequence.
319 * ft_ies_len - Length of ft_ies in bytes
324 * ft_md - FT Mobility domain (6 octets) (also included inside ft_ies)
326 * This value is provided to allow the driver interface easier access
327 * to the current mobility domain. This value is set to %NULL if no
328 * mobility domain is currently active.
333 * passphrase - RSN passphrase for PSK
335 * This value is made available only for WPA/WPA2-Personal (PSK) and
336 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
337 * the 8..63 character ASCII passphrase, if available. Please note that
338 * this can be %NULL if passphrase was not used to generate the PSK. In
339 * that case, the psk field must be used to fetch the PSK.
341 const char *passphrase
;
344 * psk - RSN PSK (alternative for passphrase for PSK)
346 * This value is made available only for WPA/WPA2-Personal (PSK) and
347 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
348 * the 32-octet (256-bit) PSK, if available. The driver wrapper should
349 * be prepared to handle %NULL value as an error.
354 * drop_unencrypted - Enable/disable unencrypted frame filtering
356 * Configure the driver to drop all non-EAPOL frames (both receive and
357 * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
358 * still be allowed for key negotiation.
360 int drop_unencrypted
;
363 * prev_bssid - Previously used BSSID in this ESS
365 * When not %NULL, this is a request to use reassociation instead of
368 const u8
*prev_bssid
;
372 * struct wpa_driver_capa - Driver capability information
374 struct wpa_driver_capa
{
375 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001
376 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002
377 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004
378 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008
379 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010
380 #define WPA_DRIVER_CAPA_KEY_MGMT_FT 0x00000020
381 #define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK 0x00000040
382 unsigned int key_mgmt
;
384 #define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001
385 #define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002
386 #define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004
387 #define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008
390 #define WPA_DRIVER_AUTH_OPEN 0x00000001
391 #define WPA_DRIVER_AUTH_SHARED 0x00000002
392 #define WPA_DRIVER_AUTH_LEAP 0x00000004
395 /* Driver generated WPA/RSN IE */
396 #define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001
397 /* Driver needs static WEP key setup after association command */
398 #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
399 #define WPA_DRIVER_FLAGS_USER_SPACE_MLME 0x00000004
400 /* Driver takes care of RSN 4-way handshake internally; PMK is configured with
401 * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
402 #define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008
403 #define WPA_DRIVER_FLAGS_WIRED 0x00000010
404 /* Driver provides separate commands for authentication and association (SME in
405 * wpa_supplicant). */
406 #define WPA_DRIVER_FLAGS_SME 0x00000020
407 /* Driver supports AP mode */
408 #define WPA_DRIVER_FLAGS_AP 0x00000040
409 /* Driver needs static WEP key setup after association has been completed */
410 #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080
417 struct ieee80211_rx_status
{
425 struct hostap_sta_driver_data
{
426 unsigned long rx_packets
, tx_packets
, rx_bytes
, tx_bytes
;
427 unsigned long current_tx_rate
;
428 unsigned long inactive_msec
;
430 unsigned long num_ps_buf_frames
;
431 unsigned long tx_retry_failed
;
432 unsigned long tx_retry_count
;
437 struct hostapd_sta_add_params
{
441 const u8
*supp_rates
;
442 size_t supp_rates_len
;
445 const struct ht_cap_ie
*ht_capabilities
;
448 struct hostapd_freq_params
{
453 int sec_channel_offset
; /* 0 = HT40 disabled, -1 = HT40 enabled,
454 * secondary channel below primary, 1 = HT40
455 * enabled, secondary channel above primary */
458 enum hostapd_driver_if_type
{
462 struct wpa_init_params
{
467 const char *test_socket
;
468 int use_pae_group_addr
;
472 u8
*own_addr
; /* buffer for writing own MAC address */
477 * struct wpa_driver_ops - Driver interface API definition
479 * This structure defines the API that each driver interface needs to implement
480 * for core wpa_supplicant code. All driver specific functionality is captured
483 struct wpa_driver_ops
{
484 /** Name of the driver interface */
486 /** One line description of the driver interface */
490 * get_bssid - Get the current BSSID
491 * @priv: private driver interface data
492 * @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)
494 * Returns: 0 on success, -1 on failure
496 * Query kernel driver for the current BSSID and copy it to bssid.
497 * Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not
500 int (*get_bssid
)(void *priv
, u8
*bssid
);
503 * get_ssid - Get the current SSID
504 * @priv: private driver interface data
505 * @ssid: buffer for SSID (at least 32 bytes)
507 * Returns: Length of the SSID on success, -1 on failure
509 * Query kernel driver for the current SSID and copy it to ssid.
510 * Returning zero is recommended if the STA is not associated.
512 * Note: SSID is an array of octets, i.e., it is not nul terminated and
513 * can, at least in theory, contain control characters (including nul)
514 * and as such, should be processed as binary data, not a printable
517 int (*get_ssid
)(void *priv
, u8
*ssid
);
520 * set_key - Configure encryption key
521 * @ifname: Interface name (for multi-SSID/VLAN support)
522 * @priv: private driver interface data
523 * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
524 * %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK);
525 * %WPA_ALG_NONE clears the key.
526 * @addr: address of the peer STA or ff:ff:ff:ff:ff:ff for
527 * broadcast/default keys
528 * @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
530 * @set_tx: configure this key as the default Tx key (only used when
531 * driver does not support separate unicast/individual key
532 * @seq: sequence number/packet number, seq_len octets, the next
533 * packet number to be used for in replay protection; configured
534 * for Rx keys (in most cases, this is only used with broadcast
535 * keys and set to zero for unicast keys)
536 * @seq_len: length of the seq, depends on the algorithm:
537 * TKIP: 6 octets, CCMP: 6 octets, IGTK: 6 octets
538 * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
540 * @key_len: length of the key buffer in octets (WEP: 5 or 13,
541 * TKIP: 32, CCMP: 16, IGTK: 16)
543 * Returns: 0 on success, -1 on failure
545 * Configure the given key for the kernel driver. If the driver
546 * supports separate individual keys (4 default keys + 1 individual),
547 * addr can be used to determine whether the key is default or
548 * individual. If only 4 keys are supported, the default key with key
549 * index 0 is used as the individual key. STA must be configured to use
550 * it as the default Tx key (set_tx is set) and accept Rx for all the
551 * key indexes. In most cases, WPA uses only key indexes 1 and 2 for
552 * broadcast keys, so key index 0 is available for this kind of
555 * Please note that TKIP keys include separate TX and RX MIC keys and
556 * some drivers may expect them in different order than wpa_supplicant
557 * is using. If the TX/RX keys are swapped, all TKIP encrypted packets
558 * will tricker Michael MIC errors. This can be fixed by changing the
559 * order of MIC keys by swapping te bytes 16..23 and 24..31 of the key
560 * in driver_*.c set_key() implementation, see driver_ndis.c for an
561 * example on how this can be done.
563 int (*set_key
)(const char *ifname
, void *priv
, wpa_alg alg
,
564 const u8
*addr
, int key_idx
, int set_tx
,
565 const u8
*seq
, size_t seq_len
,
566 const u8
*key
, size_t key_len
);
569 * init - Initialize driver interface
570 * @ctx: context to be used when calling wpa_supplicant functions,
571 * e.g., wpa_supplicant_event()
572 * @ifname: interface name, e.g., wlan0
574 * Returns: Pointer to private data, %NULL on failure
576 * Initialize driver interface, including event processing for kernel
577 * driver events (e.g., associated, scan results, Michael MIC failure).
578 * This function can allocate a private configuration data area for
579 * @ctx, file descriptor, interface name, etc. information that may be
580 * needed in future driver operations. If this is not used, non-NULL
581 * value will need to be returned because %NULL is used to indicate
582 * failure. The returned value will be used as 'void *priv' data for
583 * all other driver_ops functions.
585 * The main event loop (eloop.c) of wpa_supplicant can be used to
586 * register callback for read sockets (eloop_register_read_sock()).
588 * See below for more information about events and
589 * wpa_supplicant_event() function.
591 void * (*init
)(void *ctx
, const char *ifname
);
594 * deinit - Deinitialize driver interface
595 * @priv: private driver interface data from init()
597 * Shut down driver interface and processing of driver events. Free
598 * private data buffer if one was allocated in init() handler.
600 void (*deinit
)(void *priv
);
603 * set_param - Set driver configuration parameters
604 * @priv: private driver interface data from init()
605 * @param: driver specific configuration parameters
607 * Returns: 0 on success, -1 on failure
609 * Optional handler for notifying driver interface about configuration
610 * parameters (driver_param).
612 int (*set_param
)(void *priv
, const char *param
);
615 * set_countermeasures - Enable/disable TKIP countermeasures
616 * @priv: private driver interface data
617 * @enabled: 1 = countermeasures enabled, 0 = disabled
619 * Returns: 0 on success, -1 on failure
621 * Configure TKIP countermeasures. When these are enabled, the driver
622 * should drop all received and queued frames that are using TKIP.
624 int (*set_countermeasures
)(void *priv
, int enabled
);
627 * deauthenticate - Request driver to deauthenticate
628 * @priv: private driver interface data
629 * @addr: peer address (BSSID of the AP)
630 * @reason_code: 16-bit reason code to be sent in the deauthentication
633 * Returns: 0 on success, -1 on failure
635 int (*deauthenticate
)(void *priv
, const u8
*addr
, int reason_code
);
638 * disassociate - Request driver to disassociate
639 * @priv: private driver interface data
640 * @addr: peer address (BSSID of the AP)
641 * @reason_code: 16-bit reason code to be sent in the disassociation
644 * Returns: 0 on success, -1 on failure
646 int (*disassociate
)(void *priv
, const u8
*addr
, int reason_code
);
649 * associate - Request driver to associate
650 * @priv: private driver interface data
651 * @params: association parameters
653 * Returns: 0 on success, -1 on failure
655 int (*associate
)(void *priv
,
656 struct wpa_driver_associate_params
*params
);
659 * add_pmkid - Add PMKSA cache entry to the driver
660 * @priv: private driver interface data
661 * @bssid: BSSID for the PMKSA cache entry
662 * @pmkid: PMKID for the PMKSA cache entry
664 * Returns: 0 on success, -1 on failure
666 * This function is called when a new PMK is received, as a result of
667 * either normal authentication or RSN pre-authentication.
669 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
670 * associate(), add_pmkid() can be used to add new PMKSA cache entries
671 * in the driver. If the driver uses wpa_ie from wpa_supplicant, this
672 * driver_ops function does not need to be implemented. Likewise, if
673 * the driver does not support WPA, this function is not needed.
675 int (*add_pmkid
)(void *priv
, const u8
*bssid
, const u8
*pmkid
);
678 * remove_pmkid - Remove PMKSA cache entry to the driver
679 * @priv: private driver interface data
680 * @bssid: BSSID for the PMKSA cache entry
681 * @pmkid: PMKID for the PMKSA cache entry
683 * Returns: 0 on success, -1 on failure
685 * This function is called when the supplicant drops a PMKSA cache
686 * entry for any reason.
688 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
689 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
690 * between the driver and wpa_supplicant. If the driver uses wpa_ie
691 * from wpa_supplicant, this driver_ops function does not need to be
692 * implemented. Likewise, if the driver does not support WPA, this
693 * function is not needed.
695 int (*remove_pmkid
)(void *priv
, const u8
*bssid
, const u8
*pmkid
);
698 * flush_pmkid - Flush PMKSA cache
699 * @priv: private driver interface data
701 * Returns: 0 on success, -1 on failure
703 * This function is called when the supplicant drops all PMKSA cache
704 * entries for any reason.
706 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
707 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
708 * between the driver and wpa_supplicant. If the driver uses wpa_ie
709 * from wpa_supplicant, this driver_ops function does not need to be
710 * implemented. Likewise, if the driver does not support WPA, this
711 * function is not needed.
713 int (*flush_pmkid
)(void *priv
);
716 * get_capa - Get driver capabilities
717 * @priv: private driver interface data
719 * Returns: 0 on success, -1 on failure
721 * Get driver/firmware/hardware capabilities.
723 int (*get_capa
)(void *priv
, struct wpa_driver_capa
*capa
);
726 * poll - Poll driver for association information
727 * @priv: private driver interface data
729 * This is an option callback that can be used when the driver does not
730 * provide event mechanism for association events. This is called when
731 * receiving WPA EAPOL-Key messages that require association
732 * information. The driver interface is supposed to generate associnfo
733 * event before returning from this callback function. In addition, the
734 * driver interface should generate an association event after having
735 * sent out associnfo.
737 void (*poll
)(void *priv
);
740 * get_ifname - Get interface name
741 * @priv: private driver interface data
743 * Returns: Pointer to the interface name. This can differ from the
744 * interface name used in init() call. Init() is called first.
746 * This optional function can be used to allow the driver interface to
747 * replace the interface name with something else, e.g., based on an
748 * interface mapping from a more descriptive name.
750 const char * (*get_ifname
)(void *priv
);
753 * get_mac_addr - Get own MAC address
754 * @priv: private driver interface data
756 * Returns: Pointer to own MAC address or %NULL on failure
758 * This optional function can be used to get the own MAC address of the
759 * device from the driver interface code. This is only needed if the
760 * l2_packet implementation for the OS does not provide easy access to
762 const u8
* (*get_mac_addr
)(void *priv
);
765 * send_eapol - Optional function for sending EAPOL packets
766 * @priv: private driver interface data
767 * @dest: Destination MAC address
769 * @data: EAPOL packet starting with IEEE 802.1X header
770 * @data_len: Size of the EAPOL packet
772 * Returns: 0 on success, -1 on failure
774 * This optional function can be used to override l2_packet operations
775 * with driver specific functionality. If this function pointer is set,
776 * l2_packet module is not used at all and the driver interface code is
777 * responsible for receiving and sending all EAPOL packets. The
778 * received EAPOL packets are sent to core code by calling
779 * wpa_supplicant_rx_eapol(). The driver interface is required to
780 * implement get_mac_addr() handler if send_eapol() is used.
782 int (*send_eapol
)(void *priv
, const u8
*dest
, u16 proto
,
783 const u8
*data
, size_t data_len
);
786 * set_operstate - Sets device operating state to DORMANT or UP
787 * @priv: private driver interface data
788 * @state: 0 = dormant, 1 = up
789 * Returns: 0 on success, -1 on failure
791 * This is an optional function that can be used on operating systems
792 * that support a concept of controlling network device state from user
793 * space applications. This function, if set, gets called with
794 * state = 1 when authentication has been completed and with state = 0
795 * when connection is lost.
797 int (*set_operstate
)(void *priv
, int state
);
800 * mlme_setprotection - MLME-SETPROTECTION.request primitive
801 * @priv: Private driver interface data
802 * @addr: Address of the station for which to set protection (may be
803 * %NULL for group keys)
804 * @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_*
805 * @key_type: MLME_SETPROTECTION_KEY_TYPE_*
806 * Returns: 0 on success, -1 on failure
808 * This is an optional function that can be used to set the driver to
809 * require protection for Tx and/or Rx frames. This uses the layer
810 * interface defined in IEEE 802.11i-2004 clause 10.3.22.1
811 * (MLME-SETPROTECTION.request). Many drivers do not use explicit
812 * set protection operation; instead, they set protection implicitly
813 * based on configured keys.
815 int (*mlme_setprotection
)(void *priv
, const u8
*addr
, int protect_type
,
819 * get_hw_feature_data - Get hardware support data (channels and rates)
820 * @priv: Private driver interface data
821 * @num_modes: Variable for returning the number of returned modes
822 * flags: Variable for returning hardware feature flags
823 * Returns: Pointer to allocated hardware data on success or %NULL on
824 * failure. Caller is responsible for freeing this.
826 * This function is only needed for drivers that export MLME
827 * (management frame processing) to wpa_supplicant.
829 struct hostapd_hw_modes
* (*get_hw_feature_data
)(void *priv
,
834 * set_channel - Set channel
835 * @priv: Private driver interface data
836 * @phymode: HOSTAPD_MODE_IEEE80211B, ..
837 * @chan: IEEE 802.11 channel number
838 * @freq: Frequency of the channel in MHz
839 * Returns: 0 on success, -1 on failure
841 * This function is only needed for drivers that export MLME
842 * (management frame processing) to wpa_supplicant.
844 int (*set_channel
)(void *priv
, hostapd_hw_mode phymode
, int chan
,
848 * set_ssid - Set SSID
849 * @priv: Private driver interface data
851 * @ssid_len: SSID length
852 * Returns: 0 on success, -1 on failure
854 * This function is only needed for drivers that export MLME
855 * (management frame processing) to wpa_supplicant.
857 int (*set_ssid
)(void *priv
, const u8
*ssid
, size_t ssid_len
);
860 * set_bssid - Set BSSID
861 * @priv: Private driver interface data
863 * Returns: 0 on success, -1 on failure
865 * This function is only needed for drivers that export MLME
866 * (management frame processing) to wpa_supplicant.
868 int (*set_bssid
)(void *priv
, const u8
*bssid
);
871 * send_mlme - Send management frame from MLME
872 * @priv: Private driver interface data
873 * @data: IEEE 802.11 management frame with IEEE 802.11 header
874 * @data_len: Size of the management frame
875 * Returns: 0 on success, -1 on failure
877 * This function is only needed for drivers that export MLME
878 * (management frame processing) to wpa_supplicant.
880 int (*send_mlme
)(void *priv
, const u8
*data
, size_t data_len
);
883 * mlme_add_sta - Add a STA entry into the driver/netstack
884 * @priv: Private driver interface data
885 * @addr: MAC address of the STA (e.g., BSSID of the AP)
886 * @supp_rates: Supported rate set (from (Re)AssocResp); in IEEE 802.11
887 * format (one octet per rate, 1 = 0.5 Mbps)
888 * @supp_rates_len: Number of entries in supp_rates
889 * Returns: 0 on success, -1 on failure
891 * This function is only needed for drivers that export MLME
892 * (management frame processing) to wpa_supplicant. When the MLME code
893 * completes association with an AP, this function is called to
894 * configure the driver/netstack with a STA entry for data frame
895 * processing (TX rate control, encryption/decryption).
897 int (*mlme_add_sta
)(void *priv
, const u8
*addr
, const u8
*supp_rates
,
898 size_t supp_rates_len
);
901 * mlme_remove_sta - Remove a STA entry from the driver/netstack
902 * @priv: Private driver interface data
903 * @addr: MAC address of the STA (e.g., BSSID of the AP)
904 * Returns: 0 on success, -1 on failure
906 * This function is only needed for drivers that export MLME
907 * (management frame processing) to wpa_supplicant.
909 int (*mlme_remove_sta
)(void *priv
, const u8
*addr
);
912 * update_ft_ies - Update FT (IEEE 802.11r) IEs
913 * @priv: Private driver interface data
914 * @md: Mobility domain (2 octets) (also included inside ies)
915 * @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs
916 * @ies_len: Length of FT IEs in bytes
917 * Returns: 0 on success, -1 on failure
919 * The supplicant uses this callback to let the driver know that keying
920 * material for FT is available and that the driver can use the
921 * provided IEs in the next message in FT authentication sequence.
923 * This function is only needed for driver that support IEEE 802.11r
924 * (Fast BSS Transition).
926 int (*update_ft_ies
)(void *priv
, const u8
*md
, const u8
*ies
,
930 * send_ft_action - Send FT Action frame (IEEE 802.11r)
931 * @priv: Private driver interface data
932 * @action: Action field value
933 * @target_ap: Target AP address
934 * @ies: FT IEs (MDIE, FTIE, ...) (FT Request action frame body)
935 * @ies_len: Length of FT IEs in bytes
936 * Returns: 0 on success, -1 on failure
938 * The supplicant uses this callback to request the driver to transmit
939 * an FT Action frame (action category 6) for over-the-DS fast BSS
942 int (*send_ft_action
)(void *priv
, u8 action
, const u8
*target_ap
,
943 const u8
*ies
, size_t ies_len
);
946 * get_scan_results2 - Fetch the latest scan results
947 * @priv: private driver interface data
949 * Returns: Allocated buffer of scan results (caller is responsible for
950 * freeing the data structure) on success, NULL on failure
952 struct wpa_scan_results
* (*get_scan_results2
)(void *priv
);
955 * set_country - Set country
956 * @priv: Private driver interface data
957 * @alpha2: country to which to switch to
958 * Returns: 0 on success, -1 on failure
960 * This function is for drivers which support some form
961 * of setting a regulatory domain.
963 int (*set_country
)(void *priv
, const char *alpha2
);
966 * global_init - Global driver initialization
967 * Returns: Pointer to private data (global), %NULL on failure
969 * This optional function is called to initialize the driver wrapper
970 * for global data, i.e., data that applies to all interfaces. If this
971 * function is implemented, global_deinit() will also need to be
972 * implemented to free the private data. The driver will also likely
973 * use init2() function instead of init() to get the pointer to global
974 * data available to per-interface initializer.
976 void * (*global_init
)(void);
979 * global_deinit - Global driver deinitialization
980 * @priv: private driver global data from global_init()
982 * Terminate any global driver related functionality and free the
983 * global data structure.
985 void (*global_deinit
)(void *priv
);
988 * init2 - Initialize driver interface (with global data)
989 * @ctx: context to be used when calling wpa_supplicant functions,
990 * e.g., wpa_supplicant_event()
991 * @ifname: interface name, e.g., wlan0
992 * @global_priv: private driver global data from global_init()
993 * Returns: Pointer to private data, %NULL on failure
995 * This function can be used instead of init() if the driver wrapper
998 void * (*init2
)(void *ctx
, const char *ifname
, void *global_priv
);
1001 * get_interfaces - Get information about available interfaces
1002 * @global_priv: private driver global data from global_init()
1003 * Returns: Allocated buffer of interface information (caller is
1004 * responsible for freeing the data structure) on success, NULL on
1007 struct wpa_interface_info
* (*get_interfaces
)(void *global_priv
);
1010 * scan2 - Request the driver to initiate scan
1011 * @priv: private driver interface data
1012 * @params: Scan parameters
1014 * Returns: 0 on success, -1 on failure
1016 * Once the scan results are ready, the driver should report scan
1017 * results event for wpa_supplicant which will eventually request the
1018 * results with wpa_driver_get_scan_results2().
1020 int (*scan2
)(void *priv
, struct wpa_driver_scan_params
*params
);
1023 * authenticate - Request driver to authenticate
1024 * @priv: private driver interface data
1025 * @params: authentication parameters
1026 * Returns: 0 on success, -1 on failure
1028 * This is an optional function that can be used with drivers that
1029 * support separate authentication and association steps, i.e., when
1030 * wpa_supplicant can act as the SME. If not implemented, associate()
1031 * function is expected to take care of IEEE 802.11 authentication,
1034 int (*authenticate
)(void *priv
,
1035 struct wpa_driver_auth_params
*params
);
1037 int (*set_beacon
)(const char *ifname
, void *priv
,
1038 const u8
*head
, size_t head_len
,
1039 const u8
*tail
, size_t tail_len
, int dtim_period
,
1042 void * (*hapd_init
)(struct hostapd_data
*hapd
,
1043 struct wpa_init_params
*params
);
1044 void (*hapd_deinit
)(void *priv
);
1047 * set_8021x - enable/disable IEEE 802.1X support
1048 * @ifname: Interface name (for multi-SSID/VLAN support)
1049 * @priv: driver private data
1050 * @enabled: 1 = enable, 0 = disable
1052 * Returns: 0 on success, -1 on failure
1054 * Configure the kernel driver to enable/disable 802.1X support.
1055 * This may be an empty function if 802.1X support is always enabled.
1057 int (*set_ieee8021x
)(const char *ifname
, void *priv
, int enabled
);
1060 * set_privacy - enable/disable privacy
1061 * @priv: driver private data
1062 * @enabled: 1 = privacy enabled, 0 = disabled
1064 * Return: 0 on success, -1 on failure
1066 * Configure privacy.
1068 int (*set_privacy
)(const char *ifname
, void *priv
, int enabled
);
1070 int (*get_seqnum
)(const char *ifname
, void *priv
, const u8
*addr
,
1072 int (*get_seqnum_igtk
)(const char *ifname
, void *priv
, const u8
*addr
,
1074 int (*flush
)(void *priv
);
1075 int (*set_generic_elem
)(const char *ifname
, void *priv
, const u8
*elem
,
1078 int (*read_sta_data
)(void *priv
, struct hostap_sta_driver_data
*data
,
1080 int (*hapd_send_eapol
)(void *priv
, const u8
*addr
, const u8
*data
,
1081 size_t data_len
, int encrypt
,
1082 const u8
*own_addr
);
1083 int (*sta_deauth
)(void *priv
, const u8
*own_addr
, const u8
*addr
,
1085 int (*sta_disassoc
)(void *priv
, const u8
*own_addr
, const u8
*addr
,
1087 int (*sta_remove
)(void *priv
, const u8
*addr
);
1088 int (*hapd_get_ssid
)(const char *ifname
, void *priv
, u8
*buf
, int len
);
1089 int (*hapd_set_ssid
)(const char *ifname
, void *priv
, const u8
*buf
,
1091 int (*hapd_set_countermeasures
)(void *priv
, int enabled
);
1092 int (*sta_add
)(const char *ifname
, void *priv
,
1093 struct hostapd_sta_add_params
*params
);
1094 int (*get_inact_sec
)(void *priv
, const u8
*addr
);
1095 int (*sta_clear_stats
)(void *priv
, const u8
*addr
);
1097 int (*set_freq
)(void *priv
, struct hostapd_freq_params
*freq
);
1098 int (*set_rts
)(void *priv
, int rts
);
1099 int (*set_frag
)(void *priv
, int frag
);
1101 int (*sta_set_flags
)(void *priv
, const u8
*addr
,
1102 int total_flags
, int flags_or
, int flags_and
);
1103 int (*set_rate_sets
)(void *priv
, int *supp_rates
, int *basic_rates
,
1106 /* Configure internal bridge:
1107 * 0 = disabled, i.e., client separation is enabled (no bridging of
1108 * packets between associated STAs
1109 * 1 = enabled, i.e., bridge packets between associated STAs (default)
1111 int (*set_internal_bridge
)(void *priv
, int value
);
1112 int (*set_cts_protect
)(void *priv
, int value
);
1113 int (*set_preamble
)(void *priv
, int value
);
1114 int (*set_short_slot_time
)(void *priv
, int value
);
1115 int (*set_tx_queue_params
)(void *priv
, int queue
, int aifs
, int cw_min
,
1116 int cw_max
, int burst_time
);
1117 int (*bss_add
)(void *priv
, const char *ifname
, const u8
*bssid
);
1118 int (*bss_remove
)(void *priv
, const char *ifname
);
1119 int (*valid_bss_mask
)(void *priv
, const u8
*addr
, const u8
*mask
);
1120 int (*if_add
)(const char *iface
, void *priv
,
1121 enum hostapd_driver_if_type type
, char *ifname
,
1123 int (*if_update
)(void *priv
, enum hostapd_driver_if_type type
,
1124 char *ifname
, const u8
*addr
);
1125 int (*if_remove
)(void *priv
, enum hostapd_driver_if_type type
,
1126 const char *ifname
, const u8
*addr
);
1127 int (*set_sta_vlan
)(void *priv
, const u8
*addr
, const char *ifname
,
1130 * commit - Optional commit changes handler
1131 * @priv: driver private data
1132 * Returns: 0 on success, -1 on failure
1134 * This optional handler function can be registered if the driver
1135 * interface implementation needs to commit changes (e.g., by setting
1136 * network interface up) at the end of initial configuration. If set,
1137 * this handler will be called after initial setup has been completed.
1139 int (*commit
)(void *priv
);
1141 int (*send_ether
)(void *priv
, const u8
*dst
, const u8
*src
, u16 proto
,
1142 const u8
*data
, size_t data_len
);
1144 int (*set_radius_acl_auth
)(void *priv
, const u8
*mac
, int accepted
,
1145 u32 session_timeout
);
1146 int (*set_radius_acl_expire
)(void *priv
, const u8
*mac
);
1148 int (*set_ht_params
)(const char *ifname
, void *priv
,
1149 const u8
*ht_capab
, size_t ht_capab_len
,
1150 const u8
*ht_oper
, size_t ht_oper_len
);
1152 int (*set_wps_beacon_ie
)(const char *ifname
, void *priv
,
1153 const u8
*ie
, size_t len
);
1154 int (*set_wps_probe_resp_ie
)(const char *ifname
, void *priv
,
1155 const u8
*ie
, size_t len
);
1158 * set_supp_port - Set IEEE 802.1X Supplicant Port status
1159 * @priv: Private driver interface data
1160 * @authorized: Whether the port is authorized
1161 * Returns: 0 on success, -1 on failure
1163 int (*set_supp_port
)(void *priv
, int authorized
);
1167 * enum wpa_event_type - Event type for wpa_supplicant_event() calls
1169 typedef enum wpa_event_type
{
1171 * EVENT_ASSOC - Association completed
1173 * This event needs to be delivered when the driver completes IEEE
1174 * 802.11 association or reassociation successfully.
1175 * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
1176 * after this event has been generated. In addition, optional
1177 * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
1178 * more information about the association. If the driver interface gets
1179 * both of these events at the same time, it can also include the
1180 * assoc_info data in EVENT_ASSOC call.
1185 * EVENT_DISASSOC - Association lost
1187 * This event should be called when association is lost either due to
1188 * receiving deauthenticate or disassociate frame from the AP or when
1189 * sending either of these frames to the current AP. If the driver
1190 * supports separate deauthentication event, EVENT_DISASSOC should only
1191 * be used for disassociation and EVENT_DEAUTH for deauthentication.
1196 * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
1198 * This event must be delivered when a Michael MIC error is detected by
1199 * the local driver. Additional data for event processing is
1200 * provided with union wpa_event_data::michael_mic_failure. This
1201 * information is used to request new encyption key and to initiate
1202 * TKIP countermeasures if needed.
1204 EVENT_MICHAEL_MIC_FAILURE
,
1207 * EVENT_SCAN_RESULTS - Scan results available
1209 * This event must be called whenever scan results are available to be
1210 * fetched with struct wpa_driver_ops::get_scan_results(). This event
1211 * is expected to be used some time after struct wpa_driver_ops::scan()
1212 * is called. If the driver provides an unsolicited event when the scan
1213 * has been completed, this event can be used to trigger
1214 * EVENT_SCAN_RESULTS call. If such event is not available from the
1215 * driver, the driver wrapper code is expected to use a registered
1216 * timeout to generate EVENT_SCAN_RESULTS call after the time that the
1217 * scan is expected to be completed.
1222 * EVENT_ASSOCINFO - Report optional extra information for association
1224 * This event can be used to report extra association information for
1225 * EVENT_ASSOC processing. This extra information includes IEs from
1226 * association frames and Beacon/Probe Response frames in union
1227 * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
1228 * EVENT_ASSOC. Alternatively, the driver interface can include
1229 * assoc_info data in the EVENT_ASSOC call if it has all the
1230 * information available at the same point.
1235 * EVENT_INTERFACE_STATUS - Report interface status changes
1237 * This optional event can be used to report changes in interface
1238 * status (interface added/removed) using union
1239 * wpa_event_data::interface_status. This can be used to trigger
1240 * wpa_supplicant to stop and re-start processing for the interface,
1241 * e.g., when a cardbus card is ejected/inserted.
1243 EVENT_INTERFACE_STATUS
,
1246 * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
1248 * This event can be used to inform wpa_supplicant about candidates for
1249 * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
1250 * for scan request (ap_scan=2 mode), this event is required for
1251 * pre-authentication. If wpa_supplicant is performing scan request
1252 * (ap_scan=1), this event is optional since scan results can be used
1253 * to add pre-authentication candidates. union
1254 * wpa_event_data::pmkid_candidate is used to report the BSSID of the
1255 * candidate and priority of the candidate, e.g., based on the signal
1256 * strength, in order to try to pre-authenticate first with candidates
1257 * that are most likely targets for re-association.
1259 * EVENT_PMKID_CANDIDATE can be called whenever the driver has updates
1260 * on the candidate list. In addition, it can be called for the current
1261 * AP and APs that have existing PMKSA cache entries. wpa_supplicant
1262 * will automatically skip pre-authentication in cases where a valid
1263 * PMKSA exists. When more than one candidate exists, this event should
1264 * be generated once for each candidate.
1266 * Driver will be notified about successful pre-authentication with
1267 * struct wpa_driver_ops::add_pmkid() calls.
1269 EVENT_PMKID_CANDIDATE
,
1272 * EVENT_STKSTART - Request STK handshake (MLME-STKSTART.request)
1274 * This event can be used to inform wpa_supplicant about desire to set
1275 * up secure direct link connection between two stations as defined in
1276 * IEEE 802.11e with a new PeerKey mechanism that replaced the original
1277 * STAKey negotiation. The caller will need to set peer address for the
1283 * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
1285 * The driver is expected to report the received FT IEs from
1286 * FT authentication sequence from the AP. The FT IEs are included in
1287 * the extra information in union wpa_event_data::ft_ies.
1292 * EVENT_IBSS_RSN_START - Request RSN authentication in IBSS
1294 * The driver can use this event to inform wpa_supplicant about a STA
1295 * in an IBSS with which protected frames could be exchanged. This
1296 * event starts RSN authentication with the other STA to authenticate
1297 * the STA and set up encryption keys with it.
1299 EVENT_IBSS_RSN_START
,
1302 * EVENT_AUTH - Authentication result
1304 * This event should be called when authentication attempt has been
1305 * completed. This is only used if the driver supports separate
1306 * authentication step (struct wpa_driver_ops::authenticate).
1307 * Information about authentication result is included in
1308 * union wpa_event_data::auth.
1313 * EVENT_DEAUTH - Authentication lost
1315 * This event should be called when authentication is lost either due
1316 * to receiving deauthenticate frame from the AP or when sending that
1317 * frame to the current AP.
1322 * EVENT_ASSOC_REJECT - Association rejected
1324 * This event should be called when (re)association attempt has been
1325 * rejected by the AP. Information about authentication result is
1326 * included in union wpa_event_data::assoc_reject.
1331 * EVENT_AUTH_TIMED_OUT - Authentication timed out
1333 EVENT_AUTH_TIMED_OUT
,
1336 * EVENT_ASSOC_TIMED_OUT - Association timed out
1338 EVENT_ASSOC_TIMED_OUT
1343 * union wpa_event_data - Additional data for wpa_supplicant_event() calls
1345 union wpa_event_data
{
1347 * struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events
1349 * This structure is optional for EVENT_ASSOC calls and required for
1350 * EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the
1351 * driver interface does not need to generate separate EVENT_ASSOCINFO
1356 * req_ies - (Re)Association Request IEs
1358 * If the driver generates WPA/RSN IE, this event data must be
1359 * returned for WPA handshake to have needed information. If
1360 * wpa_supplicant-generated WPA/RSN IE is used, this
1361 * information event is optional.
1363 * This should start with the first IE (fixed fields before IEs
1364 * are not included).
1369 * req_ies_len - Length of req_ies in bytes
1374 * resp_ies - (Re)Association Response IEs
1376 * Optional association data from the driver. This data is not
1377 * required WPA, but may be useful for some protocols and as
1378 * such, should be reported if this is available to the driver
1381 * This should start with the first IE (fixed fields before IEs
1382 * are not included).
1387 * resp_ies_len - Length of resp_ies in bytes
1389 size_t resp_ies_len
;
1392 * beacon_ies - Beacon or Probe Response IEs
1394 * Optional Beacon/ProbeResp data: IEs included in Beacon or
1395 * Probe Response frames from the current AP (i.e., the one
1396 * that the client just associated with). This information is
1397 * used to update WPA/RSN IE for the AP. If this field is not
1398 * set, the results from previous scan will be used. If no
1399 * data for the new AP is found, scan results will be requested
1400 * again (without scan request). At this point, the driver is
1401 * expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is
1404 * This should start with the first IE (fixed fields before IEs
1405 * are not included).
1410 * beacon_ies_len - Length of beacon_ies */
1411 size_t beacon_ies_len
;
1415 * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
1417 struct michael_mic_failure
{
1420 } michael_mic_failure
;
1423 * struct interface_status - Data for EVENT_INTERFACE_STATUS
1425 struct interface_status
{
1428 EVENT_INTERFACE_ADDED
, EVENT_INTERFACE_REMOVED
1433 * struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE
1435 struct pmkid_candidate
{
1436 /** BSSID of the PMKID candidate */
1438 /** Smaller the index, higher the priority */
1440 /** Whether RSN IE includes pre-authenticate flag */
1445 * struct stkstart - Data for EVENT_STKSTART
1452 * struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
1454 * During FT (IEEE 802.11r) authentication sequence, the driver is
1455 * expected to use this event to report received FT IEs (MDIE, FTIE,
1456 * RSN IE, TIE, possible resource request) to the supplicant. The FT
1457 * IEs for the next message will be delivered through the
1458 * struct wpa_driver_ops::update_ft_ies() callback.
1464 u8 target_ap
[ETH_ALEN
];
1465 /** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
1467 /** Length of ric_ies buffer in octets */
1472 * struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START
1474 struct ibss_rsn_start
{
1479 * struct auth_info - Data for EVENT_AUTH events
1490 * struct assoc_reject - Data for EVENT_ASSOC_REJECT events
1492 struct assoc_reject
{
1494 * resp_ies - (Re)Association Response IEs
1496 * Optional association data from the driver. This data is not
1497 * required WPA, but may be useful for some protocols and as
1498 * such, should be reported if this is available to the driver
1501 * This should start with the first IE (fixed fields before IEs
1502 * are not included).
1507 * resp_ies_len - Length of resp_ies in bytes
1509 size_t resp_ies_len
;
1512 * status_code - Status Code from (Re)association Response
1517 struct timeout_event
{
1523 * wpa_supplicant_event - Report a driver event for wpa_supplicant
1524 * @ctx: Context pointer (wpa_s); this is the ctx variable registered
1525 * with struct wpa_driver_ops::init()
1526 * @event: event type (defined above)
1527 * @data: possible extra data for the event
1529 * Driver wrapper code should call this function whenever an event is received
1532 void wpa_supplicant_event(void *ctx
, wpa_event_type event
,
1533 union wpa_event_data
*data
);
1536 * wpa_supplicant_rx_eapol - Deliver a received EAPOL frame to wpa_supplicant
1537 * @ctx: Context pointer (wpa_s); this is the ctx variable registered
1538 * with struct wpa_driver_ops::init()
1539 * @src_addr: Source address of the EAPOL frame
1540 * @buf: EAPOL data starting from the EAPOL header (i.e., no Ethernet header)
1541 * @len: Length of the EAPOL data
1543 * This function is called for each received EAPOL frame. Most driver
1544 * interfaces rely on more generic OS mechanism for receiving frames through
1545 * l2_packet, but if such a mechanism is not available, the driver wrapper may
1546 * take care of received EAPOL frames and deliver them to the core supplicant
1547 * code by calling this function.
1549 void wpa_supplicant_rx_eapol(void *ctx
, const u8
*src_addr
,
1550 const u8
*buf
, size_t len
);
1552 void wpa_supplicant_sta_rx(void *ctx
, const u8
*buf
, size_t len
,
1553 struct ieee80211_rx_status
*rx_status
);
1555 const u8
* wpa_scan_get_ie(const struct wpa_scan_res
*res
, u8 ie
);
1556 #define WPA_IE_VENDOR_TYPE 0x0050f201
1557 #define WPS_IE_VENDOR_TYPE 0x0050f204
1558 const u8
* wpa_scan_get_vendor_ie(const struct wpa_scan_res
*res
,
1560 struct wpabuf
* wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res
*res
,
1562 int wpa_scan_get_max_rate(const struct wpa_scan_res
*res
);
1563 void wpa_scan_results_free(struct wpa_scan_results
*res
);
1564 void wpa_scan_sort_results(struct wpa_scan_results
*res
);
1566 /* hostapd functions for driver wrappers */
1569 struct ieee80211_hdr
;
1571 void hostapd_new_assoc_sta(struct hostapd_data
*hapd
, struct sta_info
*sta
,
1573 void hostapd_tx_status(struct hostapd_data
*hapd
, const u8
*addr
,
1574 const u8
*buf
, size_t len
, int ack
);
1575 void hostapd_rx_from_unknown_sta(struct hostapd_data
*hapd
,
1576 const struct ieee80211_hdr
*hdr
, size_t len
);
1577 int hostapd_notif_assoc(struct hostapd_data
*hapd
, const u8
*addr
,
1578 const u8
*ie
, size_t ielen
);
1579 void hostapd_notif_disassoc(struct hostapd_data
*hapd
, const u8
*addr
);
1580 void hostapd_eapol_receive(struct hostapd_data
*hapd
, const u8
*sa
,
1581 const u8
*buf
, size_t len
);
1583 struct hostapd_frame_info
{
1590 void hostapd_mgmt_rx(struct hostapd_data
*hapd
, u8
*buf
, size_t len
,
1591 u16 stype
, struct hostapd_frame_info
*fi
);
1592 void hostapd_mgmt_tx_cb(struct hostapd_data
*hapd
, u8
*buf
, size_t len
,
1594 void hostapd_michael_mic_failure(struct hostapd_data
*hapd
, const u8
*addr
);
1595 struct hostapd_data
* hostapd_sta_get_bss(struct hostapd_data
*hapd
,
1597 void hostapd_probe_req_rx(struct hostapd_data
*hapd
, const u8
*sa
,
1598 const u8
*ie
, size_t ie_len
);
1600 #endif /* DRIVER_H */