source: lib/rt_protocol.h @ 7b4b5ab

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

Added RT_KEYCHANGE to rt protocol
Fixed incorrect calculation in trace_get_seconds
rt_read_packet now returns sizeof(rt_header_t) + packet length
trace_get_capture_length no longer asserts for packet->size = 0

  • Property mode set to 100644
File size: 3.4 KB
Line 
1#ifndef _RT_PROTOCOL_H
2#define _RT_PROTOCOL_H
3
4#include "libtrace.h"
5#include <pcap.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)
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 
55 RT_DATA_ERF            =RT_DATA_SIMPLE + TRACE_FORMAT_ERF, 
56 RT_DATA_WAG            =RT_DATA_SIMPLE + TRACE_FORMAT_WAG, 
57 RT_DATA_LEGACY_ATM     =RT_DATA_SIMPLE + TRACE_FORMAT_LEGACY_ATM, 
58 RT_DATA_LEGACY_POS     =RT_DATA_SIMPLE + TRACE_FORMAT_LEGACY_POS, 
59 RT_DATA_LEGACY_ETH     =RT_DATA_SIMPLE + TRACE_FORMAT_LEGACY_ETH, 
60
61 RT_DATA_PCAP_NULL              =RT_DATA_PCAP + DLT_NULL,
62 RT_DATA_PCAP_EN10MB            =RT_DATA_PCAP + DLT_EN10MB,
63 RT_DATA_PCAP_ATM_RFC1483       =RT_DATA_PCAP + DLT_ATM_RFC1483,
64 RT_DATA_PCAP_IEEE802_11        =RT_DATA_PCAP + DLT_IEEE802_11,
65#ifdef DLT_LINUX_SLL
66 RT_DATA_PCAP_LINUX_SLL         =RT_DATA_PCAP + DLT_LINUX_SLL,
67#endif
68#ifdef DLT_PFLOG
69 RT_DATA_PCAP_PFLOG             =RT_DATA_PCAP + DLT_PFLOG,
70#endif
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 */
90typedef struct rt_hello {
91        uint8_t reliable;
92} rt_hello_t;
93
94typedef struct rt_start {
95
96} rt_start_t;
97
98typedef struct rt_ack {
99        uint32_t sequence;
100} rt_ack_t;
101
102typedef struct rt_status {
103        fifo_info_t fifo_status;
104} rt_status_t;
105
106typedef struct rt_duck {
107        /*duckinf_t duck; */
108} rt_duck_t;
109
110typedef struct rt_end_data {
111
112} rt_end_data_t;
113
114 typedef struct rt_close {
115
116} rt_close_t; 
117
118
119/* Connection denied reasons */
120enum rt_conn_denied_t {
121 RT_DENY_WRAPPER        =1,
122 RT_DENY_FULL           =2,
123 RT_DENY_AUTH           =3
124};
125
126typedef struct rt_deny_conn {
127        enum rt_conn_denied_t reason;
128} rt_deny_conn_t;
129
130
131typedef struct rt_pause {
132
133} rt_pause_t;
134
135typedef struct rt_pause_ack {
136
137} rt_pause_ack_t;
138
139typedef struct rt_option {
140
141} rt_option_t;
142
143typedef struct rt_keychange {
144       
145} rt_keychange_t;
146
147#endif
Note: See TracBrowser for help on using the repository browser.