QCA vendor subcommand for LL_STATS extension
[mech_eap.git] / wlantest / writepcap.c
index 58f01a0..abd889f 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "utils/common.h"
 #include "wlantest.h"
+#include "common/qca-vendor.h"
 
 
 int write_pcap_init(struct wlantest *wt, const char *fname)
@@ -58,6 +59,8 @@ void write_pcap_captured(struct wlantest *wt, const u8 *buf, size_t len)
        h.caplen = len;
        h.len = len;
        pcap_dump(wt->write_pcap_dumper, &h, buf);
+       if (wt->pcap_no_buffer)
+               pcap_dump_flush(wt->write_pcap_dumper);
 }
 
 
@@ -68,8 +71,10 @@ void write_pcap_decrypted(struct wlantest *wt, const u8 *buf1, size_t len1,
        u8 rtap[] = {
                0x00 /* rev */,
                0x00 /* pad */,
-               0x08, 0x00, /* header len */
-               0x00, 0x00, 0x00, 0x00 /* present flags */
+               0x0e, 0x00, /* header len */
+               0x00, 0x00, 0x00, 0x40, /* present flags */
+               0x00, 0x13, 0x74, QCA_RADIOTAP_VID_WLANTEST,
+               0x00, 0x00
        };
        u8 *buf;
        size_t len;
@@ -99,6 +104,8 @@ void write_pcap_decrypted(struct wlantest *wt, const u8 *buf1, size_t len1,
        h.caplen = len;
        h.len = len;
        pcap_dump(wt->write_pcap_dumper, &h, buf);
+       if (wt->pcap_no_buffer)
+               pcap_dump_flush(wt->write_pcap_dumper);
 }
 
 
@@ -178,6 +185,8 @@ int write_pcapng_init(struct wlantest *wt, const char *fname)
        desc.link_type = LINKTYPE_IEEE802_11_RADIO;
        desc.snap_len = 65535;
        fwrite(&desc, sizeof(desc), 1, wt->pcapng);
+       if (wt->pcap_no_buffer)
+               fflush(wt->pcapng);
 
        return 0;
 }
@@ -260,6 +269,8 @@ static void write_pcapng_decrypted(struct wlantest *wt)
        *block_len = pkt->block_total_len = pos - (u8 *) pkt;
 
        fwrite(pkt, pos - (u8 *) pkt, 1, wt->pcapng);
+       if (wt->pcap_no_buffer)
+               fflush(wt->pcapng);
 
        os_free(pkt);
 }
@@ -334,6 +345,8 @@ void write_pcapng_write_read(struct wlantest *wt, int dlt,
        *block_len = pkt->block_total_len = pos - (u8 *) pkt;
 
        fwrite(pkt, pos - (u8 *) pkt, 1, wt->pcapng);
+       if (wt->pcap_no_buffer)
+               fflush(wt->pcapng);
 
        os_free(pkt);