2010-11-06 15:20:45 +01:00
|
|
|
/*
|
|
|
|
* wlantest - IEEE 802.11 protocol monitoring and testing tool
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WLANTEST_H
|
|
|
|
#define WLANTEST_H
|
|
|
|
|
2010-11-06 16:11:12 +01:00
|
|
|
#include "utils/list.h"
|
|
|
|
|
2010-11-06 16:57:21 +01:00
|
|
|
struct ieee802_11_elems;
|
|
|
|
|
2010-11-06 16:11:12 +01:00
|
|
|
|
2010-11-06 16:31:02 +01:00
|
|
|
struct wlantest_sta {
|
|
|
|
struct dl_list list;
|
|
|
|
u8 addr[ETH_ALEN];
|
2010-11-06 16:55:27 +01:00
|
|
|
enum {
|
|
|
|
STATE1 /* not authenticated */,
|
|
|
|
STATE2 /* authenticated */,
|
|
|
|
STATE3 /* associated */
|
|
|
|
} state;
|
|
|
|
u16 aid;
|
2010-11-06 17:10:34 +01:00
|
|
|
u8 rsnie[257]; /* WPA/RSN IE */
|
2010-11-06 16:31:02 +01:00
|
|
|
};
|
|
|
|
|
2010-11-06 16:11:12 +01:00
|
|
|
struct wlantest_bss {
|
|
|
|
struct dl_list list;
|
|
|
|
u8 bssid[ETH_ALEN];
|
|
|
|
u16 capab_info;
|
|
|
|
u8 ssid[32];
|
|
|
|
size_t ssid_len;
|
|
|
|
int proberesp_seen;
|
|
|
|
int parse_error_reported;
|
|
|
|
u8 wpaie[257];
|
|
|
|
u8 rsnie[257];
|
2010-11-06 16:31:02 +01:00
|
|
|
struct dl_list sta; /* struct wlantest_sta */
|
2010-11-06 16:11:12 +01:00
|
|
|
};
|
|
|
|
|
2010-11-06 15:20:45 +01:00
|
|
|
struct wlantest {
|
|
|
|
int monitor_sock;
|
|
|
|
|
2010-11-06 16:11:12 +01:00
|
|
|
struct dl_list bss; /* struct wlantest_bss */
|
|
|
|
|
2010-11-06 15:20:45 +01:00
|
|
|
unsigned int rx_mgmt;
|
|
|
|
unsigned int rx_ctrl;
|
|
|
|
unsigned int rx_data;
|
|
|
|
unsigned int fcs_error;
|
|
|
|
};
|
|
|
|
|
|
|
|
int read_cap_file(struct wlantest *wt, const char *fname);
|
|
|
|
void wlantest_process(struct wlantest *wt, const u8 *data, size_t len);
|
|
|
|
u32 crc32(const u8 *frame, size_t frame_len);
|
|
|
|
int monitor_init(struct wlantest *wt, const char *ifname);
|
|
|
|
void monitor_deinit(struct wlantest *wt);
|
2010-11-06 17:01:24 +01:00
|
|
|
void rx_mgmt(struct wlantest *wt, const u8 *data, size_t len);
|
|
|
|
void rx_data(struct wlantest *wt, const u8 *data, size_t len);
|
2010-11-06 15:20:45 +01:00
|
|
|
|
2010-11-06 16:11:12 +01:00
|
|
|
struct wlantest_bss * bss_get(struct wlantest *wt, const u8 *bssid);
|
|
|
|
void bss_deinit(struct wlantest_bss *bss);
|
2010-11-06 16:57:21 +01:00
|
|
|
void bss_update(struct wlantest_bss *bss, struct ieee802_11_elems *elems);
|
2010-11-06 16:11:12 +01:00
|
|
|
|
2010-11-06 16:31:02 +01:00
|
|
|
struct wlantest_sta * sta_get(struct wlantest_bss *bss, const u8 *addr);
|
|
|
|
void sta_deinit(struct wlantest_sta *sta);
|
2010-11-06 17:10:34 +01:00
|
|
|
void sta_update_assoc(struct wlantest_sta *sta,
|
|
|
|
struct ieee802_11_elems *elems);
|
2010-11-06 16:31:02 +01:00
|
|
|
|
2010-11-06 15:20:45 +01:00
|
|
|
#endif /* WLANTEST_H */
|