Changeset 4811b1e
- Timestamp:
- 03/16/10 10:55:34 (12 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:
- ac7037b
- Parents:
- 7fc0eaa2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_pcapfile.c
r238d50a r4811b1e 345 345 * misinterpret as EOF! */ 346 346 if (bytes_to_read == 0) { 347 packet->header = packet->buffer; 347 348 return sizeof(libtrace_pcapfile_pkt_hdr_t); 348 349 } … … 434 435 assert(hdr.caplen < LIBTRACE_PACKET_BUFSIZE); 435 436 /* PCAP doesn't include the FCS in its wire length value, but we do */ 436 if (linktype==TRACE_TYPE_ETH) 437 if (linktype==TRACE_TYPE_ETH) { 437 438 if (trace_get_wire_length(packet) >= 4) { 438 439 hdr.wirelen = trace_get_wire_length(packet)-4; … … 441 442 hdr.wirelen = 0; 442 443 } 444 } 443 445 else 444 446 hdr.wirelen = trace_get_wire_length(packet); … … 544 546 const libtrace_packet_t *packet) 545 547 { 546 libtrace_pcapfile_pkt_hdr_t *hdr = 547 (libtrace_pcapfile_pkt_hdr_t*)packet->header; 548 libtrace_pcapfile_pkt_hdr_t *hdr; 548 549 struct timeval ts; 550 551 assert(packet->header); 552 553 hdr = (libtrace_pcapfile_pkt_hdr_t*)packet->header; 549 554 ts.tv_sec = swapl(packet->trace,hdr->ts_sec); 550 555 ts.tv_usec = swapl(packet->trace,hdr->ts_usec); … … 554 559 555 560 static int pcapfile_get_capture_length(const libtrace_packet_t *packet) { 556 libtrace_pcapfile_pkt_hdr_t *pcapptr 557 = (libtrace_pcapfile_pkt_hdr_t *)packet->header; 561 libtrace_pcapfile_pkt_hdr_t *pcapptr; 562 563 assert(packet->header); 564 pcapptr = (libtrace_pcapfile_pkt_hdr_t *)packet->header; 558 565 559 566 return swapl(packet->trace,pcapptr->caplen); … … 561 568 562 569 static int pcapfile_get_wire_length(const libtrace_packet_t *packet) { 563 libtrace_pcapfile_pkt_hdr_t *pcapptr 564 = (libtrace_pcapfile_pkt_hdr_t *)packet->header; 570 libtrace_pcapfile_pkt_hdr_t *pcapptr; 571 572 assert(packet->header); 573 574 pcapptr = (libtrace_pcapfile_pkt_hdr_t *)packet->header; 565 575 if (packet->type==pcap_linktype_to_rt(TRACE_DLT_EN10MB)) 566 576 /* Include the missing FCS */ … … 589 599 libtrace_pcapfile_pkt_hdr_t *pcapptr = 0; 590 600 assert(packet); 601 assert(packet->header); 591 602 if (size > trace_get_capture_length(packet)) { 592 603 /* Can't make a packet larger */
Note: See TracChangeset
for help on using the changeset viewer.