[email protected] | d0d49dd8 | 2012-01-26 00:03:59 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | c36f064 | 2009-09-09 01:10:50 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
tfarina | 77021d6 | 2015-10-11 20:19:03 | [diff] [blame] | 5 | #ifndef NET_DNS_DNS_UTIL_H_ |
6 | #define NET_DNS_DNS_UTIL_H_ | ||||
[email protected] | c36f064 | 2009-09-09 01:10:50 | [diff] [blame] | 7 | |
8 | #include <string> | ||||
9 | |||||
[email protected] | d069c11a | 2013-04-13 00:01:55 | [diff] [blame] | 10 | #include "base/strings/string_piece.h" |
ttuttle | cf1158bf | 2016-03-18 16:37:44 | [diff] [blame^] | 11 | #include "base/time/time.h" |
[email protected] | 172da1b | 2011-08-12 15:52:26 | [diff] [blame] | 12 | #include "net/base/net_export.h" |
ttuttle | cf1158bf | 2016-03-18 16:37:44 | [diff] [blame^] | 13 | #include "net/base/network_change_notifier.h" |
[email protected] | b3ccac8 | 2010-08-04 15:54:40 | [diff] [blame] | 14 | |
[email protected] | c36f064 | 2009-09-09 01:10:50 | [diff] [blame] | 15 | namespace net { |
16 | |||||
17 | // DNSDomainFromDot - convert a domain string to DNS format. From DJB's | ||||
18 | // public domain DNS library. | ||||
19 | // | ||||
20 | // dotted: a string in dotted form: "www.google.com" | ||||
21 | // out: a result in DNS form: "\x03www\x06google\x03com\x00" | ||||
[email protected] | 7556ea2 | 2011-12-08 19:29:15 | [diff] [blame] | 22 | NET_EXPORT_PRIVATE bool DNSDomainFromDot(const base::StringPiece& dotted, |
[email protected] | 172da1b | 2011-08-12 15:52:26 | [diff] [blame] | 23 | std::string* out); |
[email protected] | c36f064 | 2009-09-09 01:10:50 | [diff] [blame] | 24 | |
[email protected] | d0d49dd8 | 2012-01-26 00:03:59 | [diff] [blame] | 25 | // DNSDomainToString converts a domain in DNS format to a dotted string. |
26 | // Excludes the dot at the end. | ||||
[email protected] | 7556ea2 | 2011-12-08 19:29:15 | [diff] [blame] | 27 | NET_EXPORT_PRIVATE std::string DNSDomainToString( |
28 | const base::StringPiece& domain); | ||||
[email protected] | f060be3 | 2011-02-17 17:20:28 | [diff] [blame] | 29 | |
tfarina | ecc304ec | 2015-12-16 05:37:54 | [diff] [blame] | 30 | // Returns true if it can determine that only loopback addresses are configured. |
31 | // i.e. if only 127.0.0.1 and ::1 are routable. | ||||
32 | // Also returns false if it cannot determine this. | ||||
33 | NET_EXPORT_PRIVATE bool HaveOnlyLoopbackAddresses(); | ||||
34 | |||||
ttuttle | cf1158bf | 2016-03-18 16:37:44 | [diff] [blame^] | 35 | #if !defined(OS_NACL) |
36 | NET_EXPORT_PRIVATE | ||||
37 | base::TimeDelta GetTimeDeltaForConnectionTypeFromFieldTrialOrDefault( | ||||
38 | const char* field_trial_name, | ||||
39 | base::TimeDelta default_delta, | ||||
40 | NetworkChangeNotifier::ConnectionType connection_type); | ||||
41 | #endif // !defined(OS_NACL) | ||||
42 | |||||
[email protected] | c36f064 | 2009-09-09 01:10:50 | [diff] [blame] | 43 | } // namespace net |
44 | |||||
tfarina | 77021d6 | 2015-10-11 20:19:03 | [diff] [blame] | 45 | #endif // NET_DNS_DNS_UTIL_H_ |