source: lib/rt_protocol.h @ d8b05b7

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since d8b05b7 was d8b05b7, checked in by Shane Alcock <salcock@…>, 6 years ago

Make sure our copyright covers recent years

Consistency across all of our source files is also nice.

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