$search
00001 /* 00002 * Driver interface definition 00003 * Copyright (c) 2003-2010, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 00013 * 00014 * This file defines a driver interface used by both %wpa_supplicant and 00015 * hostapd. The first part of the file defines data structures used in various 00016 * driver operations. This is followed by the struct wpa_driver_ops that each 00017 * driver wrapper will beed to define with callback functions for requesting 00018 * driver operations. After this, there are definitions for driver event 00019 * reporting with wpa_supplicant_event() and some convenience helper functions 00020 * that can be used to report events. 00021 */ 00022 00023 #ifndef DRIVER_H 00024 #define DRIVER_H 00025 00026 #define WPA_SUPPLICANT_DRIVER_VERSION 4 00027 00028 #include "common/defs.h" 00029 00030 #define HOSTAPD_CHAN_DISABLED 0x00000001 00031 #define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002 00032 #define HOSTAPD_CHAN_NO_IBSS 0x00000004 00033 #define HOSTAPD_CHAN_RADAR 0x00000008 00034 00038 struct hostapd_channel_data { 00042 short chan; 00043 00047 short freq; 00048 00052 int flag; 00053 00057 u8 max_tx_power; 00058 }; 00059 00063 struct hostapd_hw_modes { 00067 enum hostapd_hw_mode mode; 00068 00072 int num_channels; 00073 00077 struct hostapd_channel_data *channels; 00078 00082 int num_rates; 00083 00087 int *rates; 00088 00092 u16 ht_capab; 00093 00097 u8 mcs_set[16]; 00098 00102 u8 a_mpdu_params; 00103 }; 00104 00105 00106 #define IEEE80211_MODE_INFRA 0 00107 #define IEEE80211_MODE_IBSS 1 00108 #define IEEE80211_MODE_AP 2 00109 00110 #define IEEE80211_CAP_ESS 0x0001 00111 #define IEEE80211_CAP_IBSS 0x0002 00112 #define IEEE80211_CAP_PRIVACY 0x0010 00113 00114 #define WPA_SCAN_QUAL_INVALID BIT(0) 00115 #define WPA_SCAN_NOISE_INVALID BIT(1) 00116 #define WPA_SCAN_LEVEL_INVALID BIT(2) 00117 #define WPA_SCAN_LEVEL_DBM BIT(3) 00118 #define WPA_SCAN_AUTHENTICATED BIT(4) 00119 #define WPA_SCAN_ASSOCIATED BIT(5) 00120 00146 struct wpa_scan_res { 00147 unsigned int flags; 00148 u8 bssid[ETH_ALEN]; 00149 int freq; 00150 u16 beacon_int; 00151 u16 caps; 00152 int qual; 00153 int noise; 00154 int level; 00155 u64 tsf; 00156 unsigned int age; 00157 size_t ie_len; 00158 size_t beacon_ie_len; 00159 /* 00160 * Followed by ie_len octets of IEs from Probe Response frame (or if 00161 * the driver does not indicate source of IEs, these may also be from 00162 * Beacon frame). After the first set of IEs, another set of IEs may 00163 * follow (with beacon_ie_len octets of data) if the driver provides 00164 * both IE sets. 00165 */ 00166 }; 00167 00173 struct wpa_scan_results { 00174 struct wpa_scan_res **res; 00175 size_t num; 00176 }; 00177 00188 struct wpa_interface_info { 00189 struct wpa_interface_info *next; 00190 char *ifname; 00191 char *desc; 00192 const char *drv_name; 00193 }; 00194 00195 #define WPAS_MAX_SCAN_SSIDS 4 00196 00197 struct wpa_driver_scan_ssid { 00203 const u8 *ssid; 00207 size_t ssid_len; 00208 }; 00209 00214 struct wpa_driver_scan_params { 00218 struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS]; 00219 00224 size_t num_ssids; 00225 00229 const u8 *extra_ies; 00230 00234 size_t extra_ies_len; 00235 00241 int *freqs; 00242 00257 struct wpa_driver_scan_filter { 00258 u8 ssid[32]; 00259 size_t ssid_len; 00260 } *filter_ssids; 00261 00265 size_t num_filter_ssids; 00266 }; 00267 00272 struct wpa_driver_auth_params { 00273 int freq; 00274 const u8 *bssid; 00275 const u8 *ssid; 00276 size_t ssid_len; 00277 int auth_alg; 00278 const u8 *ie; 00279 size_t ie_len; 00280 const u8 *wep_key[4]; 00281 size_t wep_key_len[4]; 00282 int wep_tx_keyidx; 00283 int local_state_change; 00284 }; 00285 00290 struct wpa_driver_associate_params { 00295 const u8 *bssid; 00296 00300 const u8 *ssid; 00301 00305 size_t ssid_len; 00306 00312 int freq; 00313 00332 const u8 *wpa_ie; 00333 00337 size_t wpa_ie_len; 00338 00344 enum wpa_cipher pairwise_suite; 00345 00351 enum wpa_cipher group_suite; 00352 00358 enum wpa_key_mgmt key_mgmt_suite; 00359 00364 int auth_alg; 00365 00369 int mode; 00370 00374 const u8 *wep_key[4]; 00375 00379 size_t wep_key_len[4]; 00380 00384 int wep_tx_keyidx; 00385 00389 enum mfp_options mgmt_frame_protection; 00390 00412 const u8 *ft_ies; 00413 00417 size_t ft_ies_len; 00418 00426 const u8 *ft_md; 00427 00437 const char *passphrase; 00438 00447 const u8 *psk; 00448 00456 int drop_unencrypted; 00457 00464 const u8 *prev_bssid; 00465 }; 00466 00470 struct wpa_driver_capa { 00471 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001 00472 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002 00473 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004 00474 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008 00475 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010 00476 #define WPA_DRIVER_CAPA_KEY_MGMT_FT 0x00000020 00477 #define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK 0x00000040 00478 unsigned int key_mgmt; 00479 00480 #define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001 00481 #define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002 00482 #define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004 00483 #define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008 00484 unsigned int enc; 00485 00486 #define WPA_DRIVER_AUTH_OPEN 0x00000001 00487 #define WPA_DRIVER_AUTH_SHARED 0x00000002 00488 #define WPA_DRIVER_AUTH_LEAP 0x00000004 00489 unsigned int auth; 00490 00491 /* Driver generated WPA/RSN IE */ 00492 #define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001 00493 /* Driver needs static WEP key setup after association command */ 00494 #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002 00495 #define WPA_DRIVER_FLAGS_USER_SPACE_MLME 0x00000004 00496 /* Driver takes care of RSN 4-way handshake internally; PMK is configured with 00497 * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */ 00498 #define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008 00499 #define WPA_DRIVER_FLAGS_WIRED 0x00000010 00500 /* Driver provides separate commands for authentication and association (SME in 00501 * wpa_supplicant). */ 00502 #define WPA_DRIVER_FLAGS_SME 0x00000020 00503 /* Driver supports AP mode */ 00504 #define WPA_DRIVER_FLAGS_AP 0x00000040 00505 /* Driver needs static WEP key setup after association has been completed */ 00506 #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080 00507 unsigned int flags; 00508 00509 int max_scan_ssids; 00510 00514 unsigned int max_remain_on_chan; 00515 }; 00516 00517 00518 struct hostapd_data; 00519 00520 struct hostap_sta_driver_data { 00521 unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes; 00522 unsigned long current_tx_rate; 00523 unsigned long inactive_msec; 00524 unsigned long flags; 00525 unsigned long num_ps_buf_frames; 00526 unsigned long tx_retry_failed; 00527 unsigned long tx_retry_count; 00528 int last_rssi; 00529 int last_ack_rssi; 00530 }; 00531 00532 struct hostapd_sta_add_params { 00533 const u8 *addr; 00534 u16 aid; 00535 u16 capability; 00536 const u8 *supp_rates; 00537 size_t supp_rates_len; 00538 u16 listen_interval; 00539 const struct ieee80211_ht_capabilities *ht_capabilities; 00540 }; 00541 00542 struct hostapd_freq_params { 00543 int mode; 00544 int freq; 00545 int channel; 00546 int ht_enabled; 00547 int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled, 00548 * secondary channel below primary, 1 = HT40 00549 * enabled, secondary channel above primary */ 00550 }; 00551 00552 enum wpa_driver_if_type { 00556 WPA_IF_STATION, 00557 00564 WPA_IF_AP_VLAN, 00565 00571 WPA_IF_AP_BSS, 00572 }; 00573 00574 struct wpa_init_params { 00575 const u8 *bssid; 00576 const char *ifname; 00577 const u8 *ssid; 00578 size_t ssid_len; 00579 const char *test_socket; 00580 int use_pae_group_addr; 00581 char **bridge; 00582 size_t num_bridge; 00583 00584 u8 *own_addr; /* buffer for writing own MAC address */ 00585 }; 00586 00587 00588 struct wpa_bss_params { 00590 const char *ifname; 00592 int enabled; 00593 00594 int wpa; 00595 int ieee802_1x; 00596 int wpa_group; 00597 int wpa_pairwise; 00598 int wpa_key_mgmt; 00599 int rsn_preauth; 00600 }; 00601 00602 #define WPA_STA_AUTHORIZED BIT(0) 00603 #define WPA_STA_WMM BIT(1) 00604 #define WPA_STA_SHORT_PREAMBLE BIT(2) 00605 #define WPA_STA_MFP BIT(3) 00606 00614 struct wpa_driver_ops { 00616 const char *name; 00618 const char *desc; 00619 00631 int (*get_bssid)(void *priv, u8 *bssid); 00632 00648 int (*get_ssid)(void *priv, u8 *ssid); 00649 00694 int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg, 00695 const u8 *addr, int key_idx, int set_tx, 00696 const u8 *seq, size_t seq_len, 00697 const u8 *key, size_t key_len); 00698 00722 void * (*init)(void *ctx, const char *ifname); 00723 00731 void (*deinit)(void *priv); 00732 00743 int (*set_param)(void *priv, const char *param); 00744 00755 int (*set_countermeasures)(void *priv, int enabled); 00756 00766 int (*deauthenticate)(void *priv, const u8 *addr, int reason_code); 00767 00777 int (*disassociate)(void *priv, const u8 *addr, int reason_code); 00778 00786 int (*associate)(void *priv, 00787 struct wpa_driver_associate_params *params); 00788 00806 int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid); 00807 00826 int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid); 00827 00844 int (*flush_pmkid)(void *priv); 00845 00854 int (*get_capa)(void *priv, struct wpa_driver_capa *capa); 00855 00868 void (*poll)(void *priv); 00869 00881 const char * (*get_ifname)(void *priv); 00882 00893 const u8 * (*get_mac_addr)(void *priv); 00894 00913 int (*send_eapol)(void *priv, const u8 *dest, u16 proto, 00914 const u8 *data, size_t data_len); 00915 00928 int (*set_operstate)(void *priv, int state); 00929 00946 int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type, 00947 int key_type); 00948 00960 struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv, 00961 u16 *num_modes, 00962 u16 *flags); 00963 00975 int (*set_channel)(void *priv, enum hostapd_hw_mode phymode, int chan, 00976 int freq); 00977 00988 int (*set_ssid)(void *priv, const u8 *ssid, size_t ssid_len); 00989 00999 int (*set_bssid)(void *priv, const u8 *bssid); 01000 01011 int (*send_mlme)(void *priv, const u8 *data, size_t data_len); 01012 01028 int (*mlme_add_sta)(void *priv, const u8 *addr, const u8 *supp_rates, 01029 size_t supp_rates_len); 01030 01040 int (*mlme_remove_sta)(void *priv, const u8 *addr); 01041 01057 int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies, 01058 size_t ies_len); 01059 01073 int (*send_ft_action)(void *priv, u8 action, const u8 *target_ap, 01074 const u8 *ies, size_t ies_len); 01075 01083 struct wpa_scan_results * (*get_scan_results2)(void *priv); 01084 01094 int (*set_country)(void *priv, const char *alpha2); 01095 01107 void * (*global_init)(void); 01108 01116 void (*global_deinit)(void *priv); 01117 01129 void * (*init2)(void *ctx, const char *ifname, void *global_priv); 01130 01138 struct wpa_interface_info * (*get_interfaces)(void *global_priv); 01139 01151 int (*scan2)(void *priv, struct wpa_driver_scan_params *params); 01152 01165 int (*authenticate)(void *priv, 01166 struct wpa_driver_auth_params *params); 01167 01184 int (*set_beacon)(void *priv, const u8 *head, size_t head_len, 01185 const u8 *tail, size_t tail_len, int dtim_period, 01186 int beacon_int); 01187 01197 void * (*hapd_init)(struct hostapd_data *hapd, 01198 struct wpa_init_params *params); 01199 01204 void (*hapd_deinit)(void *priv); 01205 01218 int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params); 01219 01230 int (*set_privacy)(void *priv, int enabled); 01231 01246 int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr, 01247 int idx, u8 *seq); 01248 01258 int (*flush)(void *priv); 01259 01272 int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len); 01273 01281 int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data, 01282 const u8 *addr); 01283 01295 int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data, 01296 size_t data_len, int encrypt, 01297 const u8 *own_addr); 01298 01310 int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr, 01311 int reason); 01312 01324 int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr, 01325 int reason); 01326 01333 int (*sta_remove)(void *priv, const u8 *addr); 01334 01346 int (*hapd_get_ssid)(void *priv, u8 *buf, int len); 01347 01355 int (*hapd_set_ssid)(void *priv, const u8 *buf, int len); 01356 01366 int (*hapd_set_countermeasures)(void *priv, int enabled); 01367 01378 int (*sta_add)(void *priv, struct hostapd_sta_add_params *params); 01379 01386 int (*get_inact_sec)(void *priv, const u8 *addr); 01387 01394 int (*sta_clear_stats)(void *priv, const u8 *addr); 01395 01402 int (*set_freq)(void *priv, struct hostapd_freq_params *freq); 01403 01410 int (*set_rts)(void *priv, int rts); 01411 01418 int (*set_frag)(void *priv, int frag); 01419 01429 int (*sta_set_flags)(void *priv, const u8 *addr, 01430 int total_flags, int flags_or, int flags_and); 01431 01440 int (*set_rate_sets)(void *priv, int *supp_rates, int *basic_rates, 01441 int mode); 01442 01449 int (*set_cts_protect)(void *priv, int value); 01450 01457 int (*set_preamble)(void *priv, int value); 01458 01465 int (*set_short_slot_time)(void *priv, int value); 01466 01476 int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min, 01477 int cw_max, int burst_time); 01478 01488 int (*valid_bss_mask)(void *priv, const u8 *addr, const u8 *mask); 01489 01507 int (*if_add)(void *priv, enum wpa_driver_if_type type, 01508 const char *ifname, const u8 *addr, void *bss_ctx, 01509 void **drv_priv, char *force_ifname, u8 *if_addr); 01510 01518 int (*if_remove)(void *priv, enum wpa_driver_if_type type, 01519 const char *ifname); 01520 01535 int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname, 01536 int vlan_id); 01537 01548 int (*commit)(void *priv); 01549 01560 int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto, 01561 const u8 *data, size_t data_len); 01562 01571 int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted, 01572 u32 session_timeout); 01573 01580 int (*set_radius_acl_expire)(void *priv, const u8 *mac); 01581 01591 int (*set_ht_params)(void *priv, 01592 const u8 *ht_capab, size_t ht_capab_len, 01593 const u8 *ht_oper, size_t ht_oper_len); 01594 01608 int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon, 01609 const struct wpabuf *proberesp); 01610 01617 int (*set_supp_port)(void *priv, int authorized); 01618 01627 int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val); 01628 01647 int (*send_action)(void *priv, unsigned int freq, 01648 const u8 *dst, const u8 *src, const u8 *bssid, 01649 const u8 *data, size_t data_len); 01650 01673 int (*remain_on_channel)(void *priv, unsigned int freq, 01674 unsigned int duration); 01675 01687 int (*cancel_remain_on_channel)(void *priv); 01688 01703 int (*probe_req_report)(void *priv, int report); 01704 01716 int (*disable_11b_rates)(void *priv, int disabled); 01717 01727 int (*deinit_ap)(void *priv); 01728 01733 void (*suspend)(void *priv); 01734 01739 void (*resume)(void *priv); 01740 01755 int (*signal_monitor)(void *priv, int threshold, int hysteresis); 01756 01768 int (*send_frame)(void *priv, const u8 *data, size_t data_len, 01769 int encrypt); 01770 }; 01771 01772 01776 enum wpa_event_type { 01789 EVENT_ASSOC, 01790 01801 EVENT_DISASSOC, 01802 01812 EVENT_MICHAEL_MIC_FAILURE, 01813 01828 EVENT_SCAN_RESULTS, 01829 01841 EVENT_ASSOCINFO, 01842 01852 EVENT_INTERFACE_STATUS, 01853 01878 EVENT_PMKID_CANDIDATE, 01879 01889 EVENT_STKSTART, 01890 01898 EVENT_FT_RESPONSE, 01899 01908 EVENT_IBSS_RSN_START, 01909 01919 EVENT_AUTH, 01920 01929 EVENT_DEAUTH, 01930 01938 EVENT_ASSOC_REJECT, 01939 01943 EVENT_AUTH_TIMED_OUT, 01944 01948 EVENT_ASSOC_TIMED_OUT, 01949 01953 EVENT_FT_RRB_RX, 01954 01958 EVENT_WPS_BUTTON_PUSHED, 01959 01963 EVENT_TX_STATUS, 01964 01968 EVENT_RX_FROM_UNKNOWN, 01969 01973 EVENT_RX_MGMT, 01974 01982 EVENT_RX_ACTION, 01983 01991 EVENT_REMAIN_ON_CHANNEL, 01992 02001 EVENT_CANCEL_REMAIN_ON_CHANNEL, 02002 02008 EVENT_MLME_RX, 02009 02021 EVENT_RX_PROBE_REQ, 02022 02032 EVENT_NEW_STA, 02033 02042 EVENT_EAPOL_RX, 02043 02051 EVENT_SIGNAL_CHANGE 02052 }; 02053 02054 02058 union wpa_event_data { 02067 struct assoc_info { 02079 const u8 *req_ies; 02080 02084 size_t req_ies_len; 02085 02097 const u8 *resp_ies; 02098 02102 size_t resp_ies_len; 02103 02120 const u8 *beacon_ies; 02121 02124 size_t beacon_ies_len; 02125 02129 unsigned int freq; 02130 02134 const u8 *addr; 02135 } assoc_info; 02136 02140 struct disassoc_info { 02144 const u8 *addr; 02145 02150 u16 reason_code; 02151 } disassoc_info; 02152 02156 struct deauth_info { 02160 const u8 *addr; 02161 02166 u16 reason_code; 02167 } deauth_info; 02168 02172 struct michael_mic_failure { 02173 int unicast; 02174 const u8 *src; 02175 } michael_mic_failure; 02176 02180 struct interface_status { 02181 char ifname[100]; 02182 enum { 02183 EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED 02184 } ievent; 02185 } interface_status; 02186 02190 struct pmkid_candidate { 02192 u8 bssid[ETH_ALEN]; 02194 int index; 02196 int preauth; 02197 } pmkid_candidate; 02198 02202 struct stkstart { 02203 u8 peer[ETH_ALEN]; 02204 } stkstart; 02205 02215 struct ft_ies { 02216 const u8 *ies; 02217 size_t ies_len; 02218 int ft_action; 02219 u8 target_ap[ETH_ALEN]; 02221 const u8 *ric_ies; 02223 size_t ric_ies_len; 02224 } ft_ies; 02225 02229 struct ibss_rsn_start { 02230 u8 peer[ETH_ALEN]; 02231 } ibss_rsn_start; 02232 02236 struct auth_info { 02237 u8 peer[ETH_ALEN]; 02238 u16 auth_type; 02239 u16 status_code; 02240 const u8 *ies; 02241 size_t ies_len; 02242 } auth; 02243 02247 struct assoc_reject { 02259 u8 *resp_ies; 02260 02264 size_t resp_ies_len; 02265 02269 u16 status_code; 02270 } assoc_reject; 02271 02272 struct timeout_event { 02273 u8 addr[ETH_ALEN]; 02274 } timeout_event; 02275 02279 struct ft_rrb_rx { 02280 const u8 *src; 02281 const u8 *data; 02282 size_t data_len; 02283 } ft_rrb_rx; 02284 02288 struct tx_status { 02289 u16 type; 02290 u16 stype; 02291 const u8 *dst; 02292 const u8 *data; 02293 size_t data_len; 02294 int ack; 02295 } tx_status; 02296 02300 struct rx_from_unknown { 02301 const u8 *frame; 02302 size_t len; 02303 } rx_from_unknown; 02304 02308 struct rx_mgmt { 02309 const u8 *frame; 02310 size_t frame_len; 02311 u32 datarate; 02312 u32 ssi_signal; 02313 } rx_mgmt; 02314 02318 struct rx_action { 02322 const u8 *da; 02323 02327 const u8 *sa; 02328 02332 const u8 *bssid; 02333 02337 u8 category; 02338 02342 const u8 *data; 02343 02347 size_t len; 02348 02352 int freq; 02353 } rx_action; 02354 02360 struct remain_on_channel { 02364 unsigned int freq; 02365 02369 unsigned int duration; 02370 } remain_on_channel; 02371 02381 struct scan_info { 02382 int aborted; 02383 const int *freqs; 02384 size_t num_freqs; 02385 struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS]; 02386 size_t num_ssids; 02387 } scan_info; 02388 02392 struct mlme_rx { 02393 const u8 *buf; 02394 size_t len; 02395 int freq; 02396 int channel; 02397 int ssi; 02398 } mlme_rx; 02399 02403 struct rx_probe_req { 02407 const u8 *sa; 02408 02412 const u8 *ie; 02413 02417 size_t ie_len; 02418 } rx_probe_req; 02419 02423 struct new_sta { 02424 const u8 *addr; 02425 } new_sta; 02426 02430 struct eapol_rx { 02431 const u8 *src; 02432 const u8 *data; 02433 size_t data_len; 02434 } eapol_rx; 02435 02439 struct signal_change { 02440 int above_threshold; 02441 } signal_change; 02442 }; 02443 02454 void wpa_supplicant_event(void *ctx, enum wpa_event_type event, 02455 union wpa_event_data *data); 02456 02457 02458 /* 02459 * The following inline functions are provided for convenience to simplify 02460 * event indication for some of the common events. 02461 */ 02462 02463 static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie, 02464 size_t ielen) 02465 { 02466 union wpa_event_data event; 02467 os_memset(&event, 0, sizeof(event)); 02468 event.assoc_info.req_ies = ie; 02469 event.assoc_info.req_ies_len = ielen; 02470 event.assoc_info.addr = addr; 02471 wpa_supplicant_event(ctx, EVENT_ASSOC, &event); 02472 } 02473 02474 static inline void drv_event_disassoc(void *ctx, const u8 *addr) 02475 { 02476 union wpa_event_data event; 02477 os_memset(&event, 0, sizeof(event)); 02478 event.disassoc_info.addr = addr; 02479 wpa_supplicant_event(ctx, EVENT_DISASSOC, &event); 02480 } 02481 02482 static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data, 02483 size_t data_len) 02484 { 02485 union wpa_event_data event; 02486 os_memset(&event, 0, sizeof(event)); 02487 event.eapol_rx.src = src; 02488 event.eapol_rx.data = data; 02489 event.eapol_rx.data_len = data_len; 02490 wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event); 02491 } 02492 02493 #endif /* DRIVER_H */