Changeset 7c8eacf for lib/format_pcap.c


Ignore:
Timestamp:
10/27/05 14:05:36 (16 years ago)
Author:
Daniel Lawson <dlawson@…>
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:
2458162
Parents:
0d82205
Message:

updated changelog
added trace_get_framing_length() to return the capture-format framing (eg, ERF or pcap headers).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_pcap.c

    r006bbf7 r7c8eacf  
    6565
    6666#if HAVE_PCAP
    67 
    68 static struct libtrace_format_t *pcap_ptr = 0;
    69 static struct libtrace_format_t *pcapint_ptr = 0;
     67extern struct libtrace_format_t pcap;
     68extern struct libtrace_format_t pcapint;
     69
    7070
    7171#define CONNINFO libtrace->format_data->conn_info
     
    243243                fflush((FILE *)OUTPUT.trace.dump);
    244244        }
    245         if (packet->trace->format == pcap_ptr ||
    246                         packet->trace->format == pcapint_ptr) {
    247         //if (!strncasecmp(packet->trace->format->name,"pcap",4)) {
    248                 // this is a pcap trace anyway
     245        if (packet->trace->format == &pcap ||
     246                        packet->trace->format == &pcapint) {
    249247               
    250248                pcap_dump((u_char*)OUTPUT.trace.dump,(struct pcap_pkthdr *)packet->buffer,link);
     
    366364}
    367365
     366static int pcap_get_framing_length(const struct libtrace_packet_t *packet) {
     367        return sizeof(struct pcap_pkthdr);
     368}
     369
    368370static size_t pcap_set_capture_length(struct libtrace_packet_t *packet,size_t size) {
    369371        struct pcap_pkthdr *pcapptr = 0;
     
    428430        pcap_get_capture_length,        /* get_capture_length */
    429431        pcap_get_wire_length,           /* get_wire_length */
     432        pcap_get_framing_length,        /* get_framing_length */
    430433        pcap_set_capture_length,        /* set_capture_length */
    431434        NULL,                           /* get_fd */
     
    454457        pcap_get_capture_length,        /* get_capture_length */
    455458        pcap_get_wire_length,           /* get_wire_length */
     459        pcap_get_framing_length,        /* get_framing_length */
    456460        pcap_set_capture_length,        /* set_capture_length */
    457461        pcap_get_fd,                    /* get_fd */
     
    464468
    465469void __attribute__((constructor)) pcap_constructor() {
    466         pcap_ptr = &pcap;
    467         pcapint_ptr = &pcapint;
    468         register_format(pcap_ptr);
    469         register_format(pcapint_ptr);
     470        register_format(&pcap);
     471        register_format(&pcapint);
    470472}
    471473
Note: See TracChangeset for help on using the changeset viewer.