Changeset f68d5b8


Ignore:
Timestamp:
01/22/10 16:02:29 (11 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:
042f345
Parents:
7da2676
Message:
  • Added a set_capture_length function for Linux Native
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_linux.c

    rd267f4d rf68d5b8  
    600600{
    601601        return sizeof(struct libtrace_linuxnative_header);
     602}
     603
     604static size_t linuxnative_set_capture_length(libtrace_packet_t *packet,
     605                size_t size) {
     606
     607        struct libtrace_linuxnative_header *linux_hdr = NULL;
     608        assert(packet);
     609        if (size > trace_get_capture_length(packet)) {
     610                /* We should avoid making a packet larger */
     611                return trace_get_capture_length(packet);
     612        }
     613       
     614        /* Reset the cached capture length */
     615        packet->capture_length = -1;
     616
     617        linux_hdr = (struct libtrace_linuxnative_header *)packet->header;
     618        linux_hdr->caplen = size;
     619        return trace_get_capture_length(packet);
    602620}
    603621
     
    711729        linuxnative_get_wire_length,    /* get_wire_length */
    712730        linuxnative_get_framing_length, /* get_framing_length */
    713         NULL,                           /* set_capture_length */
     731        linuxnative_set_capture_length, /* set_capture_length */
    714732        NULL,                           /* get_received_packets */
    715733        linuxnative_get_filtered_packets,/* get_filtered_packets */
Note: See TracChangeset for help on using the changeset viewer.