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 * @file
RodColeman 0:850eacf3e945 3 * Statistics module
RodColeman 0:850eacf3e945 4 *
RodColeman 0:850eacf3e945 5 */
RodColeman 0:850eacf3e945 6
RodColeman 0:850eacf3e945 7 /*
RodColeman 0:850eacf3e945 8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
RodColeman 0:850eacf3e945 9 * All rights reserved.
RodColeman 0:850eacf3e945 10 *
RodColeman 0:850eacf3e945 11 * Redistribution and use in source and binary forms, with or without modification,
RodColeman 0:850eacf3e945 12 * are permitted provided that the following conditions are met:
RodColeman 0:850eacf3e945 13 *
RodColeman 0:850eacf3e945 14 * 1. Redistributions of source code must retain the above copyright notice,
RodColeman 0:850eacf3e945 15 * this list of conditions and the following disclaimer.
RodColeman 0:850eacf3e945 16 * 2. Redistributions in binary form must reproduce the above copyright notice,
RodColeman 0:850eacf3e945 17 * this list of conditions and the following disclaimer in the documentation
RodColeman 0:850eacf3e945 18 * and/or other materials provided with the distribution.
RodColeman 0:850eacf3e945 19 * 3. The name of the author may not be used to endorse or promote products
RodColeman 0:850eacf3e945 20 * derived from this software without specific prior written permission.
RodColeman 0:850eacf3e945 21 *
RodColeman 0:850eacf3e945 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
RodColeman 0:850eacf3e945 23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
RodColeman 0:850eacf3e945 24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
RodColeman 0:850eacf3e945 25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
RodColeman 0:850eacf3e945 26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
RodColeman 0:850eacf3e945 27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
RodColeman 0:850eacf3e945 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
RodColeman 0:850eacf3e945 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
RodColeman 0:850eacf3e945 30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
RodColeman 0:850eacf3e945 31 * OF SUCH DAMAGE.
RodColeman 0:850eacf3e945 32 *
RodColeman 0:850eacf3e945 33 * This file is part of the lwIP TCP/IP stack.
RodColeman 0:850eacf3e945 34 *
RodColeman 0:850eacf3e945 35 * Author: Adam Dunkels <adam@sics.se>
RodColeman 0:850eacf3e945 36 *
RodColeman 0:850eacf3e945 37 */
RodColeman 0:850eacf3e945 38
RodColeman 0:850eacf3e945 39 #include "lwip/opt.h"
RodColeman 0:850eacf3e945 40
RodColeman 0:850eacf3e945 41 #if LWIP_STATS /* don't build if not configured for use in lwipopts.h */
RodColeman 0:850eacf3e945 42
RodColeman 0:850eacf3e945 43 #include "lwip/def.h"
RodColeman 0:850eacf3e945 44 #include "lwip/stats.h"
RodColeman 0:850eacf3e945 45 #include "lwip/mem.h"
RodColeman 0:850eacf3e945 46
RodColeman 0:850eacf3e945 47 #include <string.h>
RodColeman 0:850eacf3e945 48
RodColeman 0:850eacf3e945 49 struct stats_ lwip_stats;
RodColeman 0:850eacf3e945 50
RodColeman 0:850eacf3e945 51 void stats_init(void)
RodColeman 0:850eacf3e945 52 {
RodColeman 0:850eacf3e945 53 #ifdef LWIP_DEBUG
RodColeman 0:850eacf3e945 54 #if MEMP_STATS
RodColeman 0:850eacf3e945 55 const char * memp_names[] = {
RodColeman 0:850eacf3e945 56 #define LWIP_MEMPOOL(name,num,size,desc) desc,
RodColeman 0:850eacf3e945 57 #include "lwip/memp_std.h"
RodColeman 0:850eacf3e945 58 };
RodColeman 0:850eacf3e945 59 int i;
RodColeman 0:850eacf3e945 60 for (i = 0; i < MEMP_MAX; i++) {
RodColeman 0:850eacf3e945 61 lwip_stats.memp[i].name = memp_names[i];
RodColeman 0:850eacf3e945 62 }
RodColeman 0:850eacf3e945 63 #endif /* MEMP_STATS */
RodColeman 0:850eacf3e945 64 #if MEM_STATS
RodColeman 0:850eacf3e945 65 lwip_stats.mem.name = "MEM";
RodColeman 0:850eacf3e945 66 #endif /* MEM_STATS */
RodColeman 0:850eacf3e945 67 #endif /* LWIP_DEBUG */
RodColeman 0:850eacf3e945 68 }
RodColeman 0:850eacf3e945 69
RodColeman 0:850eacf3e945 70 #if LWIP_STATS_DISPLAY
RodColeman 0:850eacf3e945 71 void
RodColeman 0:850eacf3e945 72 stats_display_proto(struct stats_proto *proto, char *name)
RodColeman 0:850eacf3e945 73 {
RodColeman 0:850eacf3e945 74 LWIP_PLATFORM_DIAG(("\n%s\n\t", name));
RodColeman 0:850eacf3e945 75 LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", proto->xmit));
RodColeman 0:850eacf3e945 76 LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F"\n\t", proto->recv));
RodColeman 0:850eacf3e945 77 LWIP_PLATFORM_DIAG(("fw: %"STAT_COUNTER_F"\n\t", proto->fw));
RodColeman 0:850eacf3e945 78 LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", proto->drop));
RodColeman 0:850eacf3e945 79 LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", proto->chkerr));
RodColeman 0:850eacf3e945 80 LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", proto->lenerr));
RodColeman 0:850eacf3e945 81 LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F"\n\t", proto->memerr));
RodColeman 0:850eacf3e945 82 LWIP_PLATFORM_DIAG(("rterr: %"STAT_COUNTER_F"\n\t", proto->rterr));
RodColeman 0:850eacf3e945 83 LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F"\n\t", proto->proterr));
RodColeman 0:850eacf3e945 84 LWIP_PLATFORM_DIAG(("opterr: %"STAT_COUNTER_F"\n\t", proto->opterr));
RodColeman 0:850eacf3e945 85 LWIP_PLATFORM_DIAG(("err: %"STAT_COUNTER_F"\n\t", proto->err));
RodColeman 0:850eacf3e945 86 LWIP_PLATFORM_DIAG(("cachehit: %"STAT_COUNTER_F"\n", proto->cachehit));
RodColeman 0:850eacf3e945 87 }
RodColeman 0:850eacf3e945 88
RodColeman 0:850eacf3e945 89 #if IGMP_STATS
RodColeman 0:850eacf3e945 90 void
RodColeman 0:850eacf3e945 91 stats_display_igmp(struct stats_igmp *igmp)
RodColeman 0:850eacf3e945 92 {
RodColeman 0:850eacf3e945 93 LWIP_PLATFORM_DIAG(("\nIGMP\n\t"));
RodColeman 0:850eacf3e945 94 LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", igmp->xmit));
RodColeman 0:850eacf3e945 95 LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F"\n\t", igmp->recv));
RodColeman 0:850eacf3e945 96 LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", igmp->drop));
RodColeman 0:850eacf3e945 97 LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", igmp->chkerr));
RodColeman 0:850eacf3e945 98 LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", igmp->lenerr));
RodColeman 0:850eacf3e945 99 LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F"\n\t", igmp->memerr));
RodColeman 0:850eacf3e945 100 LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F"\n\t", igmp->proterr));
RodColeman 0:850eacf3e945 101 LWIP_PLATFORM_DIAG(("rx_v1: %"STAT_COUNTER_F"\n\t", igmp->rx_v1));
RodColeman 0:850eacf3e945 102 LWIP_PLATFORM_DIAG(("rx_group: %"STAT_COUNTER_F"\n", igmp->rx_group));
RodColeman 0:850eacf3e945 103 LWIP_PLATFORM_DIAG(("rx_general: %"STAT_COUNTER_F"\n", igmp->rx_general));
RodColeman 0:850eacf3e945 104 LWIP_PLATFORM_DIAG(("rx_report: %"STAT_COUNTER_F"\n\t", igmp->rx_report));
RodColeman 0:850eacf3e945 105 LWIP_PLATFORM_DIAG(("tx_join: %"STAT_COUNTER_F"\n\t", igmp->tx_join));
RodColeman 0:850eacf3e945 106 LWIP_PLATFORM_DIAG(("tx_leave: %"STAT_COUNTER_F"\n\t", igmp->tx_leave));
RodColeman 0:850eacf3e945 107 LWIP_PLATFORM_DIAG(("tx_report: %"STAT_COUNTER_F"\n\t", igmp->tx_report));
RodColeman 0:850eacf3e945 108 }
RodColeman 0:850eacf3e945 109 #endif /* IGMP_STATS */
RodColeman 0:850eacf3e945 110
RodColeman 0:850eacf3e945 111 #if MEM_STATS || MEMP_STATS
RodColeman 0:850eacf3e945 112 void
RodColeman 0:850eacf3e945 113 stats_display_mem(struct stats_mem *mem, char *name)
RodColeman 0:850eacf3e945 114 {
RodColeman 0:850eacf3e945 115 LWIP_PLATFORM_DIAG(("\nMEM %s\n\t", name));
RodColeman 0:850eacf3e945 116 LWIP_PLATFORM_DIAG(("avail: %"U32_F"\n\t", (u32_t)mem->avail));
RodColeman 0:850eacf3e945 117 LWIP_PLATFORM_DIAG(("used: %"U32_F"\n\t", (u32_t)mem->used));
RodColeman 0:850eacf3e945 118 LWIP_PLATFORM_DIAG(("max: %"U32_F"\n\t", (u32_t)mem->max));
RodColeman 0:850eacf3e945 119 LWIP_PLATFORM_DIAG(("err: %"U32_F"\n", (u32_t)mem->err));
RodColeman 0:850eacf3e945 120 }
RodColeman 0:850eacf3e945 121
RodColeman 0:850eacf3e945 122 #if MEMP_STATS
RodColeman 0:850eacf3e945 123 void
RodColeman 0:850eacf3e945 124 stats_display_memp(struct stats_mem *mem, int index)
RodColeman 0:850eacf3e945 125 {
RodColeman 0:850eacf3e945 126 char * memp_names[] = {
RodColeman 0:850eacf3e945 127 #define LWIP_MEMPOOL(name,num,size,desc) desc,
RodColeman 0:850eacf3e945 128 #include "lwip/memp_std.h"
RodColeman 0:850eacf3e945 129 };
RodColeman 0:850eacf3e945 130 if(index < MEMP_MAX) {
RodColeman 0:850eacf3e945 131 stats_display_mem(mem, memp_names[index]);
RodColeman 0:850eacf3e945 132 }
RodColeman 0:850eacf3e945 133 }
RodColeman 0:850eacf3e945 134 #endif /* MEMP_STATS */
RodColeman 0:850eacf3e945 135 #endif /* MEM_STATS || MEMP_STATS */
RodColeman 0:850eacf3e945 136
RodColeman 0:850eacf3e945 137 #if SYS_STATS
RodColeman 0:850eacf3e945 138 void
RodColeman 0:850eacf3e945 139 stats_display_sys(struct stats_sys *sys)
RodColeman 0:850eacf3e945 140 {
RodColeman 0:850eacf3e945 141 LWIP_PLATFORM_DIAG(("\nSYS\n\t"));
RodColeman 0:850eacf3e945 142 LWIP_PLATFORM_DIAG(("sem.used: %"U32_F"\n\t", (u32_t)sys->sem.used));
RodColeman 0:850eacf3e945 143 LWIP_PLATFORM_DIAG(("sem.max: %"U32_F"\n\t", (u32_t)sys->sem.max));
RodColeman 0:850eacf3e945 144 LWIP_PLATFORM_DIAG(("sem.err: %"U32_F"\n\t", (u32_t)sys->sem.err));
RodColeman 0:850eacf3e945 145 LWIP_PLATFORM_DIAG(("mutex.used: %"U32_F"\n\t", (u32_t)sys->mutex.used));
RodColeman 0:850eacf3e945 146 LWIP_PLATFORM_DIAG(("mutex.max: %"U32_F"\n\t", (u32_t)sys->mutex.max));
RodColeman 0:850eacf3e945 147 LWIP_PLATFORM_DIAG(("mutex.err: %"U32_F"\n\t", (u32_t)sys->mutex.err));
RodColeman 0:850eacf3e945 148 LWIP_PLATFORM_DIAG(("mbox.used: %"U32_F"\n\t", (u32_t)sys->mbox.used));
RodColeman 0:850eacf3e945 149 LWIP_PLATFORM_DIAG(("mbox.max: %"U32_F"\n\t", (u32_t)sys->mbox.max));
RodColeman 0:850eacf3e945 150 LWIP_PLATFORM_DIAG(("mbox.err: %"U32_F"\n\t", (u32_t)sys->mbox.err));
RodColeman 0:850eacf3e945 151 }
RodColeman 0:850eacf3e945 152 #endif /* SYS_STATS */
RodColeman 0:850eacf3e945 153
RodColeman 0:850eacf3e945 154 void
RodColeman 0:850eacf3e945 155 stats_display(void)
RodColeman 0:850eacf3e945 156 {
RodColeman 0:850eacf3e945 157 s16_t i;
RodColeman 0:850eacf3e945 158
RodColeman 0:850eacf3e945 159 LINK_STATS_DISPLAY();
RodColeman 0:850eacf3e945 160 ETHARP_STATS_DISPLAY();
RodColeman 0:850eacf3e945 161 IPFRAG_STATS_DISPLAY();
RodColeman 0:850eacf3e945 162 IP_STATS_DISPLAY();
RodColeman 0:850eacf3e945 163 IGMP_STATS_DISPLAY();
RodColeman 0:850eacf3e945 164 ICMP_STATS_DISPLAY();
RodColeman 0:850eacf3e945 165 UDP_STATS_DISPLAY();
RodColeman 0:850eacf3e945 166 TCP_STATS_DISPLAY();
RodColeman 0:850eacf3e945 167 MEM_STATS_DISPLAY();
RodColeman 0:850eacf3e945 168 for (i = 0; i < MEMP_MAX; i++) {
RodColeman 0:850eacf3e945 169 MEMP_STATS_DISPLAY(i);
RodColeman 0:850eacf3e945 170 }
RodColeman 0:850eacf3e945 171 SYS_STATS_DISPLAY();
RodColeman 0:850eacf3e945 172 }
RodColeman 0:850eacf3e945 173 #endif /* LWIP_STATS_DISPLAY */
RodColeman 0:850eacf3e945 174
RodColeman 0:850eacf3e945 175 #endif /* LWIP_STATS */
RodColeman 0:850eacf3e945 176