source: lib/rt_protocol.h @ 49babe0

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

Added initial format_rt and rt_protocol source files
Updated wag to be consistent with latest lt2 fixes and Dean's framing
Added a type field back into libtrace_packet
Fixed return value for trace_start

  • Property mode set to 100644
File size: 2.0 KB
Line 
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// Type field definitions
10#define RT_HELLO        0       /* Connection accepted */
11#define RT_DATA         1       /* Libtrace data packet */
12#define RT_START        2       /* Request for data transmission to begin */
13#define RT_ACK          3       /* Data acknowledgement */
14#define RT_STATUS       4       /* Fifo status packet */
15#define RT_DUCK         5       /* Dag duck info packet */
16#define RT_END_DATA     6       /* Server is exiting message */
17#define RT_CLOSE        7       /* Client is exiting message */
18#define RT_DENY_CONN    8       /* Connection has been denied */
19#define RT_PAUSE        9       /* Request server to suspend sending data */
20#define RT_PAUSE_ACK    10      /* Server is paused message */
21#define RT_OPTION       11      /* Option request */
22
23// Format field definitions
24#define RT_FORMAT_ERF           1
25#define RT_FORMAT_PCAP          2
26#define RT_FORMAT_WAG           3
27
28
29// RT packet header
30typedef struct rt_header {
31        uint8_t type;
32        uint16_t length;
33} rt_header_t;
34
35typedef struct rt_data {
36        uint16_t format;
37        char *data;
38} rt_data_t;
39
40typedef struct rt_hello {
41
42} rt_hello_t;
43
44typedef struct rt_start {
45
46} rt_start_t;
47
48typedef struct rt_ack {
49        uint64_t timestamp;
50} rt_ack_t;
51
52typedef struct rt_status {
53        tracefifo_state_t fifo_status;
54} rt_status_t;
55
56typedef struct rt_duck {
57        //duckinf_t duck;
58} rt_duck_t;
59
60typedef struct rt_end_data {
61
62} rt_end_data_t;
63
64typedef struct rt_close {
65
66} rt_close_t;
67
68
69// Connection denied reasons
70#define RT_DENY_WRAPPER         1
71#define RT_DENY_FULL            2
72#define RT_DENY_AUTH            3
73
74typedef struct rt_deny_conn {
75        uint8_t reason;
76} rt_deny_conn_t;
77
78
79typedef struct rt_pause {
80
81} rt_pause_t;
82
83typedef struct rt_pause_ack {
84
85} rt_pause_ack_t;
86
87typedef struct rt_option {
88
89} rt_option_t;
90
91
92char *rt_deny_reason(uint8_t reason) {
93        char *string = 0;
94
95        switch(reason) {
96                case RT_DENY_WRAPPER:
97                        string = "Rejected by TCP Wrappers";
98                        break;
99                case RT_DENY_FULL:
100                        string = "Max connections reached on server";
101                        break;
102                case RT_DENY_AUTH:
103                        string = "Authentication failed";
104                        break;
105                default:
106                        string = "Unknown reason";
107        }
108
109        return string;
110}
111
112#endif
Note: See TracBrowser for help on using the repository browser.