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.
lwip/include/ipv4/lwip/inet_chksum.h@0:ec559500a63f, 2011-04-08 (annotated)
- Committer:
- andrewbonney
- Date:
- Fri Apr 08 14:39:41 2011 +0000
- Revision:
- 0:ec559500a63f
Who changed what in which revision?
User | Revision | Line number | New 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_INET_CHKSUM_H__ |
andrewbonney | 0:ec559500a63f | 33 | #define __LWIP_INET_CHKSUM_H__ |
andrewbonney | 0:ec559500a63f | 34 | |
andrewbonney | 0:ec559500a63f | 35 | #include "lwip/opt.h" |
andrewbonney | 0:ec559500a63f | 36 | |
andrewbonney | 0:ec559500a63f | 37 | #include "lwip/pbuf.h" |
andrewbonney | 0:ec559500a63f | 38 | #include "lwip/ip_addr.h" |
andrewbonney | 0:ec559500a63f | 39 | |
andrewbonney | 0:ec559500a63f | 40 | /** Swap the bytes in an u16_t: much like htons() for little-endian */ |
andrewbonney | 0:ec559500a63f | 41 | #ifndef SWAP_BYTES_IN_WORD |
andrewbonney | 0:ec559500a63f | 42 | #if LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN) |
andrewbonney | 0:ec559500a63f | 43 | /* little endian and PLATFORM_BYTESWAP defined */ |
andrewbonney | 0:ec559500a63f | 44 | #define SWAP_BYTES_IN_WORD(w) LWIP_PLATFORM_HTONS(w) |
andrewbonney | 0:ec559500a63f | 45 | #else /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN) */ |
andrewbonney | 0:ec559500a63f | 46 | /* can't use htons on big endian (or PLATFORM_BYTESWAP not defined)... */ |
andrewbonney | 0:ec559500a63f | 47 | #define SWAP_BYTES_IN_WORD(w) (((w) & 0xff) << 8) | (((w) & 0xff00) >> 8) |
andrewbonney | 0:ec559500a63f | 48 | #endif /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN)*/ |
andrewbonney | 0:ec559500a63f | 49 | #endif /* SWAP_BYTES_IN_WORD */ |
andrewbonney | 0:ec559500a63f | 50 | |
andrewbonney | 0:ec559500a63f | 51 | /** Split an u32_t in two u16_ts and add them up */ |
andrewbonney | 0:ec559500a63f | 52 | #ifndef FOLD_U32T |
andrewbonney | 0:ec559500a63f | 53 | #define FOLD_U32T(u) (((u) >> 16) + ((u) & 0x0000ffffUL)) |
andrewbonney | 0:ec559500a63f | 54 | #endif |
andrewbonney | 0:ec559500a63f | 55 | |
andrewbonney | 0:ec559500a63f | 56 | #if LWIP_CHECKSUM_ON_COPY |
andrewbonney | 0:ec559500a63f | 57 | /** Function-like macro: same as MEMCPY but returns the checksum of copied data |
andrewbonney | 0:ec559500a63f | 58 | as u16_t */ |
andrewbonney | 0:ec559500a63f | 59 | #ifndef LWIP_CHKSUM_COPY |
andrewbonney | 0:ec559500a63f | 60 | #define LWIP_CHKSUM_COPY(dst, src, len) lwip_chksum_copy(dst, src, len) |
andrewbonney | 0:ec559500a63f | 61 | #ifndef LWIP_CHKSUM_COPY_ALGORITHM |
andrewbonney | 0:ec559500a63f | 62 | #define LWIP_CHKSUM_COPY_ALGORITHM 1 |
andrewbonney | 0:ec559500a63f | 63 | #endif /* LWIP_CHKSUM_COPY_ALGORITHM */ |
andrewbonney | 0:ec559500a63f | 64 | #endif /* LWIP_CHKSUM_COPY */ |
andrewbonney | 0:ec559500a63f | 65 | #else /* LWIP_CHECKSUM_ON_COPY */ |
andrewbonney | 0:ec559500a63f | 66 | #define LWIP_CHKSUM_COPY_ALGORITHM 0 |
andrewbonney | 0:ec559500a63f | 67 | #endif /* LWIP_CHECKSUM_ON_COPY */ |
andrewbonney | 0:ec559500a63f | 68 | |
andrewbonney | 0:ec559500a63f | 69 | #ifdef __cplusplus |
andrewbonney | 0:ec559500a63f | 70 | extern "C" { |
andrewbonney | 0:ec559500a63f | 71 | #endif |
andrewbonney | 0:ec559500a63f | 72 | |
andrewbonney | 0:ec559500a63f | 73 | u16_t inet_chksum(void *dataptr, u16_t len); |
andrewbonney | 0:ec559500a63f | 74 | u16_t inet_chksum_pbuf(struct pbuf *p); |
andrewbonney | 0:ec559500a63f | 75 | u16_t inet_chksum_pseudo(struct pbuf *p, |
andrewbonney | 0:ec559500a63f | 76 | ip_addr_t *src, ip_addr_t *dest, |
andrewbonney | 0:ec559500a63f | 77 | u8_t proto, u16_t proto_len); |
andrewbonney | 0:ec559500a63f | 78 | u16_t inet_chksum_pseudo_partial(struct pbuf *p, |
andrewbonney | 0:ec559500a63f | 79 | ip_addr_t *src, ip_addr_t *dest, |
andrewbonney | 0:ec559500a63f | 80 | u8_t proto, u16_t proto_len, u16_t chksum_len); |
andrewbonney | 0:ec559500a63f | 81 | #if LWIP_CHKSUM_COPY_ALGORITHM |
andrewbonney | 0:ec559500a63f | 82 | u16_t lwip_chksum_copy(void *dst, const void *src, u16_t len); |
andrewbonney | 0:ec559500a63f | 83 | #endif /* LWIP_CHKSUM_COPY_ALGORITHM */ |
andrewbonney | 0:ec559500a63f | 84 | |
andrewbonney | 0:ec559500a63f | 85 | #ifdef __cplusplus |
andrewbonney | 0:ec559500a63f | 86 | } |
andrewbonney | 0:ec559500a63f | 87 | #endif |
andrewbonney | 0:ec559500a63f | 88 | |
andrewbonney | 0:ec559500a63f | 89 | #endif /* __LWIP_INET_H__ */ |
andrewbonney | 0:ec559500a63f | 90 |