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 /** 30 * @file 31 * This file includes compile-time configurations for the DNS Client. 32 * 33 */ 34 35 #ifndef CONFIG_DNS_CLIENT_H_ 36 #define CONFIG_DNS_CLIENT_H_ 37 38 #include "config/ip6.h" 39 #include "config/srp_client.h" 40 41 /** 42 * @def OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 43 * 44 * Define to 1 to enable DNS Client support. 45 * 46 */ 47 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 48 #define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 0 49 #endif 50 51 /** 52 * @def OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE 53 * 54 * Define to 1 to enable support for NAT64 address translation (from IPv4 to IPv6) during address resolution by DNS 55 * client. 56 * 57 */ 58 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE 59 #define OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE 1 60 #endif 61 62 /** 63 * @def OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_NAT64_ALLOWED 64 * 65 * Specifies the default NAT64 mode, i.e., whether to allow or disallow NAT64 address translation during DNS client 66 * address resolution. This mode is only available when `OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE` is enabled. 67 * 68 */ 69 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_NAT64_ALLOWED 70 #define OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_NAT64_ALLOWED 1 71 #endif 72 73 /** 74 * @def OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE 75 * 76 * Define to 1 to enable DNS based Service Discovery (DNS-SD) client. 77 * 78 */ 79 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE 80 #define OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE 1 81 #endif 82 83 /** 84 * @def OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_ADDRESS_AUTO_SET_ENABLE 85 * 86 * Set to 1 for DNS client to automatically set and update the server IPv6 address in the default config (when it is 87 * not explicitly set by user). 88 * 89 * This feature requires SRP client and its auto-start feature to be also enabled. SRP client will then monitor the 90 * Thread Network Data for DNS/SRP Service entries to select an SRP server. The selected SRP server address is also set 91 * as the DNS server address in the default config. 92 * 93 */ 94 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_ADDRESS_AUTO_SET_ENABLE 95 #define OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_ADDRESS_AUTO_SET_ENABLE \ 96 (OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE && OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE) 97 #endif 98 99 /** 100 * @def OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_IP6_ADDRESS 101 * 102 * Specifies the default DNS server IPv6 address. 103 * 104 * It MUST be a C string representation of the server IPv6 address. 105 * 106 * Default value is set to "2001:4860:4860::8888" which is the Google Public DNS IPv6 address. 107 * 108 */ 109 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_IP6_ADDRESS 110 #define OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_IP6_ADDRESS "2001:4860:4860::8888" 111 #endif 112 113 /** 114 * @def OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_PORT 115 * 116 * Specifies the default DNS server port number. 117 * 118 */ 119 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_PORT 120 #define OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_PORT 53 121 #endif 122 123 /** 124 * @def OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_RESPONSE_TIMEOUT 125 * 126 * Specifies the default wait time that DNS client waits for a response from server (in milliseconds). 127 * 128 */ 129 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_RESPONSE_TIMEOUT 130 #define OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_RESPONSE_TIMEOUT 6000 131 #endif 132 133 /** 134 * @def OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_MAX_TX_ATTEMPTS 135 * 136 * Specifies the default maximum number of DNS query tx attempts with no response before reporting failure. 137 * 138 */ 139 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_MAX_TX_ATTEMPTS 140 #define OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_MAX_TX_ATTEMPTS 3 141 #endif 142 143 /** 144 * @def OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_NO_RECURSION_FLAG 145 * 146 * Specifies the default "recursion desired" flag (indicates whether the server can resolve the query recursively or 147 * not). 148 * 149 */ 150 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_RECURSION_DESIRED_FLAG 151 #define OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_RECURSION_DESIRED_FLAG 1 152 #endif 153 154 /** 155 * @def OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVICE_MODE 156 * 157 * Specifies the default `otDnsServiceMode` to use. The value MUST be from `otDnsServiceMode` enumeration. 158 * 159 */ 160 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVICE_MODE 161 #define OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVICE_MODE OT_DNS_SERVICE_MODE_SRV_TXT_OPTIMIZE 162 #endif 163 164 /** 165 * @def OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE 166 * 167 * Enables support for sending DNS Queries over TCP. 168 * 169 */ 170 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE 171 #define OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE 0 172 #endif 173 174 /** 175 * @def OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_QUERY_MAX_SIZE 176 * 177 * Specifies size of receive and transmit buffers of TCP sockets for DNS query over TCP. 178 * 179 */ 180 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_QUERY_MAX_SIZE 181 #define OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_QUERY_MAX_SIZE 1024 182 #endif 183 184 #endif // CONFIG_DNS_CLIENT_H_ 185