From 70db2ab30816bb55d9fd9f9a94461480f22bd622 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 25 Dec 2009 20:06:07 +0200 Subject: [PATCH] Move rest of the generic AP mode functionality into src/ap --- hostapd/Makefile | 10 +++++----- hostapd/main.c | 3 +++ {hostapd => src/ap}/ap_drv_ops.c | 0 {hostapd => src/ap}/ap_drv_ops.h | 0 {hostapd => src/ap}/driver_i.h | 0 {hostapd => src/ap}/drv_callbacks.c | 0 {hostapd => src/ap}/hostapd.c | 7 ++++--- src/ap/hostapd.h | 3 +++ {hostapd => src/ap}/hw_features.c | 0 {hostapd => src/ap}/hw_features.h | 0 {hostapd => src/ap}/wpa_auth_glue.c | 0 {hostapd => src/ap}/wpa_auth_glue.h | 0 wpa_supplicant/Makefile | 10 +++++----- wpa_supplicant/ap.c | 11 ----------- 14 files changed, 20 insertions(+), 24 deletions(-) rename {hostapd => src/ap}/ap_drv_ops.c (100%) rename {hostapd => src/ap}/ap_drv_ops.h (100%) rename {hostapd => src/ap}/driver_i.h (100%) rename {hostapd => src/ap}/drv_callbacks.c (100%) rename {hostapd => src/ap}/hostapd.c (99%) rename {hostapd => src/ap}/hw_features.c (100%) rename {hostapd => src/ap}/hw_features.h (100%) rename {hostapd => src/ap}/wpa_auth_glue.c (100%) rename {hostapd => src/ap}/wpa_auth_glue.h (100%) diff --git a/hostapd/Makefile b/hostapd/Makefile index 6e0869a30..9a53245bc 100644 --- a/hostapd/Makefile +++ b/hostapd/Makefile @@ -32,13 +32,13 @@ CFLAGS += -DCONFIG_NATIVE_WINDOWS LIBS += -lws2_32 endif -OBJS = hostapd.o -OBJS += wpa_auth_glue.o OBJS += main.o OBJS += config_file.o -OBJS += drv_callbacks.o -OBJS += ap_drv_ops.o +OBJS += ../src/ap/hostapd.o +OBJS += ../src/ap/wpa_auth_glue.o +OBJS += ../src/ap/drv_callbacks.o +OBJS += ../src/ap/ap_drv_ops.o OBJS += ../src/ap/utils.o OBJS += ../src/ap/authsrv.o OBJS += ../src/ap/ieee802_1x.o @@ -693,7 +693,7 @@ OBJS += ../src/ap/beacon.o OBJS += ../src/ap/wmm.o OBJS += ../src/ap/ap_list.o OBJS += ../src/ap/ieee802_11.o -OBJS += hw_features.o +OBJS += ../src/ap/hw_features.o ifdef CONFIG_IEEE80211N OBJS += ../src/ap/ieee802_11_ht.o endif diff --git a/hostapd/main.c b/hostapd/main.c index 79e2969e0..9c93a527d 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -29,6 +29,7 @@ #include "config_file.h" #include "eap_register.h" #include "dump_state.h" +#include "ctrl_iface.h" extern int wpa_debug_level; @@ -187,6 +188,8 @@ static struct hostapd_iface * hostapd_init(const char *config_file) hapd_iface->config_fname = os_strdup(config_file); if (hapd_iface->config_fname == NULL) goto fail; + hapd_iface->ctrl_iface_init = hostapd_ctrl_iface_init; + hapd_iface->ctrl_iface_deinit = hostapd_ctrl_iface_deinit; conf = hostapd_config_read(hapd_iface->config_fname); if (conf == NULL) diff --git a/hostapd/ap_drv_ops.c b/src/ap/ap_drv_ops.c similarity index 100% rename from hostapd/ap_drv_ops.c rename to src/ap/ap_drv_ops.c diff --git a/hostapd/ap_drv_ops.h b/src/ap/ap_drv_ops.h similarity index 100% rename from hostapd/ap_drv_ops.h rename to src/ap/ap_drv_ops.h diff --git a/hostapd/driver_i.h b/src/ap/driver_i.h similarity index 100% rename from hostapd/driver_i.h rename to src/ap/driver_i.h diff --git a/hostapd/drv_callbacks.c b/src/ap/drv_callbacks.c similarity index 100% rename from hostapd/drv_callbacks.c rename to src/ap/drv_callbacks.c diff --git a/hostapd/hostapd.c b/src/ap/hostapd.c similarity index 99% rename from hostapd/hostapd.c rename to src/ap/hostapd.c index 588b02b63..fe7a3c52c 100644 --- a/hostapd/hostapd.c +++ b/src/ap/hostapd.c @@ -32,7 +32,6 @@ #include "ap/wps_hostapd.h" #include "hw_features.h" #include "driver_i.h" -#include "ctrl_iface.h" #include "wpa_auth_glue.h" #include "ap_drv_ops.h" @@ -201,7 +200,8 @@ static int hostapd_broadcast_wep_set(struct hostapd_data *hapd) */ static void hostapd_cleanup(struct hostapd_data *hapd) { - hostapd_ctrl_iface_deinit(hapd); + if (hapd->iface->ctrl_iface_deinit) + hapd->iface->ctrl_iface_deinit(hapd); iapp_deinit(hapd->iapp); hapd->iapp = NULL; @@ -583,7 +583,8 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first) return -1; } - if (hostapd_ctrl_iface_init(hapd)) { + if (hapd->iface->ctrl_iface_init && + hapd->iface->ctrl_iface_init(hapd)) { wpa_printf(MSG_ERROR, "Failed to setup control interface"); return -1; } diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index fe3455945..1f753cf7d 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -225,6 +225,9 @@ struct hostapd_iface { u16 ht_op_mode; void (*scan_cb)(struct hostapd_iface *iface); + + int (*ctrl_iface_init)(struct hostapd_data *hapd); + void (*ctrl_iface_deinit)(struct hostapd_data *hapd); }; /* hostapd.c */ diff --git a/hostapd/hw_features.c b/src/ap/hw_features.c similarity index 100% rename from hostapd/hw_features.c rename to src/ap/hw_features.c diff --git a/hostapd/hw_features.h b/src/ap/hw_features.h similarity index 100% rename from hostapd/hw_features.h rename to src/ap/hw_features.h diff --git a/hostapd/wpa_auth_glue.c b/src/ap/wpa_auth_glue.c similarity index 100% rename from hostapd/wpa_auth_glue.c rename to src/ap/wpa_auth_glue.c diff --git a/hostapd/wpa_auth_glue.h b/src/ap/wpa_auth_glue.h similarity index 100% rename from hostapd/wpa_auth_glue.h rename to src/ap/wpa_auth_glue.h diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile index 21c5c6fe8..135ad10d7 100644 --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -587,8 +587,8 @@ OBJS += ap.o CFLAGS += -DCONFIG_NO_RADIUS CFLAGS += -DCONFIG_NO_ACCOUNTING CFLAGS += -DCONFIG_NO_VLAN -OBJS += ../hostapd/hostapd.o -OBJS += ../hostapd/wpa_auth_glue.o +OBJS += ../src/ap/hostapd.o +OBJS += ../src/ap/wpa_auth_glue.o OBJS += ../src/ap/utils.o OBJS += ../src/ap/authsrv.o OBJS += ../src/ap/config.o @@ -599,8 +599,8 @@ OBJS += ../src/ap/mlme.o OBJS += ../src/ap/ieee802_1x.o OBJS += ../src/eapol_auth/eapol_auth_sm.o OBJS += ../src/ap/ieee802_11_auth.o -OBJS += ../hostapd/drv_callbacks.o -OBJS += ../hostapd/ap_drv_ops.o +OBJS += ../src/ap/drv_callbacks.o +OBJS += ../src/ap/ap_drv_ops.o ifdef CONFIG_CTRL_IFACE OBJS += ../src/ap/ctrl_iface_ap.o endif @@ -619,7 +619,7 @@ OBJS += ../src/ap/beacon.o OBJS += ../src/ap/wmm.o OBJS += ../src/ap/ap_list.o OBJS += ../src/ap/ieee802_11.o -OBJS += ../hostapd/hw_features.o +OBJS += ../src/ap/hw_features.o ifdef CONFIG_IEEE80211N OBJS += ../src/ap/ieee802_11_ht.o endif diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index 4d527223a..a393b7529 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -49,17 +49,6 @@ int hostapd_for_each_interface(struct hapd_interfaces *interfaces, } -int hostapd_ctrl_iface_init(struct hostapd_data *hapd) -{ - return 0; -} - - -void hostapd_ctrl_iface_deinit(struct hostapd_data *hapd) -{ -} - - static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, struct hostapd_config *conf)