wpa_supplicant / hostapd 2.0

driver.h

Go to the documentation of this file.
00001 
00018 #ifndef DRIVER_H
00019 #define DRIVER_H
00020 
00021 #define WPA_SUPPLICANT_DRIVER_VERSION 4
00022 
00023 #include "common/defs.h"
00024 
00025 #define HOSTAPD_CHAN_DISABLED 0x00000001
00026 #define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002
00027 #define HOSTAPD_CHAN_NO_IBSS 0x00000004
00028 #define HOSTAPD_CHAN_RADAR 0x00000008
00029 #define HOSTAPD_CHAN_HT40PLUS 0x00000010
00030 #define HOSTAPD_CHAN_HT40MINUS 0x00000020
00031 #define HOSTAPD_CHAN_HT40 0x00000040
00032 
00037 struct hostapd_channel_data {
00042         short chan;
00043 
00048         short freq;
00049 
00054         int flag;
00055 
00060         u8 max_tx_power;
00061 };
00062 
00063 #define HOSTAPD_MODE_FLAG_HT_INFO_KNOWN BIT(0)
00064 
00069 struct hostapd_hw_modes {
00074         enum hostapd_hw_mode mode;
00075 
00080         int num_channels;
00081 
00086         struct hostapd_channel_data *channels;
00087 
00092         int num_rates;
00093 
00098         int *rates;
00099 
00104         u16 ht_capab;
00105 
00110         u8 mcs_set[16];
00111 
00116         u8 a_mpdu_params;
00117 
00118         unsigned int flags; /* HOSTAPD_MODE_FLAG_* */
00119 };
00120 
00121 
00122 #define IEEE80211_MODE_INFRA    0
00123 #define IEEE80211_MODE_IBSS     1
00124 #define IEEE80211_MODE_AP       2
00125 
00126 #define IEEE80211_CAP_ESS       0x0001
00127 #define IEEE80211_CAP_IBSS      0x0002
00128 #define IEEE80211_CAP_PRIVACY   0x0010
00129 
00130 #define WPA_SCAN_QUAL_INVALID           BIT(0)
00131 #define WPA_SCAN_NOISE_INVALID          BIT(1)
00132 #define WPA_SCAN_LEVEL_INVALID          BIT(2)
00133 #define WPA_SCAN_LEVEL_DBM              BIT(3)
00134 #define WPA_SCAN_AUTHENTICATED          BIT(4)
00135 #define WPA_SCAN_ASSOCIATED             BIT(5)
00136 
00163 struct wpa_scan_res {
00164         unsigned int flags;
00165         u8 bssid[ETH_ALEN];
00166         int freq;
00167         u16 beacon_int;
00168         u16 caps;
00169         int qual;
00170         int noise;
00171         int level;
00172         u64 tsf;
00173         unsigned int age;
00174         size_t ie_len;
00175         size_t beacon_ie_len;
00176         /*
00177          * Followed by ie_len octets of IEs from Probe Response frame (or if
00178          * the driver does not indicate source of IEs, these may also be from
00179          * Beacon frame). After the first set of IEs, another set of IEs may
00180          * follow (with beacon_ie_len octets of data) if the driver provides
00181          * both IE sets.
00182          */
00183 };
00184 
00191 struct wpa_scan_results {
00192         struct wpa_scan_res **res;
00193         size_t num;
00194 };
00195 
00207 struct wpa_interface_info {
00208         struct wpa_interface_info *next;
00209         char *ifname;
00210         char *desc;
00211         const char *drv_name;
00212 };
00213 
00214 #define WPAS_MAX_SCAN_SSIDS 16
00215 
00221 struct wpa_driver_scan_params {
00226         struct wpa_driver_scan_ssid {
00233                 const u8 *ssid;
00237                 size_t ssid_len;
00238         } ssids[WPAS_MAX_SCAN_SSIDS];
00239 
00245         size_t num_ssids;
00246 
00251         const u8 *extra_ies;
00252 
00257         size_t extra_ies_len;
00258 
00265         int *freqs;
00266 
00282         struct wpa_driver_scan_filter {
00283                 u8 ssid[32];
00284                 size_t ssid_len;
00285         } *filter_ssids;
00286 
00291         size_t num_filter_ssids;
00292 
00301         u8 p2p_probe;
00302 };
00303 
00309 struct wpa_driver_auth_params {
00310         int freq;
00311         const u8 *bssid;
00312         const u8 *ssid;
00313         size_t ssid_len;
00314         int auth_alg;
00315         const u8 *ie;
00316         size_t ie_len;
00317         const u8 *wep_key[4];
00318         size_t wep_key_len[4];
00319         int wep_tx_keyidx;
00320         int local_state_change;
00321 
00326         int p2p;
00327 
00328 };
00329 
00330 enum wps_mode {
00331         WPS_MODE_NONE /* no WPS provisioning being used */,
00332         WPS_MODE_OPEN /* WPS provisioning with AP that is in open mode */,
00333         WPS_MODE_PRIVACY /* WPS provisioning with AP that is using protection
00334                           */
00335 };
00336 
00342 struct wpa_driver_associate_params {
00348         const u8 *bssid;
00349 
00354         const u8 *ssid;
00355 
00360         size_t ssid_len;
00361 
00368         int freq;
00369 
00376         int bg_scan_period;
00377 
00397         const u8 *wpa_ie;
00398 
00403         size_t wpa_ie_len;
00404 
00409         unsigned int wpa_proto;
00410 
00417         enum wpa_cipher pairwise_suite;
00418 
00425         enum wpa_cipher group_suite;
00426 
00433         enum wpa_key_mgmt key_mgmt_suite;
00434 
00440         int auth_alg;
00441 
00446         int mode;
00447 
00452         const u8 *wep_key[4];
00453 
00458         size_t wep_key_len[4];
00459 
00464         int wep_tx_keyidx;
00465 
00470         enum mfp_options mgmt_frame_protection;
00471 
00494         const u8 *ft_ies;
00495 
00500         size_t ft_ies_len;
00501 
00510         const u8 *ft_md;
00511 
00522         const char *passphrase;
00523 
00533         const u8 *psk;
00534 
00543         int drop_unencrypted;
00544 
00552         const u8 *prev_bssid;
00553 
00562         enum wps_mode wps;
00563 
00568         int p2p;
00569 
00577         int uapsd;
00578 
00585         int fixed_bssid;
00586 
00591         int disable_ht;
00592 
00598         const u8 *htcaps;       /* struct ieee80211_ht_capabilities * */
00599         const u8 *htcaps_mask;  /* struct ieee80211_ht_capabilities * */
00600 };
00601 
00602 enum hide_ssid {
00603         NO_SSID_HIDING,
00604         HIDDEN_SSID_ZERO_LEN,
00605         HIDDEN_SSID_ZERO_CONTENTS
00606 };
00607 
00608 struct wpa_driver_ap_params {
00613         const u8 *head;
00614 
00619         size_t head_len;
00620 
00625         const u8 *tail;
00626 
00631         size_t tail_len;
00632 
00637         int dtim_period;
00638 
00643         int beacon_int;
00644 
00651         int *basic_rates;
00652 
00660         const u8 *proberesp;
00661 
00666         size_t proberesp_len;
00667 
00672         const u8 *ssid;
00673 
00678         size_t ssid_len;
00679 
00684         enum hide_ssid hide_ssid;
00685 
00690         unsigned int pairwise_ciphers;
00691 
00696         unsigned int group_cipher;
00697 
00702         unsigned int key_mgmt_suites;
00703 
00708         unsigned int auth_algs;
00709 
00714         unsigned int wpa_version;
00715 
00720         int privacy;
00721 
00729         const struct wpabuf *beacon_ies;
00730 
00738         const struct wpabuf *proberesp_ies;
00739 
00747         const struct wpabuf *assocresp_ies;
00748 
00756         int isolate;
00757 
00762         int cts_protect;
00763 
00768         int preamble;
00769 
00777         int short_slot_time;
00778 
00783         int ht_opmode;
00784 
00789         int interworking;
00790 
00795         const u8 *hessid;
00796 
00804         u8 access_network_type;
00805 
00812         int ap_max_inactivity;
00813 };
00814 
00819 struct wpa_driver_capa {
00820 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA            0x00000001
00821 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2           0x00000002
00822 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK        0x00000004
00823 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK       0x00000008
00824 #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE       0x00000010
00825 #define WPA_DRIVER_CAPA_KEY_MGMT_FT             0x00000020
00826 #define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK         0x00000040
00827         unsigned int key_mgmt;
00828 
00829 #define WPA_DRIVER_CAPA_ENC_WEP40       0x00000001
00830 #define WPA_DRIVER_CAPA_ENC_WEP104      0x00000002
00831 #define WPA_DRIVER_CAPA_ENC_TKIP        0x00000004
00832 #define WPA_DRIVER_CAPA_ENC_CCMP        0x00000008
00833         unsigned int enc;
00834 
00835 #define WPA_DRIVER_AUTH_OPEN            0x00000001
00836 #define WPA_DRIVER_AUTH_SHARED          0x00000002
00837 #define WPA_DRIVER_AUTH_LEAP            0x00000004
00838         unsigned int auth;
00839 
00840 /* Driver generated WPA/RSN IE */
00841 #define WPA_DRIVER_FLAGS_DRIVER_IE      0x00000001
00842 /* Driver needs static WEP key setup after association command */
00843 #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
00844 /* unused: 0x00000004 */
00845 /* Driver takes care of RSN 4-way handshake internally; PMK is configured with
00846  * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
00847 #define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008
00848 #define WPA_DRIVER_FLAGS_WIRED          0x00000010
00849 /* Driver provides separate commands for authentication and association (SME in
00850  * wpa_supplicant). */
00851 #define WPA_DRIVER_FLAGS_SME            0x00000020
00852 /* Driver supports AP mode */
00853 #define WPA_DRIVER_FLAGS_AP             0x00000040
00854 /* Driver needs static WEP key setup after association has been completed */
00855 #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE      0x00000080
00856 /* Driver takes care of P2P management operations */
00857 #define WPA_DRIVER_FLAGS_P2P_MGMT       0x00000100
00858 /* Driver supports concurrent P2P operations */
00859 #define WPA_DRIVER_FLAGS_P2P_CONCURRENT 0x00000200
00860 /*
00861  * Driver uses the initial interface as a dedicated management interface, i.e.,
00862  * it cannot be used for P2P group operations or non-P2P purposes.
00863  */
00864 #define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE        0x00000400
00865 /* This interface is P2P capable (P2P Device, GO, or P2P Client */
00866 #define WPA_DRIVER_FLAGS_P2P_CAPABLE    0x00000800
00867 /* Driver supports concurrent operations on multiple channels */
00868 #define WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT       0x00001000
00869 /*
00870  * Driver uses the initial interface for P2P management interface and non-P2P
00871  * purposes (e.g., connect to infra AP), but this interface cannot be used for
00872  * P2P group operations.
00873  */
00874 #define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P           0x00002000
00875 /*
00876  * Driver is known to use sane error codes, i.e., when it indicates that
00877  * something (e.g., association) fails, there was indeed a failure and the
00878  * operation does not end up getting completed successfully later.
00879  */
00880 #define WPA_DRIVER_FLAGS_SANE_ERROR_CODES               0x00004000
00881 /* Driver supports off-channel TX */
00882 #define WPA_DRIVER_FLAGS_OFFCHANNEL_TX                  0x00008000
00883 /* Driver indicates TX status events for EAPOL Data frames */
00884 #define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS                0x00010000
00885 /* Driver indicates TX status events for Deauth/Disassoc frames */
00886 #define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS               0x00020000
00887 /* Driver supports roaming (BSS selection) in firmware */
00888 #define WPA_DRIVER_FLAGS_BSS_SELECTION                  0x00040000
00889 /* Driver supports operating as a TDLS peer */
00890 #define WPA_DRIVER_FLAGS_TDLS_SUPPORT                   0x00080000
00891 /* Driver requires external TDLS setup/teardown/discovery */
00892 #define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP            0x00100000
00893 /* Driver indicates support for Probe Response offloading in AP mode */
00894 #define WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD             0x00200000
00895 /* Driver supports U-APSD in AP mode */
00896 #define WPA_DRIVER_FLAGS_AP_UAPSD                       0x00400000
00897 /* Driver supports inactivity timer in AP mode */
00898 #define WPA_DRIVER_FLAGS_INACTIVITY_TIMER               0x00800000
00899         unsigned int flags;
00900 
00901         int max_scan_ssids;
00902         int max_sched_scan_ssids;
00903         int sched_scan_supported;
00904         int max_match_sets;
00905 
00910         unsigned int max_remain_on_chan;
00911 
00917         unsigned int max_stations;
00918 
00924 /* Driver Probe Response offloading support for WPS ver. 1 */
00925 #define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS               0x00000001
00926 /* Driver Probe Response offloading support for WPS ver. 2 */
00927 #define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS2              0x00000002
00928 /* Driver Probe Response offloading support for P2P */
00929 #define WPA_DRIVER_PROBE_RESP_OFFLOAD_P2P               0x00000004
00930 /* Driver Probe Response offloading support for IEEE 802.11u (Interworking) */
00931 #define WPA_DRIVER_PROBE_RESP_OFFLOAD_INTERWORKING      0x00000008
00932         unsigned int probe_resp_offloads;
00933 };
00934 
00935 
00936 struct hostapd_data;
00937 
00938 struct hostap_sta_driver_data {
00939         unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
00940         unsigned long current_tx_rate;
00941         unsigned long inactive_msec;
00942         unsigned long flags;
00943         unsigned long num_ps_buf_frames;
00944         unsigned long tx_retry_failed;
00945         unsigned long tx_retry_count;
00946         int last_rssi;
00947         int last_ack_rssi;
00948 };
00949 
00950 struct hostapd_sta_add_params {
00951         const u8 *addr;
00952         u16 aid;
00953         u16 capability;
00954         const u8 *supp_rates;
00955         size_t supp_rates_len;
00956         u16 listen_interval;
00957         const struct ieee80211_ht_capabilities *ht_capabilities;
00958         u32 flags; /* bitmask of WPA_STA_* flags */
00959         int set; /* Set STA parameters instead of add */
00960         u8 qosinfo;
00961 };
00962 
00963 struct hostapd_freq_params {
00964         int mode;
00965         int freq;
00966         int channel;
00967         int ht_enabled;
00968         int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
00969                                  * secondary channel below primary, 1 = HT40
00970                                  * enabled, secondary channel above primary */
00971 };
00972 
00973 enum wpa_driver_if_type {
00978         WPA_IF_STATION,
00979 
00987         WPA_IF_AP_VLAN,
00988 
00995         WPA_IF_AP_BSS,
00996 
01001         WPA_IF_P2P_GO,
01002 
01007         WPA_IF_P2P_CLIENT,
01008 
01014         WPA_IF_P2P_GROUP
01015 };
01016 
01017 struct wpa_init_params {
01018         void *global_priv;
01019         const u8 *bssid;
01020         const char *ifname;
01021         const u8 *ssid;
01022         size_t ssid_len;
01023         const char *test_socket;
01024         int use_pae_group_addr;
01025         char **bridge;
01026         size_t num_bridge;
01027 
01028         u8 *own_addr; /* buffer for writing own MAC address */
01029 };
01030 
01031 
01032 struct wpa_bss_params {
01034         const char *ifname;
01036         int enabled;
01037 
01038         int wpa;
01039         int ieee802_1x;
01040         int wpa_group;
01041         int wpa_pairwise;
01042         int wpa_key_mgmt;
01043         int rsn_preauth;
01044         enum mfp_options ieee80211w;
01045 };
01046 
01047 #define WPA_STA_AUTHORIZED BIT(0)
01048 #define WPA_STA_WMM BIT(1)
01049 #define WPA_STA_SHORT_PREAMBLE BIT(2)
01050 #define WPA_STA_MFP BIT(3)
01051 #define WPA_STA_TDLS_PEER BIT(4)
01052 
01057 struct p2p_params {
01058         const char *dev_name;
01059         u8 pri_dev_type[8];
01060 #define DRV_MAX_SEC_DEV_TYPES 5
01061         u8 sec_dev_type[DRV_MAX_SEC_DEV_TYPES][8];
01062         size_t num_sec_dev_types;
01063 };
01064 
01065 enum tdls_oper {
01066         TDLS_DISCOVERY_REQ,
01067         TDLS_SETUP,
01068         TDLS_TEARDOWN,
01069         TDLS_ENABLE_LINK,
01070         TDLS_DISABLE_LINK,
01071         TDLS_ENABLE,
01072         TDLS_DISABLE
01073 };
01074 
01079 struct wpa_signal_info {
01080         u32 frequency;
01081         int above_threshold;
01082         int current_signal;
01083         int current_noise;
01084         int current_txrate;
01085 };
01086 
01095 struct wpa_driver_ops {
01097         const char *name;
01099         const char *desc;
01100 
01113         int (*get_bssid)(void *priv, u8 *bssid);
01114 
01131         int (*get_ssid)(void *priv, u8 *ssid);
01132 
01182         int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg,
01183                        const u8 *addr, int key_idx, int set_tx,
01184                        const u8 *seq, size_t seq_len,
01185                        const u8 *key, size_t key_len);
01186 
01211         void * (*init)(void *ctx, const char *ifname);
01212 
01221         void (*deinit)(void *priv);
01222 
01234         int (*set_param)(void *priv, const char *param);
01235 
01247         int (*set_countermeasures)(void *priv, int enabled);
01248 
01259         int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
01260 
01271         int (*disassociate)(void *priv, const u8 *addr, int reason_code);
01272 
01281         int (*associate)(void *priv,
01282                          struct wpa_driver_associate_params *params);
01283 
01302         int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
01303 
01323         int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
01324 
01342         int (*flush_pmkid)(void *priv);
01343 
01353         int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
01354 
01368         void (*poll)(void *priv);
01369 
01382         const char * (*get_ifname)(void *priv);
01383 
01395         const u8 * (*get_mac_addr)(void *priv);
01396 
01416         int (*send_eapol)(void *priv, const u8 *dest, u16 proto,
01417                           const u8 *data, size_t data_len);
01418 
01432         int (*set_operstate)(void *priv, int state);
01433 
01451         int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
01452                                   int key_type);
01453 
01463         struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
01464                                                          u16 *num_modes,
01465                                                          u16 *flags);
01466 
01476         int (*send_mlme)(void *priv, const u8 *data, size_t data_len,
01477                          int noack);
01478 
01495         int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies,
01496                              size_t ies_len);
01497 
01512         int (*send_ft_action)(void *priv, u8 action, const u8 *target_ap,
01513                               const u8 *ies, size_t ies_len);
01514 
01523          struct wpa_scan_results * (*get_scan_results2)(void *priv);
01524 
01535         int (*set_country)(void *priv, const char *alpha2);
01536 
01549         void * (*global_init)(void);
01550 
01559         void (*global_deinit)(void *priv);
01560 
01573         void * (*init2)(void *ctx, const char *ifname, void *global_priv);
01574 
01583         struct wpa_interface_info * (*get_interfaces)(void *global_priv);
01584 
01597         int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
01598 
01612         int (*authenticate)(void *priv,
01613                             struct wpa_driver_auth_params *params);
01614 
01635         int (*set_ap)(void *priv, struct wpa_driver_ap_params *params);
01636 
01647         void * (*hapd_init)(struct hostapd_data *hapd,
01648                             struct wpa_init_params *params);
01649 
01655         void (*hapd_deinit)(void *priv);
01656 
01672         int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
01673 
01687         int (*set_privacy)(void *priv, int enabled);
01688 
01704         int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
01705                           int idx, u8 *seq);
01706 
01717         int (*flush)(void *priv);
01718 
01734         int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
01735 
01744         int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
01745                              const u8 *addr);
01746 
01760         int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
01761                                size_t data_len, int encrypt,
01762                                const u8 *own_addr, u32 flags);
01763 
01776         int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
01777                           int reason);
01778 
01791         int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
01792                             int reason);
01793 
01801         int (*sta_remove)(void *priv, const u8 *addr);
01802 
01814         int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
01815 
01826         int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
01827 
01838         int (*hapd_set_countermeasures)(void *priv, int enabled);
01839 
01854         int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
01855 
01863         int (*get_inact_sec)(void *priv, const u8 *addr);
01864 
01872         int (*sta_clear_stats)(void *priv, const u8 *addr);
01873 
01881         int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
01882 
01890         int (*set_rts)(void *priv, int rts);
01891 
01899         int (*set_frag)(void *priv, int frag);
01900 
01911         int (*sta_set_flags)(void *priv, const u8 *addr,
01912                              int total_flags, int flags_or, int flags_and);
01913 
01924         int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
01925                                    int cw_max, int burst_time);
01926 
01946         int (*if_add)(void *priv, enum wpa_driver_if_type type,
01947                       const char *ifname, const u8 *addr, void *bss_ctx,
01948                       void **drv_priv, char *force_ifname, u8 *if_addr,
01949                       const char *bridge);
01950 
01959         int (*if_remove)(void *priv, enum wpa_driver_if_type type,
01960                          const char *ifname);
01961 
01977         int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
01978                             int vlan_id);
01979 
01991         int (*commit)(void *priv);
01992 
02004         int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
02005                           const u8 *data, size_t data_len);
02006 
02016         int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted, 
02017                                    u32 session_timeout);
02018 
02026         int (*set_radius_acl_expire)(void *priv, const u8 *mac);
02027 
02057         int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
02058                              const struct wpabuf *proberesp,
02059                              const struct wpabuf *assocresp);
02060 
02068         int (*set_supp_port)(void *priv, int authorized);
02069 
02081         int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
02082                            const char *bridge_ifname);
02083 
02111         int (*send_action)(void *priv, unsigned int freq, unsigned int wait,
02112                            const u8 *dst, const u8 *src, const u8 *bssid,
02113                            const u8 *data, size_t data_len, int no_cck);
02114 
02124         void (*send_action_cancel_wait)(void *priv);
02125 
02149         int (*remain_on_channel)(void *priv, unsigned int freq,
02150                                  unsigned int duration);
02151 
02164         int (*cancel_remain_on_channel)(void *priv);
02165 
02181         int (*probe_req_report)(void *priv, int report);
02182 
02193         int (*deinit_ap)(void *priv);
02194 
02204         int (*deinit_p2p_cli)(void *priv);
02205 
02211         void (*suspend)(void *priv);
02212 
02218         void (*resume)(void *priv);
02219 
02235         int (*signal_monitor)(void *priv, int threshold, int hysteresis);
02236 
02249         int (*send_frame)(void *priv, const u8 *data, size_t data_len,
02250                           int encrypt);
02251 
02263         int (*shared_freq)(void *priv);
02264 
02277         int (*get_noa)(void *priv, u8 *buf, size_t buf_len);
02278 
02292         int (*set_noa)(void *priv, u8 count, int start, int duration);
02293 
02303         int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
02304                                  int ctwindow);
02305 
02313         int (*ampdu)(void *priv, int ampdu);
02314 
02327         const char * (*get_radio_name)(void *priv);
02328 
02341         int (*p2p_find)(void *priv, unsigned int timeout, int type);
02342 
02353         int (*p2p_stop_find)(void *priv);
02354 
02371         int (*p2p_listen)(void *priv, unsigned int timeout);
02372 
02390         int (*p2p_connect)(void *priv, const u8 *peer_addr, int wps_method,
02391                            int go_intent, const u8 *own_interface_addr,
02392                            unsigned int force_freq, int persistent_group);
02393 
02409         int (*wps_success_cb)(void *priv, const u8 *peer_addr);
02410 
02425         int (*p2p_group_formation_failed)(void *priv);
02426 
02438         int (*p2p_set_params)(void *priv, const struct p2p_params *params);
02439 
02461         int (*p2p_prov_disc_req)(void *priv, const u8 *peer_addr,
02462                                  u16 config_methods, int join);
02463 
02479         u64 (*p2p_sd_request)(void *priv, const u8 *dst,
02480                               const struct wpabuf *tlvs);
02481 
02493         int (*p2p_sd_cancel_request)(void *priv, u64 req);
02494 
02512         int (*p2p_sd_response)(void *priv, int freq, const u8 *dst,
02513                                u8 dialog_token,
02514                                const struct wpabuf *resp_tlvs);
02515 
02531         int (*p2p_service_update)(void *priv);
02532 
02540         int (*p2p_reject)(void *priv, const u8 *addr);
02541 
02555         int (*p2p_invite)(void *priv, const u8 *peer, int role,
02556                           const u8 *bssid, const u8 *ssid, size_t ssid_len,
02557                           const u8 *go_dev_addr, int persistent_group);
02558 
02574         int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
02575                               u8 dialog_token, u16 status_code,
02576                               const u8 *buf, size_t len);
02577 
02589         int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
02590 
02597         int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
02598 
02612         int (*set_authmode)(void *priv, int authmode);
02613 
02626         void (*set_rekey_info)(void *priv, const u8 *kek, const u8 *kck,
02627                                const u8 *replay_ctr);
02628 
02644          int (*sta_assoc)(void *priv, const u8 *own_addr, const u8 *addr,
02645                           int reassoc, u16 status, const u8 *ie, size_t len);
02646 
02661          int (*sta_auth)(void *priv, const u8 *own_addr, const u8 *addr,
02662                          u16 seq, u16 status, const u8 *ie, size_t len);
02663 
02676          int (*add_tspec)(void *priv, const u8 *addr, u8 *tspec_ie,
02677                           size_t tspec_ielen);
02678 
02690         int (*add_sta_node)(void *priv, const u8 *addr, u16 auth_alg);
02691 
02708         int (*sched_scan)(void *priv, struct wpa_driver_scan_params *params,
02709                           u32 interval);
02710 
02721         int (*stop_sched_scan)(void *priv);
02722 
02735         void (*poll_client)(void *priv, const u8 *own_addr,
02736                             const u8 *addr, int qos);
02737 
02749         int (*radio_disable)(void *priv, int disabled);
02750 };
02751 
02752 
02756 enum wpa_event_type {
02770         EVENT_ASSOC,
02771 
02783         EVENT_DISASSOC,
02784 
02795         EVENT_MICHAEL_MIC_FAILURE,
02796 
02812         EVENT_SCAN_RESULTS,
02813 
02826         EVENT_ASSOCINFO,
02827 
02838         EVENT_INTERFACE_STATUS,
02839 
02865         EVENT_PMKID_CANDIDATE,
02866 
02877         EVENT_STKSTART,
02878 
02885         EVENT_TDLS,
02886 
02895         EVENT_FT_RESPONSE,
02896 
02906         EVENT_IBSS_RSN_START,
02907 
02918         EVENT_AUTH,
02919 
02929         EVENT_DEAUTH,
02930 
02939         EVENT_ASSOC_REJECT,
02940 
02945         EVENT_AUTH_TIMED_OUT,
02946 
02951         EVENT_ASSOC_TIMED_OUT,
02952 
02957         EVENT_FT_RRB_RX,
02958 
02963         EVENT_WPS_BUTTON_PUSHED,
02964 
02969         EVENT_TX_STATUS,
02970 
02975         EVENT_RX_FROM_UNKNOWN,
02976 
02981         EVENT_RX_MGMT,
02982 
02991         EVENT_RX_ACTION,
02992 
03001         EVENT_REMAIN_ON_CHANNEL,
03002 
03012         EVENT_CANCEL_REMAIN_ON_CHANNEL,
03013 
03020         EVENT_MLME_RX,
03021 
03034         EVENT_RX_PROBE_REQ,
03035 
03046         EVENT_NEW_STA,
03047 
03057         EVENT_EAPOL_RX,
03058 
03067         EVENT_SIGNAL_CHANGE,
03068 
03076         EVENT_INTERFACE_ENABLED,
03077 
03085         EVENT_INTERFACE_DISABLED,
03086 
03095         EVENT_CHANNEL_LIST_CHANGED,
03096 
03110         EVENT_INTERFACE_UNAVAILABLE,
03111 
03119         EVENT_BEST_CHANNEL,
03120 
03130         EVENT_UNPROT_DEAUTH,
03131 
03141         EVENT_UNPROT_DISASSOC,
03142 
03150         EVENT_STATION_LOW_ACK,
03151 
03160         EVENT_P2P_DEV_FOUND,
03161 
03170         EVENT_P2P_GO_NEG_REQ_RX,
03171 
03180         EVENT_P2P_GO_NEG_COMPLETED,
03181 
03182         EVENT_P2P_PROV_DISC_REQUEST,
03183         EVENT_P2P_PROV_DISC_RESPONSE,
03184         EVENT_P2P_SD_REQUEST,
03185         EVENT_P2P_SD_RESPONSE,
03186 
03191         EVENT_IBSS_PEER_LOST,
03192 
03202         EVENT_DRIVER_GTK_REKEY,
03203 
03208         EVENT_SCHED_SCAN_STOPPED,
03209 
03217         EVENT_DRIVER_CLIENT_POLL_OK,
03218 
03223         EVENT_EAPOL_TX_STATUS
03224 };
03225 
03226 
03230 union wpa_event_data {
03240         struct assoc_info {
03245                 int reassoc;
03246 
03259                 const u8 *req_ies;
03260 
03265                 size_t req_ies_len;
03266 
03279                 const u8 *resp_ies;
03280 
03285                 size_t resp_ies_len;
03286 
03304                 const u8 *beacon_ies;
03305 
03309                 size_t beacon_ies_len;
03310 
03315                 unsigned int freq;
03316 
03321                 const u8 *addr;
03322         } assoc_info;
03323 
03328         struct disassoc_info {
03333                 const u8 *addr;
03334 
03340                 u16 reason_code;
03341 
03346                 const u8 *ie;
03347 
03352                 size_t ie_len;
03353 
03358                 int locally_generated;
03359         } disassoc_info;
03360 
03365         struct deauth_info {
03370                 const u8 *addr;
03371 
03377                 u16 reason_code;
03378 
03383                 const u8 *ie;
03384 
03389                 size_t ie_len;
03390 
03395                 int locally_generated;
03396         } deauth_info;
03397 
03402         struct michael_mic_failure {
03403                 int unicast;
03404                 const u8 *src;
03405         } michael_mic_failure;
03406 
03411         struct interface_status {
03412                 char ifname[100];
03413                 enum {
03414                         EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED
03415                 } ievent;
03416         } interface_status;
03417 
03422         struct pmkid_candidate {
03424                 u8 bssid[ETH_ALEN];
03426                 int index;
03428                 int preauth;
03429         } pmkid_candidate;
03430 
03435         struct stkstart {
03436                 u8 peer[ETH_ALEN];
03437         } stkstart;
03438 
03443         struct tdls {
03444                 u8 peer[ETH_ALEN];
03445                 enum {
03446                         TDLS_REQUEST_SETUP,
03447                         TDLS_REQUEST_TEARDOWN
03448                 } oper;
03449                 u16 reason_code; /* for teardown */
03450         } tdls;
03451 
03462         struct ft_ies {
03463                 const u8 *ies;
03464                 size_t ies_len;
03465                 int ft_action;
03466                 u8 target_ap[ETH_ALEN];
03468                 const u8 *ric_ies;
03470                 size_t ric_ies_len;
03471         } ft_ies;
03472 
03477         struct ibss_rsn_start {
03478                 u8 peer[ETH_ALEN];
03479         } ibss_rsn_start;
03480 
03485         struct auth_info {
03486                 u8 peer[ETH_ALEN];
03487                 u8 bssid[ETH_ALEN];
03488                 u16 auth_type;
03489                 u16 auth_transaction;
03490                 u16 status_code;
03491                 const u8 *ies;
03492                 size_t ies_len;
03493         } auth;
03494 
03499         struct assoc_reject {
03504                 const u8 *bssid;
03505 
03518                 const u8 *resp_ies;
03519 
03524                 size_t resp_ies_len;
03525 
03530                 u16 status_code;
03531         } assoc_reject;
03532 
03533         struct timeout_event {
03534                 u8 addr[ETH_ALEN];
03535         } timeout_event;
03536 
03541         struct ft_rrb_rx {
03542                 const u8 *src;
03543                 const u8 *data;
03544                 size_t data_len;
03545         } ft_rrb_rx;
03546 
03551         struct tx_status {
03552                 u16 type;
03553                 u16 stype;
03554                 const u8 *dst;
03555                 const u8 *data;
03556                 size_t data_len;
03557                 int ack;
03558         } tx_status;
03559 
03564         struct rx_from_unknown {
03565                 const u8 *bssid;
03566                 const u8 *addr;
03567                 int wds;
03568         } rx_from_unknown;
03569 
03574         struct rx_mgmt {
03575                 const u8 *frame;
03576                 size_t frame_len;
03577                 u32 datarate;
03578                 int ssi_signal; /* dBm */
03579         } rx_mgmt;
03580 
03585         struct rx_action {
03590                 const u8 *da;
03591 
03596                 const u8 *sa;
03597 
03602                 const u8 *bssid;
03603 
03608                 u8 category;
03609 
03614                 const u8 *data;
03615 
03620                 size_t len;
03621 
03626                 int freq;
03627         } rx_action;
03628 
03635         struct remain_on_channel {
03640                 unsigned int freq;
03641 
03646                 unsigned int duration;
03647         } remain_on_channel;
03648 
03659         struct scan_info {
03660                 int aborted;
03661                 const int *freqs;
03662                 size_t num_freqs;
03663                 struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
03664                 size_t num_ssids;
03665         } scan_info;
03666 
03671         struct mlme_rx {
03672                 const u8 *buf;
03673                 size_t len;
03674                 int freq;
03675                 int channel;
03676                 int ssi;
03677         } mlme_rx;
03678 
03683         struct rx_probe_req {
03688                 const u8 *sa;
03689 
03695                 const u8 *da;
03696 
03702                 const u8 *bssid;
03703 
03708                 const u8 *ie;
03709 
03714                 size_t ie_len;
03715 
03720                 int ssi_signal;
03721         } rx_probe_req;
03722 
03727         struct new_sta {
03728                 const u8 *addr;
03729         } new_sta;
03730 
03735         struct eapol_rx {
03736                 const u8 *src;
03737                 const u8 *data;
03738                 size_t data_len;
03739         } eapol_rx;
03740 
03745         struct wpa_signal_info signal_change;
03746 
03756         struct best_channel {
03757                 int freq_24;
03758                 int freq_5;
03759                 int freq_overall;
03760         } best_chan;
03761 
03762         struct unprot_deauth {
03763                 const u8 *sa;
03764                 const u8 *da;
03765                 u16 reason_code;
03766         } unprot_deauth;
03767 
03768         struct unprot_disassoc {
03769                 const u8 *sa;
03770                 const u8 *da;
03771                 u16 reason_code;
03772         } unprot_disassoc;
03773 
03779         struct low_ack {
03780                 u8 addr[ETH_ALEN];
03781         } low_ack;
03782 
03787         struct p2p_dev_found {
03788                 const u8 *addr;
03789                 const u8 *dev_addr;
03790                 const u8 *pri_dev_type;
03791                 const char *dev_name;
03792                 u16 config_methods;
03793                 u8 dev_capab;
03794                 u8 group_capab;
03795         } p2p_dev_found;
03796 
03801         struct p2p_go_neg_req_rx {
03802                 const u8 *src;
03803                 u16 dev_passwd_id;
03804         } p2p_go_neg_req_rx;
03805 
03810         struct p2p_go_neg_completed {
03811                 struct p2p_go_neg_results *res;
03812         } p2p_go_neg_completed;
03813 
03814         struct p2p_prov_disc_req {
03815                 const u8 *peer;
03816                 u16 config_methods;
03817                 const u8 *dev_addr;
03818                 const u8 *pri_dev_type;
03819                 const char *dev_name;
03820                 u16 supp_config_methods;
03821                 u8 dev_capab;
03822                 u8 group_capab;
03823         } p2p_prov_disc_req;
03824 
03825         struct p2p_prov_disc_resp {
03826                 const u8 *peer;
03827                 u16 config_methods;
03828         } p2p_prov_disc_resp;
03829 
03830         struct p2p_sd_req {
03831                 int freq;
03832                 const u8 *sa;
03833                 u8 dialog_token;
03834                 u16 update_indic;
03835                 const u8 *tlvs;
03836                 size_t tlvs_len;
03837         } p2p_sd_req;
03838 
03839         struct p2p_sd_resp {
03840                 const u8 *sa;
03841                 u16 update_indic;
03842                 const u8 *tlvs;
03843                 size_t tlvs_len;
03844         } p2p_sd_resp;
03845 
03850         struct ibss_peer_lost {
03851                 u8 peer[ETH_ALEN];
03852         } ibss_peer_lost;
03853 
03858         struct driver_gtk_rekey {
03859                 const u8 *bssid;
03860                 const u8 *replay_ctr;
03861         } driver_gtk_rekey;
03862 
03868         struct client_poll {
03869                 u8 addr[ETH_ALEN];
03870         } client_poll;
03871 
03882         struct eapol_tx_status {
03883                 const u8 *dst;
03884                 const u8 *data;
03885                 int data_len;
03886                 int ack;
03887         } eapol_tx_status;
03888 };
03889 
03901 void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
03902                           union wpa_event_data *data);
03903 
03904 
03905 /*
03906  * The following inline functions are provided for convenience to simplify
03907  * event indication for some of the common events.
03908  */
03909 
03910 static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
03911                                    size_t ielen, int reassoc)
03912 {
03913         union wpa_event_data event;
03914         os_memset(&event, 0, sizeof(event));
03915         event.assoc_info.reassoc = reassoc;
03916         event.assoc_info.req_ies = ie;
03917         event.assoc_info.req_ies_len = ielen;
03918         event.assoc_info.addr = addr;
03919         wpa_supplicant_event(ctx, EVENT_ASSOC, &event);
03920 }
03921 
03922 static inline void drv_event_disassoc(void *ctx, const u8 *addr)
03923 {
03924         union wpa_event_data event;
03925         os_memset(&event, 0, sizeof(event));
03926         event.disassoc_info.addr = addr;
03927         wpa_supplicant_event(ctx, EVENT_DISASSOC, &event);
03928 }
03929 
03930 static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
03931                                       size_t data_len)
03932 {
03933         union wpa_event_data event;
03934         os_memset(&event, 0, sizeof(event));
03935         event.eapol_rx.src = src;
03936         event.eapol_rx.data = data;
03937         event.eapol_rx.data_len = data_len;
03938         wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
03939 }
03940 
03941 /* driver_common.c */
03942 void wpa_scan_results_free(struct wpa_scan_results *res);
03943 
03944 /* Convert wpa_event_type to a string for logging */
03945 const char * event_to_string(enum wpa_event_type event);
03946 
03947 #endif /* DRIVER_H */
03948 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines