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 | /* Once a proper wag api is released, most of this file will become irrelevant |
---|
35 | * but for now, we need to define a lot of this stuff ourselves |
---|
36 | */ |
---|
37 | |
---|
38 | /* IOCTL's that we use */ |
---|
39 | #define CAPTURE_RADIOON 101 |
---|
40 | #define CAPTURE_RADIOOFF 102 |
---|
41 | #define CAPTURE_SETCHANNEL 103 |
---|
42 | |
---|
43 | /* This is the WAG magic number - used to delimit frames */ |
---|
44 | #define WAG_MAGIC (0xdaa1) |
---|
45 | |
---|
46 | /* Define frame types */ |
---|
47 | #define FRAME_TYPE_DATA (0x0000) |
---|
48 | #define FRAME_TYPE_UNDEFINED (0xffff) |
---|
49 | |
---|
50 | /* Define frame subtypes */ |
---|
51 | #define FRAME_SUBTYPE_DATA_RX (0x0000) |
---|
52 | #define FRAME_SUBTYPE_DATA_TX (0x0001) |
---|
53 | |
---|
54 | /** This is the common part of the frame header. |
---|
55 | * We synchronise by scanning a stream to look for the magic number |
---|
56 | * (WAG_MAGIC). We can then tell the size and type of this frame, and pass |
---|
57 | * over it if necessary. |
---|
58 | */ |
---|
59 | struct frame_t { |
---|
60 | uint16_t magic; /**< magic number (0xdaa1) */ |
---|
61 | uint16_t size; /**< total frame size in bytes */ |
---|
62 | uint16_t type; /**< frame type */ |
---|
63 | uint16_t subtype; /**< frame subtype */ |
---|
64 | }; |
---|
65 | |
---|
66 | /*///////////////////////////////////////////////////////////////////////////////// |
---|
67 | // |
---|
68 | // Frames that the radio part of the WAG framework understands |
---|
69 | // |
---|
70 | /////////////////////////////////////////////////////////////////////////////////// |
---|
71 | // Common subfields... |
---|
72 | */ |
---|
73 | |
---|
74 | /** timestamp */ |
---|
75 | struct timestamp_t { |
---|
76 | uint32_t secs; /**< seconds since start of 01-01-1970 */ |
---|
77 | uint32_t subsecs; /**< (1/(2^32))ths of a second */ |
---|
78 | }; |
---|
79 | |
---|
80 | /** frame stream information */ |
---|
81 | struct strinfo_t { |
---|
82 | uint16_t unused_1; |
---|
83 | uint16_t unused_2; |
---|
84 | uint16_t unused_3; |
---|
85 | uint16_t packets_lost; /**< Number of packets lost */ |
---|
86 | }; |
---|
87 | |
---|
88 | /** Type: DATA, Subtype: RX */ |
---|
89 | struct frame_data_rx_t { |
---|
90 | struct frame_t hdr; /**< common frame header */ |
---|
91 | struct strinfo_t strinfo; /**< stream status */ |
---|
92 | struct timestamp_t ts; /**< timestamp of reception of this frame */ |
---|
93 | struct { |
---|
94 | uint8_t rssi; /**< receive signal strength of this frame */ |
---|
95 | uint8_t rxstatus; /**< rx status bits from the modem */ |
---|
96 | uint16_t length; /**< length in bytes of the frame payload */ |
---|
97 | struct { |
---|
98 | uint8_t signal; /**< 802.11PLCP signal field */ |
---|
99 | uint8_t service; /**< 802.11PLCP service field */ |
---|
100 | uint16_t length; /**< 802.11PLCP length field (uS) */ |
---|
101 | } plcp; |
---|
102 | } rxinfo; |
---|
103 | }; |
---|
104 | |
---|
105 | /** Type: DATA, Subtype: TX */ |
---|
106 | struct frame_data_tx_t { |
---|
107 | struct frame_t hdr; /**< common frame header */ |
---|
108 | uint64_t unused_1; |
---|
109 | uint64_t unused_2; |
---|
110 | struct { |
---|
111 | uint8_t gain; /**< tx gain with which to send this packet */ |
---|
112 | uint8_t mode; /**< tx mode with which to send this packet */ |
---|
113 | uint16_t length; /**< length in bytes of the frame payload */ |
---|
114 | uint32_t unused_1; |
---|
115 | } txinfo; |
---|
116 | }; |
---|
117 | |
---|
118 | /** 802.11 payload */ |
---|
119 | typedef struct ieee_802_11_payload { |
---|
120 | uint16_t type; /**< ether type of this packet */ |
---|
121 | } libtrace_802_11_payload_t; |
---|
122 | |
---|
123 | |
---|
124 | #endif |
---|