1 /* 2 * Copyright (c) 2021, 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 #ifndef OPENTHREAD_CORE_ANDROID_CONFIG_H_ 30 #define OPENTHREAD_CORE_ANDROID_CONFIG_H_ 31 32 #include <assert.h> 33 34 /** 35 * @def OPENTHREAD_CONFIG_PLATFORM_INFO 36 * 37 * The platform-specific string to insert into the OpenThread version string. 38 * 39 */ 40 #define OPENTHREAD_CONFIG_PLATFORM_INFO "POSIX-ANDROID" 41 42 /** 43 * @def OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH 44 * 45 * The run time data path. 46 * 47 */ 48 #define OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH "/data/misc/apexdata/com.android.tethering/ot-daemon" 49 50 /** 51 * @def OPENTHREAD_POSIX_CONFIG_DAEMON_SOCKET_BASENAME 52 * 53 * Define socket basename used by POSIX app daemon. 54 * 55 */ 56 #define OPENTHREAD_POSIX_CONFIG_DAEMON_SOCKET_BASENAME "/dev/socket/ot-daemon/%s" 57 58 /** 59 * @def OPENTHREAD_POSIX_CONFIG_RCP_PTY_ENABLE 60 * 61 * Define as 1 to enable PTY device support in POSIX app. 62 * 63 */ 64 #define OPENTHREAD_POSIX_CONFIG_RCP_PTY_ENABLE 1 65 66 /** 67 * @def OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 68 * 69 * The maximum number of retries allowed after a transmission failure for direct transmissions. 70 * 71 * Equivalent to macMaxFrameRetries, default value is 3. 72 * 73 */ 74 #define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 15 75 76 /** 77 * @def OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 78 * 79 * The maximum number of retries allowed after a transmission failure for indirect transmissions. 80 * 81 * Equivalent to macMaxFrameRetries, default value is 0. 82 * 83 */ 84 #define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 1 85 86 /** 87 * @def OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS 88 * 89 * Maximum number of transmit attempts for an outbound indirect frame (for a sleepy child) each triggered by the 90 * reception of a new data request command (a new data poll) from the sleepy child. Each data poll triggered attempt is 91 * retried by the MAC layer up to `OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT` times. 92 * 93 */ 94 #define OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS 16 95 96 /** 97 * @def OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 98 * 99 * Maximum retry delay for address query (in seconds). 100 * 101 * Replace with 2 min instead of the OT default of 8 hours. 102 * 103 */ 104 #define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120 105 106 /** 107 * @def OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 108 * 109 * The maximum number of children. 110 * 111 */ 112 #define OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 128 113 114 /** 115 * @def OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 116 * 117 * The number of message buffers in the buffer pool. 118 * 119 * NOTE: This allows for one 1KB frame per child. 120 */ 121 #define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS (OPENTHREAD_CONFIG_MLE_MAX_CHILDREN * (32 / sizeof(void *))) 122 123 static_assert(OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS * (32 * sizeof(void *)) == 124 OPENTHREAD_CONFIG_MLE_MAX_CHILDREN * 1024, 125 "Message buffer should be 1KB per child"); 126 127 /** 128 * @def OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 129 * 130 * The minimum number of supported IPv6 address registrations per child. 131 * 132 */ 133 #define OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 6 134 135 /** 136 * @def OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT 137 * 138 * Define to 1 to send an MLE Link Request when MAX_NEIGHBOR_AGE is reached for a neighboring router. 139 * 140 * This is enabled to increase reliability of exchanges between routers (default on OpenThread is disabled). 141 * 142 */ 143 #define OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT 1 144 145 /** 146 * @def OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS 147 * 148 * The maximum number of state-changed callback handlers (set using `otSetStateChangedCallback()`). 149 * 150 */ 151 #define OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS 3 152 153 /** 154 * @def OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 155 * 156 * Enable setting steering data out of band. 157 * 158 * This is used for "joinable" mode during weave pairing 159 * 160 */ 161 #define OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE 1 162 163 /** 164 * @def OPENTHREAD_CONFIG_MAC_JOIN_BEACON_VERSION 165 * 166 * The Beacon version to use when the beacon join flag is set. 167 * 168 * This is required to enable the to be able to assist older legacy only device (e.g., T2/T1 not running Fuji) during 169 * weave pairing flow. 170 * 171 */ 172 #define OPENTHREAD_CONFIG_MAC_JOIN_BEACON_VERSION 1 173 174 /** 175 * @def OPENTHREAD_CONFIG_NCP_TX_BUFFER_SIZE 176 * 177 * The size of NCP message buffer in bytes 178 * 179 */ 180 #define OPENTHREAD_CONFIG_NCP_TX_BUFFER_SIZE 3500 181 182 /** 183 * @def OPENTHREAD_CONFIG_DIAG_OUTPUT_BUFFER_SIZE 184 * 185 * Define OpenThread diagnostic mode output buffer size. 186 * 187 */ 188 #define OPENTHREAD_CONFIG_DIAG_OUTPUT_BUFFER_SIZE 1290 189 190 /** 191 * @def OPENTHREAD_CONFIG_DIAG_CMD_LINE_ARGS_MAX 192 * 193 * Define OpenThread diagnostic mode max command line arguments. 194 * 195 */ 196 #define OPENTHREAD_CONFIG_DIAG_CMD_LINE_ARGS_MAX 64 197 198 /** 199 * @def OPENTHREAD_CONFIG_DIAG_CMD_LINE_BUFFER_SIZE 200 * 201 * Define OpenThread diagnostic mode command line buffer size 202 * 203 */ 204 #define OPENTHREAD_CONFIG_DIAG_CMD_LINE_BUFFER_SIZE 1300 205 206 /** 207 * @def OPENTHREAD_CONFIG_LOG_LEVEL 208 * 209 * The log level (used at compile time). If `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE` 210 * is set, this defines the most verbose log level possible. 211 * 212 */ 213 #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG 214 215 // The initial log level used when OpenThread is initialized. 216 #define OPENTHREAD_CONFIG_LOG_LEVEL_INIT OT_LOG_LEVEL_INFO 217 218 /** 219 * @def OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE 220 * 221 * Define as 1 to enable dynamic log level control. 222 * 223 * Note that the OPENTHREAD_CONFIG_LOG_LEVEL determines the log level at 224 * compile time. The dynamic log level control (if enabled) only allows 225 * decreasing the log level from the compile time value. 226 * 227 */ 228 #define OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE 1 229 230 /** 231 * @def OPENTHREAD_CONFIG_LOG_OUTPUT 232 * 233 * Selects if, and where the LOG output goes to. 234 * 235 * OPENTHREAD_CONFIG_LOG_OUTPUT_NONE: Log output goes to the bit bucket (disabled) 236 * OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED: Log output is handled by a platform defined function 237 * OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL: Log output for NCP goes to Spinel `STREAM_LOG` property. 238 * 239 * Log output is set to `PLATFORM_DEFINED` which pushes the log through syslog(). 240 * 241 */ 242 #define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED 243 244 /** 245 * @def OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL 246 * 247 * Define to prepend the log level to all log messages 248 * 249 */ 250 #define OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL 1 251 252 /** 253 * @def OPENTHREAD_CONFIG_LOG_SUFFIX 254 * 255 * Define suffix to append at the end of logs. 256 * 257 */ 258 #define OPENTHREAD_CONFIG_LOG_SUFFIX "" 259 260 /** 261 * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE 262 * 263 * Define to 1 if you want to enable radio coexistence implemented in platform. 264 * 265 */ 266 #define OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE 1 267 268 /** 269 * @def OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE 270 * 271 * Disable UDP forward support. 272 * 273 */ 274 #define OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE 0 275 276 #define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 1 277 #define OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE 1 278 #define OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE 1 279 #define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 1 280 #define OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 1 281 #define OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE 1 282 #define OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE 1 283 #define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 1 284 #define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 285 #define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 286 #define OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE 1 287 #define OPENTHREAD_CONFIG_MAC_FILTER_ENABLE 1 288 #define OPENTHREAD_CONFIG_MLR_ENABLE 1 289 #define OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE 1 290 #define OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE 1 291 #define OPENTHREAD_CONFIG_PING_SENDER_ENABLE 1 292 #define OPENTHREAD_CONFIG_SRP_SERVER_ENABLE 1 293 #define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 1 294 #define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 1 295 296 // Disables built-in TCP support as TCP can be support on upper layer 297 #define OPENTHREAD_CONFIG_TCP_ENABLE 0 298 299 // Disable posix multicast routing feature in ot-daemon 300 #define OPENTHREAD_POSIX_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE 0 301 302 #define OPENTHREAD_POSIX_CONFIG_SPINEL_VENDOR_INTERFACE_URL_PROTOCOL_NAME "threadnetwork_hal" 303 304 // Enables CLI logs for debugging 305 #define OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE 1 306 #define OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_LEVEL OT_LOG_LEVEL_INFO 307 308 // Enables diag commands for RF testing 309 #define OPENTHREAD_CONFIG_DIAG_ENABLE 1 310 311 // Enable restriction on local source to larger scope multicast forwarding 312 #define OPENTHREAD_CONFIG_IP6_RESTRICT_FORWARDING_LARGER_SCOPE_MCAST_WITH_LOCAL_SRC 1 313 314 // Set the max log size to 1024 to allow the RCP to upload longer log. 315 #define OPENTHREAD_CONFIG_LOG_MAX_SIZE 1024 316 317 // Disable as Android device will not work as commissioner. 318 #define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 0 319 320 // Vendor extension module is not used on Android. 321 #define OPENTHREAD_ENABLE_VENDOR_EXTENSION 0 322 323 // Allow longer input string of 1300 bytes for CLI commands. 324 #define OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH 1300 325 326 // Power calibration on RCP is not needed. 327 #define OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE 0 328 329 // Disable the support for locally initializing an Active Operational Dataset. 330 #define OPENTHREAD_CONFIG_OPERATIONAL_DATASET_AUTO_INIT 0 331 332 // Disable TCAT over BLE support. 333 #define OPENTHREAD_CONFIG_BLE_TCAT_ENABLE 0 334 335 // Disable BLE secure support. 336 #define OPENTHREAD_CONFIG_CLI_BLE_SECURE_ENABLE 0 337 338 // Enable tracking the uptime of OpenThread instance. 339 #define OPENTHREAD_CONFIG_UPTIME_ENABLE 1 340 341 // The Thread version is 1.3 342 #define OPENTHREAD_CONFIG_THREAD_VERSION OT_THREAD_VERSION_1_3 343 344 // Thread 1.2 Domain Unicast Address feature is not supported. 345 #define OPENTHREAD_CONFIG_DUA_ENABLE 0 346 #define OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE 0 347 348 // Enable to support BBR feature. 349 #define OPENTHREAD_CONFIG_MLR_ENABLE 1 350 351 // Enable the external heap. 352 #define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 1 353 354 // Enable TREL. 355 #define OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE 1 356 357 // Enable Link Metrics subject feature for Thread certification test. 358 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 1 359 360 // Enable Link Metrics initiator feature for Thread certification test. 361 #define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 1 362 363 // Sets microseconds ahead should MAC deliver CSL frame to SubMac. 364 #define OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US 4000 365 366 #endif // OPENTHREAD_CORE_ANDROID_CONFIG_H_ 367