Remove unused set_retry() driver op
[wpasupplicant] / hostapd / driver_i.h
index c01ca22..20ac9a1 100644 (file)
 #ifndef DRIVER_I_H
 #define DRIVER_I_H
 
-#include "driver.h"
+#include "drivers/driver.h"
 #include "config.h"
 
 static inline void *
-hostapd_driver_init(struct hostapd_data *hapd)
+hostapd_driver_init(struct hostapd_data *hapd, const u8 *bssid)
 {
-       if (hapd->driver == NULL || hapd->driver->init == NULL)
+       struct wpa_init_params params;
+       void *ret;
+       size_t i;
+
+       if (hapd->driver == NULL || hapd->driver->hapd_init == NULL)
                return NULL;
-       return hapd->driver->init(hapd);
-}
 
-static inline void *
-hostapd_driver_init_bssid(struct hostapd_data *hapd, const u8 *bssid)
-{
-       if (hapd->driver == NULL || hapd->driver->init_bssid == NULL)
+       os_memset(&params, 0, sizeof(params));
+       params.bssid = bssid;
+       params.ifname = hapd->conf->iface;
+       params.ssid = (const u8 *) hapd->conf->ssid.ssid;
+       params.ssid_len = hapd->conf->ssid.ssid_len;
+       params.test_socket = hapd->conf->test_socket;
+       params.use_pae_group_addr = hapd->conf->use_pae_group_addr;
+
+       params.num_bridge = hapd->iface->num_bss;
+       params.bridge = os_zalloc(hapd->iface->num_bss * sizeof(char *));
+       if (params.bridge == NULL)
                return NULL;
-       return hapd->driver->init_bssid(hapd, bssid);
-}
+       for (i = 0; i < hapd->iface->num_bss; i++) {
+               struct hostapd_data *bss = hapd->iface->bss[i];
+               if (bss->conf->bridge[0])
+                       params.bridge[i] = bss->conf->bridge;
+       }
 
-static inline void
-hostapd_driver_deinit(struct hostapd_data *hapd)
-{
-       if (hapd->driver == NULL || hapd->driver->deinit == NULL)
-               return;
-       hapd->driver->deinit(hapd->drv_priv);
-}
+       params.own_addr = hapd->own_addr;
 
-static inline int
-hostapd_wireless_event_init(struct hostapd_data *hapd)
-{
-       if (hapd->driver == NULL ||
-           hapd->driver->wireless_event_init == NULL)
-               return 0;
-       return hapd->driver->wireless_event_init(hapd->drv_priv);
+       ret = hapd->driver->hapd_init(hapd, &params);
+       os_free(params.bridge);
+
+       return ret;
 }
 
 static inline void
-hostapd_wireless_event_deinit(struct hostapd_data *hapd)
+hostapd_driver_deinit(struct hostapd_data *hapd)
 {
-       if (hapd->driver == NULL ||
-           hapd->driver->wireless_event_deinit == NULL)
+       if (hapd->driver == NULL || hapd->driver->hapd_deinit == NULL)
                return;
-       hapd->driver->wireless_event_deinit(hapd->drv_priv);
+       hapd->driver->hapd_deinit(hapd->drv_priv);
 }
 
 static inline int
@@ -80,14 +82,16 @@ hostapd_set_privacy(struct hostapd_data *hapd, int enabled)
 }
 
 static inline int
-hostapd_set_encryption(const char *ifname, struct hostapd_data *hapd,
-                      const char *alg, const u8 *addr, int idx,
-                      u8 *key, size_t key_len, int txkey)
+hostapd_set_key(const char *ifname, struct hostapd_data *hapd,
+               wpa_alg alg, const u8 *addr, int key_idx,
+               int set_tx, const u8 *seq, size_t seq_len,
+               const u8 *key, size_t key_len)
 {
-       if (hapd->driver == NULL || hapd->driver->set_encryption == NULL)
+       if (hapd->driver == NULL || hapd->driver->hapd_set_key == NULL)
                return 0;
-       return hapd->driver->set_encryption(ifname, hapd->drv_priv, alg, addr,
-                                           idx, key, key_len, txkey);
+       return hapd->driver->hapd_set_key(ifname, hapd->drv_priv, alg, addr,
+                                         key_idx, set_tx, seq, seq_len, key,
+                                         key_len);
 }
 
 static inline int
