diff --git a/src/core/BUILD.gn b/src/core/BUILD.gn index 299059f39..0ad020356 100644 --- a/src/core/BUILD.gn +++ b/src/core/BUILD.gn @@ -752,7 +752,9 @@ source_set("libopenthread_core_config") { public = [ "config/announce_sender.h", "config/backbone_router.h", + "config/border_agent.h", "config/border_router.h", + "config/border_routing.h", "config/channel_manager.h", "config/channel_monitor.h", "config/child_supervision.h", diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 7b180eac5..289858c64 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -478,7 +478,9 @@ HEADERS_COMMON = \ common/uptime.hpp \ config/announce_sender.h \ config/backbone_router.h \ + config/border_agent.h \ config/border_router.h \ + config/border_routing.h \ config/channel_manager.h \ config/channel_monitor.h \ config/child_supervision.h \ diff --git a/src/core/config/border_agent.h b/src/core/config/border_agent.h new file mode 100644 index 000000000..39d7fe7f8 --- /dev/null +++ b/src/core/config/border_agent.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes compile-time configurations for Border Agent. + * + */ + +#ifndef CONFIG_BORDER_AGENT_H_ +#define CONFIG_BORDER_AGENT_H_ + +/** + * @def OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE + * + * Define to 1 to enable Border Agent support. + * + */ +#ifndef OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE +#define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_BORDER_AGENT_UDP_PORT + * + * Specifies the Border Agent UDP port, and use 0 for ephemeral port. + * + */ +#ifndef OPENTHREAD_CONFIG_BORDER_AGENT_UDP_PORT +#define OPENTHREAD_CONFIG_BORDER_AGENT_UDP_PORT 0 +#endif + +#endif // CONFIG_BORDER_AGENT_H_ diff --git a/src/core/config/border_router.h b/src/core/config/border_router.h index ec1792a1b..01ddfe9aa 100644 --- a/src/core/config/border_router.h +++ b/src/core/config/border_router.h @@ -35,16 +35,6 @@ #ifndef CONFIG_BORDER_ROUTER_H_ #define CONFIG_BORDER_ROUTER_H_ -/** - * @def OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE - * - * Define to 1 to enable Border Agent support. - * - */ -#ifndef OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE -#define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 0 -#endif - /** * @def OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE * @@ -81,65 +71,4 @@ #define OPENTHREAD_CONFIG_BORDER_ROUTER_REQUEST_ROUTER_ROLE 1 #endif -/** - * @def OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE - * - * Define to 1 to enable Border Routing support. - * - */ -#ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE -#define OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 0 -#endif - -/** - * @def OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_DISCOVERED_ROUTERS - * - * Specifies maximum number of routers (on infra link) to track by routing manager. - * - */ -#ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_DISCOVERED_ROUTERS -#define OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_DISCOVERED_ROUTERS 16 -#endif - -/** - * @def OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_DISCOVERED_PREFIXES - * - * Specifies maximum number of discovered prefixes (on-link prefixes on the infra link) maintained by routing manager. - * - */ -#ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_DISCOVERED_PREFIXES -#define OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_DISCOVERED_PREFIXES 64 -#endif - -/** - * @def OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_ON_MESH_PREFIXES - * - * Specified maximum number of on-mesh prefixes (discovered from Thread Network Data) that are included as Route Info - * Option in emitted Router Advertisement messages. - * - */ -#ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_ON_MESH_PREFIXES -#define OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_ON_MESH_PREFIXES 16 -#endif - -/** - * @def OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE - * - * Define to 1 to enable Border Routing NAT64 support. - * - */ -#ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE -#define OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE 0 -#endif - -/** - * @def OPENTHREAD_CONFIG_BORDER_AGENT_UDP_PORT - * - * Specifies the Border Agent UDP port, and use 0 for ephemeral port. - * - */ -#ifndef OPENTHREAD_CONFIG_BORDER_AGENT_UDP_PORT -#define OPENTHREAD_CONFIG_BORDER_AGENT_UDP_PORT 0 -#endif - #endif // CONFIG_BORDER_ROUTER_H_ diff --git a/src/core/config/border_routing.h b/src/core/config/border_routing.h new file mode 100644 index 000000000..c55d3ea21 --- /dev/null +++ b/src/core/config/border_routing.h @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2021-22, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes compile-time configurations for Border Routing Manager. + * + */ + +#ifndef CONFIG_BORDER_ROUTING_H_ +#define CONFIG_BORDER_ROUTING_H_ + +/** + * @def OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE + * + * Define to 1 to enable Border Routing Manager feature. + * + */ +#ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE +#define OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_DISCOVERED_ROUTERS + * + * Specifies maximum number of routers (on infra link) to track by routing manager. + * + */ +#ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_DISCOVERED_ROUTERS +#define OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_DISCOVERED_ROUTERS 16 +#endif + +/** + * @def OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_DISCOVERED_PREFIXES + * + * Specifies maximum number of discovered prefixes (on-link prefixes on the infra link) maintained by routing manager. + * + */ +#ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_DISCOVERED_PREFIXES +#define OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_DISCOVERED_PREFIXES 64 +#endif + +/** + * @def OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_ON_MESH_PREFIXES + * + * Specified maximum number of on-mesh prefixes (discovered from Thread Network Data) that are included as Route Info + * Option in emitted Router Advertisement messages. + * + */ +#ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_ON_MESH_PREFIXES +#define OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_ON_MESH_PREFIXES 16 +#endif + +/** + * @def OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE + * + * Define to 1 to enable Border Routing NAT64 support. + * + */ +#ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE +#define OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE 0 +#endif + +#endif // CONFIG_BORDER_ROUTING_H_ diff --git a/src/core/config/dtls.h b/src/core/config/dtls.h index be6077d99..09e833788 100644 --- a/src/core/config/dtls.h +++ b/src/core/config/dtls.h @@ -35,7 +35,7 @@ #ifndef CONFIG_DTLS_H_ #define CONFIG_DTLS_H_ -#include "config/border_router.h" +#include "config/border_agent.h" #include "config/coap.h" #include "config/commissioner.h" #include "config/joiner.h" @@ -50,11 +50,16 @@ #define OPENTHREAD_CONFIG_DTLS_MAX_CONTENT_LEN MBEDTLS_SSL_IN_CONTENT_LEN #endif -#if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE || OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE || \ - OPENTHREAD_CONFIG_COMMISSIONER_ENABLE || OPENTHREAD_CONFIG_JOINER_ENABLE -#define OPENTHREAD_CONFIG_DTLS_ENABLE 1 -#else -#define OPENTHREAD_CONFIG_DTLS_ENABLE 0 +/** + * @def OPENTHREAD_CONFIG_DTLS_ENABLE + * + * Define to 1 to enable DTLS. + * + */ +#ifndef OPENTHREAD_CONFIG_DTLS_ENABLE +#define OPENTHREAD_CONFIG_DTLS_ENABLE \ + (OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE || OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE || \ + OPENTHREAD_CONFIG_COMMISSIONER_ENABLE || OPENTHREAD_CONFIG_JOINER_ENABLE) #endif #endif // CONFIG_DTLS_H_ diff --git a/src/core/config/netdata_publisher.h b/src/core/config/netdata_publisher.h index bd3ef8f64..21fcdb56c 100644 --- a/src/core/config/netdata_publisher.h +++ b/src/core/config/netdata_publisher.h @@ -36,6 +36,7 @@ #define CONFIG_NETDATA_PUBLISHER_H_ #include "config/border_router.h" +#include "config/border_routing.h" #include "config/srp_server.h" /** diff --git a/src/core/openthread-core-config.h b/src/core/openthread-core-config.h index da7e18565..1949a74fc 100644 --- a/src/core/openthread-core-config.h +++ b/src/core/openthread-core-config.h @@ -58,7 +58,9 @@ #include "config/announce_sender.h" #include "config/backbone_router.h" +#include "config/border_agent.h" #include "config/border_router.h" +#include "config/border_routing.h" #include "config/channel_manager.h" #include "config/channel_monitor.h" #include "config/child_supervision.h"