Changeset 7e6b54d for lib/rt_protocol.h


Ignore:
Timestamp:
09/03/15 15:21:45 (6 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, 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:
0a368ae
Parents:
87cba74
Message:

Re-work the RT protocol to be usable cross-platform

  • All structures are packed to avoid padding mismatches.
  • All fields are in network byte order.
  • Added 'version' and 'magic' fields to the header so we can identify version mismatches or invalid packets more easily.
  • Acknowledgements are now sent for 1/10 received packets and are treated as cumulative acknowledgements. Reordering shouldn't happen at this layer, since we are using TCP for transport.
  • Replace enum types in headers with uint32_t, so we can be sure of what size these fields will be.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/rt_protocol.h

    rc5ac872 r7e6b54d  
    5050/** Maximum size for the RT header */
    5151#define RT_MAX_HDR_SIZE 256
    52 /** Maximum sequence number for the RT protocol */
    53 #define MAX_SEQUENCE 2147483647
     52
     53#define RT_ACK_FREQUENCY (10)
     54#define LIBTRACE_RT_VERSION (0x04)
     55#define LIBTRACE_RT_MAGIC (0x5a)
    5456
    5557/* Procedure for adding new RT control types
     
    8486        uint64_t length;        /**< The total length of the fifo */
    8587        uint64_t used;          /**< The amount of fifo space in use */
    86 } fifo_info_t;
     88} PACKED fifo_info_t;
    8789
    8890/** RT packet header */
    8991typedef struct rt_header {
    9092        /** The type of RT packet */
    91         libtrace_rt_types_t type;       
    92         /** The length of the packet (not including the RT header */
     93        uint32_t type; 
     94       
     95        uint8_t magic;
     96
     97        uint8_t version;
     98
     99        /** The length of the packet (not including the RT header */
    93100        uint16_t length;               
    94101        /** The sequence number of the packet */
    95102        uint32_t sequence;
    96 } rt_header_t;
     103} PACKED rt_header_t;
    97104
    98105/* TODO: Reorganise this struct once more hello info is added */
     
    103110         *  i.e. expecting acknowledgements */
    104111        uint8_t reliable;       
    105 } rt_hello_t;
     112} PACKED rt_hello_t ;
    106113
    107114#if 0
     
    115122        /** The sequence number of the last received RT packet */
    116123        uint32_t sequence;
    117 } rt_ack_t;
     124} PACKED rt_ack_t;
    118125
    119126/** RT Status sub-header */
     
    121128        /** Statistics describing the current status of the sender fifo */
    122129        fifo_info_t fifo_status;
    123 } rt_status_t;
     130} PACKED rt_status_t;
    124131
    125132#if 0
     
    154161typedef struct rt_deny_conn {
    155162        /** The reason that the connection was denied */
    156         enum rt_conn_denied_t reason;
    157 } rt_deny_conn_t;
     163        uint32_t reason;
     164} PACKED rt_deny_conn_t;
    158165
    159166#if 0
     
    187194        /** Length of the value string that follows the header */
    188195        uint32_t value_len;
    189 } rt_metadata_t ;
     196} PACKED rt_metadata_t;
    190197
    191198/** Specifications of duck structures - duck2_4 and duck2_5 match Endace's
Note: See TracChangeset for help on using the changeset viewer.