/*
* WPA Supplicant - driver interface definition
- * Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2003-2010, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
#ifndef DRIVER_H
#define DRIVER_H
-#define WPA_SUPPLICANT_DRIVER_VERSION 3
+#define WPA_SUPPLICANT_DRIVER_VERSION 4
+
+#include "common/defs.h"
+
+#define HOSTAPD_CHAN_DISABLED 0x00000001
+#define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002
+#define HOSTAPD_CHAN_NO_IBSS 0x00000004
+#define HOSTAPD_CHAN_RADAR 0x00000008
+
+struct hostapd_channel_data {
+ short chan; /* channel number (IEEE 802.11) */
+ short freq; /* frequency in MHz */
+ int flag; /* flag for hostapd use (HOSTAPD_CHAN_*) */
+ u8 max_tx_power; /* maximum transmit power in dBm */
+};
+
+struct hostapd_hw_modes {
+ enum hostapd_hw_mode mode;
+ int num_channels;
+ struct hostapd_channel_data *channels;
+ int num_rates;
+ int *rates; /* array of rates in 100 kbps units */
+ u16 ht_capab;
+ u8 mcs_set[16];
+ u8 a_mpdu_params;
+};
-#include "defs.h"
#define AUTH_ALG_OPEN_SYSTEM 0x01
#define AUTH_ALG_SHARED_KEY 0x02
#define AUTH_ALG_LEAP 0x04
+#define AUTH_ALG_FT 0x08
#define IEEE80211_MODE_INFRA 0
#define IEEE80211_MODE_IBSS 1
+#define IEEE80211_MODE_AP 2
#define IEEE80211_CAP_ESS 0x0001
#define IEEE80211_CAP_IBSS 0x0002
#define IEEE80211_CAP_PRIVACY 0x0010
-#define SSID_MAX_WPA_IE_LEN 40
-/**
- * struct wpa_scan_result - Scan results (old structure)
- * @bssid: BSSID
- * @ssid: SSID
- * @ssid_len: length of the ssid
- * @wpa_ie: WPA IE
- * @wpa_ie_len: length of the wpa_ie
- * @rsn_ie: RSN IE
- * @rsn_ie_len: length of the RSN IE
- * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
- * @caps: capability information field in host byte order
- * @qual: signal quality
- * @noise: noise level
- * @level: signal level
- * @maxrate: maximum supported rate
- * @mdie_present: Whether MDIE was included in Beacon/ProbeRsp frame
- * @mdie: Mobility domain identifier IE (IEEE 802.11r MDIE) (starting from
- * IE type field)
- * @tsf: Timestamp
- *
- * This structure is used as a generic format for scan results from the
- * driver. Each driver interface implementation is responsible for converting
- * the driver or OS specific scan results into this format.
- *
- * This structure is the old data structure used for scan results. It is
- * obsoleted by the new struct wpa_scan_res structure and the old version is
- * only included for backwards compatibility with existing driver wrapper
- * implementations. New implementations are encouraged to implement for struct
- * wpa_scan_res. The old structure will be removed at some point.
- */
-struct wpa_scan_result {
- u8 bssid[ETH_ALEN];
- u8 ssid[32];
- size_t ssid_len;
- u8 wpa_ie[SSID_MAX_WPA_IE_LEN];
- size_t wpa_ie_len;
- u8 rsn_ie[SSID_MAX_WPA_IE_LEN];
- size_t rsn_ie_len;
- int freq;
- u16 caps;
- int qual;
- int noise;
- int level;
- int maxrate;
- int mdie_present;
- u8 mdie[5];
- u64 tsf;
-};
-
+#define WPA_SCAN_QUAL_INVALID BIT(0)
+#define WPA_SCAN_NOISE_INVALID BIT(1)
+#define WPA_SCAN_LEVEL_INVALID BIT(2)
+#define WPA_SCAN_LEVEL_DBM BIT(3)
+#define WPA_SCAN_AUTHENTICATED BIT(4)
+#define WPA_SCAN_ASSOCIATED BIT(5)
/**
* struct wpa_scan_res - Scan result for an BSS/IBSS
+ * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
* @bssid: BSSID
* @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
* @beacon_int: beacon interval in TUs (host byte order)
* @noise: noise level
* @level: signal level
* @tsf: Timestamp
+ * @age: Age of the information in milliseconds (i.e., how many milliseconds
+ * ago the last Beacon or Probe Response frame was received)
* @ie_len: length of the following IE field in octets
*
* This structure is used as a generic format for scan results from the
* report all IEs to make it easier to support future additions.
*/
struct wpa_scan_res {
+ unsigned int flags;
u8 bssid[ETH_ALEN];
int freq;
u16 beacon_int;
int noise;
int level;
u64 tsf;
+ unsigned int age;
size_t ie_len;
/* followed by ie_len octets of IEs */
};
};
/**
+ * struct wpa_interface_info - Network interface information
+ * @next: Pointer to the next interface or NULL if this is the last one
+ * @ifname: Interface name that can be used with init() or init2()
+ * @desc: Human readable adapter description (e.g., vendor/model) or NULL if
+ * not available
+ * @drv_name: struct wpa_driver_ops::name (note: unlike other strings, this one
+ * is not an allocated copy, i.e., get_interfaces() caller will not free
+ * this)
+ */
+struct wpa_interface_info {
+ struct wpa_interface_info *next;
+ char *ifname;
+ char *desc;
+ const char *drv_name;
+};
+
+#define WPAS_MAX_SCAN_SSIDS 4
+
+/**
+ * struct wpa_driver_scan_params - Scan parameters
+ * Data for struct wpa_driver_ops::scan2().
+ */
+struct wpa_driver_scan_params {
+ /**
+ * ssids - SSIDs to scan for
+ */
+ struct wpa_driver_scan_ssid {
+ /**
+ * ssid - specific SSID to scan for (ProbeReq)
+ * %NULL or zero-length SSID is used to indicate active scan
+ * with wildcard SSID.
+ */
+ const u8 *ssid;
+ /**
+ * ssid_len: Length of the SSID in octets
+ */
+ size_t ssid_len;
+ } ssids[WPAS_MAX_SCAN_SSIDS];
+
+ /**
+ * num_ssids - Number of entries in ssids array
+ * Zero indicates a request for a passive scan.
+ */
+ size_t num_ssids;
+
+ /**
+ * extra_ies - Extra IE(s) to add into Probe Request or %NULL
+ */
+ const u8 *extra_ies;
+
+ /**
+ * extra_ies_len - Length of extra_ies in octets
+ */
+ size_t extra_ies_len;
+
+ /**
+ * freqs - Array of frequencies to scan or %NULL for all frequencies
+ *
+ * The frequency is set in MHz. The array is zero-terminated.
+ */
+ int *freqs;
+};
+
+/**
+ * struct wpa_driver_auth_params - Authentication parameters
+ * Data for struct wpa_driver_ops::authenticate().
+ */
+struct wpa_driver_auth_params {
+ int freq;
+ const u8 *bssid;
+ const u8 *ssid;
+ size_t ssid_len;
+ int auth_alg;
+ const u8 *ie;
+ size_t ie_len;
+ const u8 *wep_key[4];
+ size_t wep_key_len[4];
+ int wep_tx_keyidx;
+};
+
+/**
* struct wpa_driver_associate_params - Association parameters
* Data for struct wpa_driver_ops::associate().
*/
/* The selected pairwise/group cipher and key management
* suites. These are usually ignored if @wpa_ie is used. */
- wpa_cipher pairwise_suite;
- wpa_cipher group_suite;
- wpa_key_mgmt key_mgmt_suite;
+ enum wpa_cipher pairwise_suite;
+ enum wpa_cipher group_suite;
+ enum wpa_key_mgmt key_mgmt_suite;
/**
* auth_alg - Allowed authentication algorithms
* be prepared to handle %NULL value as an error.
*/
const u8 *psk;
+
+ /**
+ * drop_unencrypted - Enable/disable unencrypted frame filtering
+ *
+ * Configure the driver to drop all non-EAPOL frames (both receive and
+ * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
+ * still be allowed for key negotiation.
+ */
+ int drop_unencrypted;
+
+ /**
+ * prev_bssid - Previously used BSSID in this ESS
+ *
+ * When not %NULL, this is a request to use reassociation instead of
+ * association.
+ */
+ const u8 *prev_bssid;
};
/**
/* Driver generated WPA/RSN IE */
#define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001
+/* Driver needs static WEP key setup after association command */
#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
#define WPA_DRIVER_FLAGS_USER_SPACE_MLME 0x00000004
/* Driver takes care of RSN 4-way handshake internally; PMK is configured with
* struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
#define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008
+#define WPA_DRIVER_FLAGS_WIRED 0x00000010
+/* Driver provides separate commands for authentication and association (SME in
+ * wpa_supplicant). */
+#define WPA_DRIVER_FLAGS_SME 0x00000020
+/* Driver supports AP mode */
+#define WPA_DRIVER_FLAGS_AP 0x00000040
+/* Driver needs static WEP key setup after association has been completed */
+#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080
unsigned int flags;
+
+ int max_scan_ssids;
};
-#define WPA_CHAN_W_SCAN 0x00000001
-#define WPA_CHAN_W_ACTIVE_SCAN 0x00000002
-#define WPA_CHAN_W_IBSS 0x00000004
+struct hostapd_data;
-struct wpa_channel_data {
- short chan; /* channel number (IEEE 802.11) */
- short freq; /* frequency in MHz */
- int flag; /* flag for user space use (WPA_CHAN_*) */
+struct hostap_sta_driver_data {
+ unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
+ unsigned long current_tx_rate;
+ unsigned long inactive_msec;
+ unsigned long flags;
+ unsigned long num_ps_buf_frames;
+ unsigned long tx_retry_failed;
+ unsigned long tx_retry_count;
+ int last_rssi;
+ int last_ack_rssi;
};
-#define WPA_RATE_ERP 0x00000001
-#define WPA_RATE_BASIC 0x00000002
-#define WPA_RATE_PREAMBLE2 0x00000004
-#define WPA_RATE_SUPPORTED 0x00000010
-#define WPA_RATE_OFDM 0x00000020
-#define WPA_RATE_CCK 0x00000040
-#define WPA_RATE_MANDATORY 0x00000100
-
-struct wpa_rate_data {
- int rate; /* rate in 100 kbps */
- int flags; /* WPA_RATE_ flags */
+struct hostapd_sta_add_params {
+ const u8 *addr;
+ u16 aid;
+ u16 capability;
+ const u8 *supp_rates;
+ size_t supp_rates_len;
+ u16 listen_interval;
+ const struct ieee80211_ht_capabilities *ht_capabilities;
};
-typedef enum {
- WPA_MODE_IEEE80211B,
- WPA_MODE_IEEE80211G,
- WPA_MODE_IEEE80211A,
- NUM_WPA_MODES
-} wpa_hw_mode;
+struct hostapd_freq_params {
+ int mode;
+ int freq;
+ int channel;
+ int ht_enabled;
+ int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
+ * secondary channel below primary, 1 = HT40
+ * enabled, secondary channel above primary */
+};
-struct wpa_hw_modes {
- wpa_hw_mode mode;
- int num_channels;
- struct wpa_channel_data *channels;
- int num_rates;
- struct wpa_rate_data *rates;
+enum wpa_driver_if_type {
+ /**
+ * WPA_IF_STATION - Station mode interface
+ */
+ WPA_IF_STATION,
+
+ /**
+ * WPA_IF_AP_VLAN - AP mode VLAN interface
+ *
+ * This interface shares its address and Beacon frame with the main
+ * BSS.
+ */
+ WPA_IF_AP_VLAN,
+
+ /**
+ * WPA_IF_AP_BSS - AP mode BSS interface
+ *
+ * This interface has its own address and Beacon frame.
+ */
+ WPA_IF_AP_BSS,
+};
+
+struct wpa_init_params {
+ const u8 *bssid;
+ const char *ifname;
+ const u8 *ssid;
+ size_t ssid_len;
+ const char *test_socket;
+ int use_pae_group_addr;
+ char **bridge;
+ size_t num_bridge;
+
+ u8 *own_addr; /* buffer for writing own MAC address */
};
-struct ieee80211_rx_status {
- int channel;
- int ssi;
+struct wpa_bss_params {
+ /** Interface name (for multi-SSID/VLAN support) */
+ const char *ifname;
+ /** Whether IEEE 802.1X or WPA/WPA2 is enabled */
+ int enabled;
+
+ int wpa;
+ int ieee802_1x;
+ int wpa_group;
+ int wpa_pairwise;
+ int wpa_key_mgmt;
+ int rsn_preauth;
};
+#define WPA_STA_AUTHORIZED BIT(0)
+#define WPA_STA_WMM BIT(1)
+#define WPA_STA_SHORT_PREAMBLE BIT(2)
+#define WPA_STA_MFP BIT(3)
/**
* struct wpa_driver_ops - Driver interface API definition
int (*get_ssid)(void *priv, u8 *ssid);
/**
- * set_wpa - Enable/disable WPA support (OBSOLETE)
- * @priv: private driver interface data
- * @enabled: 1 = enable, 0 = disable
- *
- * Returns: 0 on success, -1 on failure
- *
- * Note: This function is included for backwards compatibility. This is
- * called only just after init and just before deinit, so these
- * functions can be used to implement same functionality and the driver
- * interface need not define this function.
- *
- * Configure the kernel driver to enable/disable WPA support. This may
- * be empty function, if WPA support is always enabled. Common
- * configuration items are WPA IE (clearing it when WPA support is
- * disabled), Privacy flag configuration for capability field (note:
- * this the value need to set in associate handler to allow plaintext
- * mode to be used) when trying to associate with, roaming mode (can
- * allow wpa_supplicant to control roaming if ap_scan=1 is used;
- * however, drivers can also implement roaming if desired, especially
- * ap_scan=2 mode is used for this).
- */
- int (*set_wpa)(void *priv, int enabled);
-
- /**
* set_key - Configure encryption key
+ * @ifname: Interface name (for multi-SSID/VLAN support)
* @priv: private driver interface data
* @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
* %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK);
* in driver_*.c set_key() implementation, see driver_ndis.c for an
* example on how this can be done.
*/
- int (*set_key)(void *priv, wpa_alg alg, const u8 *addr,
- int key_idx, int set_tx, const u8 *seq, size_t seq_len,
+ int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg,
+ const u8 *addr, int key_idx, int set_tx,
+ const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len);
/**
int (*set_countermeasures)(void *priv, int enabled);
/**
- * set_drop_unencrypted - Enable/disable unencrypted frame filtering
- * @priv: private driver interface data
- * @enabled: 1 = unencrypted Tx/Rx frames will be dropped, 0 = disabled
- *
- * Returns: 0 on success, -1 on failure
- *
- * Configure the driver to drop all non-EAPOL frames (both receive and
- * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
- * still be allowed for key negotiation.
- */
- int (*set_drop_unencrypted)(void *priv, int enabled);
-
- /**
- * scan - Request the driver to initiate scan
- * @priv: private driver interface data
- * @ssid: specific SSID to scan for (ProbeReq) or %NULL to scan for
- * all SSIDs (either active scan with broadcast SSID or passive
- * scan
- * @ssid_len: length of the SSID
- *
- * Returns: 0 on success, -1 on failure
- *
- * Once the scan results are ready, the driver should report scan
- * results event for wpa_supplicant which will eventually request the
- * results with wpa_driver_get_scan_results().
- */
- int (*scan)(void *priv, const u8 *ssid, size_t ssid_len);
-
- /**
- * get_scan_results - Fetch the latest scan results (old version)
- * @priv: private driver interface data
- * @results: pointer to buffer for scan results
- * @max_size: maximum number of entries (buffer size)
- *
- * Returns: Number of scan result entries used on success, -1 on
- * failure
- *
- * If scan results include more than max_size BSSes, max_size will be
- * returned and the remaining entries will not be included in the
- * buffer.
- *
- * This function is depracated. New driver wrapper implementations
- * should implement support for get_scan_results2().
- */
- int (*get_scan_results)(void *priv,
- struct wpa_scan_result *results,
- size_t max_size);
-
- /**
* deauthenticate - Request driver to deauthenticate
* @priv: private driver interface data
* @addr: peer address (BSSID of the AP)
struct wpa_driver_associate_params *params);
/**
- * set_auth_alg - Set IEEE 802.11 authentication algorithm
- * @priv: private driver interface data
- * @auth_alg: bit field of AUTH_ALG_*
- *
- * If the driver supports more than one authentication algorithm at the
- * same time, it should configure all supported algorithms. If not, one
- * algorithm needs to be selected arbitrarily. Open System
- * authentication should be ok for most cases and it is recommended to
- * be used if other options are not supported. Static WEP configuration
- * may also use Shared Key authentication and LEAP requires its own
- * algorithm number. For LEAP, user can make sure that only one
- * algorithm is used at a time by configuring LEAP as the only
- * supported EAP method. This information is also available in
- * associate() params, so set_auth_alg may not be needed in case of
- * most drivers.
- *
- * Returns: 0 on success, -1 on failure
- */
- int (*set_auth_alg)(void *priv, int auth_alg);
-
- /**
* add_pmkid - Add PMKSA cache entry to the driver
* @priv: private driver interface data
* @bssid: BSSID for the PMKSA cache entry
int (*flush_pmkid)(void *priv);
/**
- * flush_pmkid - Flush PMKSA cache
+ * get_capa - Get driver capabilities
* @priv: private driver interface data
*
* Returns: 0 on success, -1 on failure
* This function is only needed for drivers that export MLME
* (management frame processing) to wpa_supplicant.
*/
- struct wpa_hw_modes * (*get_hw_feature_data)(void *priv,
- u16 *num_modes,
- u16 *flags);
+ struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
+ u16 *num_modes,
+ u16 *flags);
/**
* set_channel - Set channel
* @priv: Private driver interface data
- * @phymode: WPA_MODE_IEEE80211B, ..
+ * @phymode: HOSTAPD_MODE_IEEE80211B, ..
* @chan: IEEE 802.11 channel number
* @freq: Frequency of the channel in MHz
* Returns: 0 on success, -1 on failure
* This function is only needed for drivers that export MLME
* (management frame processing) to wpa_supplicant.
*/
- int (*set_channel)(void *priv, wpa_hw_mode phymode, int chan,
+ int (*set_channel)(void *priv, enum hostapd_hw_mode phymode, int chan,
int freq);
/**
struct wpa_scan_results * (*get_scan_results2)(void *priv);
/**
- * * set_probe_req_ie - Set information element(s) for Probe Request
- * @priv: private driver interface data
- * @ies: Information elements to append or %NULL to remove extra IEs
- * @ies_len: Length of the IE buffer in octets
- * Returns: 0 on success, -1 on failure
- */
- int (*set_probe_req_ie)(void *priv, const u8 *ies, size_t ies_len);
-
- /**
- * set_mode - Request driver to set the operating mode
- * @priv: private driver interface data
- * @mode: Operation mode (infra/ibss) IEEE80211_MODE_*
- *
- * This handler will be called before any key configuration and call to
- * associate() handler in order to allow the operation mode to be
- * configured as early as possible. This information is also available
- * in associate() params and as such, some driver wrappers may not need
- * to implement set_mode() handler.
- * Returns: 0 on success, -1 on failure
- */
- int (*set_mode)(void *priv, int mode);
-
- /**
* set_country - Set country
* @priv: Private driver interface data
* @alpha2: country to which to switch to
* uses global data.
*/
void * (*init2)(void *ctx, const char *ifname, void *global_priv);
-};
-/* Function to check whether a driver is for wired connections */
-static inline int IS_WIRED(const struct wpa_driver_ops *drv)
-{
- return os_strcmp(drv->name, "wired") == 0 ||
- os_strcmp(drv->name, "roboswitch") == 0;
-}
+ /**
+ * get_interfaces - Get information about available interfaces
+ * @global_priv: private driver global data from global_init()
+ * Returns: Allocated buffer of interface information (caller is
+ * responsible for freeing the data structure) on success, NULL on
+ * failure
+ */
+ struct wpa_interface_info * (*get_interfaces)(void *global_priv);
-/**
- * enum wpa_event_type - Event type for wpa_supplicant_event() calls
- */
-typedef enum wpa_event_type {
/**
- * EVENT_ASSOC - Association completed
+ * scan2 - Request the driver to initiate scan
+ * @priv: private driver interface data
+ * @params: Scan parameters
*
- * This event needs to be delivered when the driver completes IEEE
- * 802.11 association or reassociation successfully.
- * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
- * after this event has been generated. In addition, optional
- * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
- * more information about the association. If the driver interface gets
- * both of these events at the same time, it can also include the
- * assoc_info data in EVENT_ASSOC call.
+ * Returns: 0 on success, -1 on failure
+ *
+ * Once the scan results are ready, the driver should report scan
+ * results event for wpa_supplicant which will eventually request the
+ * results with wpa_driver_get_scan_results2().
*/
- EVENT_ASSOC,
+ int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
/**
- * EVENT_DISASSOC - Association lost
+ * authenticate - Request driver to authenticate
+ * @priv: private driver interface data
+ * @params: authentication parameters
+ * Returns: 0 on success, -1 on failure
*
- * This event should be called when association is lost either due to
- * receiving deauthenticate or disassociate frame from the AP or when
- * sending either of these frames to the current AP.
+ * This is an optional function that can be used with drivers that
+ * support separate authentication and association steps, i.e., when
+ * wpa_supplicant can act as the SME. If not implemented, associate()
+ * function is expected to take care of IEEE 802.11 authentication,
+ * too.
*/
- EVENT_DISASSOC,
+ int (*authenticate)(void *priv,
+ struct wpa_driver_auth_params *params);
/**
- * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
+ * set_beacon - Set Beacon frame template
+ * @iface: Interface name (main interface or virtual BSS)
+ * @priv: Private driver interface data
+ * @head: Beacon head from IEEE 802.11 header to IEs before TIM IE
+ * @head_len: Length of the head buffer in octets
+ * @tail: Beacon tail following TIM IE
+ * @tail_len: Length of the tail buffer in octets
+ * @dtim_period: DTIM period
+ * @beacon_int: Beacon interval
+ * Returns: 0 on success, -1 on failure
*
- * This event must be delivered when a Michael MIC error is detected by
- * the local driver. Additional data for event processing is
- * provided with union wpa_event_data::michael_mic_failure. This
- * information is used to request new encyption key and to initiate
- * TKIP countermeasures if needed.
+ * This function is used to configure Beacon template for the driver in
+ * AP mode. The driver is responsible for building the full Beacon
+ * frame by concatenating the head part with TIM IE generated by the
+ * driver/firmware and finishing with the tail part.
*/
- EVENT_MICHAEL_MIC_FAILURE,
+ int (*set_beacon)(const char *ifname, void *priv,
+ const u8 *head, size_t head_len,
+ const u8 *tail, size_t tail_len, int dtim_period,
+ int beacon_int);
/**
- * EVENT_SCAN_RESULTS - Scan results available
+ * hapd_init - Initialize driver interface (hostapd only)
+ * @hapd: Pointer to hostapd context
+ * @params: Configuration for the driver wrapper
+ * Returns: Pointer to private data, %NULL on failure
*
- * This event must be called whenever scan results are available to be
- * fetched with struct wpa_driver_ops::get_scan_results(). This event
- * is expected to be used some time after struct wpa_driver_ops::scan()
- * is called. If the driver provides an unsolicited event when the scan
- * has been completed, this event can be used to trigger
- * EVENT_SCAN_RESULTS call. If such event is not available from the
- * driver, the driver wrapper code is expected to use a registered
- * timeout to generate EVENT_SCAN_RESULTS call after the time that the
- * scan is expected to be completed.
+ * This function is used instead of init() or init2() when the driver
+ * wrapper is used withh hostapd.
*/
- EVENT_SCAN_RESULTS,
+ void * (*hapd_init)(struct hostapd_data *hapd,
+ struct wpa_init_params *params);
/**
- * EVENT_ASSOCINFO - Report optional extra information for association
+ * hapd_deinit - Deinitialize driver interface (hostapd only)
+ * @priv: Private driver interface data from hapd_init()
+ */
+ void (*hapd_deinit)(void *priv);
+
+ /**
+ * set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
+ * @priv: Private driver interface data
+ * @params: BSS parameters
+ * Returns: 0 on success, -1 on failure
*
- * This event can be used to report extra association information for
- * EVENT_ASSOC processing. This extra information includes IEs from
- * association frames and Beacon/Probe Response frames in union
- * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
- * EVENT_ASSOC. Alternatively, the driver interface can include
- * assoc_info data in the EVENT_ASSOC call if it has all the
- * information available at the same point.
+ * This is an optional function to configure the kernel driver to
+ * enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
+ * can be left undefined (set to %NULL) if IEEE 802.1X support is
+ * always enabled and the driver uses set_beacon() to set WPA/RSN IE
+ * for Beacon frames.
*/
- EVENT_ASSOCINFO,
+ int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
/**
- * EVENT_INTERFACE_STATUS - Report interface status changes
+ * set_privacy - Enable/disable privacy (AP only)
+ * @priv: Private driver interface data
+ * @enabled: 1 = privacy enabled, 0 = disabled
+ * Returns: 0 on success, -1 on failure
*
- * This optional event can be used to report changes in interface
- * status (interface added/removed) using union
- * wpa_event_data::interface_status. This can be used to trigger
- * wpa_supplicant to stop and re-start processing for the interface,
- * e.g., when a cardbus card is ejected/inserted.
+ * This is an optional function to configure privacy field in the
+ * kernel driver for Beacon frames. This can be left undefined (set to
+ * %NULL) if the driver uses the Beacon template from set_beacon().
*/
- EVENT_INTERFACE_STATUS,
+ int (*set_privacy)(const char *ifname, void *priv, int enabled);
/**
- * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
+ * get_seqnum - Fetch the current TSC/packet number (AP only)
+ * @ifname: The interface name (main or virtual)
+ * @priv: Private driver interface data
+ * @addr: MAC address of the station or %NULL for group keys
+ * @idx: Key index
+ * @seq: Buffer for returning the latest used TSC/packet number
+ * Returns: 0 on success, -1 on failure
*
- * This event can be used to inform wpa_supplicant about candidates for
- * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
- * for scan request (ap_scan=2 mode), this event is required for
- * pre-authentication. If wpa_supplicant is performing scan request
- * (ap_scan=1), this event is optional since scan results can be used
- * to add pre-authentication candidates. union
- * wpa_event_data::pmkid_candidate is used to report the BSSID of the
- * candidate and priority of the candidate, e.g., based on the signal
- * strength, in order to try to pre-authenticate first with candidates
- * that are most likely targets for re-association.
+ * This function is used to fetch the last used TSC/packet number for
+ * a TKIP, CCMP, or BIP/IGTK key. It is mainly used with group keys, so
+ * there is no strict requirement on implementing support for unicast
+ * keys (i.e., addr != %NULL).
+ */
+ int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
+ int idx, u8 *seq);
+
+ /**
+ * flush - Flush all association stations (AP only)
+ * @priv: Private driver interface data
+ * Returns: 0 on success, -1 on failure
+ *
+ * This function requests the driver to disassociate all associated
+ * stations. This function does not need to be implemented if the
+ * driver does not process association frames internally.
+ */
+ int (*flush)(void *priv);
+
+ /**
+ * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP)
+ * @ifname: The interface name (main or virtual BSS)
+ * @priv: Private driver interface data
+ * @elem: Information elements
+ * @elem_len: Length of the elem buffer in octets
+ * Returns: 0 on success, -1 on failure
+ *
+ * This is an optional function to add information elements in the
+ * kernel driver for Beacon and Probe Response frames. This can be left
+ * undefined (set to %NULL) if the driver uses the Beacon template from
+ * set_beacon().
+ */
+ int (*set_generic_elem)(const char *ifname, void *priv, const u8 *elem,
+ size_t elem_len);
+
+ /**
+ * read_sta_data - Fetch station data (AP only)
+ * @priv: Private driver interface data
+ * @data: Buffer for returning station information
+ * @addr: MAC address of the station
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
+ const u8 *addr);
+
+ /**
+ * hapd_send_eapol - Send an EAPOL packet (AP only)
+ * @priv: private driver interface data
+ * @addr: Destination MAC address
+ * @data: EAPOL packet starting with IEEE 802.1X header
+ * @data_len: Length of the EAPOL packet in octets
+ * @encrypt: Whether the frame should be encrypted
+ * @own_addr: Source MAC address
+ *
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
+ size_t data_len, int encrypt,
+ const u8 *own_addr);
+
+ /**
+ * sta_deauth - Deauthenticate a station (AP only)
+ * @priv: Private driver interface data
+ * @own_addr: Source address and BSSID for the Deauthentication frame
+ * @addr: MAC address of the station to deauthenticate
+ * @reason: Reason code for the Deauthentiation frame
+ * Returns: 0 on success, -1 on failure
+ *
+ * This function requests a specific station to be deauthenticated and
+ * a Deauthentication frame to be sent to it.
+ */
+ int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
+ int reason);
+
+ /**
+ * sta_disassoc - Disassociate a station (AP only)
+ * @priv: Private driver interface data
+ * @own_addr: Source address and BSSID for the Disassociation frame
+ * @addr: MAC address of the station to disassociate
+ * @reason: Reason code for the Disassociation frame
+ * Returns: 0 on success, -1 on failure
+ *
+ * This function requests a specific station to be disassociated and
+ * a Disassociation frame to be sent to it.
+ */
+ int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
+ int reason);
+
+ /**
+ * sta_remove - Remove a station entry (AP only)
+ * @priv: Private driver interface data
+ * @addr: MAC address of the station to be removed
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*sta_remove)(void *priv, const u8 *addr);
+
+ /**
+ * hapd_get_ssid - Get the current SSID (AP only)
+ * @ifname: Interface (master or virtual BSS)
+ * @priv: Private driver interface data
+ * @buf: Buffer for returning the SSID
+ * @len: Maximum length of the buffer
+ * Returns: Length of the SSID on success, -1 on failure
+ *
+ * This function need not be implemented if the driver uses Beacon
+ * template from set_beacon() and does not reply to Probe Request
+ * frames.
+ */
+ int (*hapd_get_ssid)(const char *ifname, void *priv, u8 *buf, int len);
+
+ /**
+ * hapd_set_ssid - Set SSID (AP only)
+ * @ifname: Interface (master or virtual BSS)
+ * @priv: Private driver interface data
+ * @buf: SSID
+ * @len: Length of the SSID in octets
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*hapd_set_ssid)(const char *ifname, void *priv, const u8 *buf,
+ int len);
+ /**
+ * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP)
+ * @priv: Private driver interface data
+ * @enabled: 1 = countermeasures enabled, 0 = disabled
+ * Returns: 0 on success, -1 on failure
+ *
+ * This need not be implemented if the driver does not take care of
+ * association processing.
+ */
+ int (*hapd_set_countermeasures)(void *priv, int enabled);
+
+ /**
+ * sta_add - Add a station entry
+ * @ifname: Interface (master or virtual)
+ * @priv: Private driver interface data
+ * @params: Station parameters
+ * Returns: 0 on success, -1 on failure
+ *
+ * This function is used to add a station entry to the driver once the
+ * station has completed association. This is only used if the driver
+ * does not take care of association processing.
+ */
+ int (*sta_add)(const char *ifname, void *priv,
+ struct hostapd_sta_add_params *params);
+
+ /**
+ * get_inact_sec - Get station inactivity duration (AP only)
+ * @priv: Private driver interface data
+ * @addr: Station address
+ * Returns: Number of seconds station has been inactive, -1 on failure
+ */
+ int (*get_inact_sec)(void *priv, const u8 *addr);
+
+ /**
+ * sta_clear_stats - Clear station statistics (AP only)
+ * @priv: Private driver interface data
+ * @addr: Station address
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*sta_clear_stats)(void *priv, const u8 *addr);
+
+ /**
+ * set_freq - Set channel/frequency (AP only)
+ * @priv: Private driver interface data
+ * @freq: Channel parameters
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
+
+ /**
+ * set_rts - Set RTS threshold
+ * @priv: Private driver interface data
+ * @rts: RTS threshold in octets
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*set_rts)(void *priv, int rts);
+
+ /**
+ * set_frag - Set fragmentation threshold
+ * @priv: Private driver interface data
+ * @frag: Fragmentation threshold in octets
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*set_frag)(void *priv, int frag);
+
+ /**
+ * sta_set_flags - Set station flags (AP only)
+ * @priv: Private driver interface data
+ * @addr: Station address
+ * @total_flags: Bitmap of all WPA_STA_* flags currently set
+ * @flags_or: Bitmap of WPA_STA_* flags to add
+ * @flags_and: Bitmap of WPA_STA_* flags to us as a mask
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*sta_set_flags)(void *priv, const u8 *addr,
+ int total_flags, int flags_or, int flags_and);
+
+ /**
+ * set_rate_sets - Set supported and basic rate sets (AP only)
+ * @priv: Private driver interface data
+ * @supp_rates: -1 terminated array of supported rates in 100 kbps
+ * @basic_rates: -1 terminated array of basic rates in 100 kbps
+ * @mode: hardware mode (HOSTAPD_MODE_*)
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*set_rate_sets)(void *priv, int *supp_rates, int *basic_rates,
+ int mode);
+
+ /**
+ * set_cts_protect - Set CTS protection mode (AP only)
+ * @priv: Private driver interface data
+ * @value: Whether CTS protection is enabled
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*set_cts_protect)(void *priv, int value);
+
+ /**
+ * set_preamble - Set preamble mode (AP only)
+ * @priv: Private driver interface data
+ * @value: Whether short preamble is enabled
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*set_preamble)(void *priv, int value);
+
+ /**
+ * set_short_slot_time - Set short slot time (AP only)
+ * @priv: Private driver interface data
+ * @value: Whether short slot time is enabled
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*set_short_slot_time)(void *priv, int value);
+
+ /**
+ * set_tx_queue_params - Set TX queue parameters
+ * @priv: Private driver interface data
+ * @queue: Queue number
+ * @aifs: AIFS
+ * @cw_min: cwMin
+ * @cw_max: cwMax
+ * @burst_time: Maximum length for bursting in 0.1 msec units
+ */
+ int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
+ int cw_max, int burst_time);
+
+ /**
+ * valid_bss_mask - Validate BSSID mask
+ * @priv: Private driver interface data
+ * @addr: Address
+ * @mask: Mask
+ * Returns: 0 if mask is valid, -1 if mask is not valid, 1 if mask can
+ * be used, but the main interface address must be the first address in
+ * the block if mask is applied
+ */
+ int (*valid_bss_mask)(void *priv, const u8 *addr, const u8 *mask);
+
+ /**
+ * if_add - Add a virtual interface
+ * @iface: Parent interface name
+ * @priv: Private driver interface data
+ * @type: Interface type
+ * @ifname: Interface name for the new virtual interface
+ * @addr: Local address to use for the interface or %NULL to use the
+ * parent interface address
+ * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*if_add)(const char *iface, void *priv,
+ enum wpa_driver_if_type type, const char *ifname,
+ const u8 *addr, void *bss_ctx);
+
+ /**
+ * if_remove - Remove a virtual interface
+ * @priv: Private driver interface data
+ * @type: Interface type
+ * @ifname: Interface name of the virtual interface to be removed
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*if_remove)(void *priv, enum wpa_driver_if_type type,
+ const char *ifname);
+
+ /**
+ * set_sta_vlan - Bind a station into a specific interface (AP only)
+ * @priv: Private driver interface data
+ * @ifname: Interface (main or virtual BSS or VLAN)
+ * @addr: MAC address of the associated station
+ * @vlan_id: VLAN ID
+ * Returns: 0 on success, -1 on failure
+ *
+ * This function is used to bind a station to a specific virtual
+ * interface. It is only used if when virtual interfaces are supported,
+ * e.g., to assign stations to different VLAN interfaces based on
+ * information from a RADIUS server. This allows separate broadcast
+ * domains to be used with a single BSS.
+ */
+ int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
+ int vlan_id);
+
+ /**
+ * commit - Optional commit changes handler (AP only)
+ * @priv: driver private data
+ * Returns: 0 on success, -1 on failure
+ *
+ * This optional handler function can be registered if the driver
+ * interface implementation needs to commit changes (e.g., by setting
+ * network interface up) at the end of initial configuration. If set,
+ * this handler will be called after initial setup has been completed.
+ */
+ int (*commit)(void *priv);
+
+ /**
+ * send_ether - Send an ethernet packet (AP only)
+ * @priv: private driver interface data
+ * @dst: Destination MAC address
+ * @src: Source MAC address
+ * @proto: Ethertype
+ * @data: EAPOL packet starting with IEEE 802.1X header
+ * @data_len: Length of the EAPOL packet in octets
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
+ const u8 *data, size_t data_len);
+
+ /**
+ * set_radius_acl_auth - Notification of RADIUS ACL change
+ * @priv: Private driver interface data
+ * @mac: MAC address of the station
+ * @accepted: Whether the station was accepted
+ * @session_timeout: Session timeout for the station
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
+ u32 session_timeout);
+
+ /**
+ * set_radius_acl_expire - Notification of RADIUS ACL expiration
+ * @priv: Private driver interface data
+ * @mac: MAC address of the station
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*set_radius_acl_expire)(void *priv, const u8 *mac);
+
+ /**
+ * set_ht_params - Set HT parameters (AP only)
+ * @ifname: The interface name (main or virtual BSS)
+ * @priv: Private driver interface data
+ * @ht_capab: HT Capabilities IE
+ * @ht_capab_len: Length of ht_capab in octets
+ * @ht_oper: HT Operation IE
+ * @ht_oper_len: Length of ht_oper in octets
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*set_ht_params)(const char *ifname, void *priv,
+ const u8 *ht_capab, size_t ht_capab_len,
+ const u8 *ht_oper, size_t ht_oper_len);
+
+ /**
+ * set_ap_wps_ie - Add WPS IE into Beacon/Probe Response frames (AP)
+ * @ifname: The interface name (main or virtual BSS)
+ * @priv: Private driver interface data
+ * @beacon: WPS IE for Beacon frames
+ * @proberesp: WPS IE for Probe Response frames
+ * Returns: 0 on success, -1 on failure
+ *
+ * This is an optional function to add WPS IE in the kernel driver for
+ * Beacon and Probe Response frames. This can be left undefined (set
+ * to %NULL) if the driver uses the Beacon template from set_beacon()
+ * and does not process Probe Request frames.
+ */
+ int (*set_ap_wps_ie)(const char *ifname, void *priv,
+ const struct wpabuf *beacon,
+ const struct wpabuf *proberesp);
+
+ /**
+ * set_supp_port - Set IEEE 802.1X Supplicant Port status
+ * @priv: Private driver interface data
+ * @authorized: Whether the port is authorized
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*set_supp_port)(void *priv, int authorized);
+
+ /**
+ * set_wds_sta - Bind a station into a 4-address WDS (AP only)
+ * @priv: Private driver interface data
+ * @addr: MAC address of the associated station
+ * @aid: Association ID
+ * @val: 1 = bind to 4-address WDS; 0 = unbind
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val);
+};
+
+/**
+ * enum wpa_event_type - Event type for wpa_supplicant_event() calls
+ */
+typedef enum wpa_event_type {
+ /**
+ * EVENT_ASSOC - Association completed
+ *
+ * This event needs to be delivered when the driver completes IEEE
+ * 802.11 association or reassociation successfully.
+ * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
+ * after this event has been generated. In addition, optional
+ * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
+ * more information about the association. If the driver interface gets
+ * both of these events at the same time, it can also include the
+ * assoc_info data in EVENT_ASSOC call.
+ */
+ EVENT_ASSOC,
+
+ /**
+ * EVENT_DISASSOC - Association lost
+ *
+ * This event should be called when association is lost either due to
+ * receiving deauthenticate or disassociate frame from the AP or when
+ * sending either of these frames to the current AP. If the driver
+ * supports separate deauthentication event, EVENT_DISASSOC should only
+ * be used for disassociation and EVENT_DEAUTH for deauthentication.
+ */
+ EVENT_DISASSOC,
+
+ /**
+ * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
+ *
+ * This event must be delivered when a Michael MIC error is detected by
+ * the local driver. Additional data for event processing is
+ * provided with union wpa_event_data::michael_mic_failure. This
+ * information is used to request new encyption key and to initiate
+ * TKIP countermeasures if needed.
+ */
+ EVENT_MICHAEL_MIC_FAILURE,
+
+ /**
+ * EVENT_SCAN_RESULTS - Scan results available
+ *
+ * This event must be called whenever scan results are available to be
+ * fetched with struct wpa_driver_ops::get_scan_results(). This event
+ * is expected to be used some time after struct wpa_driver_ops::scan()
+ * is called. If the driver provides an unsolicited event when the scan
+ * has been completed, this event can be used to trigger
+ * EVENT_SCAN_RESULTS call. If such event is not available from the
+ * driver, the driver wrapper code is expected to use a registered
+ * timeout to generate EVENT_SCAN_RESULTS call after the time that the
+ * scan is expected to be completed. Optional information about
+ * completed scan can be provided with union wpa_event_data::scan_info.
+ */
+ EVENT_SCAN_RESULTS,
+
+ /**
+ * EVENT_ASSOCINFO - Report optional extra information for association
+ *
+ * This event can be used to report extra association information for
+ * EVENT_ASSOC processing. This extra information includes IEs from
+ * association frames and Beacon/Probe Response frames in union
+ * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
+ * EVENT_ASSOC. Alternatively, the driver interface can include
+ * assoc_info data in the EVENT_ASSOC call if it has all the
+ * information available at the same point.
+ */
+ EVENT_ASSOCINFO,
+
+ /**
+ * EVENT_INTERFACE_STATUS - Report interface status changes
+ *
+ * This optional event can be used to report changes in interface
+ * status (interface added/removed) using union
+ * wpa_event_data::interface_status. This can be used to trigger
+ * wpa_supplicant to stop and re-start processing for the interface,
+ * e.g., when a cardbus card is ejected/inserted.
+ */
+ EVENT_INTERFACE_STATUS,
+
+ /**
+ * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
+ *
+ * This event can be used to inform wpa_supplicant about candidates for
+ * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
+ * for scan request (ap_scan=2 mode), this event is required for
+ * pre-authentication. If wpa_supplicant is performing scan request
+ * (ap_scan=1), this event is optional since scan results can be used
+ * to add pre-authentication candidates. union
+ * wpa_event_data::pmkid_candidate is used to report the BSSID of the
+ * candidate and priority of the candidate, e.g., based on the signal
+ * strength, in order to try to pre-authenticate first with candidates
+ * that are most likely targets for re-association.
*
* EVENT_PMKID_CANDIDATE can be called whenever the driver has updates
* on the candidate list. In addition, it can be called for the current
* FT authentication sequence from the AP. The FT IEs are included in
* the extra information in union wpa_event_data::ft_ies.
*/
- EVENT_FT_RESPONSE
+ EVENT_FT_RESPONSE,
+
+ /**
+ * EVENT_IBSS_RSN_START - Request RSN authentication in IBSS
+ *
+ * The driver can use this event to inform wpa_supplicant about a STA
+ * in an IBSS with which protected frames could be exchanged. This
+ * event starts RSN authentication with the other STA to authenticate
+ * the STA and set up encryption keys with it.
+ */
+ EVENT_IBSS_RSN_START,
+
+ /**
+ * EVENT_AUTH - Authentication result
+ *
+ * This event should be called when authentication attempt has been
+ * completed. This is only used if the driver supports separate
+ * authentication step (struct wpa_driver_ops::authenticate).
+ * Information about authentication result is included in
+ * union wpa_event_data::auth.
+ */
+ EVENT_AUTH,
+
+ /**
+ * EVENT_DEAUTH - Authentication lost
+ *
+ * This event should be called when authentication is lost either due
+ * to receiving deauthenticate frame from the AP or when sending that
+ * frame to the current AP.
+ */
+ EVENT_DEAUTH,
+
+ /**
+ * EVENT_ASSOC_REJECT - Association rejected
+ *
+ * This event should be called when (re)association attempt has been
+ * rejected by the AP. Information about authentication result is
+ * included in union wpa_event_data::assoc_reject.
+ */
+ EVENT_ASSOC_REJECT,
+
+ /**
+ * EVENT_AUTH_TIMED_OUT - Authentication timed out
+ */
+ EVENT_AUTH_TIMED_OUT,
+
+ /**
+ * EVENT_ASSOC_TIMED_OUT - Association timed out
+ */
+ EVENT_ASSOC_TIMED_OUT,
+
+ /**
+ * EVENT_FT_RRB_RX - FT (IEEE 802.11r) RRB frame received
+ */
+ EVENT_FT_RRB_RX,
+
+ /**
+ * EVENT_WPS_BUTTON_PUSHED - Report hardware push button press for WPS
+ */
+ EVENT_WPS_BUTTON_PUSHED,
+
+ /**
+ * EVENT_TX_STATUS - Report TX status
+ */
+ EVENT_TX_STATUS,
+
+ /**
+ * EVENT_RX_FROM_UNKNOWN - Report RX from unknown STA
+ */
+ EVENT_RX_FROM_UNKNOWN,
+
+ /**
+ * EVENT_RX_MGMT - Report RX of a management frame
+ */
+ EVENT_RX_MGMT,
+
+ /**
+ * EVENT_MLME_RX - Report reception of frame for MLME (test use only)
+ *
+ * This event is used only by driver_test.c and userspace MLME.
+ */
+ EVENT_MLME_RX,
+
+ /**
+ * EVENT_RX_PROBE_REQ - Indicate received Probe Request frame
+ *
+ * This event is used to indicate when a Probe Request frame has been
+ * received. Information about the received frame is included in
+ * union wpa_event_data::rx_probe_req.
+ */
+ EVENT_RX_PROBE_REQ,
} wpa_event_type;
/**
* beacon_ies_len - Length of beacon_ies */
size_t beacon_ies_len;
+
+ /**
+ * freq - Frequency of the operational channel in MHz
+ */
+ unsigned int freq;
} assoc_info;
/**
*/
struct michael_mic_failure {
int unicast;
+ const u8 *src;
} michael_mic_failure;
/**
size_t ies_len;
int ft_action;
u8 target_ap[ETH_ALEN];
+ /** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
+ const u8 *ric_ies;
+ /** Length of ric_ies buffer in octets */
+ size_t ric_ies_len;
} ft_ies;
+
+ /**
+ * struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START
+ */
+ struct ibss_rsn_start {
+ u8 peer[ETH_ALEN];
+ } ibss_rsn_start;
+
+ /**
+ * struct auth_info - Data for EVENT_AUTH events
+ */
+ struct auth_info {
+ u8 peer[ETH_ALEN];
+ u16 auth_type;
+ u16 status_code;
+ const u8 *ies;
+ size_t ies_len;
+ } auth;
+
+ /**
+ * struct assoc_reject - Data for EVENT_ASSOC_REJECT events
+ */
+ struct assoc_reject {
+ /**
+ * resp_ies - (Re)Association Response IEs
+ *
+ * Optional association data from the driver. This data is not
+ * required WPA, but may be useful for some protocols and as
+ * such, should be reported if this is available to the driver
+ * interface.
+ *
+ * This should start with the first IE (fixed fields before IEs
+ * are not included).
+ */
+ u8 *resp_ies;
+
+ /**
+ * resp_ies_len - Length of resp_ies in bytes
+ */
+ size_t resp_ies_len;
+
+ /**
+ * status_code - Status Code from (Re)association Response
+ */
+ u16 status_code;
+ } assoc_reject;
+
+ struct timeout_event {
+ u8 addr[ETH_ALEN];
+ } timeout_event;
+
+ /**
+ * struct ft_rrb_rx - Data for EVENT_FT_RRB_RX events
+ */
+ struct ft_rrb_rx {
+ const u8 *src;
+ const u8 *data;
+ size_t data_len;
+ } ft_rrb_rx;
+
+ /**
+ * struct tx_status - Data for EVENT_TX_STATUS events
+ */
+ struct tx_status {
+ u16 type;
+ u16 stype;
+ const u8 *dst;
+ const u8 *data;
+ size_t data_len;
+ int ack;
+ } tx_status;
+
+ /**
+ * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
+ */
+ struct rx_from_unknown {
+ const struct ieee80211_hdr *hdr;
+ size_t len;
+ } rx_from_unknown;
+
+ /**
+ * struct rx_mgmt - Data for EVENT_RX_MGMT events
+ */
+ struct rx_mgmt {
+ const u8 *frame;
+ size_t frame_len;
+ struct hostapd_frame_info *fi;
+ } rx_mgmt;
+
+ /**
+ * struct scan_info - Optional data for EVENT_SCAN_RESULTS events
+ * @aborted: Whether the scan was aborted
+ * @freqs: Scanned frequencies in MHz (%NULL = all channels scanned)
+ * @num_freqs: Number of entries in freqs array
+ * @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard
+ * SSID)
+ * @num_ssids: Number of entries in ssids array
+ */
+ struct scan_info {
+ int aborted;
+ const int *freqs;
+ size_t num_freqs;
+ struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
+ size_t num_ssids;
+ } scan_info;
+
+ /**
+ * struct mlme_rx - Data for EVENT_MLME_RX events
+ */
+ struct mlme_rx {
+ const u8 *buf;
+ size_t len;
+ int freq;
+ int channel;
+ int ssi;
+ } mlme_rx;
+
+ /**
+ * struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events
+ */
+ struct rx_probe_req {
+ /**
+ * sa - Source address of the received Probe Request frame
+ */
+ const u8 *sa;
+
+ /**
+ * ie - IEs from the Probe Request body
+ */
+ const u8 *ie;
+
+ /**
+ * ie_len - Length of ie buffer in octets
+ */
+ size_t ie_len;
+ } rx_probe_req;
};
/**
void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
const u8 *buf, size_t len);
-void wpa_supplicant_sta_rx(void *ctx, const u8 *buf, size_t len,
- struct ieee80211_rx_status *rx_status);
-void wpa_supplicant_sta_free_hw_features(struct wpa_hw_modes *hw_features,
- size_t num_hw_features);
-
const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie);
-#define WPA_IE_VENDOR_TYPE 0x0050f201
-#define WPS_IE_VENDOR_TYPE 0x0050f204
const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res,
u32 vendor_type);
struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res,
void wpa_scan_results_free(struct wpa_scan_results *res);
void wpa_scan_sort_results(struct wpa_scan_results *res);
+/* hostapd functions for driver wrappers */
+
+struct ieee80211_hdr;
+
+int hostapd_notif_new_sta(struct hostapd_data *hapd, const u8 *addr);
+int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
+ const u8 *ie, size_t ielen);
+void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
+void hostapd_eapol_receive(struct hostapd_data *hapd, const u8 *sa,
+ const u8 *buf, size_t len);
+
+struct hostapd_frame_info {
+ u32 channel;
+ u32 datarate;
+ u32 ssi_signal;
+};
+
+struct hostapd_data * hostapd_sta_get_bss(struct hostapd_data *hapd,
+ const u8 *addr);
+
#endif /* DRIVER_H */