1 /*
2  *  Copyright (c) 2019, The OpenThread Authors.
3  *  All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions are met:
7  *  1. Redistributions of source code must retain the above copyright
8  *     notice, this list of conditions and the following disclaimer.
9  *  2. Redistributions in binary form must reproduce the above copyright
10  *     notice, this list of conditions and the following disclaimer in the
11  *     documentation and/or other materials provided with the distribution.
12  *  3. Neither the name of the copyright holder nor the
13  *     names of its contributors may be used to endorse or promote products
14  *     derived from this software without specific prior written permission.
15  *
16  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  *  POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 /**
30  * @file
31  *   This file includes compile-time configurations for the Thread Management Framework service.
32  *
33  */
34 
35 #ifndef CONFIG_TMF_H_
36 #define CONFIG_TMF_H_
37 
38 /**
39  * @def OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES
40  *
41  * The number of EID-to-RLOC cache entries.
42  *
43  */
44 #ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES
45 #define OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES 32
46 #endif
47 
48 /**
49  * @def OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_MAX_SNOOP_ENTRIES
50  *
51  * The maximum number of EID-to-RLOC cache entries that can be used for "snoop optimization" where an entry is created
52  * by inspecting a received message.
53  *
54  */
55 #ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_MAX_SNOOP_ENTRIES
56 #define OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_MAX_SNOOP_ENTRIES 2
57 #endif
58 
59 /**
60  * @def OPENTHREAD_CONFIG_TMF_SNOOP_CACHE_ENTRY_TIMEOUT
61  *
62  * The timeout value (in seconds) blocking eviction of an address cache entry created through snoop optimization (i.e.,
63  * inspection of a received message). After the timeout expires the entry can be reclaimed again. This timeout allows
64  * a longer response delay for a received message giving more chance that a snooped entry will be used (avoiding
65  * sending Address Query when a response message is sent to same destination from which the message was received
66  * earlier).
67  *
68  */
69 #ifndef OPENTHREAD_CONFIG_TMF_SNOOP_CACHE_ENTRY_TIMEOUT
70 #define OPENTHREAD_CONFIG_TMF_SNOOP_CACHE_ENTRY_TIMEOUT 3
71 #endif
72 
73 /**
74  * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT
75  *
76  * The timeout value (in seconds) waiting for a address notification response after sending an address query.
77  *
78  * Default: 3 seconds
79  *
80  */
81 #ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT
82 #define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_TIMEOUT 3
83 #endif
84 
85 /**
86  * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY
87  *
88  * Initial retry delay for address query (in seconds).
89  *
90  * Default: 15 seconds
91  *
92  */
93 #ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY
94 #define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_INITIAL_RETRY_DELAY 15
95 #endif
96 
97 /**
98  * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY
99  *
100  * Maximum retry delay for address query (in seconds).
101  *
102  * Default: 120 seconds
103  *
104  */
105 #ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY
106 #define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120
107 #endif
108 
109 /**
110  * @def OPENTHREAD_CONFIG_TMF_ALLOW_ADDRESS_RESOLUTION_USING_NET_DATA_SERVICES
111  *
112  * Define as 1 to allow address resolution of on-mesh addresses using Thread Network Data DNS/SRP Service entries.
113  *
114  */
115 #ifndef OPENTHREAD_CONFIG_TMF_ALLOW_ADDRESS_RESOLUTION_USING_NET_DATA_SERVICES
116 #define OPENTHREAD_CONFIG_TMF_ALLOW_ADDRESS_RESOLUTION_USING_NET_DATA_SERVICES 1
117 #endif
118 
119 /**
120  * @def OPENTHREAD_CONFIG_TMF_PENDING_DATASET_MINIMUM_DELAY
121  *
122  * Minimum Delay Timer value for a Pending Operational Dataset (in ms).
123  *
124  * Thread specification defines this value as 30,000 ms. Changing from the specified value should be done for testing
125  * only.
126  *
127  */
128 #ifndef OPENTHREAD_CONFIG_TMF_PENDING_DATASET_MINIMUM_DELAY
129 #define OPENTHREAD_CONFIG_TMF_PENDING_DATASET_MINIMUM_DELAY 30000
130 #endif
131 
132 /**
133  * @def OPENTHREAD_CONFIG_TMF_PENDING_DATASET_DEFAULT_DELAY
134  *
135  * Default Delay Timer value for a Pending Operational Dataset (in ms).
136  *
137  * Thread specification defines this value as 300,000 ms. Changing from the specified value should be done for testing
138  * only.
139  *
140  */
141 #ifndef OPENTHREAD_CONFIG_TMF_PENDING_DATASET_DEFAULT_DELAY
142 #define OPENTHREAD_CONFIG_TMF_PENDING_DATASET_DEFAULT_DELAY 300000
143 #endif
144 
145 /**
146  * @def OPENTHREAD_CONFIG_TMF_ENERGY_SCAN_MAX_RESULTS
147  *
148  * The maximum number of Energy List entries.
149  *
150  */
151 #ifndef OPENTHREAD_CONFIG_TMF_ENERGY_SCAN_MAX_RESULTS
152 #define OPENTHREAD_CONFIG_TMF_ENERGY_SCAN_MAX_RESULTS 64
153 #endif
154 
155 /**
156  * @def OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE
157  *
158  * Define to 1 to support injecting Service entries into the Thread Network Data.
159  *
160  */
161 #ifndef OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE
162 #define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 0
163 #endif
164 
165 /**
166  * @def OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_MAX_ALOCS
167  *
168  * The maximum number of supported Service ALOCs registrations for this device.
169  *
170  */
171 #ifndef OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_MAX_ALOCS
172 #define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_MAX_ALOCS 1
173 #endif
174 
175 /**
176  * @def OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
177  *
178  * Define to 1 to enable TMF network diagnostics client.
179  *
180  * The network diagnostic client add API to send diagnostic requests and queries to other node and process the response.
181  * It is enabled by default on Border Routers.
182  *
183  */
184 #ifndef OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
185 #define OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
186 #endif
187 
188 /**
189  * @def OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE
190  *
191  * Define to 1 to enable TMF anycast locator functionality.
192  *
193  * This feature allows a device to determine the mesh local EID and RLOC16 of the closest destination of an anycast
194  * address (if any) through sending `TMF_ANYCAST_LOCATE` requests.
195  *
196  */
197 #ifndef OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE
198 #define OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE 0
199 #endif
200 
201 /**
202  * @def OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_SEND_RESPONSE
203  *
204  * Define to 1 to require the device to listen and respond to `TMF_ANYCAST_LOCATE` requests.
205  *
206  * This config is used only when `OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE` is enabled. It is enabled by default.
207  *
208  */
209 #ifndef OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_SEND_RESPONSE
210 #define OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_SEND_RESPONSE 1
211 #endif
212 
213 /**
214  * @def OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
215  *
216  * Define to 1 for Thread 1.2 FTD device to register DUA of its MTD children registered
217  * even if it doesn't enable DUA feature itself.
218  *
219  */
220 #ifndef OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE
221 #define OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
222 #endif
223 
224 #if OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE && OPENTHREAD_CONFIG_THREAD_VERSION < OT_THREAD_VERSION_1_2
225 #error "Thread 1.2 or higher version is required for OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE"
226 #endif
227 
228 /**
229  * @def OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
230  *
231  * This setting configures the Multicast Listener Registration parent proxying in Thread 1.2.
232  *
233  */
234 #ifndef OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
235 #define OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
236 #endif
237 
238 #if OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE && OPENTHREAD_CONFIG_THREAD_VERSION < OT_THREAD_VERSION_1_2
239 #error "Thread 1.2 or higher version is required for OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE"
240 #endif
241 
242 #endif // CONFIG_TMF_H_
243