WAND Trace processing  4.0.5
rt_protocol.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2007-2016 The University of Waikato, Hamilton, New Zealand.
4  * All rights reserved.
5  *
6  * This file is part of libtrace.
7  *
8  * This code has been developed by the University of Waikato WAND
9  * research group. For further information please see http://www.wand.net.nz/
10  *
11  * libtrace is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation; either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * libtrace is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  *
24  *
25  */
26 #ifndef _RT_PROTOCOL_H
27 #define _RT_PROTOCOL_H
28 
29 #include "libtrace.h"
30 #include <time.h>
31 
40 #define COLLECTOR_PORT 3435
41 
43 #define RT_MAX_HDR_SIZE 256
44 
45 #define RT_ACK_FREQUENCY (10)
46 #define LIBTRACE_RT_VERSION (0x04)
47 #define LIBTRACE_RT_MAGIC (0x5a)
48 
49 /* Procedure for adding new RT control types
50  * -------------------------------------------
51  *
52  * Add type to the enum list
53  * Add a struct below (even if it is empty - wrap it in an #if 0)
54  * Update rt_get_capture_length
55  * If type is intended to be sent TO clients, update rt_read_packet
56  * Otherwise, update server implementations e.g. WDCAP
57  *
58  * Procedure for adding new RT data types
59  * ----------------------------------------
60  *
61  * If you are adding a new format:
62  * RT_DATA_(new format) must be equal to RT_DATA_SIMPLE +
63  * TRACE_FORMAT_(new_format)
64  * Add a new dummy trace type to the rt_format_t structure
65  * Set the dummy trace to NULL in rt_init_input
66  * Update rt_set_format
67  *
68  * If you are adding a new PCAP DLT type:
69  * RT_DATA_PCAP_(new DLT) must be equal to RT_DATA_PCAP + (DLT value)
70  *
71  */
72 
74 typedef struct fifo_info {
75  uint64_t in;
76  uint64_t out;
77  uint64_t ack;
78  uint64_t length;
79  uint64_t used;
80 } PACKED fifo_info_t;
81 
83 typedef struct rt_header {
85  uint32_t type;
86 
87  uint8_t magic;
88 
89  uint8_t version;
90 
92  uint16_t length;
94  uint32_t sequence;
95 } PACKED rt_header_t;
96 
97 /* TODO: Reorganise this struct once more hello info is added */
98 
100 typedef struct rt_hello {
103  uint8_t reliable;
104 } PACKED rt_hello_t ;
105 
106 #if 0
107 typedef struct rt_start {
108 
109 } rt_start_t;
110 #endif
111 
113 typedef struct rt_ack {
115  uint32_t sequence;
116 } PACKED rt_ack_t;
117 
119 typedef struct rt_status {
122 } PACKED rt_status_t;
123 
124 #if 0
125 typedef struct rt_duck {
126  /*duckinf_t duck; */
127 } rt_duck_t;
128 #endif
129 
130 #if 0
131 typedef struct rt_end_data {
132 
133 } rt_end_data_t;
134 #endif
135 
136 #if 0
137 typedef struct rt_close {
138 
139 } rt_close_t;
140 #endif
141 
150 };
151 
153 typedef struct rt_deny_conn {
155  uint32_t reason;
156 } PACKED rt_deny_conn_t;
157 
158 #if 0
159 typedef struct rt_pause {
160 
161 } rt_pause_t;
162 #endif
163 
164 #if 0
165 typedef struct rt_pause_ack {
166 
167 } rt_pause_ack_t;
168 #endif
169 
170 #if 0
171 typedef struct rt_option {
172 
173 } rt_option_t;
174 #endif
175 
176 #if 0
177 typedef struct rt_keychange {
178 
179 } rt_keychange_t;
180 #endif
181 
183 typedef struct rt_metadata {
185  uint32_t label_len;
187  uint32_t value_len;
188 } PACKED rt_metadata_t;
189 
197 typedef struct duck2_4 {
198  uint32_t Command;
199  uint32_t Config;
200  uint32_t Clock_Inc;
201  uint32_t Clock_Wrap;
202  uint32_t DDS_Rate;
203  uint32_t Crystal_Freq;
204  uint32_t Synth_Freq;
205  uint32_t Sync_Rate;
206  uint64_t Last_Ticks;
207  uint32_t Resyncs;
208  uint32_t Bad_Diffs;
209  uint32_t Bad_Offs;
210  uint32_t Bad_Pulses;
211  uint32_t Worst_Error;
212  uint32_t Worst_Off;
213  uint32_t Off_Limit;
214  uint32_t Off_Damp;
215  uint32_t Pulses;
216  uint32_t Single_Pulses_Missing;
217  uint32_t Longest_Pulse_Missing;
218  uint32_t Health;
219  uint32_t Sickness;
220  int32_t Error;
221  int32_t Offset;
222  uint32_t Stat_Start;
223  uint32_t Stat_End;
224  uint32_t Set_Duck_Field;
225 } PACKED duck2_4_t;
226 
228 typedef struct duck2_5 {
229  uint32_t Crystal_Freq;
230  uint32_t Synth_Freq;
231  uint64_t Last_Ticks;
232  uint32_t Resyncs;
233  uint32_t Bad_Pulses;
234  uint32_t Worst_Freq_Err;
235  uint32_t Worst_Phase_Err;
236  uint32_t Health_Thresh;
237  uint32_t Pulses;
238  uint32_t Single_Pulses_Missing;
239  uint32_t Longest_Pulse_Missing;
240  uint32_t Health;
241  uint32_t Sickness;
242  int32_t Freq_Err;
243  int32_t Phase_Err;
244  uint32_t Set_Duck_Field;
245  uint32_t Stat_Start;
246  uint32_t Stat_End;
247  uint64_t Last_TSC;
248 } PACKED duck2_5_t;
249 
250 typedef struct duck5_0 {
251  int64_t Phase_Correction;
252  uint64_t Last_Ticks;
253  uint64_t Last_TSC;
254  /* XXX Stat_Start and Stat_End are time_t in dagioctl.h, which means
255  * they could in theory be 32 or 64 bit depending on the architecture
256  * when capturing. I'm going to assume 5.0 era DAG captures are taking
257  * place on a 64 bit arch, rather than have to deal with the varying
258  * sizes (especially given nobody really uses DUCK these days).
259  */
260  uint64_t Stat_Start, Stat_End;
261  uint32_t Crystal_Freq;
262  uint32_t Synth_Freq;
263  uint32_t Resyncs;
264  uint32_t Bad_Pulses;
265  uint32_t Worst_Freq_Err, Worst_Phase_Err;
266  uint32_t Health_Thresh;
267  uint32_t Pulses, Single_Pulses_Missing, Longest_Pulse_Missing;
268  uint32_t Health, Sickness;
269  int32_t Freq_Err, Phase_Err;
270  uint32_t Set_Duck_Field;
271 } PACKED duck5_0_t;
272 
273 /*
274 typedef struct rt_duck_2_4 {
275  duck2_4_t duck;
276 } rt_duck_2_4_t;
277 
278 typedef struct rt_duck_2_5 {
279  duck2_5_t duck;
280 } rt_duck_2_5_t;
281 */
282 
283 #endif
uint64_t in
The offset for the fifo write pointer.
Definition: rt_protocol.h:75
struct duck2_4 duck2_4_t
Specifications of duck structures - duck2_4 and duck2_5 match Endace's duck_inf and duckinf_t respect...
The server has reached the maximum number of client connections.
Definition: rt_protocol.h:147
struct rt_status rt_status_t
RT Status sub-header.
struct fifo_info fifo_info_t
Fifo statistics reported by the RT_STATUS message.
RT packet header.
Definition: rt_protocol.h:83
Trace file processing library header.
uint64_t out
The offset for the fifo read pointer.
Definition: rt_protocol.h:76
uint32_t sequence
The sequence number of the last received RT packet.
Definition: rt_protocol.h:115
struct rt_metadata rt_metadata_t
RT meta-data sub-header.
uint64_t length
The total length of the fifo.
Definition: rt_protocol.h:78
DAG 2.5 DUCK.
Definition: rt_protocol.h:228
RT Ack sub-header.
Definition: rt_protocol.h:113
RT Status sub-header.
Definition: rt_protocol.h:119
RT Hello packet sub-header.
Definition: rt_protocol.h:100
struct rt_hello rt_hello_t
RT Hello packet sub-header.
uint16_t length
The length of the packet (not including the RT header.
Definition: rt_protocol.h:92
uint64_t used
The amount of fifo space in use.
Definition: rt_protocol.h:79
Specifications of duck structures - duck2_4 and duck2_5 match Endace's duck_inf and duckinf_t respect...
Definition: rt_protocol.h:197
uint32_t sequence
The sequence number of the packet.
Definition: rt_protocol.h:94
The client failed a TCP wrapper check.
Definition: rt_protocol.h:145
Definition: rt_protocol.h:250
uint32_t reason
The reason that the connection was denied.
Definition: rt_protocol.h:155
struct rt_deny_conn rt_deny_conn_t
RT Denied Connection sub-header.
Client failed to correctly authenticate.
Definition: rt_protocol.h:149
struct duck2_5 duck2_5_t
DAG 2.5 DUCK.
RT meta-data sub-header.
Definition: rt_protocol.h:183
uint64_t ack
The offset for the fifo ACK pointer.
Definition: rt_protocol.h:77
uint32_t type
The type of RT packet.
Definition: rt_protocol.h:85
struct rt_header rt_header_t
RT packet header.
uint8_t reliable
Indicates whether the sender is acting in a reliable fashion, i.e.
Definition: rt_protocol.h:103
rt_conn_denied_t
Reasons that an RT connection may be denied.
Definition: rt_protocol.h:143
uint32_t label_len
Length of the label string that follows the header.
Definition: rt_protocol.h:185
Fifo statistics reported by the RT_STATUS message.
Definition: rt_protocol.h:74
struct rt_ack rt_ack_t
RT Ack sub-header.
uint32_t value_len
Length of the value string that follows the header.
Definition: rt_protocol.h:187
RT Denied Connection sub-header.
Definition: rt_protocol.h:153
fifo_info_t fifo_status
Statistics describing the current status of the sender fifo.
Definition: rt_protocol.h:121