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

Committer:
RodColeman
Date:
Thu Sep 08 10:48:09 2011 +0000
Revision:
0:850eacf3e945
revised fixed length to 178 bytes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RodColeman 0:850eacf3e945 1 /*
RodColeman 0:850eacf3e945 2 * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
RodColeman 0:850eacf3e945 3 * Copyright (c) 2003-2004 Leon Woestenberg <leon.woestenberg@axon.tv>
RodColeman 0:850eacf3e945 4 * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands.
RodColeman 0:850eacf3e945 5 * All rights reserved.
RodColeman 0:850eacf3e945 6 *
RodColeman 0:850eacf3e945 7 * Redistribution and use in source and binary forms, with or without modification,
RodColeman 0:850eacf3e945 8 * are permitted provided that the following conditions are met:
RodColeman 0:850eacf3e945 9 *
RodColeman 0:850eacf3e945 10 * 1. Redistributions of source code must retain the above copyright notice,
RodColeman 0:850eacf3e945 11 * this list of conditions and the following disclaimer.
RodColeman 0:850eacf3e945 12 * 2. Redistributions in binary form must reproduce the above copyright notice,
RodColeman 0:850eacf3e945 13 * this list of conditions and the following disclaimer in the documentation
RodColeman 0:850eacf3e945 14 * and/or other materials provided with the distribution.
RodColeman 0:850eacf3e945 15 * 3. The name of the author may not be used to endorse or promote products
RodColeman 0:850eacf3e945 16 * derived from this software without specific prior written permission.
RodColeman 0:850eacf3e945 17 *
RodColeman 0:850eacf3e945 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
RodColeman 0:850eacf3e945 19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
RodColeman 0:850eacf3e945 20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
RodColeman 0:850eacf3e945 21 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
RodColeman 0:850eacf3e945 22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
RodColeman 0:850eacf3e945 23 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
RodColeman 0:850eacf3e945 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
RodColeman 0:850eacf3e945 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
RodColeman 0:850eacf3e945 26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
RodColeman 0:850eacf3e945 27 * OF SUCH DAMAGE.
RodColeman 0:850eacf3e945 28 *
RodColeman 0:850eacf3e945 29 * This file is part of the lwIP TCP/IP stack.
RodColeman 0:850eacf3e945 30 *
RodColeman 0:850eacf3e945 31 * Author: Adam Dunkels <adam@sics.se>
RodColeman 0:850eacf3e945 32 *
RodColeman 0:850eacf3e945 33 */
RodColeman 0:850eacf3e945 34
RodColeman 0:850eacf3e945 35 #ifndef __NETIF_ETHARP_H__
RodColeman 0:850eacf3e945 36 #define __NETIF_ETHARP_H__
RodColeman 0:850eacf3e945 37
RodColeman 0:850eacf3e945 38 #include "lwip/opt.h"
RodColeman 0:850eacf3e945 39
RodColeman 0:850eacf3e945 40 #if LWIP_ARP || LWIP_ETHERNET /* don't build if not configured for use in lwipopts.h */
RodColeman 0:850eacf3e945 41
RodColeman 0:850eacf3e945 42 #include "lwip/pbuf.h"
RodColeman 0:850eacf3e945 43 #include "lwip/ip_addr.h"
RodColeman 0:850eacf3e945 44 #include "lwip/netif.h"
RodColeman 0:850eacf3e945 45 #include "lwip/ip.h"
RodColeman 0:850eacf3e945 46
RodColeman 0:850eacf3e945 47 #ifdef __cplusplus
RodColeman 0:850eacf3e945 48 extern "C" {
RodColeman 0:850eacf3e945 49 #endif
RodColeman 0:850eacf3e945 50
RodColeman 0:850eacf3e945 51 #ifndef ETHARP_HWADDR_LEN
RodColeman 0:850eacf3e945 52 #define ETHARP_HWADDR_LEN 6
RodColeman 0:850eacf3e945 53 #endif
RodColeman 0:850eacf3e945 54
RodColeman 0:850eacf3e945 55 #ifdef PACK_STRUCT_USE_INCLUDES
RodColeman 0:850eacf3e945 56 # include "arch/bpstruct.h"
RodColeman 0:850eacf3e945 57 #endif
RodColeman 0:850eacf3e945 58 PACK_STRUCT_BEGIN
RodColeman 0:850eacf3e945 59 struct eth_addr {
RodColeman 0:850eacf3e945 60 PACK_STRUCT_FIELD(u8_t addr[ETHARP_HWADDR_LEN]);
RodColeman 0:850eacf3e945 61 } PACK_STRUCT_STRUCT;
RodColeman 0:850eacf3e945 62 PACK_STRUCT_END
RodColeman 0:850eacf3e945 63 #ifdef PACK_STRUCT_USE_INCLUDES
RodColeman 0:850eacf3e945 64 # include "arch/epstruct.h"
RodColeman 0:850eacf3e945 65 #endif
RodColeman 0:850eacf3e945 66
RodColeman 0:850eacf3e945 67 #ifdef PACK_STRUCT_USE_INCLUDES
RodColeman 0:850eacf3e945 68 # include "arch/bpstruct.h"
RodColeman 0:850eacf3e945 69 #endif
RodColeman 0:850eacf3e945 70 PACK_STRUCT_BEGIN
RodColeman 0:850eacf3e945 71 /* Ethernet header */
RodColeman 0:850eacf3e945 72 struct eth_hdr {
RodColeman 0:850eacf3e945 73 #if ETH_PAD_SIZE
RodColeman 0:850eacf3e945 74 PACK_STRUCT_FIELD(u8_t padding[ETH_PAD_SIZE]);
RodColeman 0:850eacf3e945 75 #endif
RodColeman 0:850eacf3e945 76 PACK_STRUCT_FIELD(struct eth_addr dest);
RodColeman 0:850eacf3e945 77 PACK_STRUCT_FIELD(struct eth_addr src);
RodColeman 0:850eacf3e945 78 PACK_STRUCT_FIELD(u16_t type);
RodColeman 0:850eacf3e945 79 } PACK_STRUCT_STRUCT;
RodColeman 0:850eacf3e945 80 PACK_STRUCT_END
RodColeman 0:850eacf3e945 81 #ifdef PACK_STRUCT_USE_INCLUDES
RodColeman 0:850eacf3e945 82 # include "arch/epstruct.h"
RodColeman 0:850eacf3e945 83 #endif
RodColeman 0:850eacf3e945 84
RodColeman 0:850eacf3e945 85 #define SIZEOF_ETH_HDR (14 + ETH_PAD_SIZE)
RodColeman 0:850eacf3e945 86
RodColeman 0:850eacf3e945 87 #if ETHARP_SUPPORT_VLAN
RodColeman 0:850eacf3e945 88
RodColeman 0:850eacf3e945 89 #ifdef PACK_STRUCT_USE_INCLUDES
RodColeman 0:850eacf3e945 90 # include "arch/bpstruct.h"
RodColeman 0:850eacf3e945 91 #endif
RodColeman 0:850eacf3e945 92 PACK_STRUCT_BEGIN
RodColeman 0:850eacf3e945 93 /* VLAN header inserted between ethernet header and payload
RodColeman 0:850eacf3e945 94 * if 'type' in ethernet header is ETHTYPE_VLAN.
RodColeman 0:850eacf3e945 95 * See IEEE802.Q */
RodColeman 0:850eacf3e945 96 struct eth_vlan_hdr {
RodColeman 0:850eacf3e945 97 PACK_STRUCT_FIELD(u16_t tpid);
RodColeman 0:850eacf3e945 98 PACK_STRUCT_FIELD(u16_t prio_vid);
RodColeman 0:850eacf3e945 99 } PACK_STRUCT_STRUCT;
RodColeman 0:850eacf3e945 100 PACK_STRUCT_END
RodColeman 0:850eacf3e945 101 #ifdef PACK_STRUCT_USE_INCLUDES
RodColeman 0:850eacf3e945 102 # include "arch/epstruct.h"
RodColeman 0:850eacf3e945 103 #endif
RodColeman 0:850eacf3e945 104
RodColeman 0:850eacf3e945 105 #define SIZEOF_VLAN_HDR 4
RodColeman 0:850eacf3e945 106 #define VLAN_ID(vlan_hdr) (htons((vlan_hdr)->prio_vid) & 0xFFF)
RodColeman 0:850eacf3e945 107
RodColeman 0:850eacf3e945 108 #endif /* ETHARP_SUPPORT_VLAN */
RodColeman 0:850eacf3e945 109
RodColeman 0:850eacf3e945 110 #ifdef PACK_STRUCT_USE_INCLUDES
RodColeman 0:850eacf3e945 111 # include "arch/bpstruct.h"
RodColeman 0:850eacf3e945 112 #endif
RodColeman 0:850eacf3e945 113 PACK_STRUCT_BEGIN
RodColeman 0:850eacf3e945 114 /* the ARP message, see RFC 826 ("Packet format") */
RodColeman 0:850eacf3e945 115 struct etharp_hdr {
RodColeman 0:850eacf3e945 116 PACK_STRUCT_FIELD(u16_t hwtype);
RodColeman 0:850eacf3e945 117 PACK_STRUCT_FIELD(u16_t proto);
RodColeman 0:850eacf3e945 118 PACK_STRUCT_FIELD(u8_t hwlen);
RodColeman 0:850eacf3e945 119 PACK_STRUCT_FIELD(u8_t protolen);
RodColeman 0:850eacf3e945 120 PACK_STRUCT_FIELD(u16_t opcode);
RodColeman 0:850eacf3e945 121 PACK_STRUCT_FIELD(struct eth_addr shwaddr);
RodColeman 0:850eacf3e945 122 PACK_STRUCT_FIELD(struct ip_addr2 sipaddr);
RodColeman 0:850eacf3e945 123 PACK_STRUCT_FIELD(struct eth_addr dhwaddr);
RodColeman 0:850eacf3e945 124 PACK_STRUCT_FIELD(struct ip_addr2 dipaddr);
RodColeman 0:850eacf3e945 125 } PACK_STRUCT_STRUCT;
RodColeman 0:850eacf3e945 126 PACK_STRUCT_END
RodColeman 0:850eacf3e945 127 #ifdef PACK_STRUCT_USE_INCLUDES
RodColeman 0:850eacf3e945 128 # include "arch/epstruct.h"
RodColeman 0:850eacf3e945 129 #endif
RodColeman 0:850eacf3e945 130
RodColeman 0:850eacf3e945 131 #define SIZEOF_ETHARP_HDR 28
RodColeman 0:850eacf3e945 132 #define SIZEOF_ETHARP_PACKET (SIZEOF_ETH_HDR + SIZEOF_ETHARP_HDR)
RodColeman 0:850eacf3e945 133
RodColeman 0:850eacf3e945 134 /* 5 seconds period */
RodColeman 0:850eacf3e945 135 #define ARP_TMR_INTERVAL 5000
RodColeman 0:850eacf3e945 136
RodColeman 0:850eacf3e945 137 #define ETHTYPE_ARP 0x0806
RodColeman 0:850eacf3e945 138 #define ETHTYPE_IP 0x0800
RodColeman 0:850eacf3e945 139 #define ETHTYPE_VLAN 0x8100
RodColeman 0:850eacf3e945 140 #define ETHTYPE_PPPOEDISC 0x8863 /* PPP Over Ethernet Discovery Stage */
RodColeman 0:850eacf3e945 141 #define ETHTYPE_PPPOE 0x8864 /* PPP Over Ethernet Session Stage */
RodColeman 0:850eacf3e945 142
RodColeman 0:850eacf3e945 143 /* MEMCPY-like macro to copy to/from struct eth_addr's that are local variables
RodColeman 0:850eacf3e945 144 * or known to be 32-bit aligned within the protocol header. */
RodColeman 0:850eacf3e945 145 #ifndef ETHADDR32_COPY
RodColeman 0:850eacf3e945 146 #define ETHADDR32_COPY(src, dst) SMEMCPY(src, dst, ETHARP_HWADDR_LEN)
RodColeman 0:850eacf3e945 147 #endif
RodColeman 0:850eacf3e945 148
RodColeman 0:850eacf3e945 149 /* MEMCPY-like macro to copy to/from struct eth_addr's that are no local
RodColeman 0:850eacf3e945 150 * variables and known to be 16-bit aligned within the protocol header. */
RodColeman 0:850eacf3e945 151 #ifndef ETHADDR16_COPY
RodColeman 0:850eacf3e945 152 #define ETHADDR16_COPY(src, dst) SMEMCPY(src, dst, ETHARP_HWADDR_LEN)
RodColeman 0:850eacf3e945 153 #endif
RodColeman 0:850eacf3e945 154
RodColeman 0:850eacf3e945 155 #if LWIP_ARP /* don't build if not configured for use in lwipopts.h */
RodColeman 0:850eacf3e945 156
RodColeman 0:850eacf3e945 157 /* ARP message types (opcodes) */
RodColeman 0:850eacf3e945 158 #define ARP_REQUEST 1
RodColeman 0:850eacf3e945 159 #define ARP_REPLY 2
RodColeman 0:850eacf3e945 160
RodColeman 0:850eacf3e945 161 /* Define this to 1 and define LWIP_ARP_FILTER_NETIF_FN(pbuf, netif, type)
RodColeman 0:850eacf3e945 162 * to a filter function that returns the correct netif when using multiple
RodColeman 0:850eacf3e945 163 * netifs on one hardware interface where the netif's low-level receive
RodColeman 0:850eacf3e945 164 * routine cannot decide for the correct netif (e.g. when mapping multiple
RodColeman 0:850eacf3e945 165 * IP addresses to one hardware interface).
RodColeman 0:850eacf3e945 166 */
RodColeman 0:850eacf3e945 167 #ifndef LWIP_ARP_FILTER_NETIF
RodColeman 0:850eacf3e945 168 #define LWIP_ARP_FILTER_NETIF 0
RodColeman 0:850eacf3e945 169 #endif
RodColeman 0:850eacf3e945 170
RodColeman 0:850eacf3e945 171 #if ARP_QUEUEING
RodColeman 0:850eacf3e945 172 /* struct for queueing outgoing packets for unknown address
RodColeman 0:850eacf3e945 173 * defined here to be accessed by memp.h
RodColeman 0:850eacf3e945 174 */
RodColeman 0:850eacf3e945 175 struct etharp_q_entry {
RodColeman 0:850eacf3e945 176 struct etharp_q_entry *next;
RodColeman 0:850eacf3e945 177 struct pbuf *p;
RodColeman 0:850eacf3e945 178 };
RodColeman 0:850eacf3e945 179 #endif /* ARP_QUEUEING */
RodColeman 0:850eacf3e945 180
RodColeman 0:850eacf3e945 181 #define etharp_init() /* Compatibility define, not init needed. */
RodColeman 0:850eacf3e945 182 void etharp_tmr(void);
RodColeman 0:850eacf3e945 183 s8_t etharp_find_addr(struct netif *netif, ip_addr_t *ipaddr,
RodColeman 0:850eacf3e945 184 struct eth_addr **eth_ret, ip_addr_t **ip_ret);
RodColeman 0:850eacf3e945 185 err_t etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr);
RodColeman 0:850eacf3e945 186 err_t etharp_query(struct netif *netif, ip_addr_t *ipaddr, struct pbuf *q);
RodColeman 0:850eacf3e945 187 err_t etharp_request(struct netif *netif, ip_addr_t *ipaddr);
RodColeman 0:850eacf3e945 188 /* For Ethernet network interfaces, we might want to send "gratuitous ARP";
RodColeman 0:850eacf3e945 189 * this is an ARP packet sent by a node in order to spontaneously cause other
RodColeman 0:850eacf3e945 190 * nodes to update an entry in their ARP cache.
RodColeman 0:850eacf3e945 191 * From RFC 3220 "IP Mobility Support for IPv4" section 4.6. */
RodColeman 0:850eacf3e945 192 #define etharp_gratuitous(netif) etharp_request((netif), &(netif)->ip_addr)
RodColeman 0:850eacf3e945 193
RodColeman 0:850eacf3e945 194 #if ETHARP_SUPPORT_STATIC_ENTRIES
RodColeman 0:850eacf3e945 195 err_t etharp_add_static_entry(ip_addr_t *ipaddr, struct eth_addr *ethaddr);
RodColeman 0:850eacf3e945 196 err_t etharp_remove_static_entry(ip_addr_t *ipaddr);
RodColeman 0:850eacf3e945 197 #endif /* ETHARP_SUPPORT_STATIC_ENTRIES */
RodColeman 0:850eacf3e945 198
RodColeman 0:850eacf3e945 199 #if LWIP_AUTOIP
RodColeman 0:850eacf3e945 200 err_t etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
RodColeman 0:850eacf3e945 201 const struct eth_addr *ethdst_addr,
RodColeman 0:850eacf3e945 202 const struct eth_addr *hwsrc_addr, const ip_addr_t *ipsrc_addr,
RodColeman 0:850eacf3e945 203 const struct eth_addr *hwdst_addr, const ip_addr_t *ipdst_addr,
RodColeman 0:850eacf3e945 204 const u16_t opcode);
RodColeman 0:850eacf3e945 205 #endif /* LWIP_AUTOIP */
RodColeman 0:850eacf3e945 206
RodColeman 0:850eacf3e945 207 #endif /* LWIP_ARP */
RodColeman 0:850eacf3e945 208
RodColeman 0:850eacf3e945 209 err_t ethernet_input(struct pbuf *p, struct netif *netif);
RodColeman 0:850eacf3e945 210
RodColeman 0:850eacf3e945 211 #define eth_addr_cmp(addr1, addr2) (memcmp((addr1)->addr, (addr2)->addr, ETHARP_HWADDR_LEN) == 0)
RodColeman 0:850eacf3e945 212
RodColeman 0:850eacf3e945 213 extern const struct eth_addr ethbroadcast, ethzero;
RodColeman 0:850eacf3e945 214
RodColeman 0:850eacf3e945 215 #ifdef __cplusplus
RodColeman 0:850eacf3e945 216 }
RodColeman 0:850eacf3e945 217 #endif
RodColeman 0:850eacf3e945 218
RodColeman 0:850eacf3e945 219 #endif /* LWIP_ARP || LWIP_ETHERNET */
RodColeman 0:850eacf3e945 220
RodColeman 0:850eacf3e945 221 #endif /* __NETIF_ARP_H__ */