Changeset b51edf5


Ignore:
Timestamp:
03/07/06 10:50:19 (15 years ago)
Author:
Shane Alcock <salcock@…>
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:
8f80e87
Parents:
e4e1635
Message:

Added RT_KEYCHANGE to rt protocol
Fixed incorrect calculation in trace_get_seconds
rt_read_packet now returns sizeof(rt_header_t) + packet length
trace_get_capture_length no longer asserts for packet->size = 0

Location:
lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lib/format_rt.c

    r7ac9705 rb51edf5  
    448448                                /* FIXME: Do something useful here as well */
    449449                                break;
     450                        case RT_KEYCHANGE:
     451                                break;
    450452                        default:
    451453                                printf("Bad rt type for client receipt: %d\n",
     
    453455                }
    454456        }
    455         return trace_get_capture_length(packet)+trace_get_framing_length(packet);
     457        /* Return the number of bytes read from the stream */
     458        return sizeof(rt_header_t) + packet->size;
    456459}
    457460
     
    480483                case RT_OPTION:
    481484                        return sizeof(rt_option_t);
     485                case RT_KEYCHANGE:
     486                        return sizeof(rt_keychange_t);
    482487        }
    483488        printf("Unknown type: %d\n", packet->type);
  • lib/rt_protocol.h

    r7ac9705 rb51edf5  
    1414#define RT_DATA_PCAP 2000
    1515
     16/* Procedure for adding new RT control types
     17 * -------------------------------------------
     18 *
     19 * Add type to the enum list
     20 * Add a struct below (even if it is empty)
     21 * Update rt_get_capture_length
     22 * If type is intended to be sent TO clients, update rt_read_packet
     23 *      Otherwise, update server implementations e.g. WDCAP
     24 *
     25 * Procedure for adding new RT data types
     26 * ----------------------------------------
     27 *
     28 * If you are adding a new format:
     29 *      RT_DATA_(new format) must be equal to RT_DATA_SIMPLE +
     30 *              TRACE_FORMAT_(new_format)
     31 *      Add a new dummy trace type to the rt_format_t structure
     32 *      Set the dummy trace to NULL in rt_init_input
     33 *      Update rt_set_format
     34 *
     35 * If you are adding a new PCAP DLT type:
     36 *      RT_DATA_PCAP_(new DLT) must be equal to RT_DATA_PCAP + (DLT value)
     37 *     
     38 */
     39
    1640/* Type field definitions */
    1741enum rt_field_t {
     
    2751 RT_PAUSE_ACK   =10,    /* Server is paused message */
    2852 RT_OPTION      =11,    /* Option request */
     53 RT_KEYCHANGE   =12,    /* Anonymisation key has changed */
    2954 
    3055 RT_DATA_ERF            =RT_DATA_SIMPLE + TRACE_FORMAT_ERF,
     
    4469 RT_DATA_PCAP_PFLOG             =RT_DATA_PCAP + DLT_PFLOG,
    4570#endif
    46 
     71 RT_LAST = 3000
    4772};
    4873
     
    116141} rt_option_t;
    117142
    118 
    119 
     143typedef struct rt_keychange {
     144       
     145} rt_keychange_t;
    120146
    121147#endif
  • lib/trace.c

    re4e1635 rb51edf5  
    11721172                /* timeval -> seconds */
    11731173                tv = packet->trace->format->get_timeval(packet);
    1174                 seconds = tv.tv_sec + ((tv.tv_usec * UINT_MAX * 1.0)/1000000);
     1174                seconds = tv.tv_sec + ((tv.tv_usec * 1.0) / 1000000);
    11751175        }
    11761176
     
    11801180size_t trace_get_capture_length(const libtrace_packet_t *packet) {
    11811181
    1182         assert(packet->size>0 && packet->size<65536);
     1182        /* Packets can be have a size of zero */
     1183        assert(packet->size>=0 && packet->size<65536);
    11831184
    11841185        if (packet->trace->format->get_capture_length) {
Note: See TracChangeset for help on using the changeset viewer.