📄 driver.h
字号:
* @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 *, const u8 *ies, size_t ies_len);};/** * 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. */ 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. */ 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 * AP and APs that have existing PMKSA cache entries. wpa_supplicant * will automatically skip pre-authentication in cases where a valid * PMKSA exists. When more than one candidate exists, this event should * be generated once for each candidate. * * Driver will be notified about successful pre-authentication with * struct wpa_driver_ops::add_pmkid() calls. */ EVENT_PMKID_CANDIDATE, /** * EVENT_STKSTART - Request STK handshake (MLME-STKSTART.request) * * This event can be used to inform wpa_supplicant about desire to set * up secure direct link connection between two stations as defined in * IEEE 802.11e with a new PeerKey mechanism that replaced the original * STAKey negotiation. The caller will need to set peer address for the * event. */ EVENT_STKSTART, /** * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs * * The driver is expected to report the received FT IEs from * 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} wpa_event_type;/** * union wpa_event_data - Additional data for wpa_supplicant_event() calls */union wpa_event_data { /** * struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events * * This structure is optional for EVENT_ASSOC calls and required for * EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the * driver interface does not need to generate separate EVENT_ASSOCINFO * calls. */ struct assoc_info { /** * req_ies - (Re)Association Request IEs * * If the driver generates WPA/RSN IE, this event data must be * returned for WPA handshake to have needed information. If * wpa_supplicant-generated WPA/RSN IE is used, this * information event is optional. * * This should start with the first IE (fixed fields before IEs * are not included). */ u8 *req_ies; /** * req_ies_len - Length of req_ies in bytes */ size_t req_ies_len; /** * 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; /** * beacon_ies - Beacon or Probe Response IEs * * Optional Beacon/ProbeResp data: IEs included in Beacon or * Probe Response frames from the current AP (i.e., the one * that the client just associated with). This information is * used to update WPA/RSN IE for the AP. If this field is not * set, the results from previous scan will be used. If no * data for the new AP is found, scan results will be requested * again (without scan request). At this point, the driver is * expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is * used). * * This should start with the first IE (fixed fields before IEs * are not included). */ u8 *beacon_ies; /** * beacon_ies_len - Length of beacon_ies */ size_t beacon_ies_len; } assoc_info; /** * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE */ struct michael_mic_failure { int unicast; } michael_mic_failure; /** * struct interface_status - Data for EVENT_INTERFACE_STATUS */ struct interface_status { char ifname[100]; enum { EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED } ievent; } interface_status; /** * struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE */ struct pmkid_candidate { /** BSSID of the PMKID candidate */ u8 bssid[ETH_ALEN]; /** Smaller the index, higher the priority */ int index; /** Whether RSN IE includes pre-authenticate flag */ int preauth; } pmkid_candidate; /** * struct stkstart - Data for EVENT_STKSTART */ struct stkstart { u8 peer[ETH_ALEN]; } stkstart; /** * struct ft_ies - FT information elements (EVENT_FT_RESPONSE) * * During FT (IEEE 802.11r) authentication sequence, the driver is * expected to use this event to report received FT IEs (MDIE, FTIE, * RSN IE, TIE, possible resource request) to the supplicant. The FT * IEs for the next message will be delivered through the * struct wpa_driver_ops::update_ft_ies() callback. */ struct ft_ies { const u8 *ies; size_t ies_len; int ft_action; u8 target_ap[ETH_ALEN]; } ft_ies;};/** * wpa_supplicant_event - Report a driver event for wpa_supplicant * @ctx: Context pointer (wpa_s); this is the ctx variable registered * with struct wpa_driver_ops::init() * @event: event type (defined above) * @data: possible extra data for the event * * Driver wrapper code should call this function whenever an event is received * from the driver. */void wpa_supplicant_event(void *ctx, wpa_event_type event, union wpa_event_data *data);/** * wpa_supplicant_rx_eapol - Deliver a received EAPOL frame to wpa_supplicant * @ctx: Context pointer (wpa_s); this is the ctx variable registered * with struct wpa_driver_ops::init() * @src_addr: Source address of the EAPOL frame * @buf: EAPOL data starting from the EAPOL header (i.e., no Ethernet header) * @len: Length of the EAPOL data * * This function is called for each received EAPOL frame. Most driver * interfaces rely on more generic OS mechanism for receiving frames through * l2_packet, but if such a mechanism is not available, the driver wrapper may * take care of received EAPOL frames and deliver them to the core supplicant * code by calling this function. */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 0x0050f201const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res, u32 vendor_type);int wpa_scan_get_max_rate(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);#endif /* DRIVER_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -