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 #ifndef OPENTHREAD_PLATFORM_CONFIG_H_ 30 #define OPENTHREAD_PLATFORM_CONFIG_H_ 31 32 #include "openthread-core-config.h" 33 34 /** 35 * @file 36 * @brief 37 * This file includes the POSIX platform-specific configurations. 38 */ 39 40 /** 41 * @def OPENTHREAD_POSIX_CONFIG_RCP_PTY_ENABLE 42 * 43 * Define as 1 to enable PTY RCP support. 44 * 45 */ 46 #ifndef OPENTHREAD_POSIX_CONFIG_RCP_PTY_ENABLE 47 #define OPENTHREAD_POSIX_CONFIG_RCP_PTY_ENABLE 1 48 #endif 49 50 /** 51 * @def OPENTHREAD_CONFIG_POSIX_APP_TREL_INTERFACE_NAME 52 * 53 * Defines the default interface name used for TREL UDP6 platform. Empty string disables TREL platform. 54 * 55 */ 56 #ifndef OPENTHREAD_CONFIG_POSIX_APP_TREL_INTERFACE_NAME 57 #define OPENTHREAD_CONFIG_POSIX_APP_TREL_INTERFACE_NAME "" 58 #endif 59 60 /** 61 * @def OPENTHREAD_CONFIG_POSIX_TREL_USE_NETLINK_SOCKET 62 * 63 * Defines whether the TREL UDP6 platform uses netlink socket to add/remove addresses on the TREL netif or `ioctl()` 64 * command. 65 * 66 * When netlink is used Duplicate Address Detection (DAD) is disabled when a new address is added on the netif. 67 * 68 * Use of netlink is enabled by default on linux-based platforms. 69 * 70 */ 71 #ifndef OPENTHREAD_CONFIG_POSIX_TREL_USE_NETLINK_SOCKET 72 #ifdef __linux__ 73 #define OPENTHREAD_CONFIG_POSIX_TREL_USE_NETLINK_SOCKET 1 74 #else 75 #define OPENTHREAD_CONFIG_POSIX_TREL_USE_NETLINK_SOCKET 0 76 #endif 77 #endif 78 79 /** 80 * @def OPENTHREAD_POSIX_CONFIG_DAEMON_SOCKET_BASENAME 81 * 82 * Define socket basename used by POSIX app daemon. 83 * 84 */ 85 #ifndef OPENTHREAD_POSIX_CONFIG_DAEMON_SOCKET_BASENAME 86 #ifdef __linux__ 87 #define OPENTHREAD_POSIX_CONFIG_DAEMON_SOCKET_BASENAME "/run/openthread-%s" 88 #else 89 #define OPENTHREAD_POSIX_CONFIG_DAEMON_SOCKET_BASENAME "/tmp/openthread-%s" 90 #endif 91 #endif 92 93 /** 94 * @def OPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE 95 * 96 * Define to 1 to enable POSIX daemon. 97 * 98 */ 99 #ifndef OPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE 100 #define OPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE 0 101 #endif 102 103 /** 104 * RCP bus UART. 105 * 106 * @note This value is also for simulated UART bus. 107 * 108 */ 109 #define OT_POSIX_RCP_BUS_UART 1 110 111 /** 112 * RCP bus SPI. 113 * 114 */ 115 #define OT_POSIX_RCP_BUS_SPI 2 116 117 /** 118 * @def OPENTHREAD_POSIX_CONFIG_RCP_BUS 119 * 120 * This setting configures what type of RCP bus to use. 121 * 122 */ 123 #ifndef OPENTHREAD_POSIX_CONFIG_RCP_BUS 124 #define OPENTHREAD_POSIX_CONFIG_RCP_BUS OT_POSIX_RCP_BUS_UART 125 #endif 126 127 /** 128 * @def OPENTHREAD_POSIX_CONFIG_MAX_POWER_TABLE_ENABLE 129 * 130 * Define as 1 to enable max power table support. 131 * 132 */ 133 #ifndef OPENTHREAD_POSIX_CONFIG_MAX_POWER_TABLE_ENABLE 134 #define OPENTHREAD_POSIX_CONFIG_MAX_POWER_TABLE_ENABLE 0 135 #endif 136 137 /** 138 * @def OPENTHREAD_POSIX_CONFIG_MAX_MULTICAST_FORWARDING_CACHE_TABLE 139 * 140 * This setting configures the maximum number of Multicast Forwarding Cache table for POSIX native multicast routing. 141 * 142 */ 143 #ifndef OPENTHREAD_POSIX_CONFIG_MAX_MULTICAST_FORWARDING_CACHE_TABLE 144 #define OPENTHREAD_POSIX_CONFIG_MAX_MULTICAST_FORWARDING_CACHE_TABLE (OPENTHREAD_CONFIG_MAX_MULTICAST_LISTENERS * 10) 145 #endif 146 147 /** 148 * @def OPENTHREAD_POSIX_CONFIG_SECURE_SETTINGS_ENABLE 149 * 150 * Define as 1 to enable the secure settings. When defined to 1, the platform MUST implement the otPosixSecureSetting* 151 * APIs defined in 'src/posix/platform/include/openthread/platform/secure_settings.h'. 152 * 153 */ 154 #ifndef OPENTHREAD_POSIX_CONFIG_SECURE_SETTINGS_ENABLE 155 #define OPENTHREAD_POSIX_CONFIG_SECURE_SETTINGS_ENABLE 0 156 #endif 157 158 /** 159 * @def OPENTHREAD_POSIX_CONFIG_INSTALL_EXTERNAL_ROUTES_ENABLE 160 * 161 * Define as 1 to add external routes to POSIX kernel when external routes are changed in netdata. 162 * 163 */ 164 #ifdef __linux__ 165 #ifndef OPENTHREAD_POSIX_CONFIG_INSTALL_EXTERNAL_ROUTES_ENABLE 166 #define OPENTHREAD_POSIX_CONFIG_INSTALL_EXTERNAL_ROUTES_ENABLE 1 167 #endif 168 #endif 169 170 /** 171 * @def OPENTHREAD_POSIX_CONFIG_EXTERNAL_ROUTE_PRIORITY 172 * 173 * This macro defines the priority of external routes added to kernel. 174 * 175 */ 176 #ifndef OPENTHREAD_POSIX_CONFIG_EXTERNAL_ROUTE_PRIORITY 177 #define OPENTHREAD_POSIX_CONFIG_EXTERNAL_ROUTE_PRIORITY 512 178 #endif 179 180 /** 181 * @def OPENTHREAD_POSIX_CONFIG_MAX_EXTERNAL_ROUTE_NUM 182 * 183 * This macro defines the max number of external routes that can be added to kernel. 184 * 185 */ 186 #ifndef OPENTHREAD_POSIX_CONFIG_MAX_EXTERNAL_ROUTE_NUM 187 #define OPENTHREAD_POSIX_CONFIG_MAX_EXTERNAL_ROUTE_NUM 8 188 #endif 189 190 #ifdef __APPLE__ 191 192 /** 193 * Use built-in utun driver on mac OS 194 */ 195 #define OT_POSIX_CONFIG_MACOS_UTUN 1 196 197 /** 198 * Use open-source tun driver on mac OS 199 */ 200 #define OT_POSIX_CONFIG_MACOS_TUN 2 201 202 /** 203 * @def OPENTHREAD_POSIX_CONFIG_MACOS_TUN_OPTION 204 * 205 * This setting configures which tunnel driver to use. 206 * 207 */ 208 #ifndef OPENTHREAD_POSIX_CONFIG_MACOS_TUN_OPTION 209 #define OPENTHREAD_POSIX_CONFIG_MACOS_TUN_OPTION OT_POSIX_CONFIG_MACOS_UTUN 210 #endif 211 212 #endif // __APPLE__ 213 214 #endif // OPENTHREAD_PLATFORM_CONFIG_H_ 215