@@ -141,10 +145,11 @@ static inline int
 hostapd_send_eapol(struct hostapd_data *hapd, const u8 *addr, const u8 *data,
                   size_t data_len, int encrypt)
 {
-       if (hapd->driver == NULL || hapd->driver->send_eapol == NULL)
+       if (hapd->driver == NULL || hapd->driver->hapd_send_eapol == NULL)
                return 0;
-       return hapd->driver->send_eapol(hapd->drv_priv, addr, data, data_len,
-                                       encrypt, hapd->own_addr);
+       return hapd->driver->hapd_send_eapol(hapd->drv_priv, addr, data,
+                                            data_len, encrypt,
+                                            hapd->own_addr);
 }
 
 static inline int
@@ -152,7 +157,8 @@ hostapd_sta_deauth(struct hostapd_data *hapd, const u8 *addr, int reason)
 {
        if (hapd->driver == NULL || hapd->driver->sta_deauth == NULL)
                return 0;
-       return hapd->driver->sta_deauth(hapd->drv_priv, addr, reason);
+       return hapd->driver->sta_deauth(hapd->drv_priv, hapd->own_addr, addr,
+                                       reason);
 }
 
 static inline int
@@ -160,7 +166,8 @@ hostapd_sta_disassoc(struct hostapd_data *hapd, const u8 *addr, int reason)
 {
        if (hapd->driver == NULL || hapd->driver->sta_disassoc == NULL)
                return 0;
-       return hapd->driver->sta_disassoc(hapd->drv_priv, addr, reason);
+       return hapd->driver->sta_disassoc(hapd->drv_priv, hapd->own_addr, addr,
+                                         reason);
 }
 
 static inline int
@@ -174,36 +181,36 @@ hostapd_sta_remove(struct hostapd_data *hapd, const u8 *addr)
 static inline int
 hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len)
 {
-       if (hapd->driver == NULL || hapd->driver->get_ssid == NULL)
+       if (hapd->driver == NULL || hapd->driver->hapd_get_ssid == NULL)
                return 0;
-       return hapd->driver->get_ssid(hapd->conf->iface, hapd->drv_priv, buf,
-                                     len);
+       return hapd->driver->hapd_get_ssid(hapd->conf->iface, hapd->drv_priv,
+                                          buf, len);
 }
 
 static inline int
 hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len)
 {
-       if (hapd->driver == NULL || hapd->driver->set_ssid == NULL)
+       if (hapd->driver == NULL || hapd->driver->hapd_set_ssid == NULL)
                return 0;
-       return hapd->driver->set_ssid(hapd->conf->iface, hapd->drv_priv, buf,
-                                     len);
+       return hapd->driver->hapd_set_ssid(hapd->conf->iface, hapd->drv_priv,
+                                          buf, len);
 }
 
 static inline int
-hostapd_send_mgmt_frame(struct hostapd_data *hapd, const void *msg, size_t len,
-                       int flags)
+hostapd_send_mgmt_frame(struct hostapd_data *hapd, const void *msg, size_t len)
 {
-       if (hapd->driver == NULL || hapd->driver->send_mgmt_frame == NULL)
+       if (hapd->driver == NULL || hapd->driver->send_mlme == NULL)
                return 0;
-       return hapd->driver->send_mgmt_frame(hapd->drv_priv, msg, len, flags);
+       return hapd->driver->send_mlme(hapd->drv_priv, msg, len);
 }
 
 static inline int
 hostapd_set_countermeasures(struct hostapd_data *hapd, int enabled)
 {
-       if (hapd->driver == NULL || hapd->driver->set_countermeasures == NULL)
+       if (hapd->driver == NULL ||
+           hapd->driver->hapd_set_countermeasures == NULL)
                return 0;
-       return hapd->driver->set_countermeasures(hapd->drv_priv, enabled);
+       return hapd->driver->hapd_set_countermeasures(hapd->drv_priv, enabled);
 }
 
 static inline int
