aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-01-03 18:27:32 (GMT)
committerJouni Malinen <j@w1.fi>2010-01-03 18:27:32 (GMT)
commitd1f9c410c1ba8b8d007c53a01da7aa2eae4d81c9 (patch)
tree79e1e9f335c69fa2b6b30aae33942bc9f2a63138
parent9ba9fa07cc35c3c62916e528785002c7898ae5d7 (diff)
downloadhostap-d1f9c410c1ba8b8d007c53a01da7aa2eae4d81c9.zip
hostap-d1f9c410c1ba8b8d007c53a01da7aa2eae4d81c9.tar.gz
hostap-d1f9c410c1ba8b8d007c53a01da7aa2eae4d81c9.tar.bz2
Remove src/drivers/scan_helpers.c
Most of this file was already moved into wpa_supplicant/scan.c and we can remove the file completely by having couple of small helper functions copied to the remaining users outside core wpa_supplicant code.
-rw-r--r--hostapd/Makefile1
-rw-r--r--src/ap/hw_features.c14
-rw-r--r--src/drivers/driver.h3
-rw-r--r--src/drivers/driver_ndis.c19
-rw-r--r--src/drivers/driver_nl80211.c14
-rw-r--r--src/drivers/scan_helpers.c52
-rw-r--r--wpa_supplicant/Makefile3
-rw-r--r--wpa_supplicant/bss.c1
-rw-r--r--wpa_supplicant/scan.c33
-rw-r--r--wpa_supplicant/scan.h2
10 files changed, 84 insertions, 58 deletions
diff --git a/hostapd/Makefile b/hostapd/Makefile
index 37fd8bb..d94ceb9 100644
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -58,7 +58,6 @@ NEED_MD5=y
NEED_SHA1=y
OBJS += ../src/drivers/drivers.o
-OBJS += ../src/drivers/scan_helpers.o
CFLAGS += -DHOSTAPD
ifdef CONFIG_WPA_TRACE
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 9f00e7f..0159c72 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -406,6 +406,20 @@ static int ieee80211n_check_40mhz_2g4(struct hostapd_iface *iface,
}
+static void wpa_scan_results_free(struct wpa_scan_results *res)
+{
+ size_t i;
+
+ if (res == NULL)
+ return;
+
+ for (i = 0; i < res->num; i++)
+ os_free(res->res[i]);
+ os_free(res->res);
+ os_free(res);
+}
+
+
static void ieee80211n_check_scan(struct hostapd_iface *iface)
{
struct wpa_scan_results *scan_res;
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 28a48ed..9406727 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2271,9 +2271,6 @@ union wpa_event_data {
void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
union wpa_event_data *data);
-const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie);
-void wpa_scan_results_free(struct wpa_scan_results *res);
-
/*
* The following inline functions are provided for convenience to simplify
diff --git a/src/drivers/driver_ndis.c b/src/drivers/driver_ndis.c
index e77a2d3..8d5fe36 100644
--- a/src/drivers/driver_ndis.c
+++ b/src/drivers/driver_ndis.c
@@ -792,6 +792,25 @@ static int wpa_driver_ndis_scan(void *priv,
}
+static const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie)
+{
+ const u8 *end, *pos;
+
+ pos = (const u8 *) (res + 1);
+ end = pos + res->ie_len;
+
+ while (pos + 1 < end) {
+ if (pos + 2 + pos[1] > end)
+ break;
+ if (pos[0] == ie)
+ return pos;
+ pos += 2 + pos[1];
+ }
+
+ return NULL;
+}
+
+
static struct wpa_scan_res * wpa_driver_ndis_add_scan_ssid(
struct wpa_scan_res *r, NDIS_802_11_SSID *ssid)
{
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 93d2727..89acdae 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1682,6 +1682,20 @@ static void wpa_driver_nl80211_check_bss_status(
}
+static void wpa_scan_results_free(struct wpa_scan_results *res)
+{
+ size_t i;
+
+ if (res == NULL)
+ return;
+
+ for (i = 0; i < res->num; i++)
+ os_free(res->res[i]);
+ os_free(res->res);
+ os_free(res);
+}
+
+
/**
* wpa_driver_nl80211_get_scan_results - Fetch the latest scan results
* @priv: Pointer to private wext data from wpa_driver_nl80211_init()
diff --git a/src/drivers/scan_helpers.c b/src/drivers/scan_helpers.c
deleted file mode 100644
index a4ec634..0000000
--- a/src/drivers/scan_helpers.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * WPA Supplicant - Helper functions for scan result processing
- * Copyright (c) 2007-2008, 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
- * 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.
- */
-
-#include "includes.h"
-
-#include "common.h"
-#include "drivers/driver.h"
-#include "common/ieee802_11_defs.h"
-
-
-const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie)
-{
- const u8 *end, *pos;
-
- pos = (const u8 *) (res + 1);
- end = pos + res->ie_len;
-
- while (pos + 1 < end) {
- if (pos + 2 + pos[1] > end)
- break;
- if (pos[0] == ie)
- return pos;
- pos += 2 + pos[1];
- }
-
- return NULL;
-}
-
-
-void wpa_scan_results_free(struct wpa_scan_results *res)
-{
- size_t i;
-
- if (res == NULL)
- return;
-
- for (i = 0; i < res->num; i++)
- os_free(res->res[i]);
- os_free(res->res);
- os_free(res);
-}
diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index b5c45ad..7b4474f 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -1164,7 +1164,6 @@ ifdef CONFIG_FIPS
CFLAGS += -DCONFIG_FIPS
endif
-OBJS += ../src/drivers/scan_helpers.o
OBJS += $(SHA1OBJS) $(DESOBJS)
OBJS_p += $(SHA1OBJS)
@@ -1197,7 +1196,7 @@ OBJS_t2 := $(OBJS) $(OBJS_l2) preauth_test.o
OBJS += $(CONFIG_MAIN).o
ifdef CONFIG_PRIVSEP
-OBJS_priv += $(OBJS_d) ../src/drivers/drivers.o ../src/drivers/scan_helpers.o
+OBJS_priv += $(OBJS_d) ../src/drivers/drivers.o
OBJS_priv += $(OBJS_l2)
OBJS_priv += ../src/utils/os_$(CONFIG_OS).o
OBJS_priv += ../src/utils/$(CONFIG_ELOOP).o
diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c
index d069d04..a125ca1 100644
--- a/wpa_supplicant/bss.c
+++ b/wpa_supplicant/bss.c
@@ -20,6 +20,7 @@
#include "drivers/driver.h"
#include "wpa_supplicant_i.h"
#include "notify.h"
+#include "scan.h"
#include "bss.h"
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 819061f..56f062f 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -460,6 +460,25 @@ static int wpa_scan_get_max_rate(const struct wpa_scan_res *res)
}
+const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie)
+{
+ const u8 *end, *pos;
+
+ pos = (const u8 *) (res + 1);
+ end = pos + res->ie_len;
+
+ while (pos + 1 < end) {
+ if (pos + 2 + pos[1] > end)
+ break;
+ if (pos[0] == ie)
+ return pos;
+ pos += 2 + pos[1];
+ }
+
+ return NULL;
+}
+
+
const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res,
u32 vendor_type)
{
@@ -610,3 +629,17 @@ int wpa_supplicant_update_scan_results(struct wpa_supplicant *wpa_s)
return 0;
}
+
+
+void wpa_scan_results_free(struct wpa_scan_results *res)
+{
+ size_t i;
+
+ if (res == NULL)
+ return;
+
+ for (i = 0; i < res->num; i++)
+ os_free(res->res[i]);
+ os_free(res->res);
+ os_free(res);
+}
diff --git a/wpa_supplicant/scan.h b/wpa_supplicant/scan.h
index b3557f9..441fdbb 100644
--- a/wpa_supplicant/scan.h
+++ b/wpa_supplicant/scan.h
@@ -27,9 +27,11 @@ struct wpa_scan_results *
wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s,
struct scan_info *info, int new_scan);
int wpa_supplicant_update_scan_results(struct wpa_supplicant *wpa_s);
+const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie);
const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res,
u32 vendor_type);
struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res,
u32 vendor_type);
+void wpa_scan_results_free(struct wpa_scan_results *res);
#endif /* SCAN_H */