2 * wlantest - IEEE 802.11 protocol monitoring and testing tool
3 * Copyright (c) 2010, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
18 #include "utils/list.h"
19 #include "common/wpa_common.h"
21 struct ieee802_11_elems;
25 #define MAX_RADIUS_SECRET_LEN 128
27 struct wlantest_radius_secret {
29 char secret[MAX_RADIUS_SECRET_LEN];
32 struct wlantest_passphrase {
49 STATE1 /* not authenticated */,
50 STATE2 /* authenticated */,
51 STATE3 /* associated */
54 u8 rsnie[257]; /* WPA/RSN IE */
55 u8 anonce[32]; /* ANonce from the previous EAPOL-Key msg 1/4 or 3/4 */
56 u8 snonce[32]; /* SNonce from the previous EAPOL-Key msg 2/4 */
57 struct wpa_ptk ptk; /* Derived PTK */
70 int parse_error_reported;
73 struct dl_list sta; /* struct wlantest_sta */
74 struct dl_list pmk; /* struct wlantest_pmk */
83 struct wlantest_radius {
87 struct radius_msg *last_req;
94 struct dl_list passphrase; /* struct wlantest_passphrase */
95 struct dl_list bss; /* struct wlantest_bss */
96 struct dl_list secret; /* struct wlantest_radius_secret */
97 struct dl_list radius; /* struct wlantest_radius */
98 struct dl_list pmk; /* struct wlantest_pmk */
100 unsigned int rx_mgmt;
101 unsigned int rx_ctrl;
102 unsigned int rx_data;
103 unsigned int fcs_error;
106 int read_cap_file(struct wlantest *wt, const char *fname);
107 int read_wired_cap_file(struct wlantest *wt, const char *fname);
108 void wlantest_process(struct wlantest *wt, const u8 *data, size_t len);
109 void wlantest_process_wired(struct wlantest *wt, const u8 *data, size_t len);
110 u32 crc32(const u8 *frame, size_t frame_len);
111 int monitor_init(struct wlantest *wt, const char *ifname);
112 int monitor_init_wired(struct wlantest *wt, const char *ifname);
113 void monitor_deinit(struct wlantest *wt);
114 void rx_mgmt(struct wlantest *wt, const u8 *data, size_t len);
115 void rx_data(struct wlantest *wt, const u8 *data, size_t len);
117 struct wlantest_bss * bss_get(struct wlantest *wt, const u8 *bssid);
118 void bss_deinit(struct wlantest_bss *bss);
119 void bss_update(struct wlantest *wt, struct wlantest_bss *bss,
120 struct ieee802_11_elems *elems);
121 void pmk_deinit(struct wlantest_pmk *pmk);
123 struct wlantest_sta * sta_get(struct wlantest_bss *bss, const u8 *addr);
124 void sta_deinit(struct wlantest_sta *sta);
125 void sta_update_assoc(struct wlantest_sta *sta,
126 struct ieee802_11_elems *elems);
128 u8 * ccmp_decrypt(const u8 *tk, const struct ieee80211_hdr *hdr,
129 const u8 *data, size_t data_len, size_t *decrypted_len);
130 void ccmp_get_pn(u8 *pn, const u8 *data);
132 #endif /* WLANTEST_H */