Modified version of NetServices. Fixes an issue where connections failed should the HTTP response status line be received in a packet on its own prior to any further headers. Changes are made to the HTTPClient.cpp file's readHeaders method.

Committer:
andrewbonney
Date:
Fri Apr 08 14:39:41 2011 +0000
Revision:
0:ec559500a63f

        

Who changed what in which revision?

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