blob: cf9633be8b2123207b63df6a2308994e8703ca59 [file] [log] [blame]
Eric Orthdc35748e2018-08-23 22:41:481// Copyright 2018 The Chromium Authors. All rights reserved.
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_HOST_RESOLVER_SOURCE_H_
6#define NET_DNS_HOST_RESOLVER_SOURCE_H_
7
Eric Orth50d4b202019-01-14 18:38:288#include "base/stl_util.h"
9
Eric Orth12c47252018-09-05 17:04:0710namespace net {
11
Eric Orthdc35748e2018-08-23 22:41:4812// Enumeration to specify the allowed results source for HostResolver
13// requests.
14enum 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
Eric Orth9871aafa2018-10-02 19:59:1826 // Results will only come from Multicast DNS queries.
27 MULTICAST_DNS,
Eric Orth50d4b202019-01-14 18:38:2828
Eric Ortheb332862019-01-26 00:52:3829 // 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.
33 LOCAL_ONLY,
34
35 MAX = LOCAL_ONLY
Eric Orthdc35748e2018-08-23 22:41:4836};
37
Eric Orth50d4b202019-01-14 18:38:2838const HostResolverSource kHostResolverSources[] = {
39 HostResolverSource::ANY, HostResolverSource::SYSTEM,
Eric Ortheb332862019-01-26 00:52:3840 HostResolverSource::DNS, HostResolverSource::MULTICAST_DNS,
41 HostResolverSource::LOCAL_ONLY};
Eric Orth50d4b202019-01-14 18:38:2842
43static_assert(
44 base::size(kHostResolverSources) ==
45 static_cast<unsigned>(HostResolverSource::MAX) + 1,
46 "All HostResolverSource values should be in kHostResolverSources.");
47
Eric Orth12c47252018-09-05 17:04:0748} // namespace net
49
Eric Orthdc35748e2018-08-23 22:41:4850#endif // NET_DNS_HOST_RESOLVER_SOURCE_H_