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

Committer:
RodColeman
Date:
Thu Sep 08 10:41:36 2011 +0000
Revision:
0:8f5825f330b0
setDataLen hacked to 180bytes

Who changed what in which revision?

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