source: lib/rt_protocol.h @ 3787331

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 3787331 was 81c0b9e, checked in by Shane Alcock <salcock@…>, 12 years ago
  • Documented and licensed the last two header files in lib/
  • Property mode set to 100644
File size: 6.7 KB
Line 
1/*
2 * This file is part of libtrace
3 *
4 * Copyright (c) 2007,2008,2009,2010 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/** Maximum sequence number for the RT protocol */
53#define MAX_SEQUENCE 2147483647
54
55/* Procedure for adding new RT control types
56 * -------------------------------------------
57 *
58 * Add type to the enum list
59 * Add a struct below (even if it is empty - wrap it in an #if 0)
60 * Update rt_get_capture_length
61 * If type is intended to be sent TO clients, update rt_read_packet
62 *      Otherwise, update server implementations e.g. WDCAP
63 *
64 * Procedure for adding new RT data types
65 * ----------------------------------------
66 *
67 * If you are adding a new format:
68 *      RT_DATA_(new format) must be equal to RT_DATA_SIMPLE +
69 *              TRACE_FORMAT_(new_format)
70 *      Add a new dummy trace type to the rt_format_t structure
71 *      Set the dummy trace to NULL in rt_init_input
72 *      Update rt_set_format
73 *
74 * If you are adding a new PCAP DLT type:
75 *      RT_DATA_PCAP_(new DLT) must be equal to RT_DATA_PCAP + (DLT value)
76 *     
77 */
78
79/** Fifo statistics reported by the RT_STATUS message */
80typedef struct fifo_info {
81        uint64_t in;            /**< The offset for the fifo write pointer */
82        uint64_t out;           /**< The offset for the fifo read pointer */
83        uint64_t ack;           /**< The offset for the fifo ACK pointer */
84        uint64_t length;        /**< The total length of the fifo */
85        uint64_t used;          /**< The amount of fifo space in use */
86} fifo_info_t;
87
88/** RT packet header */
89typedef struct rt_header {
90        /** The type of RT packet */
91        libtrace_rt_types_t type;       
92        /** The length of the packet (not including the RT header */
93        uint16_t length;               
94        /** The sequence number of the packet */
95        uint32_t sequence;
96} rt_header_t;
97
98/* TODO: Reorganise this struct once more hello info is added */
99
100/** RT Hello packet sub-header */
101typedef struct rt_hello {
102        /** Indicates whether the sender is acting in a reliable fashion,
103         *  i.e. expecting acknowledgements */
104        uint8_t reliable;       
105} rt_hello_t;
106
107#if 0
108typedef struct rt_start {
109
110} rt_start_t;
111#endif
112
113/** RT Ack sub-header */
114typedef struct rt_ack {
115        /** The sequence number of the last received RT packet */
116        uint32_t sequence;
117} rt_ack_t;
118
119/** RT Status sub-header */
120typedef struct rt_status {
121        /** Statistics describing the current status of the sender fifo */
122        fifo_info_t fifo_status;
123} rt_status_t;
124
125#if 0
126typedef struct rt_duck {
127        /*duckinf_t duck; */
128} rt_duck_t;
129#endif
130
131#if 0
132typedef struct rt_end_data {
133
134} rt_end_data_t;
135#endif
136
137#if 0
138typedef struct rt_close {
139
140} rt_close_t;
141#endif
142
143/** Reasons that an RT connection may be denied */
144enum rt_conn_denied_t {
145        /** The client failed a TCP wrapper check */
146        RT_DENY_WRAPPER         =1,
147        /** The server has reached the maximum number of client connections */
148        RT_DENY_FULL            =2,
149        /** Client failed to correctly authenticate */
150        RT_DENY_AUTH            =3
151};
152
153/** RT Denied Connection sub-header */
154typedef struct rt_deny_conn {
155        /** The reason that the connection was denied */
156        enum rt_conn_denied_t reason;
157} rt_deny_conn_t;
158
159#if 0
160typedef struct rt_pause {
161
162} rt_pause_t;
163#endif
164
165#if 0
166typedef struct rt_pause_ack {
167
168} rt_pause_ack_t;
169#endif
170
171#if 0
172typedef struct rt_option {
173
174} rt_option_t;
175#endif
176
177#if 0
178typedef struct rt_keychange {
179       
180} rt_keychange_t;
181#endif
182
183/** RT meta-data sub-header */
184typedef struct rt_metadata {
185        /** Length of the label string that follows the header */
186        uint32_t label_len;
187        /** Length of the value string that follows the header */
188        uint32_t value_len;
189} rt_metadata_t ;
190
191/** Specifications of duck structures - duck2_4 and duck2_5 match Endace's
192 * duck_inf and duckinf_t respectively. Unfortunately, Endace don't exactly
193 * make it clear what each value within the duck structure actually means.
194 * Some are self-explanatory but I have no idea about the others so our own
195 * documentation is a bit weak as a result */
196
197/** DAG 2.4 DUCK */
198typedef struct duck2_4 {
199        uint32_t        Command;
200        uint32_t        Config;
201        uint32_t        Clock_Inc;
202        uint32_t        Clock_Wrap;
203        uint32_t        DDS_Rate;
204        uint32_t        Crystal_Freq;
205        uint32_t        Synth_Freq; 
206        uint32_t        Sync_Rate;
207        uint64_t        Last_Ticks;
208        uint32_t        Resyncs;
209        uint32_t        Bad_Diffs;
210        uint32_t        Bad_Offs;
211        uint32_t        Bad_Pulses;
212        uint32_t        Worst_Error;
213        uint32_t        Worst_Off;
214        uint32_t        Off_Limit;
215        uint32_t        Off_Damp;
216        uint32_t        Pulses;
217        uint32_t        Single_Pulses_Missing;
218        uint32_t        Longest_Pulse_Missing;
219        uint32_t        Health;
220        uint32_t        Sickness;
221        int32_t         Error;
222        int32_t         Offset;
223        uint32_t        Stat_Start;
224        uint32_t        Stat_End;   
225        uint32_t        Set_Duck_Field;
226} PACKED duck2_4_t;
227
228/** DAG 2.5 DUCK */
229typedef struct duck2_5 {
230        uint32_t        Crystal_Freq;
231        uint32_t        Synth_Freq;
232        uint64_t        Last_Ticks;
233        uint32_t        Resyncs;
234        uint32_t        Bad_Pulses;
235        uint32_t        Worst_Freq_Err;
236        uint32_t        Worst_Phase_Err;
237        uint32_t        Health_Thresh;
238        uint32_t        Pulses;
239        uint32_t        Single_Pulses_Missing;
240        uint32_t        Longest_Pulse_Missing;
241        uint32_t        Health;
242        uint32_t        Sickness;
243        int32_t         Freq_Err;
244        int32_t         Phase_Err;
245        uint32_t        Set_Duck_Field;
246        uint32_t        Stat_Start;
247        uint32_t        Stat_End;
248        uint64_t        Last_TSC;
249} PACKED duck2_5_t;
250
251/*
252typedef struct rt_duck_2_4 {
253        duck2_4_t duck;
254} rt_duck_2_4_t;
255
256typedef struct rt_duck_2_5 {
257        duck2_5_t duck;
258} rt_duck_2_5_t;
259*/
260
261#endif
Note: See TracBrowser for help on using the repository browser.