4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since 130a0e4 was
49ce177,
checked in by Perry Lorier <perry@…>, 17 years ago
|
Added:
- error reports
- flow reports
- per port reports
- direction report
- moved everything to use the container library
|
-
Property mode set to
100644
|
File size:
766 bytes
|
Line | |
---|
1 | #include <netdb.h> |
---|
2 | #include <inttypes.h> |
---|
3 | #include <stdio.h> |
---|
4 | #include "libtrace.h" |
---|
5 | #include "tracereport.h" |
---|
6 | |
---|
7 | static uint64_t rx_errors = 0; |
---|
8 | static uint64_t ip_errors = 0; |
---|
9 | static uint64_t tcp_errors = 0; |
---|
10 | |
---|
11 | void error_per_packet(struct libtrace_packet_t *packet) |
---|
12 | { |
---|
13 | struct libtrace_ip *ip = trace_get_ip(packet); |
---|
14 | struct libtrace_tcp *tcp = trace_get_tcp(packet); |
---|
15 | void *link = trace_get_link(packet); |
---|
16 | if (!link) { |
---|
17 | ++rx_errors; |
---|
18 | } |
---|
19 | if (ip) { |
---|
20 | if (ntohs(ip->ip_sum)!=0) |
---|
21 | ++ip_errors; |
---|
22 | } |
---|
23 | if (tcp) { |
---|
24 | if (ntohs(tcp->check)!=0) |
---|
25 | ++tcp_errors; |
---|
26 | } |
---|
27 | } |
---|
28 | |
---|
29 | void error_report(void) |
---|
30 | { |
---|
31 | printf("# Errors:\n"); |
---|
32 | printf("RX Errors: %" PRIu64 "\n",rx_errors); |
---|
33 | printf("IP Checksum errors: %" PRIu64 "\n",ip_errors); |
---|
34 | //printf("TCP Checksum errors: %" PRIu64 "\n",tcp_errors); |
---|
35 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.