From 07bcdbb150bfd41acb271198e1babe5a9df93204 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 16 Feb 2012 19:46:27 +0200 Subject: [PATCH] Move hostapd_for_each_interface() and hapd_interfaces into src/ap Signed-hostap: Jouni Malinen --- hostapd/main.c | 23 ----------------------- src/ap/hostapd.c | 17 +++++++++++++++++ src/ap/hostapd.h | 10 +++++++++- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/hostapd/main.c b/hostapd/main.c index 2748c61f1..f33a160af 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -42,29 +42,6 @@ struct hapd_global { static struct hapd_global global; -struct hapd_interfaces { - size_t count; - struct hostapd_iface **iface; -}; - - -static int hostapd_for_each_interface(struct hapd_interfaces *interfaces, - int (*cb)(struct hostapd_iface *iface, - void *ctx), void *ctx) -{ - size_t i; - int ret; - - for (i = 0; i < interfaces->count; i++) { - ret = cb(interfaces->iface[i], ctx); - if (ret) - return ret; - } - - return 0; -} - - #ifndef CONFIG_NO_HOSTAPD_LOGGER static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module, int level, const char *txt, size_t len) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index aa57a14e6..6efc52dd9 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -39,6 +39,23 @@ static int hostapd_broadcast_wep_clear(struct hostapd_data *hapd); extern int wpa_debug_level; +int hostapd_for_each_interface(struct hapd_interfaces *interfaces, + int (*cb)(struct hostapd_iface *iface, + void *ctx), void *ctx) +{ + size_t i; + int ret; + + for (i = 0; i < interfaces->count; i++) { + ret = cb(interfaces->iface[i], ctx); + if (ret) + return ret; + } + + return 0; +} + + static void hostapd_reload_bss(struct hostapd_data *hapd) { #ifndef CONFIG_NO_RADIUS diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index bc2880568..fb0de3113 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -15,7 +15,6 @@ struct wpa_driver_ops; struct wpa_ctrl_dst; struct radius_server_data; struct upnp_wps_device_sm; -struct hapd_interfaces; struct hostapd_data; struct sta_info; struct hostap_sta_driver_data; @@ -24,6 +23,12 @@ struct full_dynamic_vlan; enum wps_event; union wps_event_data; +struct hapd_interfaces { + size_t count; + struct hostapd_iface **iface; +}; + + struct hostapd_probereq_cb { int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid, const u8 *ie, size_t ie_len); @@ -242,6 +247,9 @@ struct hostapd_iface { }; /* hostapd.c */ +int hostapd_for_each_interface(struct hapd_interfaces *interfaces, + int (*cb)(struct hostapd_iface *iface, + void *ctx), void *ctx); int hostapd_reload_config(struct hostapd_iface *iface); struct hostapd_data * hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,