/*
* WPA Supplicant - driver interface definition
- * Copyright (c) 2003-2009, 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
};
struct hostapd_hw_modes {
- hostapd_hw_mode mode;
+ enum hostapd_hw_mode mode;
int num_channels;
struct hostapd_channel_data *channels;
int num_rates;
* @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_bame: struct wpa_driver_ops::name (note: unlike other strings, this one
+ * @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)
*/
/* 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
};
-struct ieee80211_rx_status {
- int channel;
- int ssi;
-};
-
-
struct hostapd_data;
struct hostap_sta_driver_data {
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
* in driver_*.c set_key() implementation, see driver_ndis.c for an
* example on how this can be done.
*/
- int (*set_key)(const char *ifname, void *priv, wpa_alg alg,
+ 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);
* This function is only needed for drivers that export MLME
* (management frame processing) to wpa_supplicant.
*/
- int (*set_channel)(void *priv, hostapd_hw_mode phymode, int chan,
+ int (*set_channel)(void *priv, enum hostapd_hw_mode phymode, int chan,
int freq);
/**
* sta_set_flags - Set station flags (AP only)
* @priv: Private driver interface data
* @addr: Station address
- * @total_flags: Bitmap of all WLAN_STA_* flags currently set
- * @flags_or: Bitmap of WLAN_STA_* flags to add
- * @flags_and: Bitmap of WLAN_STA_* flags to us as a mask
+ * @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,
* @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);
+ const u8 *addr, void *bss_ctx);
/**
* if_remove - Remove a virtual interface
const u8 *ht_oper, size_t ht_oper_len);
/**
- * set_wps_beacon_ie - Add WPS IE into Beacon frames (AP only)
+ * 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
- * @ie: WPS IE
- * @len: Length of the ie buffer in octets
+ * @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 frames. This can be left undefined (set to %NULL) if the
- * driver uses the Beacon template from set_beacon().
+ * 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_wps_beacon_ie)(const char *ifname, void *priv,
- const u8 *ie, size_t len);
+ int (*set_ap_wps_ie)(const char *ifname, void *priv,
+ const struct wpabuf *beacon,
+ const struct wpabuf *proberesp);
/**
- * set_wps_probe_resp_ie - Add WPS IE into Probe Response frames (AP)
- * @ifname: The interface name (main or virtual BSS)
+ * set_supp_port - Set IEEE 802.1X Supplicant Port status
* @priv: Private driver interface data
- * @ie: WPS IE
- * @len: Length of the ie buffer in octets
+ * @authorized: Whether the port is authorized
* Returns: 0 on success, -1 on failure
- *
- * This is an optional function to add WPS IE in the kernel driver for
- * Beacon frames. This can be left undefined (set to %NULL) if the
- * driver does process Probe Request frames.
*/
- int (*set_wps_probe_resp_ie)(const char *ifname, void *priv,
- const u8 *ie, size_t len);
+ int (*set_supp_port)(void *priv, int authorized);
/**
- * set_supp_port - Set IEEE 802.1X Supplicant Port status
+ * set_wds_sta - Bind a station into a 4-address WDS (AP only)
* @priv: Private driver interface data
- * @authorized: Whether the port is authorized
+ * @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_supp_port)(void *priv, int authorized);
+ int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val);
};
/**
* 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.
+ * 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_FT_RRB_RX - FT (IEEE 802.11r) RRB frame received
*/
- EVENT_FT_RRB_RX
+ 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;
/**
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);
-
const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie);
const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res,
u32 vendor_type);
/* hostapd functions for driver wrappers */
-struct sta_info;
struct ieee80211_hdr;
-void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
- int reassoc);
-void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
- const u8 *buf, size_t len, int ack);
-void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd,
- const struct ieee80211_hdr *hdr, size_t len);
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);
u32 ssi_signal;
};
-void hostapd_mgmt_rx(struct hostapd_data *hapd, u8 *buf, size_t len,
- u16 stype, struct hostapd_frame_info *fi);
-void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, u8 *buf, size_t len,
- u16 stype, int ok);
-void hostapd_michael_mic_failure(struct hostapd_data *hapd, const u8 *addr);
struct hostapd_data * hostapd_sta_get_bss(struct hostapd_data *hapd,
const u8 *addr);
-void hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa,
- const u8 *ie, size_t ie_len);
-void hostapd_button_pushed(struct hostapd_data *hapd);
#endif /* DRIVER_H */