Netservices modded to read fragmented HTTP respsonse/payload from special purpose server - 180 bytes only

Committer:
RodColeman
Date:
Thu Sep 08 10:48:09 2011 +0000
Revision:
0:850eacf3e945
revised fixed length to 178 bytes

Who changed what in which revision?

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