source: lib/rt_protocol.h

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivendag_formatrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file was ee6e802, checked in by Shane Alcock <salcock@…>, 5 years ago

Updated copyright blurb on all source files

In some cases, this meant adding copyright blurbs to files that
had never had them before.

  • Property mode set to 100644
File size: 7.6 KB
Line 
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
32/** @file
33 *
34 * @brief Header file containing definitions specific to the RT protocol that
35 * can be used to transport captured packets over a network connection.
36 *
37 */
38
39/** Default port for RT clients */
40#define COLLECTOR_PORT 3435
41
42/** Maximum size for the RT header */
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
73/** Fifo statistics reported by the RT_STATUS message */
74typedef struct fifo_info {
75        uint64_t in;            /**< The offset for the fifo write pointer */
76        uint64_t out;           /**< The offset for the fifo read pointer */
77        uint64_t ack;           /**< The offset for the fifo ACK pointer */
78        uint64_t length;        /**< The total length of the fifo */
79        uint64_t used;          /**< The amount of fifo space in use */
80} PACKED fifo_info_t;
81
82/** RT packet header */
83typedef struct rt_header {
84        /** The type of RT packet */
85        uint32_t type; 
86       
87        uint8_t magic;
88
89        uint8_t version;
90
91        /** The length of the packet (not including the RT header */
92        uint16_t length;               
93        /** The sequence number of the packet */
94        uint32_t sequence;
95} PACKED rt_header_t;
96
97/* TODO: Reorganise this struct once more hello info is added */
98
99/** RT Hello packet sub-header */
100typedef struct rt_hello {
101        /** Indicates whether the sender is acting in a reliable fashion,
102         *  i.e. expecting acknowledgements */
103        uint8_t reliable;       
104} PACKED rt_hello_t ;
105
106#if 0
107typedef struct rt_start {
108
109} rt_start_t;
110#endif
111
112/** RT Ack sub-header */
113typedef struct rt_ack {
114        /** The sequence number of the last received RT packet */
115        uint32_t sequence;
116} PACKED rt_ack_t;
117
118/** RT Status sub-header */
119typedef struct rt_status {
120        /** Statistics describing the current status of the sender fifo */
121        fifo_info_t fifo_status;
122} PACKED rt_status_t;
123
124#if 0
125typedef struct rt_duck {
126        /*duckinf_t duck; */
127} rt_duck_t;
128#endif
129
130#if 0
131typedef struct rt_end_data {
132
133} rt_end_data_t;
134#endif
135
136#if 0
137typedef struct rt_close {
138
139} rt_close_t;
140#endif
141
142/** Reasons that an RT connection may be denied */
143enum rt_conn_denied_t {
144        /** The client failed a TCP wrapper check */
145        RT_DENY_WRAPPER         =1,
146        /** The server has reached the maximum number of client connections */
147        RT_DENY_FULL            =2,
148        /** Client failed to correctly authenticate */
149        RT_DENY_AUTH            =3
150};
151
152/** RT Denied Connection sub-header */
153typedef struct rt_deny_conn {
154        /** The reason that the connection was denied */
155        uint32_t reason;
156} PACKED rt_deny_conn_t;
157
158#if 0
159typedef struct rt_pause {
160
161} rt_pause_t;
162#endif
163
164#if 0
165typedef struct rt_pause_ack {
166
167} rt_pause_ack_t;
168#endif
169
170#if 0
171typedef struct rt_option {
172
173} rt_option_t;
174#endif
175
176#if 0
177typedef struct rt_keychange {
178       
179} rt_keychange_t;
180#endif
181
182/** RT meta-data sub-header */
183typedef struct rt_metadata {
184        /** Length of the label string that follows the header */
185        uint32_t label_len;
186        /** Length of the value string that follows the header */
187        uint32_t value_len;
188} PACKED rt_metadata_t;
189
190/** Specifications of duck structures - duck2_4 and duck2_5 match Endace's
191 * duck_inf and duckinf_t respectively. Unfortunately, Endace don't exactly
192 * make it clear what each value within the duck structure actually means.
193 * Some are self-explanatory but I have no idea about the others so our own
194 * documentation is a bit weak as a result */
195
196/** DAG 2.4 DUCK */
197typedef 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
227/** DAG 2.5 DUCK */
228typedef 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
250typedef 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/*
274typedef struct rt_duck_2_4 {
275        duck2_4_t duck;
276} rt_duck_2_4_t;
277
278typedef struct rt_duck_2_5 {
279        duck2_5_t duck;
280} rt_duck_2_5_t;
281*/
282
283#endif
Note: See TracBrowser for help on using the repository browser.