source: rtems/cpukit/libnetworking/rtems/rtems_showicmpstat.c @ abef0f6

4.104.114.84.95
Last change on this file since abef0f6 was 96b39164, checked in by Joel Sherrill <joel.sherrill@…>, on 08/20/98 at 21:56:40

Added CVS Ids

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  $Id$
3 */
4
5#include <sys/param.h>
6#include <sys/queue.h>
7#include <sys/systm.h>
8#include <sys/kernel.h>
9#include <sys/sysctl.h>
10#include <sys/proc.h>
11#include <sys/mbuf.h>
12#include <netinet/in_systm.h>
13#include <netinet/in.h>
14#include <netinet/ip.h>
15#include <netinet/ip_icmp.h>
16#include <netinet/icmp_var.h>
17
18/*
19 * Display ICMP statistics
20 * Don't lock the rest of the network tasks out while printing.
21 * It's no big deal if the values change while being printed.
22 */
23static void
24showicmpstat (const char *name, unsigned long n)
25{
26        if (n)
27                printf ("%35s%12lu\n", name, n);
28}
29
30void
31rtems_bsdnet_show_icmp_stats (void)
32{
33        int i;
34        char cbuf[20];
35
36        printf ("************ ICMP Statistics ************\n");
37        showicmpstat ("Calls to icmp_error()", icmpstat.icps_error);
38        showicmpstat ("Errors not sent -- old was icmp", icmpstat.icps_oldicmp);
39        for (i = 0 ; i <= ICMP_MAXTYPE ; i++) {
40                if (icmpstat.icps_outhist[i]) {
41                        sprintf (cbuf, "Type %d sent", i);
42                        showicmpstat (cbuf, icmpstat.icps_outhist[i]);
43                }
44        }
45        showicmpstat ("icmp_code out of range", icmpstat.icps_badcode);
46        showicmpstat ("packet < ICMP_MINLEN", icmpstat.icps_tooshort);
47        showicmpstat ("bad checksum", icmpstat.icps_checksum);
48        showicmpstat ("calculated bound mismatch", icmpstat.icps_badlen);
49        showicmpstat ("number of responses", icmpstat.icps_reflect);
50        showicmpstat ("b/mcast echo requests dropped", icmpstat.icps_bmcastecho);
51        showicmpstat ("b/mcast tstamp requests dropped", icmpstat.icps_bmcasttstamp);
52        for (i = 0 ; i <= ICMP_MAXTYPE ; i++) {
53                if (icmpstat.icps_inhist[i]) {
54                        sprintf (cbuf, "Type %d received", i);
55                        showicmpstat (cbuf, icmpstat.icps_inhist[i]);
56                }
57        }
58
59        printf ("\n");
60}
Note: See TracBrowser for help on using the repository browser.