/*
* hostapd / main()
- * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2002-2010, Jouni Malinen <j@w1.fi>
*
* 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
* See README and COPYING for more details.
*/
-#include "includes.h"
+#include "utils/includes.h"
#ifndef CONFIG_NATIVE_WINDOWS
#include <syslog.h>
#endif /* CONFIG_NATIVE_WINDOWS */
-#include "common.h"
-#include "eloop.h"
+#include "utils/common.h"
+#include "utils/eloop.h"
#include "crypto/tls.h"
#include "common/version.h"
#include "drivers/driver.h"
#include "eap_server/eap.h"
#include "eap_server/tncs.h"
#include "ap/hostapd.h"
-#include "ap/config.h"
+#include "ap/ap_config.h"
#include "config_file.h"
#include "eap_register.h"
#include "dump_state.h"
+#include "ctrl_iface.h"
extern int wpa_debug_level;
};
-int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
- int (*cb)(struct hostapd_iface *iface,
- void *ctx), void *ctx)
+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;
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;
+ hapd_iface->for_each_interface = hostapd_for_each_interface;
conf = hostapd_config_read(hapd_iface->config_fname);
if (conf == NULL)
&conf->bss[i]);
if (hapd == NULL)
goto fail;
+ hapd->msg_ctx = hapd;
}
return hapd_iface;
}
+static void hostapd_interface_deinit_free(struct hostapd_iface *iface)
+{
+ const struct wpa_driver_ops *driver;
+ void *drv_priv;
+ if (iface == NULL)
+ return;
+ driver = iface->bss[0]->driver;
+ drv_priv = iface->bss[0]->drv_priv;
+ hostapd_interface_deinit(iface);
+ if (driver && driver->hapd_deinit)
+ driver->hapd_deinit(drv_priv);
+ hostapd_interface_free(iface);
+}
+
+
static struct hostapd_iface *
hostapd_interface_init(struct hapd_interfaces *interfaces,
const char *config_fname, int debug)
if (hostapd_driver_init(iface) ||
hostapd_setup_interface(iface)) {
- hostapd_interface_deinit(iface);
+ hostapd_interface_deinit_free(iface);
return NULL;
}
"hostapd v" VERSION_STR "\n"
"User space daemon for IEEE 802.11 AP management,\n"
"IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator\n"
- "Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi> "
+ "Copyright (c) 2002-2010, Jouni Malinen <j@w1.fi> "
"and contributors\n");
}
out:
/* Deinitialize all interfaces */
for (i = 0; i < interfaces.count; i++)
- hostapd_interface_deinit(interfaces.iface[i]);
+ hostapd_interface_deinit_free(interfaces.iface[i]);
os_free(interfaces.iface);
hostapd_global_deinit(pid_file);