@@ -212,29 +219,23 @@ hostapd_sta_add(const char *ifname, struct hostapd_data *hapd, const u8 *addr,
                size_t supp_rates_len, int flags, u16 listen_interval,
                const struct ht_cap_ie *ht_capabilities)
 {
+       struct hostapd_sta_add_params params;
+
        if (hapd->driver == NULL)
                return 0;
-
-       if (hapd->driver->sta_add2) {
-               struct hostapd_sta_add_params params;
-               os_memset(&params, 0, sizeof(params));
-               params.addr = addr;
-               params.aid = aid;
-               params.capability = capability;
-               params.supp_rates = supp_rates;
-               params.supp_rates_len = supp_rates_len;
-               params.flags = flags;
-               params.listen_interval = listen_interval;
-               params.ht_capabilities = ht_capabilities;
-               return hapd->driver->sta_add2(ifname, hapd->drv_priv, &params);
-       }
-
        if (hapd->driver->sta_add == NULL)
                return 0;
-       return hapd->driver->sta_add(ifname, hapd->drv_priv, addr, aid,
-                                    capability, (u8 *) supp_rates,
-                                    supp_rates_len,
-                                    flags, listen_interval);
+
+       os_memset(&params, 0, sizeof(params));
+       params.addr = addr;
+       params.aid = aid;
+       params.capability = capability;
+       params.supp_rates = supp_rates;
+       params.supp_rates_len = supp_rates_len;
+       params.flags = flags;
+       params.listen_interval = listen_interval;
+       params.ht_capabilities = ht_capabilities;
+       return hapd->driver->sta_add(ifname, hapd->drv_priv, &params);
 }
 
 static inline int
@@ -246,8 +247,8 @@ hostapd_get_inact_sec(struct hostapd_data *hapd, const u8 *addr)
 }
 
 static inline int
-hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq, int ht_enabled,
-                int sec_channel_offset)
+hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq, int channel,
+                int ht_enabled, int sec_channel_offset)
 {
        struct hostapd_freq_params data;
        if (hapd->driver == NULL)
@@ -257,6 +258,7 @@ hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq, int ht_enabled,
        os_memset(&data, 0, sizeof(data));
        data.mode = mode;
        data.freq = freq;
+       data.channel = channel;
        data.ht_enabled = ht_enabled;
        data.sec_channel_offset = sec_channel_offset;
        return hapd->driver->set_freq(hapd->drv_priv, &data);
@@ -271,14 +273,6 @@ hostapd_set_rts(struct hostapd_data *hapd, int rts)
 }
 
 static inline int
-hostapd_get_rts(struct hostapd_data *hapd, int *rts)
-{
-       if (hapd->driver == NULL || hapd->driver->get_rts == NULL)
-               return 0;
-       return hapd->driver->get_rts(hapd->drv_priv, rts);
-}
-
-static inline int
 hostapd_set_frag(struct hostapd_data *hapd, int frag)
 {
        if (hapd->driver == NULL || hapd->driver->set_frag == NULL)
@@ -287,32 +281,6 @@ hostapd_set_frag(struct hostapd_data *hapd, int frag)
 }
 
 static inline int
-hostapd_get_frag(struct hostapd_data *hapd, int *frag)
-{
-       if (hapd->driver == NULL || hapd->driver->get_frag == NULL)
-               return 0;
-       return hapd->driver->get_frag(hapd->drv_priv, frag);
-}
-
-static inline int
-hostapd_set_retry(struct hostapd_data *hapd, int short_retry, int long_retry)
-{
-       if (hapd->driver == NULL || hapd->driver->set_retry == NULL)
-               return 0;
-       return hapd->driver->set_retry(hapd->drv_priv, short_retry,
-                                      long_retry);
-}
-
-static inline int
-hostapd_get_retry(struct hostapd_data *hapd, int *short_retry, int *long_retry)
-{
-       if (hapd->driver == NULL || hapd->driver->get_retry == NULL)
-               return 0;
-       return hapd->driver->get_retry(hapd->drv_priv, short_retry,
-                                      long_retry);
-}
-
-static inline int
 hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
                      int total_flags, int flags_or, int flags_and)
 {
@@ -360,13 +328,14 @@ hostapd_sta_clear_stats(struct hostapd_data *hapd, const u8 *addr)
 
 static inline int
 hostapd_set_beacon(const char *ifname, struct hostapd_data *hapd,
-                  u8 *head, size_t head_len,
-                  u8 *tail, size_t tail_len)
+                  const u8 *head, size_t head_len,
+                  const u8 *tail, size_t tail_len, int dtim_period)
 {
-       if (hapd->driver == NULL || hapd->driver->set_beacon == NULL)
+       if (hapd->driver == NULL || hapd->driver->hapd_set_beacon == NULL)
                return 0;
-       return hapd->driver->set_beacon(ifname, hapd->drv_priv, head, head_len,
-                                       tail, tail_len);
+       return hapd->driver->hapd_set_beacon(ifname, hapd->drv_priv,
+                                            head, head_len,
+                                            tail, tail_len, dtim_period);
 }
 
 static inline int
