This is lwip library for WlanBP3595 library. We forked lwip library. We extended TCP/IP thread stack size.

Fork of lwip by mbed official

Committer:
tousaki
Date:
Fri Dec 25 05:54:39 2015 +0000
Revision:
20:23fd48e7c5cf
Parent:
0:51ac1d130fd4
We forked lwip library.; We extended TCP/IP thread stack size.

Who changed what in which revision?

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