aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/sta.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-11-06 15:31:02 (GMT)
committerJouni Malinen <j@w1.fi>2010-11-07 21:29:00 (GMT)
commit422ef7d2056e982bbd83415f5a329e996b0c2608 (patch)
treeee7d77b826ed8d6cc2352f7c0af7740f14b6d3cb /wlantest/sta.c
parentd84d38935127dc6f64ed1c1b8aa986e85d99c9b6 (diff)
downloadhostap-422ef7d2056e982bbd83415f5a329e996b0c2608.zip
hostap-422ef7d2056e982bbd83415f5a329e996b0c2608.tar.gz
hostap-422ef7d2056e982bbd83415f5a329e996b0c2608.tar.bz2
wlantest: Create station list for each BSS
Diffstat (limited to 'wlantest/sta.c')
-rw-r--r--wlantest/sta.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/wlantest/sta.c b/wlantest/sta.c
new file mode 100644
index 0000000..fc84ee1
--- /dev/null
+++ b/wlantest/sta.c
@@ -0,0 +1,48 @@
+/*
+ * STA list
+ * Copyright (c) 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
+ * 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 "utils/includes.h"
+
+#include "utils/common.h"
+#include "wlantest.h"
+
+
+struct wlantest_sta * sta_get(struct wlantest_bss *bss, const u8 *addr)
+{
+ struct wlantest_sta *sta;
+
+ if (addr[0] & 0x01)
+ return NULL; /* Skip group addressed frames */
+
+ dl_list_for_each(sta, &bss->sta, struct wlantest_sta, list) {
+ if (os_memcmp(sta->addr, addr, ETH_ALEN) == 0)
+ return sta;
+ }
+
+ sta = os_zalloc(sizeof(*sta));
+ if (sta == NULL)
+ return NULL;
+ os_memcpy(sta->addr, addr, ETH_ALEN);
+ dl_list_add(&bss->sta, &sta->list);
+ wpa_printf(MSG_DEBUG, "Discovered new STA " MACSTR " in BSS " MACSTR,
+ MAC2STR(sta->addr), MAC2STR(bss->bssid));
+ return sta;
+}
+
+
+void sta_deinit(struct wlantest_sta *sta)
+{
+ dl_list_del(&sta->list);
+ os_free(sta);
+}