Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
autoip.h
00001 /** 00002 * @file 00003 * 00004 * AutoIP Automatic LinkLocal IP Configuration 00005 */ 00006 00007 /* 00008 * 00009 * Copyright (c) 2007 Dominik Spies <kontakt@dspies.de> 00010 * All rights reserved. 00011 * 00012 * Redistribution and use in source and binary forms, with or without modification, 00013 * are permitted provided that the following conditions are met: 00014 * 00015 * 1. Redistributions of source code must retain the above copyright notice, 00016 * this list of conditions and the following disclaimer. 00017 * 2. Redistributions in binary form must reproduce the above copyright notice, 00018 * this list of conditions and the following disclaimer in the documentation 00019 * and/or other materials provided with the distribution. 00020 * 3. The name of the author may not be used to endorse or promote products 00021 * derived from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00024 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00025 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00026 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00027 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00028 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00029 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00030 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00031 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00032 * OF SUCH DAMAGE. 00033 * 00034 * Author: Dominik Spies <kontakt@dspies.de> 00035 * 00036 * This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform 00037 * with RFC 3927. 00038 * 00039 */ 00040 00041 #ifndef LWIP_HDR_AUTOIP_H 00042 #define LWIP_HDR_AUTOIP_H 00043 00044 #include "lwip/opt.h" 00045 00046 #if LWIP_IPV4 && LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */ 00047 00048 #include "lwip/netif.h" 00049 /* #include "lwip/udp.h" */ 00050 #include "lwip/etharp.h" 00051 00052 #ifdef __cplusplus 00053 extern "C" { 00054 #endif 00055 00056 /** AutoIP Timing */ 00057 #define AUTOIP_TMR_INTERVAL 100 00058 #define AUTOIP_TICKS_PER_SECOND (1000 / AUTOIP_TMR_INTERVAL) 00059 00060 /** AutoIP state information per netif */ 00061 struct autoip 00062 { 00063 /** the currently selected, probed, announced or used LL IP-Address */ 00064 ip4_addr_t llipaddr; 00065 /** current AutoIP state machine state */ 00066 u8_t state; 00067 /** sent number of probes or announces, dependent on state */ 00068 u8_t sent_num; 00069 /** ticks to wait, tick is AUTOIP_TMR_INTERVAL long */ 00070 u16_t ttw; 00071 /** ticks until a conflict can be solved by defending */ 00072 u8_t lastconflict; 00073 /** total number of probed/used Link Local IP-Addresses */ 00074 u8_t tried_llipaddr; 00075 }; 00076 00077 00078 void autoip_set_struct(struct netif *netif, struct autoip *autoip); 00079 /** Remove a struct autoip previously set to the netif using autoip_set_struct() */ 00080 #define autoip_remove_struct(netif) do { (netif)->autoip = NULL; } while (0) 00081 err_t autoip_start(struct netif *netif); 00082 err_t autoip_stop(struct netif *netif); 00083 void autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr); 00084 void autoip_tmr(void); 00085 void autoip_network_changed(struct netif *netif); 00086 u8_t autoip_supplied_address(const struct netif *netif); 00087 00088 /* for lwIP internal use by ip4.c */ 00089 u8_t autoip_accept_packet(struct netif *netif, const ip4_addr_t *addr); 00090 00091 #define netif_autoip_data(netif) ((struct autoip*)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP)) 00092 00093 #ifdef __cplusplus 00094 } 00095 #endif 00096 00097 #endif /* LWIP_IPV4 && LWIP_AUTOIP */ 00098 00099 #endif /* LWIP_HDR_AUTOIP_H */
Generated on Tue Jul 12 2022 18:18:28 by
