4 * AutoIP Automatic LinkLocal IP Configuration
9 * Copyright (c) 2007 Dominik Spies <kontakt@dspies.de>
10 * All rights reserved.
12 * Redistribution and use in source and binary forms, with or without modification,
13 * are permitted provided that the following conditions are met:
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 * 3. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
24 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
26 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
28 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
31 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
34 * Author: Dominik Spies <kontakt@dspies.de>
36 * This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform
41 #ifndef LWIP_HDR_AUTOIP_H
42 #define LWIP_HDR_AUTOIP_H
46 #if LWIP_IPV4 && LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */
48 #include "lwip/netif.h"
49 /* #include "lwip/udp.h" */
50 #include "lwip/etharp.h"
57 #define AUTOIP_TMR_INTERVAL 100
58 #define AUTOIP_TICKS_PER_SECOND (1000 / AUTOIP_TMR_INTERVAL)
60 /** AutoIP state information per netif */
63 /** the currently selected, probed, announced or used LL IP-Address */
65 /** current AutoIP state machine state */
67 /** sent number of probes or announces, dependent on state */
69 /** ticks to wait, tick is AUTOIP_TMR_INTERVAL long */
71 /** ticks until a conflict can be solved by defending */
73 /** total number of probed/used Link Local IP-Addresses */
78 void autoip_set_struct(struct netif *netif, struct autoip *autoip);
79 /** Remove a struct autoip previously set to the netif using autoip_set_struct() */
80 #define autoip_remove_struct(netif) netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP, NULL)
81 err_t autoip_start(struct netif *netif);
82 err_t autoip_stop(struct netif *netif);
83 void autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr);
84 void autoip_tmr(void);
85 void autoip_network_changed(struct netif *netif);
86 u8_t autoip_supplied_address(const struct netif *netif);
88 /* for lwIP internal use by ip4.c */
89 u8_t autoip_accept_packet(struct netif *netif, const ip4_addr_t *addr);
91 #define netif_autoip_data(netif) ((struct autoip*)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP))
97 #endif /* LWIP_IPV4 && LWIP_AUTOIP */
99 #endif /* LWIP_HDR_AUTOIP_H */