1 /*
2  * Copyright (c) 2017 Matthias Boesl
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /** @file
8  * @brief IPv4 Autoconfiguration
9  */
10 
11 #ifndef ZEPHYR_INCLUDE_NET_IPV4_AUTOCONF_H_
12 #define ZEPHYR_INCLUDE_NET_IPV4_AUTOCONF_H_
13 
14 /** Current state of IPv4 Autoconfiguration */
15 enum net_ipv4_autoconf_state {
16 	NET_IPV4_AUTOCONF_INIT,     /**< Initialization state */
17 	NET_IPV4_AUTOCONF_ASSIGNED, /**< Assigned state */
18 	NET_IPV4_AUTOCONF_RENEW,    /**< Renew state */
19 };
20 
21 struct net_if;
22 
23 /**
24  * @brief Start IPv4 autoconfiguration RFC 3927: IPv4 Link Local
25  *
26  * @details Start IPv4 IP autoconfiguration
27  *
28  * @param iface A valid pointer on an interface
29  */
30 #if defined(CONFIG_NET_IPV4_AUTO)
31 void net_ipv4_autoconf_start(struct net_if *iface);
32 #else
net_ipv4_autoconf_start(struct net_if * iface)33 static inline void net_ipv4_autoconf_start(struct net_if *iface)
34 {
35 	ARG_UNUSED(iface);
36 }
37 #endif
38 
39 /**
40  * @brief Reset autoconf process
41  *
42  * @details Reset IPv4 IP autoconfiguration
43  *
44  * @param iface A valid pointer on an interface
45  */
46 #if defined(CONFIG_NET_IPV4_AUTO)
47 void net_ipv4_autoconf_reset(struct net_if *iface);
48 #else
net_ipv4_autoconf_reset(struct net_if * iface)49 static inline void net_ipv4_autoconf_reset(struct net_if *iface)
50 {
51 	ARG_UNUSED(iface);
52 }
53 #endif
54 
55 /** @cond INTERNAL_HIDDEN */
56 
57 /**
58  * @brief Initialize IPv4 auto configuration engine.
59  */
60 #if defined(CONFIG_NET_IPV4_AUTO)
61 void net_ipv4_autoconf_init(void);
62 #else
net_ipv4_autoconf_init(void)63 static inline void net_ipv4_autoconf_init(void) { }
64 #endif
65 
66 /** @endcond */
67 
68 #endif /* ZEPHYR_INCLUDE_NET_IPV4_AUTOCONF_H_ */
69