source: lib/rt_protocol.h @ ee5e4c7

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

Added a fifo state structure to rt_protocol so that wdcap can see it

  • Property mode set to 100644
File size: 2.2 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
28typedef struct fifo_state {
29        uint64_t in;
30        uint64_t out;
31        uint64_t ack;
32        uint64_t length;
33        uint64_t used;
34} fifo_state_t;
35
36// RT packet header
37typedef struct rt_header {
38        uint8_t type;
39        uint16_t length;
40} rt_header_t;
41
42typedef struct rt_data {
43        uint16_t format;
44        char *data;
45} rt_data_t;
46
47typedef struct rt_hello {
48
49} rt_hello_t;
50
51typedef struct rt_start {
52
53} rt_start_t;
54
55typedef struct rt_ack {
56        uint64_t timestamp;
57} rt_ack_t;
58
59typedef struct rt_status {
60        fifo_state_t fifo_status;
61} rt_status_t;
62
63typedef struct rt_duck {
64        //duckinf_t duck;
65} rt_duck_t;
66
67typedef struct rt_end_data {
68
69} rt_end_data_t;
70
71typedef struct rt_close {
72
73} rt_close_t;
74
75
76// Connection denied reasons
77#define RT_DENY_WRAPPER         1
78#define RT_DENY_FULL            2
79#define RT_DENY_AUTH            3
80
81typedef struct rt_deny_conn {
82        uint8_t reason;
83} rt_deny_conn_t;
84
85
86typedef struct rt_pause {
87
88} rt_pause_t;
89
90typedef struct rt_pause_ack {
91
92} rt_pause_ack_t;
93
94typedef struct rt_option {
95
96} rt_option_t;
97
98
99char *rt_deny_reason(uint8_t reason) {
100        char *string = 0;
101
102        switch(reason) {
103                case RT_DENY_WRAPPER:
104                        string = "Rejected by TCP Wrappers";
105                        break;
106                case RT_DENY_FULL:
107                        string = "Max connections reached on server";
108                        break;
109                case RT_DENY_AUTH:
110                        string = "Authentication failed";
111                        break;
112                default:
113                        string = "Unknown reason";
114        }
115
116        return string;
117}
118
119
120
121#endif
Note: See TracBrowser for help on using the repository browser.