xref: /aosp_15_r20/external/cronet/net/dns/public/secure_dns_mode.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2020 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_SECURE_DNS_MODE_H_
6 #define NET_DNS_PUBLIC_SECURE_DNS_MODE_H_
7 
8 #include <string_view>
9 
10 #include "base/containers/fixed_flat_map.h"
11 
12 namespace net {
13 
14 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net
15 // The SecureDnsMode specifies what types of lookups (secure/insecure) should
16 // be performed and in what order when resolving a specific query. The int
17 // values should not be changed as they are logged.
18 enum class SecureDnsMode : int {
19   // In OFF mode, no DoH lookups should be performed.
20   kOff = 0,
21   // In AUTOMATIC mode, DoH lookups should be performed first if DoH is
22   // available, and insecure DNS lookups should be performed as a fallback.
23   kAutomatic = 1,
24   // In SECURE mode, only DoH lookups should be performed.
25   kSecure = 2,
26 };
27 
28 inline constexpr auto kSecureDnsModes =
29     base::MakeFixedFlatMap<SecureDnsMode, std::string_view>(
30         {{SecureDnsMode::kOff, "Off"},
31          {SecureDnsMode::kAutomatic, "Automatic"},
32          {SecureDnsMode::kSecure, "Secure"}});
33 
34 }  // namespace net
35 
36 #endif  // NET_DNS_PUBLIC_SECURE_DNS_MODE_H_
37