diff options
author | Jouni Malinen <j@w1.fi> | 2010-11-06 17:11:12 +0200 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2010-11-07 23:29:00 +0200 |
commit | d84d38935127dc6f64ed1c1b8aa986e85d99c9b6 (patch) | |
tree | f6369f0a3d8f6da1c2e8453e320f7224d898f720 /wlantest/bss.c | |
parent | a149fcc77d3322bf23d1f53c2cd9fc84a1097c31 (diff) | |
download | external_wpa_supplicant_8_ti-d84d38935127dc6f64ed1c1b8aa986e85d99c9b6.zip external_wpa_supplicant_8_ti-d84d38935127dc6f64ed1c1b8aa986e85d99c9b6.tar.gz external_wpa_supplicant_8_ti-d84d38935127dc6f64ed1c1b8aa986e85d99c9b6.tar.bz2 |
wlantest: Maintain table of BSS information
Whenever a Beacon or Probe Response frame is observed, add or update
a BSS entry to maintain current information about the active BSSes.
Diffstat (limited to 'wlantest/bss.c')
-rw-r--r-- | wlantest/bss.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/wlantest/bss.c b/wlantest/bss.c new file mode 100644 index 0000000..11b9248 --- /dev/null +++ b/wlantest/bss.c @@ -0,0 +1,48 @@ +/* + * BSS 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_bss * bss_get(struct wlantest *wt, const u8 *bssid) +{ + struct wlantest_bss *bss; + + if (bssid[0] & 0x01) + return NULL; /* Skip group addressed frames */ + + dl_list_for_each(bss, &wt->bss, struct wlantest_bss, list) { + if (os_memcmp(bss->bssid, bssid, ETH_ALEN) == 0) + return bss; + } + + bss = os_zalloc(sizeof(*bss)); + if (bss == NULL) + return NULL; + os_memcpy(bss->bssid, bssid, ETH_ALEN); + dl_list_add(&wt->bss, &bss->list); + wpa_printf(MSG_DEBUG, "Discovered new BSS - " MACSTR, + MAC2STR(bss->bssid)); + return bss; +} + + +void bss_deinit(struct wlantest_bss *bss) +{ + dl_list_del(&bss->list); + os_free(bss); +} |