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__
38 #include "lwip/memp.h"
46 #ifndef LWIP_STATS_LARGE
47 #define LWIP_STATS_LARGE 0
51 #define STAT_COUNTER u32_t
52 #define STAT_COUNTER_F U32_F
54 #define STAT_COUNTER u16_t
55 #define STAT_COUNTER_F U16_F
59 STAT_COUNTER xmit; /* Transmitted packets. */
60 STAT_COUNTER rexmit; /* Retransmitted packets. */
61 STAT_COUNTER recv; /* Received packets. */
62 STAT_COUNTER fw; /* Forwarded packets. */
63 STAT_COUNTER drop; /* Dropped packets. */
64 STAT_COUNTER chkerr; /* Checksum error. */
65 STAT_COUNTER lenerr; /* Invalid length error. */
66 STAT_COUNTER memerr; /* Out of memory error. */
67 STAT_COUNTER rterr; /* Routing error. */
68 STAT_COUNTER proterr; /* Protocol error. */
69 STAT_COUNTER opterr; /* Error in options. */
70 STAT_COUNTER err; /* Misc error. */
71 STAT_COUNTER cachehit;
75 STAT_COUNTER lenerr; /* Invalid length error. */
76 STAT_COUNTER chkerr; /* Checksum error. */
77 STAT_COUNTER v1_rxed; /* */
78 STAT_COUNTER join_sent; /* */
79 STAT_COUNTER leave_sent; /* */
80 STAT_COUNTER unicast_query; /* */
81 STAT_COUNTER report_sent; /* */
82 STAT_COUNTER report_rxed; /* */
83 STAT_COUNTER group_query_rxed; /* */
93 struct stats_syselem {
100 struct stats_syselem sem;
101 struct stats_syselem mbox;
106 struct stats_proto link;
109 struct stats_proto etharp;
112 struct stats_proto ip_frag;
115 struct stats_proto ip;
118 struct stats_proto icmp;
121 struct stats_igmp igmp;
124 struct stats_proto udp;
127 struct stats_proto tcp;
130 struct stats_mem mem;
133 struct stats_mem memp[MEMP_MAX];
136 struct stats_sys sys;
140 extern struct stats_ lwip_stats;
142 #define stats_init() /* Compatibility define, not init needed. */
144 #define STATS_INC(x) ++lwip_stats.x
148 #endif /* LWIP_STATS */
151 #define TCP_STATS_INC(x) STATS_INC(x)
153 #define TCP_STATS_INC(x)
157 #define UDP_STATS_INC(x) STATS_INC(x)
159 #define UDP_STATS_INC(x)
163 #define ICMP_STATS_INC(x) STATS_INC(x)
165 #define ICMP_STATS_INC(x)
169 #define IGMP_STATS_INC(x) STATS_INC(x)
171 #define IGMP_STATS_INC(x)
175 #define IP_STATS_INC(x) STATS_INC(x)
177 #define IP_STATS_INC(x)
181 #define IPFRAG_STATS_INC(x) STATS_INC(x)
183 #define IPFRAG_STATS_INC(x)
187 #define ETHARP_STATS_INC(x) STATS_INC(x)
189 #define ETHARP_STATS_INC(x)
193 #define LINK_STATS_INC(x) STATS_INC(x)
195 #define LINK_STATS_INC(x)
198 /* Display of statistics */
199 #if LWIP_STATS_DISPLAY
200 void stats_display(void);
202 #define stats_display()
203 #endif /* LWIP_STATS_DISPLAY */
209 #endif /* __LWIP_STATS_H__ */