OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [libnetworking/] [rtems/] [rtems_showicmpstat.c] - Blame information for rev 279

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  $Id: rtems_showicmpstat.c,v 1.2 2001-09-27 12:02:00 chris Exp $
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
 */
23
static void
24
showicmpstat (const char *name, unsigned long n)
25
{
26
        if (n)
27
                printf ("%35s%12lu\n", name, n);
28
}
29
 
30
void
31
rtems_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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.