1 | /* |
---|
2 | * This file is part of libtrace |
---|
3 | * |
---|
4 | * Copyright (c) 2004 The University of Waikato, Hamilton, New Zealand. |
---|
5 | * Authors: Daniel Lawson |
---|
6 | * Perry Lorier |
---|
7 | * |
---|
8 | * All rights reserved. |
---|
9 | * |
---|
10 | * This code has been developed by the University of Waikato WAND |
---|
11 | * research group. For further information please see http://www.wand.net.nz/ |
---|
12 | * |
---|
13 | * libtrace is free software; you can redistribute it and/or modify |
---|
14 | * it under the terms of the GNU General Public License as published by |
---|
15 | * the Free Software Foundation; either version 2 of the License, or |
---|
16 | * (at your option) any later version. |
---|
17 | * |
---|
18 | * libtrace is distributed in the hope that it will be useful, |
---|
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
21 | * GNU General Public License for more details. |
---|
22 | * |
---|
23 | * You should have received a copy of the GNU General Public License |
---|
24 | * along with libtrace; if not, write to the Free Software |
---|
25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
26 | * |
---|
27 | * $Id$ |
---|
28 | * |
---|
29 | */ |
---|
30 | |
---|
31 | #ifndef _WAG_H |
---|
32 | #define _WAG_H |
---|
33 | |
---|
34 | /* This is the WAG magic number - used to delimit frames */ |
---|
35 | #define WAG_MAGIC (0xdaa1) |
---|
36 | |
---|
37 | /* Define frame types */ |
---|
38 | #define FRAME_TYPE_DATA (0x0000) |
---|
39 | #define FRAME_TYPE_UNDEFINED (0xffff) |
---|
40 | |
---|
41 | /* Define frame subtypes */ |
---|
42 | #define FRAME_SUBTYPE_DATA_RX (0x0000) |
---|
43 | #define FRAME_SUBTYPE_DATA_TX (0x0001) |
---|
44 | |
---|
45 | /* This is the common part of the frame header. |
---|
46 | * We synchronise by scanning a stream to look for the magic number (WAG_MAGIC). |
---|
47 | * We can then tell the size and type of this frame, and pass over it if necessary. |
---|
48 | */ |
---|
49 | struct frame_t { |
---|
50 | uint16_t magic; /* magic number (0xdaa1) */ |
---|
51 | uint16_t size; /* total frame size in bytes */ |
---|
52 | uint16_t type; /* frame type */ |
---|
53 | uint16_t subtype; /* frame subtype */ |
---|
54 | }; |
---|
55 | |
---|
56 | /*///////////////////////////////////////////////////////////////////////////////// |
---|
57 | // |
---|
58 | // Frames that the radio part of the WAG framework understands |
---|
59 | // |
---|
60 | /////////////////////////////////////////////////////////////////////////////////// |
---|
61 | // Common subfields... |
---|
62 | */ |
---|
63 | |
---|
64 | /* timestamp */ |
---|
65 | struct timestamp_t { |
---|
66 | uint32_t secs; /* seconds since start of 01-01-1970 */ |
---|
67 | uint32_t subsecs; /* (1/(2^32))ths of a second */ |
---|
68 | }; |
---|
69 | |
---|
70 | /* frame stream information */ |
---|
71 | struct strinfo_t { |
---|
72 | uint16_t unused_1; |
---|
73 | uint16_t unused_2; |
---|
74 | uint16_t unused_3; |
---|
75 | uint16_t packets_lost; |
---|
76 | }; |
---|
77 | |
---|
78 | /* Type: DATA, Subtype: RX */ |
---|
79 | struct frame_data_rx_t { |
---|
80 | struct frame_t hdr; /* common frame header */ |
---|
81 | struct strinfo_t strinfo; /* stream status */ |
---|
82 | struct timestamp_t ts; /* timestamp of reception of this frame */ |
---|
83 | struct { |
---|
84 | uint8_t rssi; /* receive signal strength of this frame */ |
---|
85 | uint8_t rxstatus; /* rx status bits from the modem */ |
---|
86 | uint16_t length; /* length in bytes of the frame payload */ |
---|
87 | struct { |
---|
88 | uint8_t signal; /* 802.11PLCP signal field */ |
---|
89 | uint8_t service; /* 802.11PLCP service field */ |
---|
90 | uint16_t length; } plcp; } rxinfo; /* 802.11PLCP length field (uS) */ |
---|
91 | }; |
---|
92 | |
---|
93 | /* Type: DATA, Subtype: TX */ |
---|
94 | struct frame_data_tx_t { |
---|
95 | struct frame_t hdr; /* common frame header */ |
---|
96 | uint64_t unused_1; |
---|
97 | uint64_t unused_2; |
---|
98 | struct { |
---|
99 | uint8_t gain; /* tx gain with which to send this packet */ |
---|
100 | uint8_t mode; /* tx mode with which to send this packet */ |
---|
101 | uint16_t length; /* length in bytes of the frame payload */ |
---|
102 | uint32_t unused_1; } txinfo; |
---|
103 | }; |
---|
104 | |
---|
105 | struct ieee_802_11_header { |
---|
106 | unsigned int protocol:2; |
---|
107 | unsigned int type:2; |
---|
108 | unsigned int subtype:4; |
---|
109 | unsigned int to_ds:1; |
---|
110 | unsigned int from_ds:1; |
---|
111 | unsigned int more_frag:1; |
---|
112 | unsigned int retry:1; |
---|
113 | unsigned int power:1; |
---|
114 | unsigned int more_data:1; |
---|
115 | unsigned int wep:1; |
---|
116 | unsigned int order:1; |
---|
117 | unsigned int duration; |
---|
118 | uint8_t mac1[6]; |
---|
119 | uint8_t mac2[6]; |
---|
120 | uint8_t mac3[6]; |
---|
121 | uint16_t SeqCtl; |
---|
122 | uint8_t mac4[6]; |
---|
123 | }; |
---|
124 | |
---|
125 | struct ieee_802_11_payload { |
---|
126 | uint16_t type; |
---|
127 | }; |
---|
128 | |
---|
129 | |
---|
130 | #endif |
---|