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 /** 30 * @file 31 * This file includes compile-time configurations for Network Data Publisher. 32 * 33 */ 34 35 #ifndef CONFIG_NETDATA_PUBLISHER_H_ 36 #define CONFIG_NETDATA_PUBLISHER_H_ 37 38 /** 39 * @addtogroup config-netdata-publisher 40 * 41 * @brief 42 * This module includes configuration variables for Network Data Publisher. 43 * 44 * @{ 45 * 46 */ 47 48 #include "config/border_router.h" 49 #include "config/border_routing.h" 50 #include "config/srp_server.h" 51 52 /** 53 * @def OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE 54 * 55 * Define to 1 to enable Network Data Publisher. 56 * 57 * Network Data Publisher provides mechanisms to limit the number of similar Service and/or Prefix (on-mesh prefix 58 * or external route) entries in the Thread Network Data by monitoring the Network Data and managing if or when to add 59 * or remove entries. 60 * 61 */ 62 #ifndef OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE 63 #define OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE \ 64 (OPENTHREAD_CONFIG_SRP_SERVER_ENABLE || OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE) 65 #endif 66 67 /** 68 * @def OPENTHREAD_CONFIG_NETDATA_PUBLISHER_MAX_DELAY_TO_ADD 69 * 70 * Specifies the maximum value (in milliseconds) of the random delay used before adding an entry in the Thread Network 71 * Data. 72 * 73 */ 74 #ifndef OPENTHREAD_CONFIG_NETDATA_PUBLISHER_MAX_DELAY_TO_ADD 75 #define OPENTHREAD_CONFIG_NETDATA_PUBLISHER_MAX_DELAY_TO_ADD 3500 76 #endif 77 78 /** 79 * @def OPENTHREAD_CONFIG_NETDATA_PUBLISHER_MAX_DELAY_TO_REMOVE 80 * 81 * Specifies the maximum value (in milliseconds) of the random wait time used before removing an entry from the Thread 82 * Network Data. 83 * 84 */ 85 #ifndef OPENTHREAD_CONFIG_NETDATA_PUBLISHER_MAX_DELAY_TO_REMOVE 86 #define OPENTHREAD_CONFIG_NETDATA_PUBLISHER_MAX_DELAY_TO_REMOVE 15000 87 #endif 88 89 /** 90 * @def OPENTHREAD_CONFIG_NETDATA_PUBLISHER_EXTRA_DELAY_TIME_TO_REMOVE_PREFERRED 91 * 92 * Specifies the extra wait time (in milliseconds) used when removing a preferred entry. 93 * 94 * When removing entries, certain entries are preferred over others. How the preference is determined depends on the 95 * entry type (e.g., (for DNS/SRP service entries associated with smaller RLOC16 or smaller IPv6 address are preferred). 96 * If the `Publisher` determines that its own entry is a preferred one, it adds the above extra wait time in addition 97 * to the random wait selected based on `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_MAX_DELAY_TO_REMOVE` before removing 98 * its entry. This gives higher chance for a non-preferred entry from another device to be removed before removing a 99 * preferred entry which helps towards quicker convergence of the process to the desired number of entries. 100 * 101 * It is recommended that `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_EXTRA_DELAY_TIME_TO_REMOVE_PREFERRED` to be set to a 102 * value larger than `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_MAX_DELAY_TO_REMOVE` to ensure that non-preferred entries 103 * are removed first. 104 * 105 */ 106 #ifndef OPENTHREAD_CONFIG_NETDATA_PUBLISHER_EXTRA_DELAY_TIME_TO_REMOVE_PREFERRED 107 #define OPENTHREAD_CONFIG_NETDATA_PUBLISHER_EXTRA_DELAY_TIME_TO_REMOVE_PREFERRED 16000 108 #endif 109 110 /** 111 * @def OPENTHREAD_CONFIG_NETDATA_PUBLISHER_DESIRED_NUM_ANYCAST_DNS_SRP_SERVICE_ENTRIES 112 * 113 * Specifies the desired number of "DNS/SRP Service Anycast Address" entries in the Thread Network Data. 114 * 115 * Publisher attempts to limit the number of such entries to this value. 116 * 117 */ 118 #ifndef OPENTHREAD_CONFIG_NETDATA_PUBLISHER_DESIRED_NUM_ANYCAST_DNS_SRP_SERVICE_ENTRIES 119 #define OPENTHREAD_CONFIG_NETDATA_PUBLISHER_DESIRED_NUM_ANYCAST_DNS_SRP_SERVICE_ENTRIES 8 120 #endif 121 122 /** 123 * @def OPENTHREAD_CONFIG_NETDATA_PUBLISHER_DESIRED_NUM_UNICAST_DNS_SRP_SERVICE_ENTRIES 124 * 125 * Specifies the desired number of "DNS/SRP Service Anycast Address" entries in the Thread Network Data. 126 * 127 * Publisher attempts to limit the number of such entries to this value. 128 * 129 */ 130 #ifndef OPENTHREAD_CONFIG_NETDATA_PUBLISHER_DESIRED_NUM_UNICAST_DNS_SRP_SERVICE_ENTRIES 131 #define OPENTHREAD_CONFIG_NETDATA_PUBLISHER_DESIRED_NUM_UNICAST_DNS_SRP_SERVICE_ENTRIES 2 132 #endif 133 134 /** 135 * @def OPENTHREAD_CONFIG_NETDATA_PUBLISHER_DESIRED_NUM_ON_MESH_PREFIX_ENTRIES 136 * 137 * Specifies the desired number of matching On-mesh Prefix entries in the Thread Network Data. 138 * 139 * Publisher attempts to limit the number of matching entries to this value. 140 * 141 */ 142 #ifndef OPENTHREAD_CONFIG_NETDATA_PUBLISHER_DESIRED_NUM_ON_MESH_PREFIX_ENTRIES 143 #define OPENTHREAD_CONFIG_NETDATA_PUBLISHER_DESIRED_NUM_ON_MESH_PREFIX_ENTRIES 3 144 #endif 145 146 /** 147 * @def OPENTHREAD_CONFIG_NETDATA_PUBLISHER_DESIRED_NUM_EXTERNAL_ROUTE_ENTRIES 148 * 149 * Specifies the desired number of matching External Route entries in the Thread Network Data. 150 * 151 * Publisher attempts to limit the number of matching entries to this value. 152 * 153 */ 154 #ifndef OPENTHREAD_CONFIG_NETDATA_PUBLISHER_DESIRED_NUM_EXTERNAL_ROUTE_ENTRIES 155 #define OPENTHREAD_CONFIG_NETDATA_PUBLISHER_DESIRED_NUM_EXTERNAL_ROUTE_ENTRIES 10 156 #endif 157 158 /** 159 * @def OPENTHREAD_CONFIG_NETDATA_PUBLISHER_MAX_PREFIX_ENTRIES 160 * 161 * Specifies maximum number of prefix (on-mesh prefix or external route) entries reserved by Publisher for use by 162 * user (through OT public APIs). 163 * 164 */ 165 #ifndef OPENTHREAD_CONFIG_NETDATA_PUBLISHER_MAX_PREFIX_ENTRIES 166 #define OPENTHREAD_CONFIG_NETDATA_PUBLISHER_MAX_PREFIX_ENTRIES 3 167 #endif 168 169 /** 170 * @} 171 * 172 */ 173 174 #endif // CONFIG_NETDATA_PUBLISHER_H_ 175