Changeset f1a1f5e for lib


Ignore:
Timestamp:
10/21/05 16:45:49 (16 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:
b87e133
Parents:
25858d8
Message:

Understand legacy erf formats (as opposed to "legacy dag")
Use libtrace_err properly

Location:
lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lib/format_erf.c

    r006bbf7 rf1a1f5e  
    470470        void *buffer = packet->buffer;
    471471        void *buffer2 = buffer;
    472         dag_record_t *erfptr = (dag_record_t *)buffer;
    473472        int rlen;
    474473
     
    519518        assert(size < LIBTRACE_PACKET_BUFSIZE);
    520519        /* If your trace is legacy, or corrupt, then this assert may fire. */
     520        /* turns out some older traces have fixed snaplens, which are padded
     521         * with 00's if the packet is smaller, so this doesn't work.  Sigh.
    521522        assert(ntohs(((dag_record_t *)buffer)->rlen) <=
    522523                        ntohs(((dag_record_t*)buffer)->wlen)+erf_get_erf_headersize(packet));
    523         /* If it's an unknown type, your trace is legacy */
    524         assert(((dag_record_t *)buffer)->type != 0);
     524        */
    525525        /* Unknown/corrupt */
    526526        assert(((dag_record_t *)buffer)->type < 10);
     
    712712        erfptr = (dag_record_t *)packet->buffer;
    713713        switch (erfptr->type) {
    714                 case TYPE_ETH: return TRACE_TYPE_ETH;
    715                 case TYPE_ATM: return TRACE_TYPE_ATM;
    716                 default: assert(0);
     714                case TYPE_LEGACY:       return TRACE_TYPE_LEGACY;
     715                case TYPE_ETH:          return TRACE_TYPE_ETH;
     716                case TYPE_ATM:          return TRACE_TYPE_ATM;
     717                default:
     718                               fprintf(stderr,"Unknown erf type %02x\n",erfptr->type);
     719                               assert(0);
    717720        }
    718721        return erfptr->type;
  • lib/libtrace_int.h

    r8f4152b rf1a1f5e  
    7474
    7575
    76 static struct {
     76extern struct trace_err_t{
    7777        int err_num;    // error code
    7878        char problem[255];      // the format, uri etc that caused the error for reporting purposes
  • lib/trace.c

    ref90843 rf1a1f5e  
    131131#endif
    132132
    133 
     133struct trace_err_t trace_err;
    134134
    135135struct libtrace_format_t **format_list = 0;
Note: See TracChangeset for help on using the changeset viewer.