Changeset 509ee47 for lib/format_erf.c


Ignore:
Timestamp:
12/10/18 14:52:43 (2 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
develop
Children:
418c78d
Parents:
54ef438
Message:

Add option to allow users to specify a constant ERF framing length.

This can be useful for situations where

a) the input uses ERF (or some derivative thereof)
b) the link type and ERF record type are constant for the

duration of the capture

c) performance is critical

This option allows users to simply tell libtrace what the ERF
framing length on every packet is going to be, so libtrace
doesn't have to repeatedly derive the framing length for each
packet it processes. At high packet rates, the time taken to
do this calculation can really add up and it makes no sense
to risk dropping packets because you're busy calculating a value
that is always a single constant value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_erf.c

    rc337c9f9 r509ee47  
    254254                        IN_OPTIONS.real_time = *(int *)value;
    255255                        return 0;
     256                case TRACE_OPTION_CONSTANT_ERF_FRAMING:
     257                        trace_set_err(libtrace, TRACE_ERR_OPTION_UNAVAIL,
     258                                        "Setting constant framing length is not supported for %s:", libtrace->format->name);
     259                        return -1;
    256260                case TRACE_OPTION_SNAPLEN:
    257261                case TRACE_OPTION_PROMISC:
     
    667671{
    668672        int numbytes = 0;
    669         unsigned int pad = 0;
    670673        dag_record_t *dag_hdr = (dag_record_t *)packet->header;
    671674        void *payload = packet->payload;
     
    684687        }
    685688       
    686         pad = erf_get_padding(packet);
    687689
    688690        /* If we've had an rxerror, we have no payload to write - fix
     
    692694         * a way to write out the payload even if it is gibberish -- Perry */
    693695        if (payload == NULL) {
     696                unsigned int pad = 0;
     697                pad = erf_get_padding(packet);
    694698                dag_hdr->rlen = htons(dag_record_size + pad);
    695699               
     
    720724
    721725                payload=packet->payload;
    722                 pad = erf_get_padding(packet);
    723726
    724727                erfhdr.type = libtrace_to_erf_type(trace_get_link_type(packet));
Note: See TracChangeset for help on using the changeset viewer.