about summary refs log tree commit diff stats
path: root/test/src/helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/src/helpers.h')
-rw-r--r--test/src/helpers.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/test/src/helpers.h b/test/src/helpers.h new file mode 100644 index 0000000..99a5329 --- /dev/null +++ b/test/src/helpers.h
@@ -0,0 +1,60 @@
1#include <stdint.h>
2#include <sys/types.h>
3
4#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
5#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
6
7static const uint8_t radiotap_data[] = {
8 0x00,
9 0x00, // <-- radiotap version (ignore this)
10 0x18,
11 0x00, // <-- number of bytes in our header (count the number of "0x"s)
12
13 /**
14 * The next field is a bitmap of which options we are including.
15 * The full list of which field is which option is in ieee80211_radiotap.h,
16 * but I've chosen to include:
17 * 0x00 0x01: timestamp
18 * 0x00 0x02: flags
19 * 0x00 0x03: rate
20 * 0x00 0x04: channel
21 * 0x80 0x00: tx flags (seems silly to have this AND flags, but oh well)
22 */
23 0x0f,
24 0x80,
25 0x00,
26 0x00,
27
28 0x00,
29 0x00,
30 0x00,
31 0x00,
32 0x00,
33 0x00,
34 0x00,
35 0x00, // <-- timestamp
36
37 /**
38 * This is the first set of flags, and we've set the bit corresponding to
39 * IEEE80211_RADIOTAP_F_FCS, meaning we want the card to add a FCS at the
40 * end of our buffer for us.
41 */
42 0x10,
43
44 0x00, // <-- rate
45 0x00,
46 0x00,
47 0x00,
48 0x00, // <-- channel
49
50 /**
51 * This is the second set of flags, specifically related to transmissions.
52 * The bit we've set is IEEE80211_RADIOTAP_F_TX_NOACK, which means the card
53 * won't wait for an ACK for this frame, and that it won't retry if it
54 * doesn't get one.
55 */
56 0x08,
57 0x00,
58};
59
60void hexdump(void *data, size_t size);