Changeset 9e3902e for lib/format_erf.c


Ignore:
Timestamp:
02/09/06 11:39:26 (16 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:
56ef532
Parents:
bb09ce4
Message:

Corrected bug where trace_event point to the trace function for dag instead
of device

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_erf.c

    r5baec88 r9e3902e  
    491491        return (size);
    492492}
    493 
    494 
    495 // Lots of repeated code in here - could easily be tidied up
    496 static int dag_read_packet_nb(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) {
    497         int numbytes;
    498         int size;
    499         char buf[RP_BUFSIZE];
    500         dag_record_t *erfptr;
    501         void *buffer = packet->buffer;
    502         void *buffer2 = buffer;
    503         int rlen;
    504 
    505         if (packet->buf_control == PACKET) {
    506                 packet->buf_control = EXTERNAL;
    507                 free(packet->buffer);
    508                 packet->buffer = 0;
    509         }
    510 
    511         if (DAG.diff == 0) {
    512                 if ((numbytes = dag_read(libtrace,buf,RP_BUFSIZE, DAGF_NONBLOCK)) <= 0)
    513                         return numbytes;
    514         }
    515 
    516         //DAG always gives us whole packets
    517         erfptr = (dag_record_t *) ((void *)DAG.buf +
    518                         (DAG.bottom + DAG.offset));
    519         size = ntohs(erfptr->rlen);
    520 
    521         if ( size  > LIBTRACE_PACKET_BUFSIZE) {
    522                 assert( size < LIBTRACE_PACKET_BUFSIZE);
    523         }
    524 
    525         packet->buffer = erfptr;
    526         packet->header = erfptr;
    527         if (((dag_record_t *)buffer)->flags.rxerror == 1) {
    528                 packet->payload = NULL;
    529         } else {
    530                 packet->payload = packet->buffer + erf_get_framing_length(packet);
    531         }
    532 
    533 
    534         packet->status.type = RT_DATA;
    535         packet->status.message = 0;
    536         packet->size = size;
    537         DAG.offset += size;
    538         DAG.diff -= size;
    539 
    540         assert(DAG.diff >= 0);
    541 
    542         return (size);
    543 }
    544 
    545 #endif
     493#endif
    546494
    547495static int legacy_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) {
     
    11501098        erf_set_capture_length,         /* set_capture_length */
    11511099        NULL,                           /* get_fd */
    1152         trace_event_trace,              /* trace_event */
     1100        trace_event_device,             /* trace_event */
    11531101        dag_help                        /* help */
    11541102};
Note: See TracChangeset for help on using the changeset viewer.