4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since e3b0188 was
e3b0188,
checked in by Daniel Lawson <dlawson@…>, 17 years ago
|
a lot of changes for cross-compilation support
- header ordering
- os-specific headers
- an lt_inttypes.h which defines PRIu64 etc for platforms that don't have them
- removed daglegacy.h, merged with dagformat.h
|
-
Property mode set to
100644
|
File size:
791 bytes
|
Rev | Line | |
---|
[d3ff1fb] | 1 | #include <netdb.h> |
---|
| 2 | #include <inttypes.h> |
---|
[e3b0188] | 3 | #include <lt_inttypes.h> |
---|
[d3ff1fb] | 4 | #include <stdio.h> |
---|
| 5 | #include "libtrace.h" |
---|
| 6 | #include "tracereport.h" |
---|
| 7 | |
---|
| 8 | static uint64_t rx_errors = 0; |
---|
| 9 | static uint64_t ip_errors = 0; |
---|
[49ce177] | 10 | static uint64_t tcp_errors = 0; |
---|
[d3ff1fb] | 11 | |
---|
| 12 | void error_per_packet(struct libtrace_packet_t *packet) |
---|
| 13 | { |
---|
| 14 | struct libtrace_ip *ip = trace_get_ip(packet); |
---|
[49ce177] | 15 | struct libtrace_tcp *tcp = trace_get_tcp(packet); |
---|
[d3ff1fb] | 16 | void *link = trace_get_link(packet); |
---|
| 17 | if (!link) { |
---|
| 18 | ++rx_errors; |
---|
| 19 | } |
---|
| 20 | if (ip) { |
---|
| 21 | if (ntohs(ip->ip_sum)!=0) |
---|
| 22 | ++ip_errors; |
---|
| 23 | } |
---|
[49ce177] | 24 | if (tcp) { |
---|
| 25 | if (ntohs(tcp->check)!=0) |
---|
| 26 | ++tcp_errors; |
---|
| 27 | } |
---|
[d3ff1fb] | 28 | } |
---|
| 29 | |
---|
| 30 | void error_report(void) |
---|
| 31 | { |
---|
| 32 | printf("# Errors:\n"); |
---|
| 33 | printf("RX Errors: %" PRIu64 "\n",rx_errors); |
---|
| 34 | printf("IP Checksum errors: %" PRIu64 "\n",ip_errors); |
---|
[49ce177] | 35 | //printf("TCP Checksum errors: %" PRIu64 "\n",tcp_errors); |
---|
[d3ff1fb] | 36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.