- Timestamp:
- 11/02/04 16:23:59 (18 years ago)
- 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:
- 4389bd1
- Parents:
- aa27e1e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/trace.c
r678048a ra6d38b6 485 485 switch(libtrace->format) { 486 486 case DAG: 487 487 488 libtrace->dag.bottom = libtrace->dag.top; 488 489 libtrace->dag.top = dag_offset( 489 490 libtrace->input.fd, … … 493 494 libtrace->dag.bottom; 494 495 495 //recptr = (dag_record_t *) ((void *)libtrace->buf + (bottom + curr));496 //rlen = ntohs(recptr->rlen);497 498 499 //memcpy(buffer,(void *)(libtrace->buf + (bottom + curr)),diff);500 501 //buffer=libtrace->buf + (bottom + curr);502 503 496 numbytes=libtrace->dag.diff; 504 libtrace->dag.bottom = libtrace->dag.top;505 497 libtrace->dag.offset = 0; 506 498 … … 604 596 605 597 if (libtrace->format == DAG) { 606 // we can do some zero-copy stuff here 607 while(1) { 608 if (libtrace->dag.diff == 0) { 609 if ((numbytes = trace_read(libtrace,buf,RP_BUFSIZE)) <= 0) 610 return numbytes; 611 } 612 // DAG always gives us whole packets. 613 614 erfptr = (dag_record_t *) (libtrace->dag.buf + libtrace->dag.offset); 615 size = ntohs(erfptr->rlen); 616 617 assert( (size - sizeof(dag_record_t)) < LIBTRACE_PACKET_BUFSIZE); 618 619 memcpy(packet->buffer, erfptr, size); 620 //packet->buffer = (void *)erfptr; 621 packet->size = size; 622 libtrace->dag.offset += size; 623 libtrace->dag.diff -= size; 624 625 return (size); 598 if (libtrace->dag.diff == 0) { 599 if ((numbytes = trace_read(libtrace,buf,RP_BUFSIZE)) <= 0) 600 return numbytes; 601 } 602 // DAG always gives us whole packets. 603 604 erfptr = (dag_record_t *) ((void *)libtrace->dag.buf + (libtrace->dag.bottom + libtrace->dag.offset)); 605 size = ntohs(erfptr->rlen); 606 607 if ( size > LIBTRACE_PACKET_BUFSIZE) { 608 printf("%d\n",size); 609 assert( size < LIBTRACE_PACKET_BUFSIZE); 610 } 611 612 // have to copy it out of the memory hole at this stage: 613 memcpy(packet->buffer, erfptr, size); 614 615 packet->size = size; 616 libtrace->dag.offset += size; 617 libtrace->dag.diff -= size; 618 619 assert(libtrace->dag.diff >= 0); 620 //assert(libtrace->dag.offset <= libtrace->dag.top); 621 return (size); 626 622 627 }628 623 } 629 624 do { … … 649 644 650 645 /* FALL THRU */ 651 case ERF:652 case DAG:646 //case ERF: 647 //case DAG: 653 648 // read in the erf header 654 649 if ((numbytes = fifo_out_read(libtrace->fifo, buffer, sizeof(dag_record_t))) == 0) {
Note: See TracChangeset
for help on using the changeset viewer.