I have a problem getting this to work. Server only recieves half of the data being sent. Whats wrong

Dependencies:   mbed

Committer:
tax
Date:
Tue Mar 29 13:20:15 2011 +0000
Revision:
0:66300c77c6e9

        

Who changed what in which revision?

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