⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 driver.h

📁 IEEE 802.11a/b/g 服务器端AP
💻 H
📖 第 1 页 / 共 3 页
字号:
/* * WPA Supplicant - driver interface definition * Copyright (c) 2003-2008, 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 * 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. */#ifndef DRIVER_H#define DRIVER_H#define WPA_SUPPLICANT_DRIVER_VERSION 3#include "defs.h"#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#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;};/** * struct wpa_scan_res - Scan result for an BSS/IBSS * @bssid: BSSID * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1) * @beacon_int: beacon interval in TUs (host byte order) * @caps: capability information field in host byte order * @qual: signal quality * @noise: noise level * @level: signal level * @tsf: Timestamp * @ie_len: length of the following IE field in octets * * 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. * * If the driver does not support reporting all IEs, the IE data structure is * constructed of the IEs that are available. This field will also need to * include SSID in IE format. All drivers are encouraged to be extended to * report all IEs to make it easier to support future additions. */struct wpa_scan_res {	u8 bssid[ETH_ALEN];	int freq;	u16 beacon_int;	u16 caps;	int qual;	int noise;	int level;	u64 tsf;	size_t ie_len;	/* followed by ie_len octets of IEs */};/** * struct wpa_scan_results - Scan results * @res: Array of pointers to allocated variable length scan result entries * @num: Number of entries in the scan result array */struct wpa_scan_results {	struct wpa_scan_res **res;	size_t num;};/** * struct wpa_driver_associate_params - Association parameters * Data for struct wpa_driver_ops::associate(). */struct wpa_driver_associate_params {	/**	 * 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. */	const u8 *bssid;	/**	 * ssid - The selected SSID	 */	const u8 *ssid;	size_t ssid_len;	/**	 * 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)	 */	int freq;	/**	 * wpa_ie - WPA information element for (Re)Association Request	 * WPA information element to be included in (Re)Association	 * Request (including information element id and length). Use	 * of this WPA IE is optional. If the driver generates the WPA	 * IE, it can use pairwise_suite, group_suite, and	 * key_mgmt_suite to select proper algorithms. In this case,	 * 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 below).	 *	 * When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE	 * instead. The driver can determine which version is used by	 * looking at the first byte of the IE (0xdd for WPA, 0x30 for	 * WPA2/RSN).	 */	const u8 *wpa_ie;	/**	 * wpa_ie_len - length of the wpa_ie	 */	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;	/**	 * auth_alg - Allowed authentication algorithms	 * Bit field of AUTH_ALG_*	 */	int auth_alg;	/**	 * mode - Operation mode (infra/ibss) IEEE80211_MODE_*	 */	int mode;	/**	 * 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;	/**	 * ft_ies - IEEE 802.11r / FT information elements	 * If the supplicant is using IEEE 802.11r (FT) and has the needed keys	 * for fast transition, this parameter is set to include the IEs that	 * are to be sent in the next FT Authentication Request message.	 * update_ft_ies() handler is called to update the IEs for further	 * FT messages in the sequence.	 *	 * The driver should use these IEs only if the target AP is advertising	 * the same mobility domain as the one included in the MDIE here.	 *	 * In ap_scan=2 mode, the driver can use these IEs when moving to a new	 * AP after the initial association. These IEs can only be used if the	 * target AP is advertising support for FT and is using the same MDIE	 * and SSID as the current AP.	 *	 * The driver is responsible for reporting the FT IEs received from the	 * AP's response using wpa_supplicant_event() with EVENT_FT_RESPONSE	 * type. update_ft_ies() handler will then be called with the FT IEs to	 * include in the next frame in the authentication sequence.	 */	const u8 *ft_ies;	/**	 * ft_ies_len - Length of ft_ies in bytes	 */	size_t ft_ies_len;	/**	 * ft_md - FT Mobility domain (6 octets) (also included inside ft_ies)	 *	 * This value is provided to allow the driver interface easier access	 * to the current mobility domain. This value is set to %NULL if no	 * mobility domain is currently active.	 */	const u8 *ft_md;	/**	 * passphrase - RSN passphrase for PSK	 *	 * This value is made available only for WPA/WPA2-Personal (PSK) and	 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is	 * the 8..63 character ASCII passphrase, if available. Please note that	 * this can be %NULL if passphrase was not used to generate the PSK. In	 * that case, the psk field must be used to fetch the PSK.	 */	const char *passphrase;	/**	 * psk - RSN PSK (alternative for passphrase for PSK)	 *	 * This value is made available only for WPA/WPA2-Personal (PSK) and	 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is	 * the 32-octet (256-bit) PSK, if available. The driver wrapper should	 * be prepared to handle %NULL value as an error.	 */	const u8 *psk;};/** * struct wpa_driver_capa - Driver capability information */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#define WPA_DRIVER_CAPA_KEY_MGMT_FT		0x00000020#define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK		0x00000040	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#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	unsigned int flags;};#define WPA_CHAN_W_SCAN 0x00000001#define WPA_CHAN_W_ACTIVE_SCAN 0x00000002#define WPA_CHAN_W_IBSS 0x00000004struct 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 0x00000100struct 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;};/** * 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. */struct wpa_driver_ops {	/** Name of the driver interface */	const char *name;	/** One line description of the driver interface */	const char *desc;	/**	 * get_bssid - Get the current BSSID	 * @priv: private driver interface data	 * @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)	 *	 * Returns: 0 on success, -1 on failure	 *	 * 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	 * associated.	 */	int (*get_bssid)(void *priv, u8 *bssid);	/**	 * get_ssid - Get the current SSID	 * @priv: private driver interface data	 * @ssid: buffer for SSID (at least 32 bytes)	 *	 * Returns: Length of the SSID on success, -1 on failure	 *	 * Query kernel driver for the current SSID and copy it to ssid.	 * 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);	/**	 * 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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -