1 | #ifndef _RT_PROTOCOL_H |
---|
2 | #define _RT_PROTOCOL_H |
---|
3 | |
---|
4 | #include "libtrace.h" |
---|
5 | |
---|
6 | #define CAPTURE_PORT 3434 |
---|
7 | #define COLLECTOR_PORT 3435 |
---|
8 | |
---|
9 | #define RT_MAX_HDR_SIZE 256 |
---|
10 | #define MAX_SEQUENCE 2147483647 |
---|
11 | |
---|
12 | #define RT_DATA_SIMPLE 1000 |
---|
13 | #define RT_DATA_PCAP 2000 |
---|
14 | |
---|
15 | /* Procedure for adding new RT control types |
---|
16 | * ------------------------------------------- |
---|
17 | * |
---|
18 | * Add type to the enum list |
---|
19 | * Add a struct below (even if it is empty) |
---|
20 | * Update rt_get_capture_length |
---|
21 | * If type is intended to be sent TO clients, update rt_read_packet |
---|
22 | * Otherwise, update server implementations e.g. WDCAP |
---|
23 | * |
---|
24 | * Procedure for adding new RT data types |
---|
25 | * ---------------------------------------- |
---|
26 | * |
---|
27 | * If you are adding a new format: |
---|
28 | * RT_DATA_(new format) must be equal to RT_DATA_SIMPLE + |
---|
29 | * TRACE_FORMAT_(new_format) |
---|
30 | * Add a new dummy trace type to the rt_format_t structure |
---|
31 | * Set the dummy trace to NULL in rt_init_input |
---|
32 | * Update rt_set_format |
---|
33 | * |
---|
34 | * If you are adding a new PCAP DLT type: |
---|
35 | * RT_DATA_PCAP_(new DLT) must be equal to RT_DATA_PCAP + (DLT value) |
---|
36 | * |
---|
37 | */ |
---|
38 | |
---|
39 | /* Type field definitions */ |
---|
40 | enum rt_field_t { |
---|
41 | RT_HELLO =1, /* Connection accepted */ |
---|
42 | RT_START =2, /* Request for data transmission to begin */ |
---|
43 | RT_ACK =3, /* Data acknowledgement */ |
---|
44 | RT_STATUS =4, /* Fifo status packet */ |
---|
45 | RT_DUCK =5, /* Dag duck info packet */ |
---|
46 | RT_END_DATA =6, /* Server is exiting message */ |
---|
47 | RT_CLOSE =7, /* Client is exiting message */ |
---|
48 | RT_DENY_CONN =8, /* Connection has been denied */ |
---|
49 | RT_PAUSE =9, /* Request server to suspend sending data */ |
---|
50 | RT_PAUSE_ACK =10, /* Server is paused message */ |
---|
51 | RT_OPTION =11, /* Option request */ |
---|
52 | RT_KEYCHANGE =12, /* Anonymisation key has changed */ |
---|
53 | |
---|
54 | RT_DATA_ERF =RT_DATA_SIMPLE + TRACE_FORMAT_ERF, |
---|
55 | RT_DATA_WAG =RT_DATA_SIMPLE + TRACE_FORMAT_WAG, |
---|
56 | RT_DATA_LEGACY_ATM =RT_DATA_SIMPLE + TRACE_FORMAT_LEGACY_ATM, |
---|
57 | RT_DATA_LEGACY_POS =RT_DATA_SIMPLE + TRACE_FORMAT_LEGACY_POS, |
---|
58 | RT_DATA_LEGACY_ETH =RT_DATA_SIMPLE + TRACE_FORMAT_LEGACY_ETH, |
---|
59 | RT_DATA_LINUX_NATIVE =RT_DATA_SIMPLE + TRACE_FORMAT_LINUX_NATIVE, |
---|
60 | |
---|
61 | RT_DATA_PCAP_NULL =RT_DATA_PCAP + TRACE_DLT_NULL, |
---|
62 | RT_DATA_PCAP_EN10MB =RT_DATA_PCAP + TRACE_DLT_EN10MB, |
---|
63 | RT_DATA_PCAP_ATM_RFC1483 =RT_DATA_PCAP + TRACE_DLT_ATM_RFC1483, |
---|
64 | RT_DATA_PCAP_IEEE802_11 =RT_DATA_PCAP + TRACE_DLT_IEEE802_11, |
---|
65 | RT_DATA_PCAP_LINUX_SLL =RT_DATA_PCAP + TRACE_DLT_LINUX_SLL, |
---|
66 | RT_DATA_PCAP_PFLOG =RT_DATA_PCAP + TRACE_DLT_PFLOG, |
---|
67 | RT_LAST = 3000 |
---|
68 | }; |
---|
69 | |
---|
70 | typedef struct fifo_info { |
---|
71 | uint64_t in; |
---|
72 | uint64_t out; |
---|
73 | uint64_t ack; |
---|
74 | uint64_t length; |
---|
75 | uint64_t used; |
---|
76 | } fifo_info_t; |
---|
77 | |
---|
78 | /* RT packet header */ |
---|
79 | typedef struct rt_header { |
---|
80 | enum rt_field_t type; |
---|
81 | uint16_t length; |
---|
82 | uint32_t sequence; |
---|
83 | } rt_header_t; |
---|
84 | |
---|
85 | /* TODO: Reorganise this struct once more hello info is added */ |
---|
86 | typedef struct rt_hello { |
---|
87 | uint8_t reliable; |
---|
88 | } rt_hello_t; |
---|
89 | |
---|
90 | #if 0 |
---|
91 | typedef struct rt_start { |
---|
92 | |
---|
93 | } rt_start_t; |
---|
94 | #endif |
---|
95 | |
---|
96 | typedef struct rt_ack { |
---|
97 | uint32_t sequence; |
---|
98 | } rt_ack_t; |
---|
99 | |
---|
100 | typedef struct rt_status { |
---|
101 | fifo_info_t fifo_status; |
---|
102 | } rt_status_t; |
---|
103 | |
---|
104 | #if 0 |
---|
105 | typedef struct rt_duck { |
---|
106 | /*duckinf_t duck; */ |
---|
107 | } rt_duck_t; |
---|
108 | #endif |
---|
109 | |
---|
110 | #if 0 |
---|
111 | typedef struct rt_end_data { |
---|
112 | |
---|
113 | } rt_end_data_t; |
---|
114 | #endif |
---|
115 | |
---|
116 | #if 0 |
---|
117 | typedef struct rt_close { |
---|
118 | |
---|
119 | } rt_close_t; |
---|
120 | #endif |
---|
121 | |
---|
122 | /* Connection denied reasons */ |
---|
123 | enum rt_conn_denied_t { |
---|
124 | RT_DENY_WRAPPER =1, |
---|
125 | RT_DENY_FULL =2, |
---|
126 | RT_DENY_AUTH =3 |
---|
127 | }; |
---|
128 | |
---|
129 | typedef struct rt_deny_conn { |
---|
130 | enum rt_conn_denied_t reason; |
---|
131 | } rt_deny_conn_t; |
---|
132 | |
---|
133 | #if 0 |
---|
134 | typedef struct rt_pause { |
---|
135 | |
---|
136 | } rt_pause_t; |
---|
137 | #endif |
---|
138 | |
---|
139 | #if 0 |
---|
140 | typedef struct rt_pause_ack { |
---|
141 | |
---|
142 | } rt_pause_ack_t; |
---|
143 | #endif |
---|
144 | |
---|
145 | #if 0 |
---|
146 | typedef struct rt_option { |
---|
147 | |
---|
148 | } rt_option_t; |
---|
149 | #endif |
---|
150 | |
---|
151 | #if 0 |
---|
152 | typedef struct rt_keychange { |
---|
153 | |
---|
154 | } rt_keychange_t; |
---|
155 | #endif |
---|
156 | |
---|
157 | #endif |
---|