@@ -386,15 +355,6 @@ hostapd_set_beacon_int(struct hostapd_data *hapd, int value)
 }
 
 static inline int
-hostapd_set_dtim_period(struct hostapd_data *hapd, int value)
-{
-       if (hapd->driver == NULL || hapd->driver->set_dtim_period == NULL)
-               return 0;
-       return hapd->driver->set_dtim_period(hapd->conf->iface, hapd->drv_priv,
-                                            value);
-}
-
-static inline int
 hostapd_set_broadcast_ssid(struct hostapd_data *hapd, int value)
 {
        if (hapd->driver == NULL || hapd->driver->set_broadcast_ssid == NULL)
@@ -411,15 +371,6 @@ hostapd_set_cts_protect(struct hostapd_data *hapd, int value)
 }
 
 static inline int
-hostapd_set_key_tx_rx_threshold(struct hostapd_data *hapd, int value)
-{
-       if (hapd->driver == NULL ||
-           hapd->driver->set_key_tx_rx_threshold == NULL)
-               return 0;
-       return hapd->driver->set_key_tx_rx_threshold(hapd->drv_priv, value);
-}
-
-static inline int
 hostapd_set_preamble(struct hostapd_data *hapd, int value)
 {
        if (hapd->driver == NULL || hapd->driver->set_preamble == NULL)
@@ -498,22 +449,12 @@ hostapd_if_remove(struct hostapd_data *hapd, enum hostapd_driver_if_type type,
        return hapd->driver->if_remove(hapd->drv_priv, type, ifname, addr);
 }
 
-static inline int
-hostapd_passive_scan(struct hostapd_data *hapd, int now, int our_mode_only,
-                    int interval, int _listen, int *channel,
-                    int *last_rx)
-{
-       if (hapd->driver == NULL || hapd->driver->passive_scan == NULL)
-               return -1;
-       return hapd->driver->passive_scan(hapd->drv_priv, now, our_mode_only,
-                                         interval, _listen, channel, last_rx);
-}
-
 static inline struct hostapd_hw_modes *
 hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
                            u16 *flags)
 {
-       if (hapd->driver == NULL || hapd->driver->get_hw_feature_data == NULL)
+       if (hapd->driver == NULL ||
+           hapd->driver->get_hw_feature_data == NULL)
                return NULL;
        return hapd->driver->get_hw_feature_data(hapd->drv_priv, num_modes,
                                                 flags);
@@ -596,12 +537,27 @@ hostapd_set_wps_probe_resp_ie(struct hostapd_data *hapd, const u8 *ie,
                                                   hapd->drv_priv, ie, len);
 }
 
-static inline const struct hostapd_neighbor_bss *
-hostapd_driver_get_neighbor_bss(struct hostapd_data *hapd, size_t *num)
+static inline int hostapd_driver_set_mode(struct hostapd_data *hapd, int mode)
 {
-       if (hapd->driver == NULL || hapd->driver->get_neighbor_bss == NULL)
-               return NULL;
-       return hapd->driver->get_neighbor_bss(hapd->drv_priv, num);
+       if (hapd->driver == NULL || hapd->driver->set_mode == NULL)
+               return 0;
+       return hapd->driver->set_mode(hapd->drv_priv, mode);
+}
+
+static inline int hostapd_driver_scan(struct hostapd_data *hapd,
+                                     struct wpa_driver_scan_params *params)
+{
+       if (hapd->driver && hapd->driver->scan2)
+               return hapd->driver->scan2(hapd->drv_priv, params);
+       return -1;
+}
+
+static inline struct wpa_scan_results * hostapd_driver_get_scan_results(
+       struct hostapd_data *hapd)
+{
+       if (hapd->driver && hapd->driver->get_scan_results2)
+               return hapd->driver->get_scan_results2(hapd->drv_priv);
+       return NULL;
 }
 
 #endif /* DRIVER_I_H */