/*
* hostapd - internal driver interface wrappers
* Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2007-2008, Intel Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
#include "config.h"
static inline void *
-hostapd_driver_init(struct hostapd_data *hapd)
+hostapd_driver_init(struct hostapd_data *hapd, const u8 *bssid)
{
+ struct wpa_init_params params;
+ void *ret;
+ size_t i;
+
if (hapd->driver == NULL || hapd->driver->hapd_init == NULL)
return NULL;
- return hapd->driver->hapd_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(¶ms, 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;
+ }
+
+ params.own_addr = hapd->own_addr;
+
+ ret = hapd->driver->hapd_init(hapd, ¶ms);
+ os_free(params.bridge);
+
+ return ret;
}
static inline void
}
static inline int
-hostapd_set_ieee8021x(const char *ifname, struct hostapd_data *hapd,
- int enabled)
+hostapd_set_ieee8021x(struct hostapd_data *hapd, struct wpa_bss_params *params)
{
if (hapd->driver == NULL || hapd->driver->set_ieee8021x == NULL)
return 0;
- return hapd->driver->set_ieee8021x(ifname, hapd->drv_priv, enabled);
+ return hapd->driver->set_ieee8021x(hapd->drv_priv, params);
}
static inline int
}
static inline int
-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->hapd_set_key == NULL)
- return 0;
- 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
hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
const u8 *addr, int idx, u8 *seq)
{
}
static inline int
-hostapd_get_seqnum_igtk(const char *ifname, struct hostapd_data *hapd,
- const u8 *addr, int idx, u8 *seq)
-{
- if (hapd->driver == NULL || hapd->driver->get_seqnum_igtk == NULL)
- return -1;
- return hapd->driver->get_seqnum_igtk(ifname, hapd->drv_priv, addr, idx,
- seq);
-}
-
-static inline int
hostapd_flush(struct hostapd_data *hapd)
{
if (hapd->driver == NULL || hapd->driver->flush == NULL)
}
static inline int
-hostapd_read_sta_data(struct hostapd_data *hapd,
- struct hostap_sta_driver_data *data, const u8 *addr)
-{
- if (hapd->driver == NULL || hapd->driver->read_sta_data == NULL)
- return -1;
- return hapd->driver->read_sta_data(hapd->drv_priv, data, addr);
-}
-
-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->hapd_send_eapol == NULL)
- return 0;
- return hapd->driver->hapd_send_eapol(hapd->drv_priv, addr, data,
- data_len, encrypt,
- hapd->own_addr);
-}
-
-static inline int
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
{
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
}
static inline int
-hostapd_send_mgmt_frame(struct hostapd_data *hapd, const void *msg, size_t len)
-{
- if (hapd->driver == NULL || hapd->driver->send_mlme == NULL)
- return 0;
- 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 ||
static inline int
hostapd_sta_add(const char *ifname, struct hostapd_data *hapd, const u8 *addr,
u16 aid, u16 capability, const u8 *supp_rates,
- size_t supp_rates_len, int flags, u16 listen_interval,
- const struct ht_cap_ie *ht_capabilities)
+ size_t supp_rates_len, u16 listen_interval,
+ const struct ieee80211_ht_capabilities *ht_capabilities)
{
struct hostapd_sta_add_params params;
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, ¶ms);
}
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_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
int total_flags, int flags_or, int flags_and)
{
}
static inline int
-hostapd_set_ieee80211d(struct hostapd_data *hapd, int enabled)
-{
- if (hapd->driver == NULL ||
- hapd->driver->set_ieee80211d == NULL)
- return 0;
- return hapd->driver->set_ieee80211d(hapd->drv_priv, enabled);
-}
-
-static inline int
-hostapd_sta_clear_stats(struct hostapd_data *hapd, const u8 *addr)
-{
- if (hapd->driver == NULL || hapd->driver->sta_clear_stats == NULL)
- return 0;
- return hapd->driver->sta_clear_stats(hapd->drv_priv, addr);
-}
-
-static inline int
hostapd_set_beacon(const char *ifname, struct hostapd_data *hapd,
const u8 *head, size_t head_len,
- const u8 *tail, size_t tail_len, int dtim_period)
+ const u8 *tail, size_t tail_len, int dtim_period,
+ int beacon_int)
{
- if (hapd->driver == NULL || hapd->driver->hapd_set_beacon == NULL)
+ if (hapd->driver == NULL || hapd->driver->set_beacon == NULL)
return 0;
- return hapd->driver->hapd_set_beacon(ifname, hapd->drv_priv,
- head, head_len,
- tail, tail_len, dtim_period);
-}
-
-static inline int
-hostapd_set_internal_bridge(struct hostapd_data *hapd, int value)
-{
- if (hapd->driver == NULL || hapd->driver->set_internal_bridge == NULL)
- return 0;
- return hapd->driver->set_internal_bridge(hapd->drv_priv, value);
-}
-
-static inline int
-hostapd_set_beacon_int(struct hostapd_data *hapd, int value)
-{
- if (hapd->driver == NULL || hapd->driver->hapd_set_beacon_int == NULL)
- return 0;
- return hapd->driver->hapd_set_beacon_int(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)
- return 0;
- return hapd->driver->set_broadcast_ssid(hapd->drv_priv, value);
+ return hapd->driver->set_beacon(ifname, hapd->drv_priv,
+ head, head_len, tail, tail_len,
+ dtim_period, beacon_int);
}
static inline int
}
static inline int
-hostapd_bss_add(struct hostapd_data *hapd, const char *ifname, const u8 *bssid)
-{
- if (hapd->driver == NULL || hapd->driver->bss_add == NULL)
- return 0;
- return hapd->driver->bss_add(hapd->drv_priv, ifname, bssid);
-}
-
-static inline int
-hostapd_bss_remove(struct hostapd_data *hapd, const char *ifname)
-{
- if (hapd->driver == NULL || hapd->driver->bss_remove == NULL)
- return 0;
- return hapd->driver->bss_remove(hapd->drv_priv, ifname);
-}
-
-static inline int
hostapd_valid_bss_mask(struct hostapd_data *hapd, const u8 *addr,
const u8 *mask)
{
}
static inline int
-hostapd_if_add(struct hostapd_data *hapd, enum hostapd_driver_if_type type,
- char *ifname, const u8 *addr)
+hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
+ const char *ifname, const u8 *addr, void *bss_ctx)
{
if (hapd->driver == NULL || hapd->driver->if_add == NULL)
return -1;
return hapd->driver->if_add(hapd->conf->iface, hapd->drv_priv, type,
- ifname, addr);
+ ifname, addr, bss_ctx);
}
static inline int
-hostapd_if_update(struct hostapd_data *hapd, enum hostapd_driver_if_type type,
- char *ifname, const u8 *addr)
-{
- if (hapd->driver == NULL || hapd->driver->if_update == NULL)
- return -1;
- return hapd->driver->if_update(hapd->drv_priv, type, ifname, addr);
-}
-
-static inline int
-hostapd_if_remove(struct hostapd_data *hapd, enum hostapd_driver_if_type type,
- char *ifname, const u8 *addr)
+hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type,
+ const char *ifname)
{
if (hapd->driver == NULL || hapd->driver->if_remove == NULL)
return -1;
- 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);
+ return hapd->driver->if_remove(hapd->drv_priv, type, ifname);
}
static inline struct hostapd_hw_modes *
}
static inline int
+hostapd_set_wds_sta(struct hostapd_data *hapd, const u8 *addr, int aid,
+ int val)
+{
+ if (hapd->driver == NULL || hapd->driver->set_wds_sta == NULL)
+ return 0;
+ return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val);
+}
+
+static inline int
hostapd_driver_commit(struct hostapd_data *hapd)
{
if (hapd->driver == NULL || hapd->driver->commit == NULL)
return hapd->driver->set_radius_acl_expire(hapd->drv_priv, mac);
}
-#ifdef CONFIG_IEEE80211N
static inline int
hostapd_set_ht_params(const char *ifname, struct hostapd_data *hapd,
const u8 *ht_capab, size_t ht_capab_len,
ifname, hapd->drv_priv, ht_capab, ht_capab_len,
ht_oper, ht_oper_len);
}
-#endif /* CONFIG_IEEE80211N */
static inline int
hostapd_drv_none(struct hostapd_data *hapd)
return hapd->driver && os_strcmp(hapd->driver->name, "none") == 0;
}
-static inline int
-hostapd_set_wps_beacon_ie(struct hostapd_data *hapd, const u8 *ie, size_t len)
-{
- if (hapd->driver == NULL || hapd->driver->set_wps_beacon_ie == NULL)
- return 0;
- return hapd->driver->set_wps_beacon_ie(hapd->conf->iface,
- hapd->drv_priv, ie, len);
-}
-
-static inline int
-hostapd_set_wps_probe_resp_ie(struct hostapd_data *hapd, const u8 *ie,
- size_t len)
+static inline int hostapd_driver_scan(struct hostapd_data *hapd,
+ struct wpa_driver_scan_params *params)
{
- if (hapd->driver == NULL ||
- hapd->driver->set_wps_probe_resp_ie == NULL)
- return 0;
- return hapd->driver->set_wps_probe_resp_ie(hapd->conf->iface,
- hapd->drv_priv, ie, len);
+ if (hapd->driver && hapd->driver->scan2)
+ return hapd->driver->scan2(hapd->drv_priv, params);
+ return -1;
}
-static inline const struct hostapd_neighbor_bss *
-hostapd_driver_get_neighbor_bss(struct hostapd_data *hapd, size_t *num)
+static inline struct wpa_scan_results * hostapd_driver_get_scan_results(
+ struct hostapd_data *hapd)
{
- 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 && hapd->driver->get_scan_results2)
+ return hapd->driver->get_scan_results2(hapd->drv_priv);
+ return NULL;
}
#endif /* DRIVER_I_H */