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 * Redistribution and use in source and binary forms, with or without modification,
andrewbonney 0:ec559500a63f 3 * are permitted provided that the following conditions are met:
andrewbonney 0:ec559500a63f 4 *
andrewbonney 0:ec559500a63f 5 * 1. Redistributions of source code must retain the above copyright notice,
andrewbonney 0:ec559500a63f 6 * this list of conditions and the following disclaimer.
andrewbonney 0:ec559500a63f 7 * 2. Redistributions in binary form must reproduce the above copyright notice,
andrewbonney 0:ec559500a63f 8 * this list of conditions and the following disclaimer in the documentation
andrewbonney 0:ec559500a63f 9 * and/or other materials provided with the distribution.
andrewbonney 0:ec559500a63f 10 * 3. The name of the author may not be used to endorse or promote products
andrewbonney 0:ec559500a63f 11 * derived from this software without specific prior written permission.
andrewbonney 0:ec559500a63f 12 *
andrewbonney 0:ec559500a63f 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
andrewbonney 0:ec559500a63f 14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
andrewbonney 0:ec559500a63f 15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
andrewbonney 0:ec559500a63f 16 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
andrewbonney 0:ec559500a63f 17 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
andrewbonney 0:ec559500a63f 18 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
andrewbonney 0:ec559500a63f 19 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
andrewbonney 0:ec559500a63f 20 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
andrewbonney 0:ec559500a63f 21 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
andrewbonney 0:ec559500a63f 22 * OF SUCH DAMAGE.
andrewbonney 0:ec559500a63f 23 *
andrewbonney 0:ec559500a63f 24 * This file is part of the lwIP TCP/IP stack.
andrewbonney 0:ec559500a63f 25 *
andrewbonney 0:ec559500a63f 26 */
andrewbonney 0:ec559500a63f 27
andrewbonney 0:ec559500a63f 28 #ifndef __LWIP_NETIFAPI_H__
andrewbonney 0:ec559500a63f 29 #define __LWIP_NETIFAPI_H__
andrewbonney 0:ec559500a63f 30
andrewbonney 0:ec559500a63f 31 #include "lwip/opt.h"
andrewbonney 0:ec559500a63f 32
andrewbonney 0:ec559500a63f 33 #if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */
andrewbonney 0:ec559500a63f 34
andrewbonney 0:ec559500a63f 35 #include "lwip/sys.h"
andrewbonney 0:ec559500a63f 36 #include "lwip/netif.h"
andrewbonney 0:ec559500a63f 37 #include "lwip/dhcp.h"
andrewbonney 0:ec559500a63f 38 #include "lwip/autoip.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 typedef void (*netifapi_void_fn)(struct netif *netif);
andrewbonney 0:ec559500a63f 45 typedef err_t (*netifapi_errt_fn)(struct netif *netif);
andrewbonney 0:ec559500a63f 46
andrewbonney 0:ec559500a63f 47 struct netifapi_msg_msg {
andrewbonney 0:ec559500a63f 48 #if !LWIP_TCPIP_CORE_LOCKING
andrewbonney 0:ec559500a63f 49 sys_sem_t sem;
andrewbonney 0:ec559500a63f 50 #endif /* !LWIP_TCPIP_CORE_LOCKING */
andrewbonney 0:ec559500a63f 51 err_t err;
andrewbonney 0:ec559500a63f 52 struct netif *netif;
andrewbonney 0:ec559500a63f 53 union {
andrewbonney 0:ec559500a63f 54 struct {
andrewbonney 0:ec559500a63f 55 ip_addr_t *ipaddr;
andrewbonney 0:ec559500a63f 56 ip_addr_t *netmask;
andrewbonney 0:ec559500a63f 57 ip_addr_t *gw;
andrewbonney 0:ec559500a63f 58 void *state;
andrewbonney 0:ec559500a63f 59 netif_init_fn init;
andrewbonney 0:ec559500a63f 60 netif_input_fn input;
andrewbonney 0:ec559500a63f 61 } add;
andrewbonney 0:ec559500a63f 62 struct {
andrewbonney 0:ec559500a63f 63 netifapi_void_fn voidfunc;
andrewbonney 0:ec559500a63f 64 netifapi_errt_fn errtfunc;
andrewbonney 0:ec559500a63f 65 } common;
andrewbonney 0:ec559500a63f 66 } msg;
andrewbonney 0:ec559500a63f 67 };
andrewbonney 0:ec559500a63f 68
andrewbonney 0:ec559500a63f 69 struct netifapi_msg {
andrewbonney 0:ec559500a63f 70 void (* function)(struct netifapi_msg_msg *msg);
andrewbonney 0:ec559500a63f 71 struct netifapi_msg_msg msg;
andrewbonney 0:ec559500a63f 72 };
andrewbonney 0:ec559500a63f 73
andrewbonney 0:ec559500a63f 74
andrewbonney 0:ec559500a63f 75 /* API for application */
andrewbonney 0:ec559500a63f 76 err_t netifapi_netif_add ( struct netif *netif,
andrewbonney 0:ec559500a63f 77 ip_addr_t *ipaddr,
andrewbonney 0:ec559500a63f 78 ip_addr_t *netmask,
andrewbonney 0:ec559500a63f 79 ip_addr_t *gw,
andrewbonney 0:ec559500a63f 80 void *state,
andrewbonney 0:ec559500a63f 81 netif_init_fn init,
andrewbonney 0:ec559500a63f 82 netif_input_fn input);
andrewbonney 0:ec559500a63f 83
andrewbonney 0:ec559500a63f 84 err_t netifapi_netif_set_addr ( struct netif *netif,
andrewbonney 0:ec559500a63f 85 ip_addr_t *ipaddr,
andrewbonney 0:ec559500a63f 86 ip_addr_t *netmask,
andrewbonney 0:ec559500a63f 87 ip_addr_t *gw );
andrewbonney 0:ec559500a63f 88
andrewbonney 0:ec559500a63f 89 err_t netifapi_netif_common ( struct netif *netif,
andrewbonney 0:ec559500a63f 90 netifapi_void_fn voidfunc,
andrewbonney 0:ec559500a63f 91 netifapi_errt_fn errtfunc);
andrewbonney 0:ec559500a63f 92
andrewbonney 0:ec559500a63f 93 #define netifapi_netif_remove(n) netifapi_netif_common(n, netif_remove, NULL)
andrewbonney 0:ec559500a63f 94 #define netifapi_netif_set_up(n) netifapi_netif_common(n, netif_set_up, NULL)
andrewbonney 0:ec559500a63f 95 #define netifapi_netif_set_down(n) netifapi_netif_common(n, netif_set_down, NULL)
andrewbonney 0:ec559500a63f 96 #define netifapi_netif_set_default(n) netifapi_netif_common(n, netif_set_default, NULL)
andrewbonney 0:ec559500a63f 97 #define netifapi_dhcp_start(n) netifapi_netif_common(n, NULL, dhcp_start)
andrewbonney 0:ec559500a63f 98 #define netifapi_dhcp_stop(n) netifapi_netif_common(n, dhcp_stop, NULL)
andrewbonney 0:ec559500a63f 99 #define netifapi_autoip_start(n) netifapi_netif_common(n, NULL, autoip_start)
andrewbonney 0:ec559500a63f 100 #define netifapi_autoip_stop(n) netifapi_netif_common(n, NULL, autoip_stop)
andrewbonney 0:ec559500a63f 101
andrewbonney 0:ec559500a63f 102 #ifdef __cplusplus
andrewbonney 0:ec559500a63f 103 }
andrewbonney 0:ec559500a63f 104 #endif
andrewbonney 0:ec559500a63f 105
andrewbonney 0:ec559500a63f 106 #endif /* LWIP_NETIF_API */
andrewbonney 0:ec559500a63f 107
andrewbonney 0:ec559500a63f 108 #endif /* __LWIP_NETIFAPI_H__ */