From 1f1b62a0f0b15cb04ef07ecb5e481dab89b6f52f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 26 Mar 2009 16:08:17 +0200 Subject: [PATCH] Move wpa_supplicant_create_ap() into ap.c --- wpa_supplicant/ap.c | 25 +++++++++++++++++++++++++ wpa_supplicant/ap.h | 22 ++++++++++++++++++++++ wpa_supplicant/wpa_supplicant.c | 26 +------------------------- 3 files changed, 48 insertions(+), 25 deletions(-) create mode 100644 wpa_supplicant/ap.h diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index 25f0ed421..04ff5beea 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -21,6 +21,8 @@ #include "eap_common/eap_defs.h" #include "eap_server/eap_methods.h" #include "eap_common/eap_wsc_common.h" +#include "config_ssid.h" +#include "wpa_supplicant_i.h" int hostapd_reload_config(struct hostapd_iface *iface) @@ -137,3 +139,26 @@ hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity, return user; } + + +void wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid) +{ + struct wpa_driver_associate_params params; + + if (ssid->ssid == NULL || ssid->ssid_len == 0) { + wpa_printf(MSG_ERROR, "No SSID configured for AP mode"); + return; + } + + wpa_printf(MSG_DEBUG, "Setting up AP (SSID='%s')", + wpa_ssid_txt(ssid->ssid, ssid->ssid_len)); + + os_memset(¶ms, 0, sizeof(params)); + params.ssid = ssid->ssid; + params.ssid_len = ssid->ssid_len; + params.mode = ssid->mode; + + if (wpa_drv_associate(wpa_s, ¶ms) < 0) + wpa_msg(wpa_s, MSG_INFO, "Failed to start AP functionality"); +} diff --git a/wpa_supplicant/ap.h b/wpa_supplicant/ap.h new file mode 100644 index 000000000..1255b6072 --- /dev/null +++ b/wpa_supplicant/ap.h @@ -0,0 +1,22 @@ +/* + * WPA Supplicant - Basic AP mode support routines + * Copyright (c) 2003-2009, Jouni Malinen + * Copyright (c) 2009, Atheros Communications + * + * 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 + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifndef AP_H +#define AP_H + +void wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid); + +#endif /* AP_H */ diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 45a0a760b..45390bb91 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -41,6 +41,7 @@ #include "wps_supplicant.h" #include "ibss_rsn.h" #include "sme.h" +#include "ap.h" const char *wpa_supplicant_version = "wpa_supplicant v" VERSION_STR "\n" @@ -919,31 +920,6 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s, } -#ifdef CONFIG_AP -static void wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s, - struct wpa_ssid *ssid) -{ - struct wpa_driver_associate_params params; - - if (ssid->ssid == NULL || ssid->ssid_len == 0) { - wpa_printf(MSG_ERROR, "No SSID configured for AP mode"); - return; - } - - wpa_printf(MSG_DEBUG, "Setting up AP (SSID='%s')", - wpa_ssid_txt(ssid->ssid, ssid->ssid_len)); - - os_memset(¶ms, 0, sizeof(params)); - params.ssid = ssid->ssid; - params.ssid_len = ssid->ssid_len; - params.mode = ssid->mode; - - if (wpa_drv_associate(wpa_s, ¶ms) < 0) - wpa_msg(wpa_s, MSG_INFO, "Failed to start AP functionality"); -} -#endif /* CONFIG_AP */ - - /** * wpa_supplicant_associate - Request association * @wpa_s: Pointer to wpa_supplicant data