1 // Copyright 2018 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_DNS_PUBLIC_HOST_RESOLVER_SOURCE_H_ 6 #define NET_DNS_PUBLIC_HOST_RESOLVER_SOURCE_H_ 7 8 #include <iterator> 9 10 namespace net { 11 12 // Enumeration to specify the allowed results source for HostResolver 13 // requests. 14 enum class HostResolverSource { 15 // Resolver will pick an appropriate source. Results could come from DNS, 16 // MulticastDNS, HOSTS file, etc. 17 ANY, 18 19 // Results will only be retrieved from the system or OS, eg via the 20 // getaddrinfo() system call. 21 SYSTEM, 22 23 // Results will only come from DNS queries. 24 DNS, 25 26 // Results will only come from Multicast DNS queries. 27 MULTICAST_DNS, 28 29 // No external sources will be used. Results will only come from fast local 30 // sources that are available no matter the source setting, e.g. cache, hosts 31 // file, IP literal resolution, etc. Resolves with this setting are guaranteed 32 // to finish synchronously. Resolves with this settings will return 33 // ERR_NAME_NOT_RESOLVED if an asynchronous IPv6 reachability probe needs to 34 // be done. 35 LOCAL_ONLY, 36 37 MAX = LOCAL_ONLY 38 }; 39 40 const HostResolverSource kHostResolverSources[] = { 41 HostResolverSource::ANY, HostResolverSource::SYSTEM, 42 HostResolverSource::DNS, HostResolverSource::MULTICAST_DNS, 43 HostResolverSource::LOCAL_ONLY}; 44 45 static_assert( 46 std::size(kHostResolverSources) == 47 static_cast<unsigned>(HostResolverSource::MAX) + 1, 48 "All HostResolverSource values should be in kHostResolverSources."); 49 50 } // namespace net 51 52 #endif // NET_DNS_PUBLIC_HOST_RESOLVER_SOURCE_H_ 53