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