2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
27 * This file is part of the lwIP TCP/IP stack.
29 * Author: Adam Dunkels <adam@sics.se>
32 #ifndef __LWIP_STATS_H__
33 #define __LWIP_STATS_H__
39 #include "lwip/memp.h"
44 u16_t xmit; /* Transmitted packets. */
45 u16_t rexmit; /* Retransmitted packets. */
46 u16_t recv; /* Received packets. */
47 u16_t fw; /* Forwarded packets. */
48 u16_t drop; /* Dropped packets. */
49 u16_t chkerr; /* Checksum error. */
50 u16_t lenerr; /* Invalid length error. */
51 u16_t memerr; /* Out of memory error. */
52 u16_t rterr; /* Routing error. */
53 u16_t proterr; /* Protocol error. */
54 u16_t opterr; /* Error in options. */
55 u16_t err; /* Misc error. */
76 struct stats_syselem {
83 struct stats_syselem sem;
84 struct stats_syselem mbox;
88 struct stats_proto link;
89 struct stats_proto ip_frag;
90 struct stats_proto ip;
91 struct stats_proto icmp;
92 struct stats_proto udp;
93 struct stats_proto tcp;
94 struct stats_pbuf pbuf;
96 struct stats_mem memp[MEMP_MAX];
100 extern struct stats_ lwip_stats;
103 void stats_init(void);
105 #define STATS_INC(x) ++lwip_stats.x
109 #endif /* LWIP_STATS */
112 #define TCP_STATS_INC(x) STATS_INC(x)
114 #define TCP_STATS_INC(x)
118 #define UDP_STATS_INC(x) STATS_INC(x)
120 #define UDP_STATS_INC(x)
124 #define ICMP_STATS_INC(x) STATS_INC(x)
126 #define ICMP_STATS_INC(x)
130 #define IP_STATS_INC(x) STATS_INC(x)
132 #define IP_STATS_INC(x)
136 #define IPFRAG_STATS_INC(x) STATS_INC(x)
138 #define IPFRAG_STATS_INC(x)
142 #define LINK_STATS_INC(x) STATS_INC(x)
144 #define LINK_STATS_INC(x)
147 /* Display of statistics */
148 #if LWIP_STATS_DISPLAY
149 void stats_display(void);
151 #define stats_display()
154 #endif /* __LWIP_STATS_H__ */