1 /*
2  *  Copyright (c) 2017, 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 posix app compile-time configuration constants for OpenThread core.
32  */
33 
34 #ifndef OPENTHREAD_CORE_POSIX_CONFIG_H_
35 #define OPENTHREAD_CORE_POSIX_CONFIG_H_
36 
37 /**
38  * @def OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS
39  *
40  * The number of message buffers in the buffer pool.
41  *
42  */
43 #ifndef OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS
44 #define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 256
45 #endif
46 
47 /**
48  * @def OPENTHREAD_CONFIG_LOG_PLATFORM
49  *
50  * Define to enable platform region logging.
51  *
52  */
53 #ifndef OPENTHREAD_CONFIG_LOG_PLATFORM
54 #define OPENTHREAD_CONFIG_LOG_PLATFORM 1
55 #endif
56 
57 /**
58  * @def OPENTHREAD_CONFIG_LOG_OUTPUT
59  *
60  * Select the log output.
61  *
62  */
63 #ifndef OPENTHREAD_CONFIG_LOG_OUTPUT
64 #define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
65 #endif
66 
67 /**
68  * @def OPENTHREAD_CONFIG_LOG_LEVEL
69  *
70  * Define the compile-time log level which is the lowest log level
71  * that can be set at run-time by `otLoggingSetLevel`.
72  *
73  */
74 #ifndef OPENTHREAD_CONFIG_LOG_LEVEL
75 #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG
76 #endif
77 
78 /**
79  * @def OPENTHREAD_CONFIG_LOG_LEVEL_INIT
80  *
81  * The initial log level used when OpenThread is initialized. See
82  * `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE`.
83  */
84 #ifndef OPENTHREAD_CONFIG_LOG_LEVEL_INIT
85 #define OPENTHREAD_CONFIG_LOG_LEVEL_INIT OT_LOG_LEVEL_CRIT
86 #endif
87 
88 /**
89  * @def OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE
90  *
91  * Define as 1 to enable dynamic log level control.
92  *
93  * Note that the OPENTHREAD_CONFIG_LOG_LEVEL determines the log level at
94  * compile time. The dynamic log level control (if enabled) only allows
95  * decreasing the log level from the compile time value.
96  *
97  */
98 #ifndef OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE
99 #define OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE 1
100 #endif
101 
102 /**
103  * @def OPENTHREAD_CONFIG_PLATFORM_INFO
104  *
105  * The platform-specific string to insert into the OpenThread version string.
106  *
107  */
108 #define OPENTHREAD_CONFIG_PLATFORM_INFO "POSIX"
109 
110 /**
111  * @def OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE
112  *
113  * Define as 1 to enable support for adding of auto-configured SLAAC addresses by OpenThread.
114  *
115  */
116 #ifndef OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE /* allows command line override */
117 #define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1
118 #endif
119 
120 /**
121  * @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
122  *
123  * Define to 1 to enable NCP HDLC support.
124  *
125  */
126 #define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1
127 
128 /**
129  * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE
130  *
131  * Define to 1 if you want to enable radio coexistence implemented in platform.
132  *
133  */
134 #ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE
135 #define OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE 1
136 #endif
137 
138 #if OPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE
139 
140 #ifndef OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
141 #define OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE 1
142 #endif
143 
144 #ifndef OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
145 #define OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE 1
146 #endif
147 
148 #endif
149 
150 /**
151  * @def OPENTHREAD_CONFIG_LOG_MAX_SIZE
152  *
153  * The maximum log string size (number of chars).
154  *
155  */
156 #ifndef OPENTHREAD_CONFIG_LOG_MAX_SIZE
157 #define OPENTHREAD_CONFIG_LOG_MAX_SIZE 1024
158 #endif
159 
160 /**
161  * @def OPENTHREAD_CONFIG_COMMISSIONER_MAX_JOINER_ENTRIES
162  *
163  * The maximum number of Joiner entries maintained by the Commissioner.
164  *
165  */
166 #ifndef OPENTHREAD_CONFIG_COMMISSIONER_MAX_JOINER_ENTRIES
167 #define OPENTHREAD_CONFIG_COMMISSIONER_MAX_JOINER_ENTRIES 4
168 #endif
169 
170 /**
171  * @def OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES
172  *
173  * The number of EID-to-RLOC cache entries.
174  *
175  */
176 #ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES
177 #define OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES 128
178 #endif
179 
180 /**
181  * @def OPENTHREAD_CONFIG_MLE_MAX_CHILDREN
182  *
183  * The maximum number of children.
184  *
185  */
186 #ifndef OPENTHREAD_CONFIG_MLE_MAX_CHILDREN
187 #define OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 64
188 #endif
189 
190 /**
191  * @def OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD
192  *
193  * The maximum number of supported IPv6 address registrations per child.
194  *
195  */
196 #ifndef OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD
197 #define OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 16
198 #endif
199 
200 /**
201  * @def OPENTHREAD_CONFIG_IP6_MAX_EXT_UCAST_ADDRS
202  *
203  * The maximum number of supported IPv6 addresses allows to be externally added.
204  *
205  */
206 #ifndef OPENTHREAD_CONFIG_IP6_MAX_EXT_UCAST_ADDRS
207 #define OPENTHREAD_CONFIG_IP6_MAX_EXT_UCAST_ADDRS 8
208 #endif
209 
210 /**
211  * @def OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS
212  *
213  * The maximum number of supported IPv6 multicast addresses allows to be externally added.
214  *
215  */
216 #ifndef OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS
217 #define OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS 8
218 #endif
219 
220 /**
221  * @def OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE
222  *
223  * Define as 1 to enable History Tracker module.
224  *
225  */
226 #ifndef OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE
227 #define OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE 1
228 #endif
229 
230 /**
231  * @def OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE
232  *
233  * The size of heap buffer when DTLS is enabled.
234  *
235  */
236 #ifndef OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE
237 #define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE (63 * 1024)
238 #endif
239 
240 /**
241  * @def OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS
242  *
243  * The size of heap buffer when DTLS is disabled.
244  *
245  */
246 #ifndef OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS
247 #define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS (63 * 1024)
248 #endif
249 
250 /**
251  * @def OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH
252  *
253  * The maximum size of the CLI line in bytes.
254  *
255  */
256 #ifndef OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH
257 #define OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH 640
258 #endif
259 
260 /**
261  * @def OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE
262  *
263  * The size of CLI UART RX buffer in bytes.
264  *
265  */
266 #ifndef OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE
267 #define OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE 640
268 #endif
269 
270 #endif // OPENTHREAD_CORE_POSIX_CONFIG_H_
271