Changeset 9bc4689 for lib/trace.c


Ignore:
Timestamp:
09/06/07 01:07:07 (14 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:
fbc4342
Parents:
180f095
Message:

Move everything over to using the newer API's

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    r180f095 r9bc4689  
    646646                (libtrace_packet_t *)malloc(sizeof(libtrace_packet_t));
    647647        dest->trace=packet->trace;
    648         dest->buffer=malloc(
    649                         trace_get_framing_length(packet)
    650                         +trace_get_capture_length(packet));
     648        dest->buffer=malloc(65536);
    651649        dest->header=dest->buffer;
    652650        dest->payload=(void*)
     
    869867}
    870868
    871 DLLEXPORT size_t trace_get_capture_length(libtrace_packet_t *packet)
     869DLLEXPORT size_t trace_get_capture_length(const libtrace_packet_t *packet)
    872870{
    873871        /* Cache the capture length */
     
    875873                if (!packet->trace->format->get_capture_length)
    876874                        return ~0U;
    877                 packet->capture_length =
     875                /* Cast away constness because this is "just" a cache */
     876                ((libtrace_packet_t*)packet)->capture_length =
    878877                        packet->trace->format->get_capture_length(packet);
    879878        }
     
    10021001#ifdef HAVE_BPF
    10031002        void *linkptr = 0;
     1003        libtrace_linktype_t linktype;
    10041004        assert(filter);
    10051005
    10061006        /* If this isn't a real packet, then fail */
    1007         linkptr = trace_get_link(packet);
     1007        linkptr = trace_get_packet_buffer(packet,&linktype,NULL);
    10081008        if (!linkptr) {
    10091009                trace_set_err(packet->trace,
     
    10141014        if (filter->filterstring && ! filter->flag) {
    10151015                pcap_t *pcap = NULL;
    1016                 libtrace_linktype_t linktype=trace_get_link_type(packet);
    10171016                if (linktype==(libtrace_linktype_t)-1) {
    10181017                        trace_set_err(packet->trace,
     
    10561055#ifdef HAVE_BPF
    10571056        void *linkptr = 0;
    1058         unsigned int clen = 0;
     1057        uint32_t clen = 0;
    10591058        bool free_packet_needed = false;
    10601059        int ret;
     
    10841083        }
    10851084       
    1086         linkptr = trace_get_link(packet_copy);
     1085        linkptr = trace_get_packet_buffer(packet_copy,NULL,&clen);
    10871086        if (!linkptr) {
    10881087                if (free_packet_needed) {
     
    11021101        }
    11031102
    1104         clen = trace_get_capture_length(packet_copy);
    1105 
    11061103        assert(filter->flag);
    1107         ret=bpf_filter(filter->filter.bf_insns,(u_char*)linkptr,clen,clen);
     1104        ret=bpf_filter(filter->filter.bf_insns,(u_char*)linkptr,(unsigned int)clen,(unsigned int)clen);
    11081105        if (free_packet_needed) {
    11091106                trace_destroy_packet(packet_copy);
Note: See TracChangeset for help on using the changeset viewer.