Changeset 1fbd938 for lib/rt_protocol.h


Ignore:
Timestamp:
02/16/06 11:56:02 (15 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
880aa58
Parents:
ee5e4c7
Message:

More -pedantic cleanups
Changed the format structure (again) for pause and seek support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/rt_protocol.h

    r20b7e75 r1fbd938  
    77#define COLLECTOR_PORT 3435
    88
    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 */
     9/* Type field definitions */
     10enum rt_field_t {
     11 RT_HELLO       =0,     /* Connection accepted */
     12 RT_DATA        =1,     /* Libtrace data packet */
     13 RT_START       =2,     /* Request for data transmission to begin */
     14 RT_ACK         =3,     /* Data acknowledgement */
     15 RT_STATUS      =4,     /* Fifo status packet */
     16 RT_DUCK        =5,     /* Dag duck info packet */
     17 RT_END_DATA    =6,     /* Server is exiting message */
     18 RT_CLOSE       =7,     /* Client is exiting message */
     19 RT_DENY_CONN   =8,     /* Connection has been denied */
     20 RT_PAUSE       =9,     /* Request server to suspend sending data */
     21 RT_PAUSE_ACK   =10,    /* Server is paused message */
     22 RT_OPTION      =11     /* Option request */
     23};
    2224
    23 // Format field definitions
    24 #define RT_FORMAT_ERF           1
    25 #define RT_FORMAT_PCAP          2
    26 #define RT_FORMAT_WAG           3
     25/* Format field definitions */
     26enum rt_format_t {
     27 RT_FORMAT_ERF          =1,
     28 RT_FORMAT_PCAP         =2,
     29 RT_FORMAT_WAG          =3
     30};
    2731
    2832typedef struct fifo_state {
     
    3438} fifo_state_t;
    3539
    36 // RT packet header
     40/* RT packet header */
    3741typedef struct rt_header {
    38         uint8_t type;
     42        enum rt_field_t type;
    3943        uint16_t length;
    4044} rt_header_t;
     
    6266
    6367typedef struct rt_duck {
    64         //duckinf_t duck;
     68        /*duckinf_t duck; */
    6569} rt_duck_t;
    6670
     
    7478
    7579
    76 // Connection denied reasons
    77 #define RT_DENY_WRAPPER         1
    78 #define RT_DENY_FULL            2
    79 #define RT_DENY_AUTH            3
     80/* Connection denied reasons */
     81enum rt_conn_denied_t {
     82 RT_DENY_WRAPPER        =1,
     83 RT_DENY_FULL           =2,
     84 RT_DENY_AUTH           =3
     85};
    8086
    8187typedef struct rt_deny_conn {
    82         uint8_t reason;
     88        enum rt_conn_denied_t reason;
    8389} rt_deny_conn_t;
    8490
     
    97103
    98104
    99 char *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 
    119105
    120106
Note: See TracChangeset for help on using the changeset viewer.