Official mbed lwIP library (version 1.4.0)

Dependents:   LwIPNetworking NetServicesMin EthernetInterface EthernetInterface_RSF ... more

Legacy Networking Libraries

This is an mbed 2 networking library. For mbed OS 5, lwip has been integrated with built-in networking interfaces. The networking libraries have been revised to better support additional network stacks and thread safety here.

This library is based on the code of lwIP v1.4.0

Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
All rights reserved. 

Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
   this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
   derived from this software without specific prior written permission. 

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.
Committer:
mbed_official
Date:
Mon Mar 14 16:15:36 2016 +0000
Revision:
20:08f08bfc3f3d
Parent:
0:51ac1d130fd4
Synchronized with git revision fec574a5ed6db26aca1b13992ff271bf527d4a0d

Full URL: https://github.com/mbedmicro/mbed/commit/fec574a5ed6db26aca1b13992ff271bf527d4a0d/

Increased allocated netbufs to handle DTLS handshakes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:51ac1d130fd4 1 /*
mbed_official 0:51ac1d130fd4 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
mbed_official 0:51ac1d130fd4 3 * All rights reserved.
mbed_official 0:51ac1d130fd4 4 *
mbed_official 0:51ac1d130fd4 5 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 0:51ac1d130fd4 6 * are permitted provided that the following conditions are met:
mbed_official 0:51ac1d130fd4 7 *
mbed_official 0:51ac1d130fd4 8 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 0:51ac1d130fd4 9 * this list of conditions and the following disclaimer.
mbed_official 0:51ac1d130fd4 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 0:51ac1d130fd4 11 * this list of conditions and the following disclaimer in the documentation
mbed_official 0:51ac1d130fd4 12 * and/or other materials provided with the distribution.
mbed_official 0:51ac1d130fd4 13 * 3. The name of the author may not be used to endorse or promote products
mbed_official 0:51ac1d130fd4 14 * derived from this software without specific prior written permission.
mbed_official 0:51ac1d130fd4 15 *
mbed_official 0:51ac1d130fd4 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
mbed_official 0:51ac1d130fd4 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mbed_official 0:51ac1d130fd4 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
mbed_official 0:51ac1d130fd4 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
mbed_official 0:51ac1d130fd4 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
mbed_official 0:51ac1d130fd4 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mbed_official 0:51ac1d130fd4 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mbed_official 0:51ac1d130fd4 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
mbed_official 0:51ac1d130fd4 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
mbed_official 0:51ac1d130fd4 25 * OF SUCH DAMAGE.
mbed_official 0:51ac1d130fd4 26 *
mbed_official 0:51ac1d130fd4 27 * This file is part of the lwIP TCP/IP stack.
mbed_official 0:51ac1d130fd4 28 *
mbed_official 0:51ac1d130fd4 29 * Author: Adam Dunkels <adam@sics.se>
mbed_official 0:51ac1d130fd4 30 *
mbed_official 0:51ac1d130fd4 31 */
mbed_official 0:51ac1d130fd4 32 #ifndef __LWIP_STATS_H__
mbed_official 0:51ac1d130fd4 33 #define __LWIP_STATS_H__
mbed_official 0:51ac1d130fd4 34
mbed_official 0:51ac1d130fd4 35 #include "lwip/opt.h"
mbed_official 0:51ac1d130fd4 36
mbed_official 0:51ac1d130fd4 37 #include "lwip/mem.h"
mbed_official 0:51ac1d130fd4 38 #include "lwip/memp.h"
mbed_official 0:51ac1d130fd4 39
mbed_official 0:51ac1d130fd4 40 #ifdef __cplusplus
mbed_official 0:51ac1d130fd4 41 extern "C" {
mbed_official 0:51ac1d130fd4 42 #endif
mbed_official 0:51ac1d130fd4 43
mbed_official 0:51ac1d130fd4 44 #if LWIP_STATS
mbed_official 0:51ac1d130fd4 45
mbed_official 0:51ac1d130fd4 46 #ifndef LWIP_STATS_LARGE
mbed_official 0:51ac1d130fd4 47 #define LWIP_STATS_LARGE 0
mbed_official 0:51ac1d130fd4 48 #endif
mbed_official 0:51ac1d130fd4 49
mbed_official 0:51ac1d130fd4 50 #if LWIP_STATS_LARGE
mbed_official 0:51ac1d130fd4 51 #define STAT_COUNTER u32_t
mbed_official 0:51ac1d130fd4 52 #define STAT_COUNTER_F U32_F
mbed_official 0:51ac1d130fd4 53 #else
mbed_official 0:51ac1d130fd4 54 #define STAT_COUNTER u16_t
mbed_official 0:51ac1d130fd4 55 #define STAT_COUNTER_F U16_F
mbed_official 0:51ac1d130fd4 56 #endif
mbed_official 0:51ac1d130fd4 57
mbed_official 0:51ac1d130fd4 58 struct stats_proto {
mbed_official 0:51ac1d130fd4 59 STAT_COUNTER xmit; /* Transmitted packets. */
mbed_official 0:51ac1d130fd4 60 STAT_COUNTER recv; /* Received packets. */
mbed_official 0:51ac1d130fd4 61 STAT_COUNTER fw; /* Forwarded packets. */
mbed_official 0:51ac1d130fd4 62 STAT_COUNTER drop; /* Dropped packets. */
mbed_official 0:51ac1d130fd4 63 STAT_COUNTER chkerr; /* Checksum error. */
mbed_official 0:51ac1d130fd4 64 STAT_COUNTER lenerr; /* Invalid length error. */
mbed_official 0:51ac1d130fd4 65 STAT_COUNTER memerr; /* Out of memory error. */
mbed_official 0:51ac1d130fd4 66 STAT_COUNTER rterr; /* Routing error. */
mbed_official 0:51ac1d130fd4 67 STAT_COUNTER proterr; /* Protocol error. */
mbed_official 0:51ac1d130fd4 68 STAT_COUNTER opterr; /* Error in options. */
mbed_official 0:51ac1d130fd4 69 STAT_COUNTER err; /* Misc error. */
mbed_official 0:51ac1d130fd4 70 STAT_COUNTER cachehit;
mbed_official 0:51ac1d130fd4 71 };
mbed_official 0:51ac1d130fd4 72
mbed_official 0:51ac1d130fd4 73 struct stats_igmp {
mbed_official 0:51ac1d130fd4 74 STAT_COUNTER xmit; /* Transmitted packets. */
mbed_official 0:51ac1d130fd4 75 STAT_COUNTER recv; /* Received packets. */
mbed_official 0:51ac1d130fd4 76 STAT_COUNTER drop; /* Dropped packets. */
mbed_official 0:51ac1d130fd4 77 STAT_COUNTER chkerr; /* Checksum error. */
mbed_official 0:51ac1d130fd4 78 STAT_COUNTER lenerr; /* Invalid length error. */
mbed_official 0:51ac1d130fd4 79 STAT_COUNTER memerr; /* Out of memory error. */
mbed_official 0:51ac1d130fd4 80 STAT_COUNTER proterr; /* Protocol error. */
mbed_official 0:51ac1d130fd4 81 STAT_COUNTER rx_v1; /* Received v1 frames. */
mbed_official 0:51ac1d130fd4 82 STAT_COUNTER rx_group; /* Received group-specific queries. */
mbed_official 0:51ac1d130fd4 83 STAT_COUNTER rx_general; /* Received general queries. */
mbed_official 0:51ac1d130fd4 84 STAT_COUNTER rx_report; /* Received reports. */
mbed_official 0:51ac1d130fd4 85 STAT_COUNTER tx_join; /* Sent joins. */
mbed_official 0:51ac1d130fd4 86 STAT_COUNTER tx_leave; /* Sent leaves. */
mbed_official 0:51ac1d130fd4 87 STAT_COUNTER tx_report; /* Sent reports. */
mbed_official 0:51ac1d130fd4 88 };
mbed_official 0:51ac1d130fd4 89
mbed_official 0:51ac1d130fd4 90 struct stats_mem {
mbed_official 0:51ac1d130fd4 91 #ifdef LWIP_DEBUG
mbed_official 0:51ac1d130fd4 92 const char *name;
mbed_official 0:51ac1d130fd4 93 #endif /* LWIP_DEBUG */
mbed_official 0:51ac1d130fd4 94 mem_size_t avail;
mbed_official 0:51ac1d130fd4 95 mem_size_t used;
mbed_official 0:51ac1d130fd4 96 mem_size_t max;
mbed_official 0:51ac1d130fd4 97 STAT_COUNTER err;
mbed_official 0:51ac1d130fd4 98 STAT_COUNTER illegal;
mbed_official 0:51ac1d130fd4 99 };
mbed_official 0:51ac1d130fd4 100
mbed_official 0:51ac1d130fd4 101 struct stats_syselem {
mbed_official 0:51ac1d130fd4 102 STAT_COUNTER used;
mbed_official 0:51ac1d130fd4 103 STAT_COUNTER max;
mbed_official 0:51ac1d130fd4 104 STAT_COUNTER err;
mbed_official 0:51ac1d130fd4 105 };
mbed_official 0:51ac1d130fd4 106
mbed_official 0:51ac1d130fd4 107 struct stats_sys {
mbed_official 0:51ac1d130fd4 108 struct stats_syselem sem;
mbed_official 0:51ac1d130fd4 109 struct stats_syselem mutex;
mbed_official 0:51ac1d130fd4 110 struct stats_syselem mbox;
mbed_official 0:51ac1d130fd4 111 };
mbed_official 0:51ac1d130fd4 112
mbed_official 0:51ac1d130fd4 113 struct stats_ {
mbed_official 0:51ac1d130fd4 114 #if LINK_STATS
mbed_official 0:51ac1d130fd4 115 struct stats_proto link;
mbed_official 0:51ac1d130fd4 116 #endif
mbed_official 0:51ac1d130fd4 117 #if ETHARP_STATS
mbed_official 0:51ac1d130fd4 118 struct stats_proto etharp;
mbed_official 0:51ac1d130fd4 119 #endif
mbed_official 0:51ac1d130fd4 120 #if IPFRAG_STATS
mbed_official 0:51ac1d130fd4 121 struct stats_proto ip_frag;
mbed_official 0:51ac1d130fd4 122 #endif
mbed_official 0:51ac1d130fd4 123 #if IP_STATS
mbed_official 0:51ac1d130fd4 124 struct stats_proto ip;
mbed_official 0:51ac1d130fd4 125 #endif
mbed_official 0:51ac1d130fd4 126 #if ICMP_STATS
mbed_official 0:51ac1d130fd4 127 struct stats_proto icmp;
mbed_official 0:51ac1d130fd4 128 #endif
mbed_official 0:51ac1d130fd4 129 #if IGMP_STATS
mbed_official 0:51ac1d130fd4 130 struct stats_igmp igmp;
mbed_official 0:51ac1d130fd4 131 #endif
mbed_official 0:51ac1d130fd4 132 #if UDP_STATS
mbed_official 0:51ac1d130fd4 133 struct stats_proto udp;
mbed_official 0:51ac1d130fd4 134 #endif
mbed_official 0:51ac1d130fd4 135 #if TCP_STATS
mbed_official 0:51ac1d130fd4 136 struct stats_proto tcp;
mbed_official 0:51ac1d130fd4 137 #endif
mbed_official 0:51ac1d130fd4 138 #if MEM_STATS
mbed_official 0:51ac1d130fd4 139 struct stats_mem mem;
mbed_official 0:51ac1d130fd4 140 #endif
mbed_official 0:51ac1d130fd4 141 #if MEMP_STATS
mbed_official 0:51ac1d130fd4 142 struct stats_mem memp[MEMP_MAX];
mbed_official 0:51ac1d130fd4 143 #endif
mbed_official 0:51ac1d130fd4 144 #if SYS_STATS
mbed_official 0:51ac1d130fd4 145 struct stats_sys sys;
mbed_official 0:51ac1d130fd4 146 #endif
mbed_official 0:51ac1d130fd4 147 };
mbed_official 0:51ac1d130fd4 148
mbed_official 0:51ac1d130fd4 149 extern struct stats_ lwip_stats;
mbed_official 0:51ac1d130fd4 150
mbed_official 0:51ac1d130fd4 151 void stats_init(void);
mbed_official 0:51ac1d130fd4 152
mbed_official 0:51ac1d130fd4 153 #define STATS_INC(x) ++lwip_stats.x
mbed_official 0:51ac1d130fd4 154 #define STATS_DEC(x) --lwip_stats.x
mbed_official 0:51ac1d130fd4 155 #define STATS_INC_USED(x, y) do { lwip_stats.x.used += y; \
mbed_official 0:51ac1d130fd4 156 if (lwip_stats.x.max < lwip_stats.x.used) { \
mbed_official 0:51ac1d130fd4 157 lwip_stats.x.max = lwip_stats.x.used; \
mbed_official 0:51ac1d130fd4 158 } \
mbed_official 0:51ac1d130fd4 159 } while(0)
mbed_official 0:51ac1d130fd4 160 #else /* LWIP_STATS */
mbed_official 0:51ac1d130fd4 161 #define stats_init()
mbed_official 0:51ac1d130fd4 162 #define STATS_INC(x)
mbed_official 0:51ac1d130fd4 163 #define STATS_DEC(x)
mbed_official 0:51ac1d130fd4 164 #define STATS_INC_USED(x)
mbed_official 0:51ac1d130fd4 165 #endif /* LWIP_STATS */
mbed_official 0:51ac1d130fd4 166
mbed_official 0:51ac1d130fd4 167 #if TCP_STATS
mbed_official 0:51ac1d130fd4 168 #define TCP_STATS_INC(x) STATS_INC(x)
mbed_official 0:51ac1d130fd4 169 #define TCP_STATS_DISPLAY() stats_display_proto(&lwip_stats.tcp, "TCP")
mbed_official 0:51ac1d130fd4 170 #else
mbed_official 0:51ac1d130fd4 171 #define TCP_STATS_INC(x)
mbed_official 0:51ac1d130fd4 172 #define TCP_STATS_DISPLAY()
mbed_official 0:51ac1d130fd4 173 #endif
mbed_official 0:51ac1d130fd4 174
mbed_official 0:51ac1d130fd4 175 #if UDP_STATS
mbed_official 0:51ac1d130fd4 176 #define UDP_STATS_INC(x) STATS_INC(x)
mbed_official 0:51ac1d130fd4 177 #define UDP_STATS_DISPLAY() stats_display_proto(&lwip_stats.udp, "UDP")
mbed_official 0:51ac1d130fd4 178 #else
mbed_official 0:51ac1d130fd4 179 #define UDP_STATS_INC(x)
mbed_official 0:51ac1d130fd4 180 #define UDP_STATS_DISPLAY()
mbed_official 0:51ac1d130fd4 181 #endif
mbed_official 0:51ac1d130fd4 182
mbed_official 0:51ac1d130fd4 183 #if ICMP_STATS
mbed_official 0:51ac1d130fd4 184 #define ICMP_STATS_INC(x) STATS_INC(x)
mbed_official 0:51ac1d130fd4 185 #define ICMP_STATS_DISPLAY() stats_display_proto(&lwip_stats.icmp, "ICMP")
mbed_official 0:51ac1d130fd4 186 #else
mbed_official 0:51ac1d130fd4 187 #define ICMP_STATS_INC(x)
mbed_official 0:51ac1d130fd4 188 #define ICMP_STATS_DISPLAY()
mbed_official 0:51ac1d130fd4 189 #endif
mbed_official 0:51ac1d130fd4 190
mbed_official 0:51ac1d130fd4 191 #if IGMP_STATS
mbed_official 0:51ac1d130fd4 192 #define IGMP_STATS_INC(x) STATS_INC(x)
mbed_official 0:51ac1d130fd4 193 #define IGMP_STATS_DISPLAY() stats_display_igmp(&lwip_stats.igmp)
mbed_official 0:51ac1d130fd4 194 #else
mbed_official 0:51ac1d130fd4 195 #define IGMP_STATS_INC(x)
mbed_official 0:51ac1d130fd4 196 #define IGMP_STATS_DISPLAY()
mbed_official 0:51ac1d130fd4 197 #endif
mbed_official 0:51ac1d130fd4 198
mbed_official 0:51ac1d130fd4 199 #if IP_STATS
mbed_official 0:51ac1d130fd4 200 #define IP_STATS_INC(x) STATS_INC(x)
mbed_official 0:51ac1d130fd4 201 #define IP_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip, "IP")
mbed_official 0:51ac1d130fd4 202 #else
mbed_official 0:51ac1d130fd4 203 #define IP_STATS_INC(x)
mbed_official 0:51ac1d130fd4 204 #define IP_STATS_DISPLAY()
mbed_official 0:51ac1d130fd4 205 #endif
mbed_official 0:51ac1d130fd4 206
mbed_official 0:51ac1d130fd4 207 #if IPFRAG_STATS
mbed_official 0:51ac1d130fd4 208 #define IPFRAG_STATS_INC(x) STATS_INC(x)
mbed_official 0:51ac1d130fd4 209 #define IPFRAG_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG")
mbed_official 0:51ac1d130fd4 210 #else
mbed_official 0:51ac1d130fd4 211 #define IPFRAG_STATS_INC(x)
mbed_official 0:51ac1d130fd4 212 #define IPFRAG_STATS_DISPLAY()
mbed_official 0:51ac1d130fd4 213 #endif
mbed_official 0:51ac1d130fd4 214
mbed_official 0:51ac1d130fd4 215 #if ETHARP_STATS
mbed_official 0:51ac1d130fd4 216 #define ETHARP_STATS_INC(x) STATS_INC(x)
mbed_official 0:51ac1d130fd4 217 #define ETHARP_STATS_DISPLAY() stats_display_proto(&lwip_stats.etharp, "ETHARP")
mbed_official 0:51ac1d130fd4 218 #else
mbed_official 0:51ac1d130fd4 219 #define ETHARP_STATS_INC(x)
mbed_official 0:51ac1d130fd4 220 #define ETHARP_STATS_DISPLAY()
mbed_official 0:51ac1d130fd4 221 #endif
mbed_official 0:51ac1d130fd4 222
mbed_official 0:51ac1d130fd4 223 #if LINK_STATS
mbed_official 0:51ac1d130fd4 224 #define LINK_STATS_INC(x) STATS_INC(x)
mbed_official 0:51ac1d130fd4 225 #define LINK_STATS_DISPLAY() stats_display_proto(&lwip_stats.link, "LINK")
mbed_official 0:51ac1d130fd4 226 #else
mbed_official 0:51ac1d130fd4 227 #define LINK_STATS_INC(x)
mbed_official 0:51ac1d130fd4 228 #define LINK_STATS_DISPLAY()
mbed_official 0:51ac1d130fd4 229 #endif
mbed_official 0:51ac1d130fd4 230
mbed_official 0:51ac1d130fd4 231 #if MEM_STATS
mbed_official 0:51ac1d130fd4 232 #define MEM_STATS_AVAIL(x, y) lwip_stats.mem.x = y
mbed_official 0:51ac1d130fd4 233 #define MEM_STATS_INC(x) STATS_INC(mem.x)
mbed_official 0:51ac1d130fd4 234 #define MEM_STATS_INC_USED(x, y) STATS_INC_USED(mem, y)
mbed_official 0:51ac1d130fd4 235 #define MEM_STATS_DEC_USED(x, y) lwip_stats.mem.x -= y
mbed_official 0:51ac1d130fd4 236 #define MEM_STATS_DISPLAY() stats_display_mem(&lwip_stats.mem, "HEAP")
mbed_official 0:51ac1d130fd4 237 #else
mbed_official 0:51ac1d130fd4 238 #define MEM_STATS_AVAIL(x, y)
mbed_official 0:51ac1d130fd4 239 #define MEM_STATS_INC(x)
mbed_official 0:51ac1d130fd4 240 #define MEM_STATS_INC_USED(x, y)
mbed_official 0:51ac1d130fd4 241 #define MEM_STATS_DEC_USED(x, y)
mbed_official 0:51ac1d130fd4 242 #define MEM_STATS_DISPLAY()
mbed_official 0:51ac1d130fd4 243 #endif
mbed_official 0:51ac1d130fd4 244
mbed_official 0:51ac1d130fd4 245 #if MEMP_STATS
mbed_official 0:51ac1d130fd4 246 #define MEMP_STATS_AVAIL(x, i, y) lwip_stats.memp[i].x = y
mbed_official 0:51ac1d130fd4 247 #define MEMP_STATS_INC(x, i) STATS_INC(memp[i].x)
mbed_official 0:51ac1d130fd4 248 #define MEMP_STATS_DEC(x, i) STATS_DEC(memp[i].x)
mbed_official 0:51ac1d130fd4 249 #define MEMP_STATS_INC_USED(x, i) STATS_INC_USED(memp[i], 1)
mbed_official 0:51ac1d130fd4 250 #define MEMP_STATS_DISPLAY(i) stats_display_memp(&lwip_stats.memp[i], i)
mbed_official 0:51ac1d130fd4 251 #else
mbed_official 0:51ac1d130fd4 252 #define MEMP_STATS_AVAIL(x, i, y)
mbed_official 0:51ac1d130fd4 253 #define MEMP_STATS_INC(x, i)
mbed_official 0:51ac1d130fd4 254 #define MEMP_STATS_DEC(x, i)
mbed_official 0:51ac1d130fd4 255 #define MEMP_STATS_INC_USED(x, i)
mbed_official 0:51ac1d130fd4 256 #define MEMP_STATS_DISPLAY(i)
mbed_official 0:51ac1d130fd4 257 #endif
mbed_official 0:51ac1d130fd4 258
mbed_official 0:51ac1d130fd4 259 #if SYS_STATS
mbed_official 0:51ac1d130fd4 260 #define SYS_STATS_INC(x) STATS_INC(sys.x)
mbed_official 0:51ac1d130fd4 261 #define SYS_STATS_DEC(x) STATS_DEC(sys.x)
mbed_official 0:51ac1d130fd4 262 #define SYS_STATS_INC_USED(x) STATS_INC_USED(sys.x, 1)
mbed_official 0:51ac1d130fd4 263 #define SYS_STATS_DISPLAY() stats_display_sys(&lwip_stats.sys)
mbed_official 0:51ac1d130fd4 264 #else
mbed_official 0:51ac1d130fd4 265 #define SYS_STATS_INC(x)
mbed_official 0:51ac1d130fd4 266 #define SYS_STATS_DEC(x)
mbed_official 0:51ac1d130fd4 267 #define SYS_STATS_INC_USED(x)
mbed_official 0:51ac1d130fd4 268 #define SYS_STATS_DISPLAY()
mbed_official 0:51ac1d130fd4 269 #endif
mbed_official 0:51ac1d130fd4 270
mbed_official 0:51ac1d130fd4 271 /* Display of statistics */
mbed_official 0:51ac1d130fd4 272 #if LWIP_STATS_DISPLAY
mbed_official 0:51ac1d130fd4 273 void stats_display(void);
mbed_official 0:51ac1d130fd4 274 void stats_display_proto(struct stats_proto *proto, char *name);
mbed_official 0:51ac1d130fd4 275 void stats_display_igmp(struct stats_igmp *igmp);
mbed_official 0:51ac1d130fd4 276 void stats_display_mem(struct stats_mem *mem, char *name);
mbed_official 0:51ac1d130fd4 277 void stats_display_memp(struct stats_mem *mem, int index);
mbed_official 0:51ac1d130fd4 278 void stats_display_sys(struct stats_sys *sys);
mbed_official 0:51ac1d130fd4 279 #else /* LWIP_STATS_DISPLAY */
mbed_official 0:51ac1d130fd4 280 #define stats_display()
mbed_official 0:51ac1d130fd4 281 #define stats_display_proto(proto, name)
mbed_official 0:51ac1d130fd4 282 #define stats_display_igmp(igmp)
mbed_official 0:51ac1d130fd4 283 #define stats_display_mem(mem, name)
mbed_official 0:51ac1d130fd4 284 #define stats_display_memp(mem, index)
mbed_official 0:51ac1d130fd4 285 #define stats_display_sys(sys)
mbed_official 0:51ac1d130fd4 286 #endif /* LWIP_STATS_DISPLAY */
mbed_official 0:51ac1d130fd4 287
mbed_official 0:51ac1d130fd4 288 #ifdef __cplusplus
mbed_official 0:51ac1d130fd4 289 }
mbed_official 0:51ac1d130fd4 290 #endif
mbed_official 0:51ac1d130fd4 291
mbed_official 0:51ac1d130fd4 292 #endif /* __LWIP_STATS_H__ */