}
-static int hostapd_set_ap_wps_ie(struct hostapd_data *hapd)
+int hostapd_set_ap_wps_ie(struct hostapd_data *hapd)
{
struct wpabuf *beacon, *proberesp, *assocresp = NULL;
int ret;
}
-static int hostapd_set_authorized(struct hostapd_data *hapd,
- struct sta_info *sta, int authorized)
+int hostapd_set_authorized(struct hostapd_data *hapd,
+ struct sta_info *sta, int authorized)
{
if (authorized) {
return hostapd_sta_set_flags(hapd, sta->addr,
}
-static int hostapd_set_sta_flags(struct hostapd_data *hapd,
- struct sta_info *sta)
+int hostapd_set_sta_flags(struct hostapd_data *hapd, struct sta_info *sta)
{
int set_flags, total_flags, flags_and, flags_or;
total_flags = hostapd_sta_flags_to_drv(sta->flags);
}
-static int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd,
- const char *ifname, int enabled)
+int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
+ int enabled)
{
struct wpa_bss_params params;
os_memset(¶ms, 0, sizeof(params));
}
-static int hostapd_set_bss_params(struct hostapd_data *hapd,
- int use_protection)
+int hostapd_set_bss_params(struct hostapd_data *hapd, int use_protection)
{
int ret = 0;
int preamble;
}
-static int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname)
+int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname)
{
char force_ifname[IFNAMSIZ];
u8 if_addr[ETH_ALEN];
force_ifname, if_addr);
}
-static int hostapd_vlan_if_remove(struct hostapd_data *hapd,
- const char *ifname)
+
+int hostapd_vlan_if_remove(struct hostapd_data *hapd, const char *ifname)
{
return hostapd_if_remove(hapd, WPA_IF_AP_VLAN, ifname);
}
-static int hostapd_set_wds_sta(struct hostapd_data *hapd, const u8 *addr,
- int aid, int val)
+int hostapd_set_wds_sta(struct hostapd_data *hapd, const u8 *addr, int aid,
+ int val)
{
const char *bridge = NULL;
bridge = hapd->conf->wds_bridge;
else if (hapd->conf->bridge[0])
bridge = hapd->conf->bridge;
- return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val, bridge);
+ return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val,
+ bridge);
}
-static int hostapd_sta_add(struct hostapd_data *hapd,
- const u8 *addr, u16 aid, u16 capability,
- const u8 *supp_rates, size_t supp_rates_len,
- u16 listen_interval,
- const struct ieee80211_ht_capabilities *ht_capab)
+int hostapd_sta_add(struct hostapd_data *hapd,
+ const u8 *addr, u16 aid, u16 capability,
+ const u8 *supp_rates, size_t supp_rates_len,
+ u16 listen_interval,
+ const struct ieee80211_ht_capabilities *ht_capab)
{
struct hostapd_sta_add_params params;
}
-void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
-{
- ops->set_ap_wps_ie = hostapd_set_ap_wps_ie;
- ops->set_authorized = hostapd_set_authorized;
- ops->set_sta_flags = hostapd_set_sta_flags;
- ops->set_drv_ieee8021x = hostapd_set_drv_ieee8021x;
- ops->set_bss_params = hostapd_set_bss_params;
- ops->vlan_if_add = hostapd_vlan_if_add;
- ops->vlan_if_remove = hostapd_vlan_if_remove;
- ops->set_wds_sta = hostapd_set_wds_sta;
- ops->sta_add = hostapd_sta_add;
-}
-
-
int hostapd_set_privacy(struct hostapd_data *hapd, int enabled)
{
if (hapd->driver == NULL || hapd->driver->set_privacy == NULL)
enum wpa_driver_if_type;
struct wpa_bss_params;
struct wpa_driver_scan_params;
-
-void hostapd_set_driver_ops(struct hostapd_driver_ops *ops);
+struct ieee80211_ht_capabilities;
+
+int hostapd_set_ap_wps_ie(struct hostapd_data *hapd);
+int hostapd_set_authorized(struct hostapd_data *hapd,
+ struct sta_info *sta, int authorized);
+int hostapd_set_sta_flags(struct hostapd_data *hapd, struct sta_info *sta);
+int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
+ int enabled);
+int hostapd_set_bss_params(struct hostapd_data *hapd, int use_protection);
+int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname);
+int hostapd_vlan_if_remove(struct hostapd_data *hapd, const char *ifname);
+int hostapd_set_wds_sta(struct hostapd_data *hapd, const u8 *addr, int aid,
+ int val);
+int hostapd_sta_add(struct hostapd_data *hapd,
+ const u8 *addr, u16 aid, u16 capability,
+ const u8 *supp_rates, size_t supp_rates_len,
+ u16 listen_interval,
+ const struct ieee80211_ht_capabilities *ht_capab);
int hostapd_set_privacy(struct hostapd_data *hapd, int enabled);
int hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
size_t elem_len);
#ifdef CONFIG_P2P
no_beacon:
#endif /* CONFIG_P2P */
- hapd->drv.set_bss_params(hapd, !!(ieee802_11_erp_info(hapd) &
- ERP_INFO_USE_PROTECTION));
+ hostapd_set_bss_params(hapd, !!(ieee802_11_erp_info(hapd) &
+ ERP_INFO_USE_PROTECTION));
}
}
if (hapd->conf->ieee802_1x || hapd->conf->wpa)
- hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 1);
+ hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1);
else
- hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
+ hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
if (hapd->conf->wpa && hapd->wpa_auth == NULL)
hostapd_setup_wpa(hapd);
if (hapd == NULL)
return NULL;
- hostapd_set_driver_ops(&hapd->drv);
hapd->new_assoc_sta_cb = hostapd_new_assoc_sta;
hapd->iconf = conf;
hapd->conf = bss;
};
-struct hostapd_driver_ops {
- int (*set_ap_wps_ie)(struct hostapd_data *hapd);
- int (*set_authorized)(struct hostapd_data *hapd, struct sta_info *sta,
- int authorized);
- int (*set_sta_flags)(struct hostapd_data *hapd, struct sta_info *sta);
- int (*set_drv_ieee8021x)(struct hostapd_data *hapd, const char *ifname,
- int enabled);
- int (*set_bss_params)(struct hostapd_data *hapd, int use_protection);
- int (*vlan_if_add)(struct hostapd_data *hapd, const char *ifname);
- int (*vlan_if_remove)(struct hostapd_data *hapd, const char *ifname);
- int (*set_wds_sta)(struct hostapd_data *hapd, const u8 *addr, int aid,
- int val);
- int (*sta_add)(struct hostapd_data *hapd,
- const u8 *addr, u16 aid, u16 capability,
- const u8 *supp_rates, size_t supp_rates_len,
- u16 listen_interval,
- const struct ieee80211_ht_capabilities *ht_capab);
-};
-
/**
* struct hostapd_data - hostapd per-BSS data structure
*/
const struct wpa_driver_ops *driver;
void *drv_priv;
- struct hostapd_driver_ops drv;
void (*new_assoc_sta_cb)(struct hostapd_data *hapd,
struct sta_info *sta, int reassoc);
hostapd_get_ht_capab(hapd, sta->ht_capabilities, &ht_cap);
#endif /* CONFIG_IEEE80211N */
- if (hapd->drv.sta_add(hapd, sta->addr, sta->aid, sta->capability,
- sta->supported_rates, sta->supported_rates_len,
- sta->listen_interval,
- sta->flags & WLAN_STA_HT ? &ht_cap : NULL)) {
+ if (hostapd_sta_add(hapd, sta->addr, sta->aid, sta->capability,
+ sta->supported_rates, sta->supported_rates_len,
+ sta->listen_interval,
+ sta->flags & WLAN_STA_HT ? &ht_cap : NULL)) {
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_NOTICE,
"Could not add STA to kernel driver");
}
if (sta->flags & WLAN_STA_WDS)
- hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 1);
+ hostapd_set_wds_sta(hapd, sta->addr, sta->aid, 1);
if (sta->eapol_sm == NULL) {
/*
goto fail;
}
- hapd->drv.set_sta_flags(hapd, sta);
+ hostapd_set_sta_flags(hapd, sta);
if (sta->auth_alg == WLAN_AUTH_FT)
wpa_auth_sm_event(sta->wpa_sm, WPA_ASSOC_FT);
"STA " MACSTR " (aid %u)",
MAC2STR(sta->addr), sta->aid);
sta->flags |= WLAN_STA_WDS;
- hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 1);
+ hostapd_set_wds_sta(hapd, sta->addr, sta->aid, 1);
}
return;
}
wpa_msg(hapd->msg_ctx, MSG_INFO,
AP_STA_CONNECTED MACSTR, MAC2STR(sta->addr));
sta->flags |= WLAN_STA_AUTHORIZED;
- res = hapd->drv.set_authorized(hapd, sta, 1);
+ res = hostapd_set_authorized(hapd, sta, 1);
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
HOSTAPD_LEVEL_DEBUG, "authorizing port");
} else {
AP_STA_DISCONNECTED MACSTR,
MAC2STR(sta->addr));
sta->flags &= ~WLAN_STA_AUTHORIZED;
- res = hapd->drv.set_authorized(hapd, sta, 0);
+ res = hostapd_set_authorized(hapd, sta, 0);
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
HOSTAPD_LEVEL_DEBUG, "unauthorizing port");
}
key->len[key->idx]))
printf("Could not set dynamic VLAN WEP encryption key.\n");
- hapd->drv.set_drv_ieee8021x(hapd, ifname, 1);
+ hostapd_set_drv_ieee8021x(hapd, ifname, 1);
return key;
}
return -1;
if ((hapd->conf->ieee802_1x || hapd->conf->wpa) &&
- hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 1))
+ hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1))
return -1;
#ifndef CONFIG_NO_RADIUS
if (hapd->driver != NULL &&
(hapd->conf->ieee802_1x || hapd->conf->wpa))
- hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
+ hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
eapol_auth_deinit(hapd->eapol_auth);
hapd->eapol_auth = NULL;
accounting_sta_stop(hapd, sta);
if (sta->flags & WLAN_STA_WDS)
- hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0);
+ hostapd_set_wds_sta(hapd, sta->addr, sta->aid, 0);
if (!(sta->flags & WLAN_STA_PREAUTH))
hostapd_drv_sta_remove(hapd, sta->addr);
{
while (vlan) {
if (vlan->vlan_id != VLAN_ID_WILDCARD) {
- if (hapd->drv.vlan_if_add(hapd, vlan->ifname)) {
+ if (hostapd_vlan_if_add(hapd, vlan->ifname)) {
if (errno != EEXIST) {
wpa_printf(MSG_ERROR, "VLAN: Could "
"not add VLAN %s: %s",
next = vlan->next;
if (vlan->vlan_id != VLAN_ID_WILDCARD &&
- hapd->drv.vlan_if_remove(hapd, vlan->ifname)) {
+ hostapd_vlan_if_remove(hapd, vlan->ifname)) {
wpa_printf(MSG_ERROR, "VLAN: Could not remove VLAN "
"iface: %s: %s",
vlan->ifname, strerror(errno));
pos);
os_free(ifname);
- if (hapd->drv.vlan_if_add(hapd, n->ifname)) {
+ if (hostapd_vlan_if_add(hapd, n->ifname)) {
os_free(n);
return NULL;
}
return 1;
if (vlan->dynamic_vlan == 0)
- hapd->drv.vlan_if_remove(hapd, vlan->ifname);
+ hostapd_vlan_if_remove(hapd, vlan->ifname);
return 0;
}
#include "wps/wps_dev_attr.h"
#include "hostapd.h"
#include "ap_config.h"
+#include "ap_drv_ops.h"
#include "beacon.h"
#include "sta_info.h"
#include "wps_hostapd.h"
wpabuf_free(hapd->wps_probe_resp_ie);
hapd->wps_probe_resp_ie = probe_resp_ie;
ieee802_11_set_beacon(hapd);
- return hapd->drv.set_ap_wps_ie(hapd);
+ return hostapd_set_ap_wps_ie(hapd);
}
wpabuf_free(hapd->wps_probe_resp_ie);
hapd->wps_probe_resp_ie = NULL;
- hapd->drv.set_ap_wps_ie(hapd);
+ hostapd_set_ap_wps_ie(hapd);
}