]> git.sur5r.net Git - freertos/blob - Demo/lwIP_MCF5235_GCC/lwip/src/include/lwip/stats.h
Start to re-arrange files to include FreeRTOS+ in main download.
[freertos] / Demo / lwIP_MCF5235_GCC / lwip / src / include / lwip / stats.h
1 /*\r
2  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.\r
3  * All rights reserved. \r
4  * \r
5  * Redistribution and use in source and binary forms, with or without modification, \r
6  * are permitted provided that the following conditions are met:\r
7  *\r
8  * 1. Redistributions of source code must retain the above copyright notice,\r
9  *    this list of conditions and the following disclaimer.\r
10  * 2. Redistributions in binary form must reproduce the above copyright notice,\r
11  *    this list of conditions and the following disclaimer in the documentation\r
12  *    and/or other materials provided with the distribution.\r
13  * 3. The name of the author may not be used to endorse or promote products\r
14  *    derived from this software without specific prior written permission. \r
15  *\r
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED \r
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF \r
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT \r
19  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, \r
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT \r
21  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS \r
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN \r
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING \r
24  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY \r
25  * OF SUCH DAMAGE.\r
26  *\r
27  * This file is part of the lwIP TCP/IP stack.\r
28  * \r
29  * Author: Adam Dunkels <adam@sics.se>\r
30  *\r
31  */\r
32 #ifndef __LWIP_STATS_H__\r
33 #define __LWIP_STATS_H__\r
34 \r
35 #include "lwip/opt.h"\r
36 #include "arch/cc.h"\r
37 \r
38 #include "lwip/mem.h"\r
39 #include "lwip/memp.h"\r
40 \r
41 #if LWIP_STATS\r
42 \r
43 struct stats_proto {\r
44   u16_t xmit;    /* Transmitted packets. */\r
45   u16_t rexmit;  /* Retransmitted packets. */\r
46   u16_t recv;    /* Received packets. */\r
47   u16_t fw;      /* Forwarded packets. */\r
48   u16_t drop;    /* Dropped packets. */\r
49   u16_t chkerr;  /* Checksum error. */\r
50   u16_t lenerr;  /* Invalid length error. */\r
51   u16_t memerr;  /* Out of memory error. */\r
52   u16_t rterr;   /* Routing error. */\r
53   u16_t proterr; /* Protocol error. */\r
54   u16_t opterr;  /* Error in options. */\r
55   u16_t err;     /* Misc error. */\r
56   u16_t cachehit;\r
57 };\r
58 \r
59 struct stats_mem {\r
60   mem_size_t avail;\r
61   mem_size_t used;\r
62   mem_size_t max;  \r
63   mem_size_t err;\r
64 };\r
65 \r
66 struct stats_pbuf {\r
67   u16_t avail;\r
68   u16_t used;\r
69   u16_t max;  \r
70   u16_t err;\r
71 \r
72   u16_t alloc_locked;\r
73   u16_t refresh_locked;\r
74 };\r
75 \r
76 struct stats_syselem {\r
77   u16_t used;\r
78   u16_t max;\r
79   u16_t err;\r
80 };\r
81 \r
82 struct stats_sys {\r
83   struct stats_syselem sem;\r
84   struct stats_syselem mbox;\r
85 };\r
86 \r
87 struct stats_ {\r
88   struct stats_proto link;\r
89   struct stats_proto ip_frag;\r
90   struct stats_proto ip;\r
91   struct stats_proto icmp;\r
92   struct stats_proto udp;\r
93   struct stats_proto tcp;\r
94   struct stats_pbuf pbuf;\r
95   struct stats_mem mem;\r
96   struct stats_mem memp[MEMP_MAX];\r
97   struct stats_sys sys;\r
98 };\r
99 \r
100 extern struct stats_ lwip_stats;\r
101 \r
102 \r
103 void stats_init(void);\r
104 \r
105 #define STATS_INC(x) ++lwip_stats.x\r
106 #else\r
107 #define stats_init()\r
108 #define STATS_INC(x)\r
109 #endif /* LWIP_STATS */\r
110 \r
111 #if TCP_STATS\r
112 #define TCP_STATS_INC(x) STATS_INC(x)\r
113 #else\r
114 #define TCP_STATS_INC(x)\r
115 #endif\r
116 \r
117 #if UDP_STATS\r
118 #define UDP_STATS_INC(x) STATS_INC(x)\r
119 #else\r
120 #define UDP_STATS_INC(x)\r
121 #endif\r
122 \r
123 #if ICMP_STATS\r
124 #define ICMP_STATS_INC(x) STATS_INC(x)\r
125 #else\r
126 #define ICMP_STATS_INC(x)\r
127 #endif\r
128 \r
129 #if IP_STATS\r
130 #define IP_STATS_INC(x) STATS_INC(x)\r
131 #else\r
132 #define IP_STATS_INC(x)\r
133 #endif\r
134 \r
135 #if IPFRAG_STATS\r
136 #define IPFRAG_STATS_INC(x) STATS_INC(x)\r
137 #else\r
138 #define IPFRAG_STATS_INC(x)\r
139 #endif\r
140 \r
141 #if LINK_STATS\r
142 #define LINK_STATS_INC(x) STATS_INC(x)\r
143 #else\r
144 #define LINK_STATS_INC(x)\r
145 #endif\r
146 \r
147 /* Display of statistics */\r
148 #if LWIP_STATS_DISPLAY\r
149 void stats_display(void);\r
150 #else\r
151 #define stats_display()\r
152 #endif\r
153 \r
154 #endif /* __LWIP_STATS_H__ */\r
155 \r
156 \r
157 \r
158 \r