wlantest: Track TDLS setup nonces
[mech_eap.git] / wlantest / wlantest.h
index a8db20b..1ff3229 100644 (file)
@@ -106,6 +106,8 @@ struct wlantest_tdls {
        u8 rsc_init[16 + 1][6];
        u8 rsc_resp[16 + 1][6];
        u32 counters[NUM_WLANTEST_TDLS_COUNTER];
+       u8 inonce[32];
+       u8 rnonce[32];
 };
 
 struct wlantest_bss {
@@ -148,6 +150,7 @@ struct wlantest_radius {
 
 
 #define MAX_CTRL_CONNECTIONS 10
+#define MAX_NOTES 10
 
 struct wlantest {
        int monitor_sock;
@@ -171,20 +174,44 @@ struct wlantest {
        void *write_pcap; /* pcap_t* */
        void *write_pcap_dumper; /* pcpa_dumper_t */
        struct timeval write_pcap_time;
+       u8 *decrypted;
+       size_t decrypted_len;
+       FILE *pcapng;
+       u32 write_pcapng_time_high;
+       u32 write_pcapng_time_low;
 
        u8 last_hdr[30];
        size_t last_len;
        int last_mgmt_valid;
+
+       unsigned int assume_fcs:1;
+
+       char *notes[MAX_NOTES];
+       size_t num_notes;
 };
 
+void add_note(struct wlantest *wt, int level, const char *fmt, ...)
+PRINTF_FORMAT(3, 4);
+void clear_notes(struct wlantest *wt);
+size_t notes_len(struct wlantest *wt, size_t hdrlen);
+
 int add_wep(struct wlantest *wt, const char *key);
 int read_cap_file(struct wlantest *wt, const char *fname);
 int read_wired_cap_file(struct wlantest *wt, const char *fname);
+
 int write_pcap_init(struct wlantest *wt, const char *fname);
 void write_pcap_deinit(struct wlantest *wt);
 void write_pcap_captured(struct wlantest *wt, const u8 *buf, size_t len);
 void write_pcap_decrypted(struct wlantest *wt, const u8 *buf1, size_t len1,
                          const u8 *buf2, size_t len2);
+
+int write_pcapng_init(struct wlantest *wt, const char *fname);
+void write_pcapng_deinit(struct wlantest *wt);
+struct pcap_pkthdr;
+void write_pcapng_write_read(struct wlantest *wt, int dlt,
+                            struct pcap_pkthdr *hdr, const u8 *data);
+void write_pcapng_captured(struct wlantest *wt, const u8 *buf, size_t len);
+
 void wlantest_process(struct wlantest *wt, const u8 *data, size_t len);
 void wlantest_process_prism(struct wlantest *wt, const u8 *data, size_t len);
 void wlantest_process_80211(struct wlantest *wt, const u8 *data, size_t len);
@@ -243,6 +270,8 @@ u8 * wep_decrypt(struct wlantest *wt, const struct ieee80211_hdr *hdr,
 
 u8 * bip_protect(const u8 *igtk, u8 *frame, size_t len, u8 *ipn, int keyid,
                 size_t *prot_len);
+u8 * bip_gmac_protect(const u8 *igtk, size_t igtk_len, u8 *frame, size_t len,
+                     u8 *ipn, int keyid, size_t *prot_len);
 
 u8 * gcmp_decrypt(const u8 *tk, size_t tk_len, const struct ieee80211_hdr *hdr,
                  const u8 *data, size_t data_len, size_t *decrypted_len);