2006-03-07 05:26:33 +00:00
|
|
|
/*
|
|
|
|
* WPA Supplicant - driver interface definition
|
2007-07-11 15:48:36 +00:00
|
|
|
* Copyright (c) 2003-2006, Jouni Malinen <j@w1.fi>
|
2006-03-07 05:26:33 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of BSD
|
|
|
|
* license.
|
|
|
|
*
|
|
|
|
* See README and COPYING for more details.
|
|
|
|
*/
|
|
|
|
|
2005-06-05 20:52:14 +00:00
|
|
|
#ifndef DRIVER_H
|
|
|
|
#define DRIVER_H
|
|
|
|
|
|
|
|
#define WPA_SUPPLICANT_DRIVER_VERSION 2
|
|
|
|
|
2006-03-07 05:26:33 +00:00
|
|
|
#include "defs.h"
|
2005-06-05 20:52:14 +00:00
|
|
|
|
|
|
|
#define AUTH_ALG_OPEN_SYSTEM 0x01
|
|
|
|
#define AUTH_ALG_SHARED_KEY 0x02
|
|
|
|
#define AUTH_ALG_LEAP 0x04
|
|
|
|
|
|
|
|
#define IEEE80211_MODE_INFRA 0
|
|
|
|
#define IEEE80211_MODE_IBSS 1
|
|
|
|
|
2006-03-07 05:26:33 +00:00
|
|
|
#define IEEE80211_CAP_ESS 0x0001
|
|
|
|
#define IEEE80211_CAP_IBSS 0x0002
|
|
|
|
#define IEEE80211_CAP_PRIVACY 0x0010
|
|
|
|
|
2005-06-05 20:52:14 +00:00
|
|
|
#define SSID_MAX_WPA_IE_LEN 40
|
2006-03-07 05:26:33 +00:00
|
|
|
/**
|
|
|
|
* struct wpa_scan_result - Scan results
|
|
|
|
* @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
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2005-06-05 20:52:14 +00:00
|
|
|
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;
|
2006-03-07 05:26:33 +00:00
|
|
|
int freq;
|
|
|
|
u16 caps;
|
|
|
|
int qual;
|
2005-06-05 20:52:14 +00:00
|
|
|
int noise;
|
|
|
|
int level;
|
|
|
|
int maxrate;
|
|
|
|
};
|
|
|
|
|
2006-03-07 05:26:33 +00:00
|
|
|
/**
|
|
|
|
* struct wpa_driver_associate_params - Association parameters
|
|
|
|
* Data for struct wpa_driver_ops::associate().
|
|
|
|
*/
|
2005-06-05 20:52:14 +00:00
|
|
|
struct wpa_driver_associate_params {
|
2006-03-07 05:26:33 +00:00
|
|
|
/**
|
|
|
|
* bssid - BSSID of the selected AP
|
|
|
|
* This can be %NULL, if ap_scan=2 mode is used and the driver is
|
|
|
|
* responsible for selecting with which BSS to associate. */
|
2005-06-05 20:52:14 +00:00
|
|
|
const u8 *bssid;
|
|
|
|
|
2006-03-07 05:26:33 +00:00
|
|
|
/**
|
|
|
|
* ssid - The selected SSID
|
|
|
|
*/
|
2005-06-05 20:52:14 +00:00
|
|
|
const u8 *ssid;
|
|
|
|
size_t ssid_len;
|
|
|
|
|
2006-03-07 05:26:33 +00:00
|
|
|
/**
|
|
|
|
* freq - Frequency of the channel the selected AP is using
|
|
|
|
* Frequency that the selected AP is using (in MHz as
|
|
|
|
* reported in the scan results)
|
|
|
|
*/
|
2005-06-05 20:52:14 +00:00
|
|
|
int freq;
|
|
|
|
|
2006-03-07 05:26:33 +00:00
|
|
|
/**
|
|
|
|
* wpa_ie - WPA information element for (Re)Association Request
|
|
|
|
* WPA information element to be included in (Re)Association
|
2005-06-05 20:52:14 +00:00
|
|
|
* Request (including information element id and length). Use
|
|
|
|
* of this WPA IE is optional. If the driver generates the WPA
|
2006-03-07 05:26:33 +00:00
|
|
|
* IE, it can use pairwise_suite, group_suite, and
|
|
|
|
* key_mgmt_suite to select proper algorithms. In this case,
|
2005-06-05 20:52:14 +00:00
|
|
|
* the driver has to notify wpa_supplicant about the used WPA
|
|
|
|
* IE by generating an event that the interface code will
|
|
|
|
* convert into EVENT_ASSOCINFO data (see wpa_supplicant.h).
|
2006-03-07 05:26:33 +00:00
|
|
|
* When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE
|
2005-06-05 20:52:14 +00:00
|
|
|
* instead. The driver can determine which version is used by
|
|
|
|
* looking at the first byte of the IE (0xdd for WPA, 0x30 for
|
2006-03-07 05:26:33 +00:00
|
|
|
* WPA2/RSN).
|
|
|
|
*/
|
2005-06-05 20:52:14 +00:00
|
|
|
const u8 *wpa_ie;
|
2006-03-07 05:26:33 +00:00
|
|
|
/**
|
|
|
|
* wpa_ie_len - length of the wpa_ie
|
|
|
|
*/
|
2005-06-05 20:52:14 +00:00
|
|
|
size_t wpa_ie_len;
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
2006-03-07 05:26:33 +00:00
|
|
|
/**
|
|
|
|
* auth_alg - Allowed authentication algorithms
|
|
|
|
* Bit field of AUTH_ALG_*
|
|
|
|
*/
|
|
|
|
int auth_alg;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mode - Operation mode (infra/ibss) IEEE80211_MODE_*
|
|
|
|
*/
|
|
|
|
int mode;
|
2007-07-11 15:48:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* wep_key - WEP keys for static WEP configuration
|
|
|
|
*/
|
|
|
|
const u8 *wep_key[4];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wep_key_len - WEP key length for static WEP configuration
|
|
|
|
*/
|
|
|
|
size_t wep_key_len[4];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* wep_tx_keyidx - WEP TX key index for static WEP configuration
|
|
|
|
*/
|
|
|
|
int wep_tx_keyidx;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mgmt_frame_protection - IEEE 802.11w management frame protection
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
NO_MGMT_FRAME_PROTECTION,
|
|
|
|
MGMT_FRAME_PROTECTION_OPTIONAL,
|
|
|
|
MGMT_FRAME_PROTECTION_REQUIRED
|
|
|
|
} mgmt_frame_protection;
|
2005-06-05 20:52:14 +00:00
|
|
|
};
|
|
|
|
|
2006-03-07 05:26:33 +00:00
|
|
|
/**
|
|
|
|
* struct wpa_driver_capa - Driver capability information
|
|
|
|
*/
|
2005-06-05 20:52:14 +00:00
|
|
|
struct wpa_driver_capa {
|
|
|
|
#define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001
|
|
|
|
#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002
|
|
|
|
#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004
|
|
|
|
#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008
|
|
|
|
#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010
|
|
|
|
unsigned int key_mgmt;
|
|
|
|
|
|
|
|
#define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001
|
|
|
|
#define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002
|
|
|
|
#define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004
|
|
|
|
#define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008
|
|
|
|
unsigned int enc;
|
|
|
|
|
|
|
|
#define WPA_DRIVER_AUTH_OPEN 0x00000001
|
|
|
|
#define WPA_DRIVER_AUTH_SHARED 0x00000002
|
|
|
|
#define WPA_DRIVER_AUTH_LEAP 0x00000004
|
|
|
|
unsigned int auth;
|
|
|
|
|
|
|
|
/* Driver generated WPA/RSN IE */
|
|
|
|
#define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001
|
|
|
|
#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
|
2007-07-11 15:48:36 +00:00
|
|
|
#define WPA_DRIVER_FLAGS_USER_SPACE_MLME 0x00000004
|
2005-06-05 20:52:14 +00:00
|
|
|
unsigned int flags;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-07-11 15:48:36 +00:00
|
|
|
#define WPA_CHAN_W_SCAN 0x00000001
|
|
|
|
#define WPA_CHAN_W_ACTIVE_SCAN 0x00000002
|
|
|
|
#define WPA_CHAN_W_IBSS 0x00000004
|
|
|
|
|
|
|
|
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_*) */
|
|
|
|
};
|
|
|
|
|
|
|
|
#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 */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
WPA_MODE_IEEE80211B,
|
|
|
|
WPA_MODE_IEEE80211G,
|
|
|
|
WPA_MODE_IEEE80211A,
|
|
|
|
NUM_WPA_MODES
|
|
|
|
} wpa_hw_mode;
|
|
|
|
|
|
|
|
struct wpa_hw_modes {
|
|
|
|
wpa_hw_mode mode;
|
|
|
|
int num_channels;
|
|
|
|
struct wpa_channel_data *channels;
|
|
|
|
int num_rates;
|
|
|
|
struct wpa_rate_data *rates;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct ieee80211_rx_status {
|
|
|
|
int channel;
|
|
|
|
int ssi;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-03-07 05:26:33 +00:00
|
|
|
/**
|
|
|
|
* struct wpa_driver_ops - Driver interface API definition
|
|
|
|
*
|
|
|
|
* This structure defines the API that each driver interface needs to implement
|
|
|
|
* for core wpa_supplicant code. All driver specific functionality is captured
|
|
|
|
* in this wrapper.
|
|
|
|
*/
|
2005-06-05 20:52:14 +00:00
|
|
|
struct wpa_driver_ops {
|
2006-03-07 05:26:33 +00:00
|
|
|
/** Name of the driver interface */
|
2005-06-05 20:52:14 +00:00
|
|
|
const char *name;
|
2006-03-07 05:26:33 +00:00
|
|
|
/** One line description of the driver interface */
|
2005-06-05 20:52:14 +00:00
|
|
|
const char *desc;
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* get_bssid - Get the current BSSID
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
* @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)
|
|
|
|
*
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Query kernel driver for the current BSSID and copy it to bssid.
|
|
|
|
* Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not
|
2005-06-05 20:52:14 +00:00
|
|
|
* associated.
|
|
|
|
*/
|
|
|
|
int (*get_bssid)(void *priv, u8 *bssid);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* get_ssid - Get the current SSID
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
* @ssid: buffer for SSID (at least 32 bytes)
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Returns: Length of the SSID on success, -1 on failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Query kernel driver for the current SSID and copy it to ssid.
|
2005-06-05 20:52:14 +00:00
|
|
|
* Returning zero is recommended if the STA is not associated.
|
|
|
|
*
|
|
|
|
* Note: SSID is an array of octets, i.e., it is not nul terminated and
|
|
|
|
* can, at least in theory, contain control characters (including nul)
|
|
|
|
* and as such, should be processed as binary data, not a printable
|
|
|
|
* string.
|
|
|
|
*/
|
|
|
|
int (*get_ssid)(void *priv, u8 *ssid);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* set_wpa - Enable/disable WPA support (OBSOLETE)
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
* @enabled: 1 = enable, 0 = disable
|
|
|
|
*
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2005-06-05 20:52:14 +00:00
|
|
|
* 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
|
2006-03-07 05:26:33 +00:00
|
|
|
* 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).
|
2005-06-05 20:52:14 +00:00
|
|
|
*/
|
|
|
|
int (*set_wpa)(void *priv, int enabled);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* set_key - Configure encryption key
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
* @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
|
2007-07-11 15:48:36 +00:00
|
|
|
* %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_DHV);
|
|
|
|
* %WPA_ALG_NONE clears the key.
|
2005-06-05 20:52:14 +00:00
|
|
|
* @addr: address of the peer STA or ff:ff:ff:ff:ff:ff for
|
|
|
|
* broadcast/default keys
|
2007-07-11 15:48:36 +00:00
|
|
|
* @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
|
|
|
|
* IGTK
|
2005-06-05 20:52:14 +00:00
|
|
|
* @set_tx: configure this key as the default Tx key (only used when
|
|
|
|
* driver does not support separate unicast/individual key
|
2006-03-07 05:26:33 +00:00
|
|
|
* @seq: sequence number/packet number, seq_len octets, the next
|
2005-06-05 20:52:14 +00:00
|
|
|
* packet number to be used for in replay protection; configured
|
|
|
|
* for Rx keys (in most cases, this is only used with broadcast
|
|
|
|
* keys and set to zero for unicast keys)
|
2006-03-07 05:26:33 +00:00
|
|
|
* @seq_len: length of the seq, depends on the algorithm:
|
2007-07-11 15:48:36 +00:00
|
|
|
* TKIP: 6 octets, CCMP: 6 octets, IGTK: 6 octets
|
2005-06-05 20:52:14 +00:00
|
|
|
* @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
|
|
|
|
* 8-byte Rx Mic Key
|
|
|
|
* @key_len: length of the key buffer in octets (WEP: 5 or 13,
|
2007-07-11 15:48:36 +00:00
|
|
|
* TKIP: 32, CCMP: 16, IGTK: 16, DHV: 16)
|
2005-06-05 20:52:14 +00:00
|
|
|
*
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* Configure the given key for the kernel driver. If the driver
|
|
|
|
* supports separate individual keys (4 default keys + 1 individual),
|
2006-03-07 05:26:33 +00:00
|
|
|
* addr can be used to determine whether the key is default or
|
2005-06-05 20:52:14 +00:00
|
|
|
* individual. If only 4 keys are supported, the default key with key
|
|
|
|
* index 0 is used as the individual key. STA must be configured to use
|
2006-03-07 05:26:33 +00:00
|
|
|
* it as the default Tx key (set_tx is set) and accept Rx for all the
|
2005-06-05 20:52:14 +00:00
|
|
|
* key indexes. In most cases, WPA uses only key indexes 1 and 2 for
|
|
|
|
* broadcast keys, so key index 0 is available for this kind of
|
|
|
|
* configuration.
|
2006-03-07 05:26:33 +00:00
|
|
|
*
|
|
|
|
* Please note that TKIP keys include separate TX and RX MIC keys and
|
|
|
|
* some drivers may expect them in different order than wpa_supplicant
|
|
|
|
* is using. If the TX/RX keys are swapped, all TKIP encrypted packets
|
|
|
|
* will tricker Michael MIC errors. This can be fixed by changing the
|
|
|
|
* order of MIC keys by swapping te bytes 16..23 and 24..31 of the key
|
|
|
|
* in driver_*.c set_key() implementation, see driver_ndis.c for an
|
|
|
|
* example on how this can be done.
|
2005-06-05 20:52:14 +00:00
|
|
|
*/
|
|
|
|
int (*set_key)(void *priv, 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);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* init - Initialize driver interface
|
2005-06-05 20:52:14 +00:00
|
|
|
* @ctx: context to be used when calling wpa_supplicant functions,
|
|
|
|
* e.g., wpa_supplicant_event()
|
|
|
|
* @ifname: interface name, e.g., wlan0
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Returns: Pointer to private data, %NULL on failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*
|
|
|
|
* Initialize driver interface, including event processing for kernel
|
|
|
|
* driver events (e.g., associated, scan results, Michael MIC failure).
|
|
|
|
* This function can allocate a private configuration data area for
|
|
|
|
* @ctx, file descriptor, interface name, etc. information that may be
|
|
|
|
* needed in future driver operations. If this is not used, non-NULL
|
|
|
|
* value will need to be returned because %NULL is used to indicate
|
|
|
|
* failure. The returned value will be used as 'void *priv' data for
|
|
|
|
* all other driver_ops functions.
|
|
|
|
*
|
|
|
|
* The main event loop (eloop.c) of wpa_supplicant can be used to
|
|
|
|
* register callback for read sockets (eloop_register_read_sock()).
|
|
|
|
*
|
|
|
|
* See wpa_supplicant.h for more information about events and
|
|
|
|
* wpa_supplicant_event() function.
|
|
|
|
*/
|
|
|
|
void * (*init)(void *ctx, const char *ifname);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* deinit - Deinitialize driver interface
|
|
|
|
* @priv: private driver interface data from init()
|
2005-06-05 20:52:14 +00:00
|
|
|
*
|
|
|
|
* Shut down driver interface and processing of driver events. Free
|
|
|
|
* private data buffer if one was allocated in init() handler.
|
|
|
|
*/
|
|
|
|
void (*deinit)(void *priv);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* set_param - Set driver configuration parameters
|
|
|
|
* @priv: private driver interface data from init()
|
|
|
|
* @param: driver specific configuration parameters
|
|
|
|
*
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* Optional handler for notifying driver interface about configuration
|
|
|
|
* parameters (driver_param).
|
|
|
|
*/
|
|
|
|
int (*set_param)(void *priv, const char *param);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set_countermeasures - Enable/disable TKIP countermeasures
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
* @enabled: 1 = countermeasures enabled, 0 = disabled
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Returns: 0 on success, -1 on failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*
|
|
|
|
* Configure TKIP countermeasures. When these are enabled, the driver
|
|
|
|
* should drop all received and queued frames that are using TKIP.
|
|
|
|
*/
|
|
|
|
int (*set_countermeasures)(void *priv, int enabled);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* set_drop_unencrypted - Enable/disable unencrypted frame filtering
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
* @enabled: 1 = unencrypted Tx/Rx frames will be dropped, 0 = disabled
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Returns: 0 on success, -1 on failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*
|
|
|
|
* 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);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* scan - Request the driver to initiate scan
|
2005-06-05 20:52:14 +00:00
|
|
|
* @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
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Returns: 0 on success, -1 on failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*
|
|
|
|
* 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);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* get_scan_results - Fetch the latest scan results
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
* @results: pointer to buffer for scan results
|
|
|
|
* @max_size: maximum number of entries (buffer size)
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Returns: Number of scan result entries used on success, -1 on
|
|
|
|
* failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* If scan results include more than max_size BSSes, max_size will be
|
2005-06-05 20:52:14 +00:00
|
|
|
* returned and the remaining entries will not be included in the
|
|
|
|
* buffer.
|
|
|
|
*/
|
|
|
|
int (*get_scan_results)(void *priv,
|
|
|
|
struct wpa_scan_result *results,
|
|
|
|
size_t max_size);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* deauthenticate - Request driver to deauthenticate
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
* @addr: peer address (BSSID of the AP)
|
|
|
|
* @reason_code: 16-bit reason code to be sent in the deauthentication
|
|
|
|
* frame
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Returns: 0 on success, -1 on failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*/
|
|
|
|
int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* disassociate - Request driver to disassociate
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
* @addr: peer address (BSSID of the AP)
|
|
|
|
* @reason_code: 16-bit reason code to be sent in the disassociation
|
|
|
|
* frame
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Returns: 0 on success, -1 on failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*/
|
|
|
|
int (*disassociate)(void *priv, const u8 *addr, int reason_code);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* associate - Request driver to associate
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
* @params: association parameters
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Returns: 0 on success, -1 on failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*/
|
|
|
|
int (*associate)(void *priv,
|
|
|
|
struct wpa_driver_associate_params *params);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* set_auth_alg - Set IEEE 802.11 authentication algorithm
|
2005-06-05 20:52:14 +00:00
|
|
|
* @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.
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Returns: 0 on success, -1 on failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*/
|
|
|
|
int (*set_auth_alg)(void *priv, int auth_alg);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* add_pmkid - Add PMKSA cache entry to the driver
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
* @bssid: BSSID for the PMKSA cache entry
|
|
|
|
* @pmkid: PMKID for the PMKSA cache entry
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Returns: 0 on success, -1 on failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*
|
|
|
|
* This function is called when a new PMK is received, as a result of
|
|
|
|
* either normal authentication or RSN pre-authentication.
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* If the driver generates RSN IE, i.e., it does not use wpa_ie in
|
2005-06-05 20:52:14 +00:00
|
|
|
* associate(), add_pmkid() can be used to add new PMKSA cache entries
|
2006-03-07 05:26:33 +00:00
|
|
|
* in the driver. If the driver uses wpa_ie from wpa_supplicant, this
|
2005-06-05 20:52:14 +00:00
|
|
|
* driver_ops function does not need to be implemented. Likewise, if
|
|
|
|
* the driver does not support WPA, this function is not needed.
|
|
|
|
*/
|
|
|
|
int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* remove_pmkid - Remove PMKSA cache entry to the driver
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
* @bssid: BSSID for the PMKSA cache entry
|
|
|
|
* @pmkid: PMKID for the PMKSA cache entry
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Returns: 0 on success, -1 on failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*
|
|
|
|
* This function is called when the supplicant drops a PMKSA cache
|
|
|
|
* entry for any reason.
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* If the driver generates RSN IE, i.e., it does not use wpa_ie in
|
2005-06-05 20:52:14 +00:00
|
|
|
* associate(), remove_pmkid() can be used to synchronize PMKSA caches
|
2006-03-07 05:26:33 +00:00
|
|
|
* between the driver and wpa_supplicant. If the driver uses wpa_ie
|
2005-06-05 20:52:14 +00:00
|
|
|
* from wpa_supplicant, this driver_ops function does not need to be
|
|
|
|
* implemented. Likewise, if the driver does not support WPA, this
|
|
|
|
* function is not needed.
|
|
|
|
*/
|
|
|
|
int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* flush_pmkid - Flush PMKSA cache
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Returns: 0 on success, -1 on failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*
|
|
|
|
* This function is called when the supplicant drops all PMKSA cache
|
|
|
|
* entries for any reason.
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* If the driver generates RSN IE, i.e., it does not use wpa_ie in
|
2005-06-05 20:52:14 +00:00
|
|
|
* associate(), remove_pmkid() can be used to synchronize PMKSA caches
|
2006-03-07 05:26:33 +00:00
|
|
|
* between the driver and wpa_supplicant. If the driver uses wpa_ie
|
2005-06-05 20:52:14 +00:00
|
|
|
* from wpa_supplicant, this driver_ops function does not need to be
|
|
|
|
* implemented. Likewise, if the driver does not support WPA, this
|
|
|
|
* function is not needed.
|
|
|
|
*/
|
|
|
|
int (*flush_pmkid)(void *priv);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* flush_pmkid - Flush PMKSA cache
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
*
|
2006-03-07 05:26:33 +00:00
|
|
|
* Returns: 0 on success, -1 on failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*
|
|
|
|
* Get driver/firmware/hardware capabilities.
|
|
|
|
*/
|
|
|
|
int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* poll - Poll driver for association information
|
2005-06-05 20:52:14 +00:00
|
|
|
* @priv: private driver interface data
|
|
|
|
*
|
|
|
|
* This is an option callback that can be used when the driver does not
|
|
|
|
* provide event mechanism for association events. This is called when
|
|
|
|
* receiving WPA EAPOL-Key messages that require association
|
|
|
|
* information. The driver interface is supposed to generate associnfo
|
|
|
|
* event before returning from this callback function. In addition, the
|
|
|
|
* driver interface should generate an association event after having
|
|
|
|
* sent out associnfo.
|
|
|
|
*/
|
|
|
|
void (*poll)(void *priv);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* get_ifname - Get interface name
|
|
|
|
* @priv: private driver interface data
|
|
|
|
*
|
|
|
|
* Returns: Pointer to the interface name. This can differ from the
|
|
|
|
* interface name used in init() call.
|
2005-06-05 20:52:14 +00:00
|
|
|
*
|
|
|
|
* This optional function can be used to allow the driver interface to
|
|
|
|
* replace the interface name with something else, e.g., based on an
|
|
|
|
* interface mapping from a more descriptive name.
|
|
|
|
*/
|
|
|
|
const char * (*get_ifname)(void *priv);
|
|
|
|
|
|
|
|
/**
|
2006-03-07 05:26:33 +00:00
|
|
|
* get_mac_addr - Get own MAC address
|
|
|
|
* @priv: private driver interface data
|
|
|
|
*
|
|
|
|
* Returns: Pointer to own MAC address or %NULL on failure
|
2005-06-05 20:52:14 +00:00
|
|
|
*
|
|
|
|
* This optional function can be used to get the own MAC address of the
|
|
|
|
* device from the driver interface code. This is only needed if the
|
|
|
|
* l2_packet implementation for the OS does not provide easy access to
|
|
|
|
* a MAC address. */
|
|
|
|
const u8 * (*get_mac_addr)(void *priv);
|
2006-03-07 05:26:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* send_eapol - Optional function for sending EAPOL packets
|
|
|
|
* @priv: private driver interface data
|
|
|
|
* @dest: Destination MAC address
|
|
|
|
* @proto: Ethertype
|
|
|
|
* @data: EAPOL packet starting with IEEE 802.1X header
|
|
|
|
* @data_len: Size of the EAPOL packet
|
|
|
|
*
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* This optional function can be used to override l2_packet operations
|
|
|
|
* with driver specific functionality. If this function pointer is set,
|
|
|
|
* l2_packet module is not used at all and the driver interface code is
|
|
|
|
* responsible for receiving and sending all EAPOL packets. The
|
|
|
|
* received EAPOL packets are sent to core code by calling
|
|
|
|
* wpa_supplicant_rx_eapol(). The driver interface is required to
|
|
|
|
* implement get_mac_addr() handler if send_eapol() is used.
|
|
|
|
*/
|
|
|
|
int (*send_eapol)(void *priv, const u8 *dest, u16 proto,
|
|
|
|
const u8 *data, size_t data_len);
|
2007-07-11 15:48:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* set_operstate - Sets device operating state to DORMANT or UP
|
|
|
|
* @priv: private driver interface data
|
|
|
|
* @state: 0 = dormant, 1 = up
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* This is an optional function that can be used on operating systems
|
|
|
|
* that support a concept of controlling network device state from user
|
|
|
|
* space applications. This function, if set, gets called with
|
|
|
|
* state = 1 when authentication has been completed and with state = 0
|
|
|
|
* when connection is lost.
|
|
|
|
*/
|
|
|
|
int (*set_operstate)(void *priv, int state);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mlme_setprotection - MLME-SETPROTECTION.request primitive
|
|
|
|
* @priv: Private driver interface data
|
|
|
|
* @addr: Address of the station for which to set protection (may be
|
|
|
|
* %NULL for group keys)
|
|
|
|
* @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_*
|
|
|
|
* @key_type: MLME_SETPROTECTION_KEY_TYPE_*
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* This is an optional function that can be used to set the driver to
|
|
|
|
* require protection for Tx and/or Rx frames. This uses the layer
|
|
|
|
* interface defined in IEEE 802.11i-2004 clause 10.3.22.1
|
|
|
|
* (MLME-SETPROTECTION.request). Many drivers do not use explicit
|
|
|
|
* set protection operation; instead, they set protection implicitly
|
|
|
|
* based on configured keys.
|
|
|
|
*/
|
|
|
|
int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
|
|
|
|
int key_type);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get_hw_feature_data - Get hardware support data (channels and rates)
|
|
|
|
* @priv: Private driver interface data
|
|
|
|
* @num_modes: Variable for returning the number of returned modes
|
|
|
|
* flags: Variable for returning hardware feature flags
|
|
|
|
* Returns: Pointer to allocated hardware data on success or %NULL on
|
|
|
|
* failure. Caller is responsible for freeing this.
|
|
|
|
*
|
|
|
|
* 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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set_channel - Set channel
|
|
|
|
* @priv: Private driver interface data
|
|
|
|
* @phymode: WPA_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 freq);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set_ssid - Set SSID
|
|
|
|
* @priv: Private driver interface data
|
|
|
|
* @ssid: SSID
|
|
|
|
* @ssid_len: SSID length
|
|
|
|
* 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_ssid)(void *priv, const u8 *ssid, size_t ssid_len);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set_bssid - Set BSSID
|
|
|
|
* @priv: Private driver interface data
|
|
|
|
* @bssid: BSSID
|
|
|
|
* 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_bssid)(void *priv, const u8 *bssid);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* send_mlme - Send management frame from MLME
|
|
|
|
* @priv: Private driver interface data
|
|
|
|
* @data: IEEE 802.11 management frame with IEEE 802.11 header
|
|
|
|
* @data_len: Size of the management frame
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* This function is only needed for drivers that export MLME
|
|
|
|
* (management frame processing) to wpa_supplicant.
|
|
|
|
*/
|
|
|
|
int (*send_mlme)(void *priv, const u8 *data, size_t data_len);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mlme_add_sta - Add a STA entry into the driver/netstack
|
|
|
|
* @priv: Private driver interface data
|
|
|
|
* @addr: MAC address of the STA (e.g., BSSID of the AP)
|
|
|
|
* @supp_rates: Supported rate set (from (Re)AssocResp); in IEEE 802.11
|
|
|
|
* format (one octet per rate, 1 = 0.5 Mbps)
|
|
|
|
* @supp_rates_len: Number of entries in supp_rates
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* This function is only needed for drivers that export MLME
|
|
|
|
* (management frame processing) to wpa_supplicant. When the MLME code
|
|
|
|
* completes association with an AP, this function is called to
|
|
|
|
* configure the driver/netstack with a STA entry for data frame
|
|
|
|
* processing (TX rate control, encryption/decryption).
|
|
|
|
*/
|
|
|
|
int (*mlme_add_sta)(void *priv, const u8 *addr, const u8 *supp_rates,
|
|
|
|
size_t supp_rates_len);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mlme_remove_sta - Remove a STA entry from the driver/netstack
|
|
|
|
* @priv: Private driver interface data
|
|
|
|
* @addr: MAC address of the STA (e.g., BSSID of the AP)
|
|
|
|
* Returns: 0 on success, -1 on failure
|
|
|
|
*
|
|
|
|
* This function is only needed for drivers that export MLME
|
|
|
|
* (management frame processing) to wpa_supplicant.
|
|
|
|
*/
|
|
|
|
int (*mlme_remove_sta)(void *priv, const u8 *addr);
|
2005-06-05 20:52:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* DRIVER_H */
|