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 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
RodColeman 0:8f5825f330b0 3 * All rights reserved.
RodColeman 0:8f5825f330b0 4 *
RodColeman 0:8f5825f330b0 5 * Redistribution and use in source and binary forms, with or without modification,
RodColeman 0:8f5825f330b0 6 * are permitted provided that the following conditions are met:
RodColeman 0:8f5825f330b0 7 *
RodColeman 0:8f5825f330b0 8 * 1. Redistributions of source code must retain the above copyright notice,
RodColeman 0:8f5825f330b0 9 * this list of conditions and the following disclaimer.
RodColeman 0:8f5825f330b0 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
RodColeman 0:8f5825f330b0 11 * this list of conditions and the following disclaimer in the documentation
RodColeman 0:8f5825f330b0 12 * and/or other materials provided with the distribution.
RodColeman 0:8f5825f330b0 13 * 3. The name of the author may not be used to endorse or promote products
RodColeman 0:8f5825f330b0 14 * derived from this software without specific prior written permission.
RodColeman 0:8f5825f330b0 15 *
RodColeman 0:8f5825f330b0 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
RodColeman 0:8f5825f330b0 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
RodColeman 0:8f5825f330b0 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
RodColeman 0:8f5825f330b0 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
RodColeman 0:8f5825f330b0 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
RodColeman 0:8f5825f330b0 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
RodColeman 0:8f5825f330b0 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
RodColeman 0:8f5825f330b0 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
RodColeman 0:8f5825f330b0 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
RodColeman 0:8f5825f330b0 25 * OF SUCH DAMAGE.
RodColeman 0:8f5825f330b0 26 *
RodColeman 0:8f5825f330b0 27 * This file is part of the lwIP TCP/IP stack.
RodColeman 0:8f5825f330b0 28 *
RodColeman 0:8f5825f330b0 29 * Author: Adam Dunkels <adam@sics.se>
RodColeman 0:8f5825f330b0 30 *
RodColeman 0:8f5825f330b0 31 */
RodColeman 0:8f5825f330b0 32 #ifndef __LWIP_NETBUF_H__
RodColeman 0:8f5825f330b0 33 #define __LWIP_NETBUF_H__
RodColeman 0:8f5825f330b0 34
RodColeman 0:8f5825f330b0 35 #include "lwip/opt.h"
RodColeman 0:8f5825f330b0 36 #include "lwip/pbuf.h"
RodColeman 0:8f5825f330b0 37 #include "lwip/ip_addr.h"
RodColeman 0:8f5825f330b0 38
RodColeman 0:8f5825f330b0 39 #ifdef __cplusplus
RodColeman 0:8f5825f330b0 40 extern "C" {
RodColeman 0:8f5825f330b0 41 #endif
RodColeman 0:8f5825f330b0 42
RodColeman 0:8f5825f330b0 43 /** This netbuf has dest-addr/port set */
RodColeman 0:8f5825f330b0 44 #define NETBUF_FLAG_DESTADDR 0x01
RodColeman 0:8f5825f330b0 45 /** This netbuf includes a checksum */
RodColeman 0:8f5825f330b0 46 #define NETBUF_FLAG_CHKSUM 0x02
RodColeman 0:8f5825f330b0 47
RodColeman 0:8f5825f330b0 48 struct netbuf {
RodColeman 0:8f5825f330b0 49 struct pbuf *p, *ptr;
RodColeman 0:8f5825f330b0 50 ip_addr_t addr;
RodColeman 0:8f5825f330b0 51 u16_t port;
RodColeman 0:8f5825f330b0 52 #if LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY
RodColeman 0:8f5825f330b0 53 #if LWIP_CHECKSUM_ON_COPY
RodColeman 0:8f5825f330b0 54 u8_t flags;
RodColeman 0:8f5825f330b0 55 #endif /* LWIP_CHECKSUM_ON_COPY */
RodColeman 0:8f5825f330b0 56 u16_t toport_chksum;
RodColeman 0:8f5825f330b0 57 #if LWIP_NETBUF_RECVINFO
RodColeman 0:8f5825f330b0 58 ip_addr_t toaddr;
RodColeman 0:8f5825f330b0 59 #endif /* LWIP_NETBUF_RECVINFO */
RodColeman 0:8f5825f330b0 60 #endif /* LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY */
RodColeman 0:8f5825f330b0 61 };
RodColeman 0:8f5825f330b0 62
RodColeman 0:8f5825f330b0 63 /* Network buffer functions: */
RodColeman 0:8f5825f330b0 64 struct netbuf * netbuf_new (void);
RodColeman 0:8f5825f330b0 65 void netbuf_delete (struct netbuf *buf);
RodColeman 0:8f5825f330b0 66 void * netbuf_alloc (struct netbuf *buf, u16_t size);
RodColeman 0:8f5825f330b0 67 void netbuf_free (struct netbuf *buf);
RodColeman 0:8f5825f330b0 68 err_t netbuf_ref (struct netbuf *buf,
RodColeman 0:8f5825f330b0 69 const void *dataptr, u16_t size);
RodColeman 0:8f5825f330b0 70 void netbuf_chain (struct netbuf *head,
RodColeman 0:8f5825f330b0 71 struct netbuf *tail);
RodColeman 0:8f5825f330b0 72
RodColeman 0:8f5825f330b0 73 err_t netbuf_data (struct netbuf *buf,
RodColeman 0:8f5825f330b0 74 void **dataptr, u16_t *len);
RodColeman 0:8f5825f330b0 75 s8_t netbuf_next (struct netbuf *buf);
RodColeman 0:8f5825f330b0 76 void netbuf_first (struct netbuf *buf);
RodColeman 0:8f5825f330b0 77
RodColeman 0:8f5825f330b0 78
RodColeman 0:8f5825f330b0 79 #define netbuf_copy_partial(buf, dataptr, len, offset) \
RodColeman 0:8f5825f330b0 80 pbuf_copy_partial((buf)->p, (dataptr), (len), (offset))
RodColeman 0:8f5825f330b0 81 #define netbuf_copy(buf,dataptr,len) netbuf_copy_partial(buf, dataptr, len, 0)
RodColeman 0:8f5825f330b0 82 #define netbuf_take(buf, dataptr, len) pbuf_take((buf)->p, dataptr, len)
RodColeman 0:8f5825f330b0 83 #define netbuf_len(buf) ((buf)->p->tot_len)
RodColeman 0:8f5825f330b0 84 #define netbuf_fromaddr(buf) (&((buf)->addr))
RodColeman 0:8f5825f330b0 85 #define netbuf_set_fromaddr(buf, fromaddr) ip_addr_set((&(buf)->addr), fromaddr)
RodColeman 0:8f5825f330b0 86 #define netbuf_fromport(buf) ((buf)->port)
RodColeman 0:8f5825f330b0 87 #if LWIP_NETBUF_RECVINFO
RodColeman 0:8f5825f330b0 88 #define netbuf_destaddr(buf) (&((buf)->toaddr))
RodColeman 0:8f5825f330b0 89 #define netbuf_set_destaddr(buf, destaddr) ip_addr_set((&(buf)->addr), destaddr)
RodColeman 0:8f5825f330b0 90 #define netbuf_destport(buf) (((buf)->flags & NETBUF_FLAG_DESTADDR) ? (buf)->toport_chksum : 0)
RodColeman 0:8f5825f330b0 91 #endif /* LWIP_NETBUF_RECVINFO */
RodColeman 0:8f5825f330b0 92 #if LWIP_CHECKSUM_ON_COPY
RodColeman 0:8f5825f330b0 93 #define netbuf_set_chksum(buf, chksum) do { (buf)->flags = NETBUF_FLAG_CHKSUM; \
RodColeman 0:8f5825f330b0 94 (buf)->toport_chksum = chksum; } while(0)
RodColeman 0:8f5825f330b0 95 #endif /* LWIP_CHECKSUM_ON_COPY */
RodColeman 0:8f5825f330b0 96
RodColeman 0:8f5825f330b0 97 #ifdef __cplusplus
RodColeman 0:8f5825f330b0 98 }
RodColeman 0:8f5825f330b0 99 #endif
RodColeman 0:8f5825f330b0 100
RodColeman 0:8f5825f330b0 101 #endif /* __LWIP_NETBUF_H__ */