📄 driver.h
字号:
/** * remove_pmkid - Remove PMKSA cache entry to the driver * @priv: private driver interface data * @bssid: BSSID for the PMKSA cache entry * @pmkid: PMKID for the PMKSA cache entry * * Returns: 0 on success, -1 on failure * * This function is called when the supplicant drops a PMKSA cache * entry for any reason. * * If the driver generates RSN IE, i.e., it does not use wpa_ie in * associate(), remove_pmkid() can be used to synchronize PMKSA caches * between the driver and wpa_supplicant. If the driver uses wpa_ie * 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); /** * flush_pmkid - Flush PMKSA cache * @priv: private driver interface data * * Returns: 0 on success, -1 on failure * * This function is called when the supplicant drops all PMKSA cache * entries for any reason. * * If the driver generates RSN IE, i.e., it does not use wpa_ie in * associate(), remove_pmkid() can be used to synchronize PMKSA caches * between the driver and wpa_supplicant. If the driver uses wpa_ie * 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); /** * flush_pmkid - Flush PMKSA cache * @priv: private driver interface data * * Returns: 0 on success, -1 on failure * * Get driver/firmware/hardware capabilities. */ int (*get_capa)(void *priv, struct wpa_driver_capa *capa); /** * poll - Poll driver for association information * @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); /** * 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. Init() is called first. * * 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); /** * get_mac_addr - Get own MAC address * @priv: private driver interface data * * Returns: Pointer to own MAC address or %NULL on failure * * 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); /** * 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); /** * 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); /** * update_ft_ies - Update FT (IEEE 802.11r) IEs * @priv: Private driver interface data * @md: Mobility domain (2 octets) (also included inside ies) * @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs * @ies_len: Length of FT IEs in bytes * Returns: 0 on success, -1 on failure * * The supplicant uses this callback to let the driver know that keying * material for FT is available and that the driver can use the * provided IEs in the next message in FT authentication sequence. * * This function is only needed for driver that support IEEE 802.11r * (Fast BSS Transition). */ int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies, size_t ies_len); /** * send_ft_action - Send FT Action frame (IEEE 802.11r) * @priv: Private driver interface data * @action: Action field value * @target_ap: Target AP address * @ies: FT IEs (MDIE, FTIE, ...) (FT Request action frame body) * @ies_len: Length of FT IEs in bytes * Returns: 0 on success, -1 on failure * * The supplicant uses this callback to request the driver to transmit * an FT Action frame (action category 6) for over-the-DS fast BSS * transition. */ int (*send_ft_action)(void *priv, u8 action, const u8 *target_ap, const u8 *ies, size_t ies_len); /** * get_scan_results2 - Fetch the latest scan results * @priv: private driver interface data * * Returns: Allocated buffer of scan results (caller is responsible for * freeing the data structure) on success, NULL on failure */ 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 * Returns: 0 on success, -1 on failure * * This function is for drivers which support some form * of setting a regulatory domain. */ int (*set_country)(void *priv, const char *alpha2); /** * global_init - Global driver initialization * Returns: Pointer to private data (global), %NULL on failure * * This optional function is called to initialize the driver wrapper * for global data, i.e., data that applies to all interfaces. If this * function is implemented, global_deinit() will also need to be * implemented to free the private data. The driver will also likely * use init2() function instead of init() to get the pointer to global * data available to per-interface initializer. */ void * (*global_init)(void); /** * global_deinit - Global driver deinitialization * @priv: private driver global data from global_init() * * Terminate any global driver related functionality and free the * global data structure. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -