source: lib/rt_protocol.h @ e502f76

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

Added a pause function to format_rt
Moved the rt_connect call to rt_start
Got rid of blocking in rt_read_versatile by remembering the rt header
Removed 'restrict' from trace.c as some compilers didn't like it
Fixed bugs in configure that was causing failure to detect DAG
Added a new rt type for lost connections

  • Property mode set to 100644
File size: 5.5 KB
Line 
1#ifndef _RT_PROTOCOL_H
2#define _RT_PROTOCOL_H
3
4#include "libtrace.h"
5#include <time.h>
6
7#define CAPTURE_PORT 3434
8#define COLLECTOR_PORT 3435
9
10#define RT_MAX_HDR_SIZE 256
11#define MAX_SEQUENCE 2147483647
12
13#define RT_DATA_SIMPLE 1000
14#define RT_DATA_PCAP 2000
15
16/* Procedure for adding new RT control types
17 * -------------------------------------------
18 *
19 * Add type to the enum list
20 * Add a struct below (even if it is empty - wrap it in an #if 0)
21 * Update rt_get_capture_length
22 * If type is intended to be sent TO clients, update rt_read_packet
23 *      Otherwise, update server implementations e.g. WDCAP
24 *
25 * Procedure for adding new RT data types
26 * ----------------------------------------
27 *
28 * If you are adding a new format:
29 *      RT_DATA_(new format) must be equal to RT_DATA_SIMPLE +
30 *              TRACE_FORMAT_(new_format)
31 *      Add a new dummy trace type to the rt_format_t structure
32 *      Set the dummy trace to NULL in rt_init_input
33 *      Update rt_set_format
34 *
35 * If you are adding a new PCAP DLT type:
36 *      RT_DATA_PCAP_(new DLT) must be equal to RT_DATA_PCAP + (DLT value)
37 *     
38 */
39
40/** Type field definitions */
41enum rt_field_t {
42 RT_HELLO       =1,     /**< Connection accepted */
43 RT_START       =2,     /**< Request for data transmission to begin */
44 RT_ACK         =3,     /**< Data acknowledgement */
45 RT_STATUS      =4,     /**< Fifo status packet */
46 RT_DUCK        =5,     /**< Dag duck info packet */
47 RT_END_DATA    =6,     /**< Server is exiting message */
48 RT_CLOSE       =7,     /**< Client is exiting message */
49 RT_DENY_CONN   =8,     /**< Connection has been denied */
50 RT_PAUSE       =9,     /**< Request server to suspend sending data */
51 RT_PAUSE_ACK   =10,    /**< Server is paused message */
52 RT_OPTION      =11,    /**< Option request */
53 RT_KEYCHANGE   =12,    /**< Anonymisation key has changed */ 
54 RT_DUCK_2_4    =13,    /**< Dag 2.4 Duck */
55 RT_DUCK_2_5    =14,    /**< Dag 2.5 Duck */
56 RT_LOSTCONN    =15,    /**< Lost connection to server */
57 
58 RT_DATA_ERF            =RT_DATA_SIMPLE + TRACE_FORMAT_ERF, 
59 RT_DATA_WAG            =RT_DATA_SIMPLE + TRACE_FORMAT_WAG, 
60 RT_DATA_LEGACY_ATM     =RT_DATA_SIMPLE + TRACE_FORMAT_LEGACY_ATM, 
61 RT_DATA_LEGACY_POS     =RT_DATA_SIMPLE + TRACE_FORMAT_LEGACY_POS, 
62 RT_DATA_LEGACY_ETH     =RT_DATA_SIMPLE + TRACE_FORMAT_LEGACY_ETH, 
63 RT_DATA_LINUX_NATIVE   =RT_DATA_SIMPLE + TRACE_FORMAT_LINUX_NATIVE,
64
65 RT_DATA_PCAP_NULL              =RT_DATA_PCAP + TRACE_DLT_NULL,
66 RT_DATA_PCAP_EN10MB            =RT_DATA_PCAP + TRACE_DLT_EN10MB,
67 RT_DATA_PCAP_ATM_RFC1483       =RT_DATA_PCAP + TRACE_DLT_ATM_RFC1483,
68 RT_DATA_PCAP_IEEE802_11        =RT_DATA_PCAP + TRACE_DLT_IEEE802_11,
69 RT_DATA_PCAP_LINUX_SLL         =RT_DATA_PCAP + TRACE_DLT_LINUX_SLL,
70 RT_DATA_PCAP_PFLOG             =RT_DATA_PCAP + TRACE_DLT_PFLOG,
71 RT_LAST = 3000
72};
73
74typedef struct fifo_info {
75        uint64_t in;
76        uint64_t out;
77        uint64_t ack;
78        uint64_t length;
79        uint64_t used;
80} fifo_info_t;
81
82/** RT packet header */
83typedef struct rt_header {
84        enum rt_field_t type;
85        uint16_t length;
86        uint32_t sequence;
87} rt_header_t;
88
89/* TODO: Reorganise this struct once more hello info is added */
90/** RT Hello packet sub-header */
91typedef struct rt_hello {
92        uint8_t reliable;
93} rt_hello_t;
94
95#if 0
96typedef struct rt_start {
97
98} rt_start_t;
99#endif
100
101/** RT Ack sub-header */
102typedef struct rt_ack {
103        uint32_t sequence;
104} rt_ack_t;
105
106/** RT Status sub-header */
107typedef struct rt_status {
108        fifo_info_t fifo_status;
109} rt_status_t;
110
111#if 0
112typedef struct rt_duck {
113        /*duckinf_t duck; */
114} rt_duck_t;
115#endif
116
117#if 0
118typedef struct rt_end_data {
119
120} rt_end_data_t;
121#endif
122
123#if 0
124typedef struct rt_close {
125
126} rt_close_t;
127#endif
128
129/** Connection denied reasons */
130enum rt_conn_denied_t {
131 RT_DENY_WRAPPER        =1,
132 RT_DENY_FULL           =2,
133 RT_DENY_AUTH           =3
134};
135
136/** RT Denied Connection sub-header */
137typedef struct rt_deny_conn {
138        enum rt_conn_denied_t reason;
139} rt_deny_conn_t;
140
141#if 0
142typedef struct rt_pause {
143
144} rt_pause_t;
145#endif
146
147#if 0
148typedef struct rt_pause_ack {
149
150} rt_pause_ack_t;
151#endif
152
153#if 0
154typedef struct rt_option {
155
156} rt_option_t;
157#endif
158
159#if 0
160typedef struct rt_keychange {
161       
162} rt_keychange_t;
163#endif
164
165/** Specifications of duck structures - duck2_4 and duck2_5 match Endace's
166 * duck_inf and duckinf_t respectively */
167
168/** DAG 2.4 DUCK */
169typedef struct duck2_4 {
170        uint32_t        Command;
171        uint32_t        Config;
172        uint32_t        Clock_Inc;
173        uint32_t        Clock_Wrap;
174        uint32_t        DDS_Rate;
175        uint32_t        Crystal_Freq;
176        uint32_t        Synth_Freq; 
177        uint32_t        Sync_Rate;
178        uint64_t        Last_Ticks;
179        uint32_t        Resyncs;
180        uint32_t        Bad_Diffs;
181        uint32_t        Bad_Offs;
182        uint32_t        Bad_Pulses;
183        uint32_t        Worst_Error;
184        uint32_t        Worst_Off;
185        uint32_t        Off_Limit;
186        uint32_t        Off_Damp;
187        uint32_t        Pulses;
188        uint32_t        Single_Pulses_Missing;
189        uint32_t        Longest_Pulse_Missing;
190        uint32_t        Health;
191        uint32_t        Sickness;
192        int32_t         Error;
193        int32_t         Offset;
194        uint32_t        Stat_Start;
195        uint32_t        Stat_End;   
196        uint32_t        Set_Duck_Field;
197} PACKED duck2_4_t;
198
199/** DAG 2.5 DUCK */
200typedef struct duck2_5 {
201        uint32_t        Crystal_Freq;
202        uint32_t        Synth_Freq;
203        uint64_t        Last_Ticks;
204        uint32_t        Resyncs;
205        uint32_t        Bad_Pulses;
206        uint32_t        Worst_Freq_Err;
207        uint32_t        Worst_Phase_Err;
208        uint32_t        Health_Thresh;
209        uint32_t        Pulses;
210        uint32_t        Single_Pulses_Missing;
211        uint32_t        Longest_Pulse_Missing;
212        uint32_t        Health;
213        uint32_t        Sickness;
214        int32_t         Freq_Err;
215        int32_t         Phase_Err;
216        uint32_t        Set_Duck_Field;
217        uint32_t        Stat_Start;
218        uint32_t        Stat_End;
219        uint64_t        Last_TSC;
220} PACKED duck2_5_t;
221
222/*
223typedef struct rt_duck_2_4 {
224        duck2_4_t duck;
225} rt_duck_2_4_t;
226
227typedef struct rt_duck_2_5 {
228        duck2_5_t duck;
229} rt_duck_2_5_t;
230*/
231
232#endif
Note: See TracBrowser for help on using the repository browser.