Line data Source code
1 1 : /** @file
2 : * @brief Routines for network subsystem initialization.
3 : */
4 :
5 : /*
6 : * Copyright (c) 2017 Intel Corporation
7 : *
8 : * SPDX-License-Identifier: Apache-2.0
9 : */
10 :
11 : #ifndef ZEPHYR_INCLUDE_NET_NET_CONFIG_H_
12 : #define ZEPHYR_INCLUDE_NET_NET_CONFIG_H_
13 :
14 : #include <zephyr/types.h>
15 : #include <zephyr/device.h>
16 : #include <zephyr/net/net_if.h>
17 :
18 : #ifdef __cplusplus
19 : extern "C" {
20 : #endif
21 :
22 : /**
23 : * @brief Network configuration library
24 : * @defgroup net_config Network Configuration Library
25 : * @since 1.8
26 : * @version 0.8.0
27 : * @ingroup networking
28 : * @{
29 : */
30 :
31 : /* Flags that tell what kind of functionality is needed by the client. */
32 : /**
33 : * @brief Application needs routers to be set so that connectivity to remote
34 : * network is possible. For IPv6 networks, this means that the device should
35 : * receive IPv6 router advertisement message before continuing.
36 : */
37 1 : #define NET_CONFIG_NEED_ROUTER 0x00000001
38 :
39 : /**
40 : * @brief Application needs IPv6 subsystem configured and initialized.
41 : * Typically this means that the device has IPv6 address set.
42 : */
43 1 : #define NET_CONFIG_NEED_IPV6 0x00000002
44 :
45 : /**
46 : * @brief Application needs IPv4 subsystem configured and initialized.
47 : * Typically this means that the device has IPv4 address set.
48 : */
49 1 : #define NET_CONFIG_NEED_IPV4 0x00000004
50 :
51 : /**
52 : * @brief Initialize this network application.
53 : *
54 : * @details This will call net_config_init_by_iface() with NULL network
55 : * interface.
56 : *
57 : * @param app_info String describing this application.
58 : * @param flags Flags related to services needed by the client.
59 : * @param timeout How long to wait the network setup before continuing
60 : * the startup.
61 : *
62 : * @return 0 if ok, <0 if error.
63 : */
64 1 : int net_config_init(const char *app_info, uint32_t flags, int32_t timeout);
65 :
66 : /**
67 : * @brief Initialize this network application using a specific network
68 : * interface.
69 : *
70 : * @details If network interface is set to NULL, then the default one
71 : * is used in the configuration.
72 : *
73 : * @param iface Initialize networking using this network interface.
74 : * @param app_info String describing this application.
75 : * @param flags Flags related to services needed by the client.
76 : * @param timeout How long to wait the network setup before continuing
77 : * the startup.
78 : *
79 : * @return 0 if ok, <0 if error.
80 : */
81 1 : int net_config_init_by_iface(struct net_if *iface, const char *app_info,
82 : uint32_t flags, int32_t timeout);
83 :
84 : /**
85 : * @brief Initialize this network application.
86 : *
87 : * @details If CONFIG_NET_CONFIG_AUTO_INIT is set, then this function is called
88 : * automatically when the device boots. If that is not desired, unset
89 : * the config option and call the function manually when the
90 : * application starts.
91 : *
92 : * @param dev Network device to use. The function will figure out what
93 : * network interface to use based on the device. If the device is NULL,
94 : * then default network interface is used by the function.
95 : * @param app_info String describing this application.
96 : *
97 : * @return 0 if ok, <0 if error.
98 : */
99 1 : int net_config_init_app(const struct device *dev, const char *app_info);
100 :
101 : /**
102 : * @}
103 : */
104 :
105 : #ifdef __cplusplus
106 : }
107 : #endif
108 :
109 : #endif /* ZEPHYR_INCLUDE_NET_NET_CONFIG_H_ */
|