Move wpa_supplicant_create_ap() into ap.c

This commit is contained in:
Jouni Malinen 2009-03-26 16:08:17 +02:00 committed by Jouni Malinen
parent c746331b52
commit 1f1b62a0f0
3 changed files with 48 additions and 25 deletions

View File

@ -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(&params, 0, sizeof(params));
params.ssid = ssid->ssid;
params.ssid_len = ssid->ssid_len;
params.mode = ssid->mode;
if (wpa_drv_associate(wpa_s, &params) < 0)
wpa_msg(wpa_s, MSG_INFO, "Failed to start AP functionality");
}

22
wpa_supplicant/ap.h Normal file
View File

@ -0,0 +1,22 @@
/*
* WPA Supplicant - Basic AP mode support routines
* Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
* 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 */

View File

@ -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(&params, 0, sizeof(params));
params.ssid = ssid->ssid;
params.ssid_len = ssid->ssid_len;
params.mode = ssid->mode;
if (wpa_drv_associate(wpa_s, &params) < 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