Netservices modded to read fragmented HTTP respsonse/payload from special purpose server - 180 bytes only

Committer:
RodColeman
Date:
Thu Sep 08 10:41:36 2011 +0000
Revision:
0:8f5825f330b0
setDataLen hacked to 180bytes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RodColeman 0:8f5825f330b0 1 /**
RodColeman 0:8f5825f330b0 2 * @file
RodColeman 0:8f5825f330b0 3 * Common functions used throughout the stack.
RodColeman 0:8f5825f330b0 4 *
RodColeman 0:8f5825f330b0 5 */
RodColeman 0:8f5825f330b0 6
RodColeman 0:8f5825f330b0 7 /*
RodColeman 0:8f5825f330b0 8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
RodColeman 0:8f5825f330b0 9 * All rights reserved.
RodColeman 0:8f5825f330b0 10 *
RodColeman 0:8f5825f330b0 11 * Redistribution and use in source and binary forms, with or without modification,
RodColeman 0:8f5825f330b0 12 * are permitted provided that the following conditions are met:
RodColeman 0:8f5825f330b0 13 *
RodColeman 0:8f5825f330b0 14 * 1. Redistributions of source code must retain the above copyright notice,
RodColeman 0:8f5825f330b0 15 * this list of conditions and the following disclaimer.
RodColeman 0:8f5825f330b0 16 * 2. Redistributions in binary form must reproduce the above copyright notice,
RodColeman 0:8f5825f330b0 17 * this list of conditions and the following disclaimer in the documentation
RodColeman 0:8f5825f330b0 18 * and/or other materials provided with the distribution.
RodColeman 0:8f5825f330b0 19 * 3. The name of the author may not be used to endorse or promote products
RodColeman 0:8f5825f330b0 20 * derived from this software without specific prior written permission.
RodColeman 0:8f5825f330b0 21 *
RodColeman 0:8f5825f330b0 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
RodColeman 0:8f5825f330b0 23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
RodColeman 0:8f5825f330b0 24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
RodColeman 0:8f5825f330b0 25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
RodColeman 0:8f5825f330b0 26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
RodColeman 0:8f5825f330b0 27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
RodColeman 0:8f5825f330b0 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
RodColeman 0:8f5825f330b0 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
RodColeman 0:8f5825f330b0 30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
RodColeman 0:8f5825f330b0 31 * OF SUCH DAMAGE.
RodColeman 0:8f5825f330b0 32 *
RodColeman 0:8f5825f330b0 33 * This file is part of the lwIP TCP/IP stack.
RodColeman 0:8f5825f330b0 34 *
RodColeman 0:8f5825f330b0 35 * Author: Simon Goldschmidt
RodColeman 0:8f5825f330b0 36 *
RodColeman 0:8f5825f330b0 37 */
RodColeman 0:8f5825f330b0 38
RodColeman 0:8f5825f330b0 39 #include "lwip/opt.h"
RodColeman 0:8f5825f330b0 40 #include "lwip/def.h"
RodColeman 0:8f5825f330b0 41
RodColeman 0:8f5825f330b0 42 /**
RodColeman 0:8f5825f330b0 43 * These are reference implementations of the byte swapping functions.
RodColeman 0:8f5825f330b0 44 * Again with the aim of being simple, correct and fully portable.
RodColeman 0:8f5825f330b0 45 * Byte swapping is the second thing you would want to optimize. You will
RodColeman 0:8f5825f330b0 46 * need to port it to your architecture and in your cc.h:
RodColeman 0:8f5825f330b0 47 *
RodColeman 0:8f5825f330b0 48 * #define LWIP_PLATFORM_BYTESWAP 1
RodColeman 0:8f5825f330b0 49 * #define LWIP_PLATFORM_HTONS(x) <your_htons>
RodColeman 0:8f5825f330b0 50 * #define LWIP_PLATFORM_HTONL(x) <your_htonl>
RodColeman 0:8f5825f330b0 51 *
RodColeman 0:8f5825f330b0 52 * Note ntohs() and ntohl() are merely references to the htonx counterparts.
RodColeman 0:8f5825f330b0 53 */
RodColeman 0:8f5825f330b0 54
RodColeman 0:8f5825f330b0 55 #if (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN)
RodColeman 0:8f5825f330b0 56
RodColeman 0:8f5825f330b0 57 /**
RodColeman 0:8f5825f330b0 58 * Convert an u16_t from host- to network byte order.
RodColeman 0:8f5825f330b0 59 *
RodColeman 0:8f5825f330b0 60 * @param n u16_t in host byte order
RodColeman 0:8f5825f330b0 61 * @return n in network byte order
RodColeman 0:8f5825f330b0 62 */
RodColeman 0:8f5825f330b0 63 u16_t
RodColeman 0:8f5825f330b0 64 lwip_htons(u16_t n)
RodColeman 0:8f5825f330b0 65 {
RodColeman 0:8f5825f330b0 66 return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
RodColeman 0:8f5825f330b0 67 }
RodColeman 0:8f5825f330b0 68
RodColeman 0:8f5825f330b0 69 /**
RodColeman 0:8f5825f330b0 70 * Convert an u16_t from network- to host byte order.
RodColeman 0:8f5825f330b0 71 *
RodColeman 0:8f5825f330b0 72 * @param n u16_t in network byte order
RodColeman 0:8f5825f330b0 73 * @return n in host byte order
RodColeman 0:8f5825f330b0 74 */
RodColeman 0:8f5825f330b0 75 u16_t
RodColeman 0:8f5825f330b0 76 lwip_ntohs(u16_t n)
RodColeman 0:8f5825f330b0 77 {
RodColeman 0:8f5825f330b0 78 return lwip_htons(n);
RodColeman 0:8f5825f330b0 79 }
RodColeman 0:8f5825f330b0 80
RodColeman 0:8f5825f330b0 81 /**
RodColeman 0:8f5825f330b0 82 * Convert an u32_t from host- to network byte order.
RodColeman 0:8f5825f330b0 83 *
RodColeman 0:8f5825f330b0 84 * @param n u32_t in host byte order
RodColeman 0:8f5825f330b0 85 * @return n in network byte order
RodColeman 0:8f5825f330b0 86 */
RodColeman 0:8f5825f330b0 87 u32_t
RodColeman 0:8f5825f330b0 88 lwip_htonl(u32_t n)
RodColeman 0:8f5825f330b0 89 {
RodColeman 0:8f5825f330b0 90 return ((n & 0xff) << 24) |
RodColeman 0:8f5825f330b0 91 ((n & 0xff00) << 8) |
RodColeman 0:8f5825f330b0 92 ((n & 0xff0000UL) >> 8) |
RodColeman 0:8f5825f330b0 93 ((n & 0xff000000UL) >> 24);
RodColeman 0:8f5825f330b0 94 }
RodColeman 0:8f5825f330b0 95
RodColeman 0:8f5825f330b0 96 /**
RodColeman 0:8f5825f330b0 97 * Convert an u32_t from network- to host byte order.
RodColeman 0:8f5825f330b0 98 *
RodColeman 0:8f5825f330b0 99 * @param n u32_t in network byte order
RodColeman 0:8f5825f330b0 100 * @return n in host byte order
RodColeman 0:8f5825f330b0 101 */
RodColeman 0:8f5825f330b0 102 u32_t
RodColeman 0:8f5825f330b0 103 lwip_ntohl(u32_t n)
RodColeman 0:8f5825f330b0 104 {
RodColeman 0:8f5825f330b0 105 return lwip_htonl(n);
RodColeman 0:8f5825f330b0 106 }
RodColeman 0:8f5825f330b0 107
RodColeman 0:8f5825f330b0 108 #endif /* (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN) */