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 * @file
RodColeman 0:850eacf3e945 3 *
RodColeman 0:850eacf3e945 4 * AutoIP Automatic LinkLocal IP Configuration
RodColeman 0:850eacf3e945 5 */
RodColeman 0:850eacf3e945 6
RodColeman 0:850eacf3e945 7 /*
RodColeman 0:850eacf3e945 8 *
RodColeman 0:850eacf3e945 9 * Copyright (c) 2007 Dominik Spies <kontakt@dspies.de>
RodColeman 0:850eacf3e945 10 * All rights reserved.
RodColeman 0:850eacf3e945 11 *
RodColeman 0:850eacf3e945 12 * Redistribution and use in source and binary forms, with or without modification,
RodColeman 0:850eacf3e945 13 * are permitted provided that the following conditions are met:
RodColeman 0:850eacf3e945 14 *
RodColeman 0:850eacf3e945 15 * 1. Redistributions of source code must retain the above copyright notice,
RodColeman 0:850eacf3e945 16 * this list of conditions and the following disclaimer.
RodColeman 0:850eacf3e945 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
RodColeman 0:850eacf3e945 18 * this list of conditions and the following disclaimer in the documentation
RodColeman 0:850eacf3e945 19 * and/or other materials provided with the distribution.
RodColeman 0:850eacf3e945 20 * 3. The name of the author may not be used to endorse or promote products
RodColeman 0:850eacf3e945 21 * derived from this software without specific prior written permission.
RodColeman 0:850eacf3e945 22 *
RodColeman 0:850eacf3e945 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
RodColeman 0:850eacf3e945 24 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
RodColeman 0:850eacf3e945 25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
RodColeman 0:850eacf3e945 26 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
RodColeman 0:850eacf3e945 27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
RodColeman 0:850eacf3e945 28 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
RodColeman 0:850eacf3e945 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
RodColeman 0:850eacf3e945 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
RodColeman 0:850eacf3e945 31 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
RodColeman 0:850eacf3e945 32 * OF SUCH DAMAGE.
RodColeman 0:850eacf3e945 33 *
RodColeman 0:850eacf3e945 34 * Author: Dominik Spies <kontakt@dspies.de>
RodColeman 0:850eacf3e945 35 *
RodColeman 0:850eacf3e945 36 * This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform
RodColeman 0:850eacf3e945 37 * with RFC 3927.
RodColeman 0:850eacf3e945 38 *
RodColeman 0:850eacf3e945 39 *
RodColeman 0:850eacf3e945 40 * Please coordinate changes and requests with Dominik Spies
RodColeman 0:850eacf3e945 41 * <kontakt@dspies.de>
RodColeman 0:850eacf3e945 42 */
RodColeman 0:850eacf3e945 43
RodColeman 0:850eacf3e945 44 #ifndef __LWIP_AUTOIP_H__
RodColeman 0:850eacf3e945 45 #define __LWIP_AUTOIP_H__
RodColeman 0:850eacf3e945 46
RodColeman 0:850eacf3e945 47 #include "lwip/opt.h"
RodColeman 0:850eacf3e945 48
RodColeman 0:850eacf3e945 49 #if LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */
RodColeman 0:850eacf3e945 50
RodColeman 0:850eacf3e945 51 #include "lwip/netif.h"
RodColeman 0:850eacf3e945 52 #include "lwip/udp.h"
RodColeman 0:850eacf3e945 53 #include "netif/etharp.h"
RodColeman 0:850eacf3e945 54
RodColeman 0:850eacf3e945 55 #ifdef __cplusplus
RodColeman 0:850eacf3e945 56 extern "C" {
RodColeman 0:850eacf3e945 57 #endif
RodColeman 0:850eacf3e945 58
RodColeman 0:850eacf3e945 59 /* AutoIP Timing */
RodColeman 0:850eacf3e945 60 #define AUTOIP_TMR_INTERVAL 100
RodColeman 0:850eacf3e945 61 #define AUTOIP_TICKS_PER_SECOND (1000 / AUTOIP_TMR_INTERVAL)
RodColeman 0:850eacf3e945 62
RodColeman 0:850eacf3e945 63 /* RFC 3927 Constants */
RodColeman 0:850eacf3e945 64 #define PROBE_WAIT 1 /* second (initial random delay) */
RodColeman 0:850eacf3e945 65 #define PROBE_MIN 1 /* second (minimum delay till repeated probe) */
RodColeman 0:850eacf3e945 66 #define PROBE_MAX 2 /* seconds (maximum delay till repeated probe) */
RodColeman 0:850eacf3e945 67 #define PROBE_NUM 3 /* (number of probe packets) */
RodColeman 0:850eacf3e945 68 #define ANNOUNCE_NUM 2 /* (number of announcement packets) */
RodColeman 0:850eacf3e945 69 #define ANNOUNCE_INTERVAL 2 /* seconds (time between announcement packets) */
RodColeman 0:850eacf3e945 70 #define ANNOUNCE_WAIT 2 /* seconds (delay before announcing) */
RodColeman 0:850eacf3e945 71 #define MAX_CONFLICTS 10 /* (max conflicts before rate limiting) */
RodColeman 0:850eacf3e945 72 #define RATE_LIMIT_INTERVAL 60 /* seconds (delay between successive attempts) */
RodColeman 0:850eacf3e945 73 #define DEFEND_INTERVAL 10 /* seconds (min. wait between defensive ARPs) */
RodColeman 0:850eacf3e945 74
RodColeman 0:850eacf3e945 75 /* AutoIP client states */
RodColeman 0:850eacf3e945 76 #define AUTOIP_STATE_OFF 0
RodColeman 0:850eacf3e945 77 #define AUTOIP_STATE_PROBING 1
RodColeman 0:850eacf3e945 78 #define AUTOIP_STATE_ANNOUNCING 2
RodColeman 0:850eacf3e945 79 #define AUTOIP_STATE_BOUND 3
RodColeman 0:850eacf3e945 80
RodColeman 0:850eacf3e945 81 struct autoip
RodColeman 0:850eacf3e945 82 {
RodColeman 0:850eacf3e945 83 ip_addr_t llipaddr; /* the currently selected, probed, announced or used LL IP-Address */
RodColeman 0:850eacf3e945 84 u8_t state; /* current AutoIP state machine state */
RodColeman 0:850eacf3e945 85 u8_t sent_num; /* sent number of probes or announces, dependent on state */
RodColeman 0:850eacf3e945 86 u16_t ttw; /* ticks to wait, tick is AUTOIP_TMR_INTERVAL long */
RodColeman 0:850eacf3e945 87 u8_t lastconflict; /* ticks until a conflict can be solved by defending */
RodColeman 0:850eacf3e945 88 u8_t tried_llipaddr; /* total number of probed/used Link Local IP-Addresses */
RodColeman 0:850eacf3e945 89 };
RodColeman 0:850eacf3e945 90
RodColeman 0:850eacf3e945 91
RodColeman 0:850eacf3e945 92 /** Init srand, has to be called before entering mainloop */
RodColeman 0:850eacf3e945 93 void autoip_init(void);
RodColeman 0:850eacf3e945 94
RodColeman 0:850eacf3e945 95 /** Set a struct autoip allocated by the application to work with */
RodColeman 0:850eacf3e945 96 void autoip_set_struct(struct netif *netif, struct autoip *autoip);
RodColeman 0:850eacf3e945 97
RodColeman 0:850eacf3e945 98 /** Start AutoIP client */
RodColeman 0:850eacf3e945 99 err_t autoip_start(struct netif *netif);
RodColeman 0:850eacf3e945 100
RodColeman 0:850eacf3e945 101 /** Stop AutoIP client */
RodColeman 0:850eacf3e945 102 err_t autoip_stop(struct netif *netif);
RodColeman 0:850eacf3e945 103
RodColeman 0:850eacf3e945 104 /** Handles every incoming ARP Packet, called by etharp_arp_input */
RodColeman 0:850eacf3e945 105 void autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr);
RodColeman 0:850eacf3e945 106
RodColeman 0:850eacf3e945 107 /** Has to be called in loop every AUTOIP_TMR_INTERVAL milliseconds */
RodColeman 0:850eacf3e945 108 void autoip_tmr(void);
RodColeman 0:850eacf3e945 109
RodColeman 0:850eacf3e945 110 /** Handle a possible change in the network configuration */
RodColeman 0:850eacf3e945 111 void autoip_network_changed(struct netif *netif);
RodColeman 0:850eacf3e945 112
RodColeman 0:850eacf3e945 113 #ifdef __cplusplus
RodColeman 0:850eacf3e945 114 }
RodColeman 0:850eacf3e945 115 #endif
RodColeman 0:850eacf3e945 116
RodColeman 0:850eacf3e945 117 #endif /* LWIP_AUTOIP */
RodColeman 0:850eacf3e945 118
RodColeman 0:850eacf3e945 119 #endif /* __LWIP_AUTOIP_H__ */