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 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
tax 0:66300c77c6e9 3 * All rights reserved.
tax 0:66300c77c6e9 4 *
tax 0:66300c77c6e9 5 * Redistribution and use in source and binary forms, with or without modification,
tax 0:66300c77c6e9 6 * are permitted provided that the following conditions are met:
tax 0:66300c77c6e9 7 *
tax 0:66300c77c6e9 8 * 1. Redistributions of source code must retain the above copyright notice,
tax 0:66300c77c6e9 9 * this list of conditions and the following disclaimer.
tax 0:66300c77c6e9 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
tax 0:66300c77c6e9 11 * this list of conditions and the following disclaimer in the documentation
tax 0:66300c77c6e9 12 * and/or other materials provided with the distribution.
tax 0:66300c77c6e9 13 * 3. The name of the author may not be used to endorse or promote products
tax 0:66300c77c6e9 14 * derived from this software without specific prior written permission.
tax 0:66300c77c6e9 15 *
tax 0:66300c77c6e9 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
tax 0:66300c77c6e9 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
tax 0:66300c77c6e9 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
tax 0:66300c77c6e9 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
tax 0:66300c77c6e9 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
tax 0:66300c77c6e9 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
tax 0:66300c77c6e9 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
tax 0:66300c77c6e9 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
tax 0:66300c77c6e9 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
tax 0:66300c77c6e9 25 * OF SUCH DAMAGE.
tax 0:66300c77c6e9 26 *
tax 0:66300c77c6e9 27 * This file is part of the lwIP TCP/IP stack.
tax 0:66300c77c6e9 28 *
tax 0:66300c77c6e9 29 * Author: Adam Dunkels <adam@sics.se>
tax 0:66300c77c6e9 30 *
tax 0:66300c77c6e9 31 */
tax 0:66300c77c6e9 32 #ifndef __LWIP_ICMP_H__
tax 0:66300c77c6e9 33 #define __LWIP_ICMP_H__
tax 0:66300c77c6e9 34
tax 0:66300c77c6e9 35 #include "lwip/opt.h"
tax 0:66300c77c6e9 36 #include "lwip/pbuf.h"
tax 0:66300c77c6e9 37 #include "lwip/ip_addr.h"
tax 0:66300c77c6e9 38 #include "lwip/netif.h"
tax 0:66300c77c6e9 39
tax 0:66300c77c6e9 40 #ifdef __cplusplus
tax 0:66300c77c6e9 41 extern "C" {
tax 0:66300c77c6e9 42 #endif
tax 0:66300c77c6e9 43
tax 0:66300c77c6e9 44 #define ICMP_ER 0 /* echo reply */
tax 0:66300c77c6e9 45 #define ICMP_DUR 3 /* destination unreachable */
tax 0:66300c77c6e9 46 #define ICMP_SQ 4 /* source quench */
tax 0:66300c77c6e9 47 #define ICMP_RD 5 /* redirect */
tax 0:66300c77c6e9 48 #define ICMP_ECHO 8 /* echo */
tax 0:66300c77c6e9 49 #define ICMP_TE 11 /* time exceeded */
tax 0:66300c77c6e9 50 #define ICMP_PP 12 /* parameter problem */
tax 0:66300c77c6e9 51 #define ICMP_TS 13 /* timestamp */
tax 0:66300c77c6e9 52 #define ICMP_TSR 14 /* timestamp reply */
tax 0:66300c77c6e9 53 #define ICMP_IRQ 15 /* information request */
tax 0:66300c77c6e9 54 #define ICMP_IR 16 /* information reply */
tax 0:66300c77c6e9 55
tax 0:66300c77c6e9 56 enum icmp_dur_type {
tax 0:66300c77c6e9 57 ICMP_DUR_NET = 0, /* net unreachable */
tax 0:66300c77c6e9 58 ICMP_DUR_HOST = 1, /* host unreachable */
tax 0:66300c77c6e9 59 ICMP_DUR_PROTO = 2, /* protocol unreachable */
tax 0:66300c77c6e9 60 ICMP_DUR_PORT = 3, /* port unreachable */
tax 0:66300c77c6e9 61 ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */
tax 0:66300c77c6e9 62 ICMP_DUR_SR = 5 /* source route failed */
tax 0:66300c77c6e9 63 };
tax 0:66300c77c6e9 64
tax 0:66300c77c6e9 65 enum icmp_te_type {
tax 0:66300c77c6e9 66 ICMP_TE_TTL = 0, /* time to live exceeded in transit */
tax 0:66300c77c6e9 67 ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */
tax 0:66300c77c6e9 68 };
tax 0:66300c77c6e9 69
tax 0:66300c77c6e9 70 #ifdef PACK_STRUCT_USE_INCLUDES
tax 0:66300c77c6e9 71 # include "arch/bpstruct.h"
tax 0:66300c77c6e9 72 #endif
tax 0:66300c77c6e9 73 /* This is the standard ICMP header only that the u32_t data
tax 0:66300c77c6e9 74 * is splitted to two u16_t like ICMP echo needs it.
tax 0:66300c77c6e9 75 * This header is also used for other ICMP types that do not
tax 0:66300c77c6e9 76 * use the data part.
tax 0:66300c77c6e9 77 */
tax 0:66300c77c6e9 78 PACK_STRUCT_BEGIN
tax 0:66300c77c6e9 79 struct icmp_echo_hdr {
tax 0:66300c77c6e9 80 PACK_STRUCT_FIELD(u8_t type);
tax 0:66300c77c6e9 81 PACK_STRUCT_FIELD(u8_t code);
tax 0:66300c77c6e9 82 PACK_STRUCT_FIELD(u16_t chksum);
tax 0:66300c77c6e9 83 PACK_STRUCT_FIELD(u16_t id);
tax 0:66300c77c6e9 84 PACK_STRUCT_FIELD(u16_t seqno);
tax 0:66300c77c6e9 85 } PACK_STRUCT_STRUCT;
tax 0:66300c77c6e9 86 PACK_STRUCT_END
tax 0:66300c77c6e9 87 #ifdef PACK_STRUCT_USE_INCLUDES
tax 0:66300c77c6e9 88 # include "arch/epstruct.h"
tax 0:66300c77c6e9 89 #endif
tax 0:66300c77c6e9 90
tax 0:66300c77c6e9 91 #define ICMPH_TYPE(hdr) ((hdr)->type)
tax 0:66300c77c6e9 92 #define ICMPH_CODE(hdr) ((hdr)->code)
tax 0:66300c77c6e9 93
tax 0:66300c77c6e9 94 /* Combines type and code to an u16_t */
tax 0:66300c77c6e9 95 #define ICMPH_TYPE_SET(hdr, t) ((hdr)->type = (t))
tax 0:66300c77c6e9 96 #define ICMPH_CODE_SET(hdr, c) ((hdr)->code = (c))
tax 0:66300c77c6e9 97
tax 0:66300c77c6e9 98
tax 0:66300c77c6e9 99 #if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */
tax 0:66300c77c6e9 100
tax 0:66300c77c6e9 101 void icmp_input(struct pbuf *p, struct netif *inp);
tax 0:66300c77c6e9 102 void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t);
tax 0:66300c77c6e9 103 void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t);
tax 0:66300c77c6e9 104
tax 0:66300c77c6e9 105 #endif /* LWIP_ICMP */
tax 0:66300c77c6e9 106
tax 0:66300c77c6e9 107 #ifdef __cplusplus
tax 0:66300c77c6e9 108 }
tax 0:66300c77c6e9 109 #endif
tax 0:66300c77c6e9 110
tax 0:66300c77c6e9 111 #endif /* __LWIP_ICMP_H__ */