| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_DNS_DNS_UTIL_H_ | 5 #ifndef NET_DNS_DNS_UTIL_H_ |
| 6 #define NET_DNS_DNS_UTIL_H_ | 6 #define NET_DNS_DNS_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| 11 #include "base/time/time.h" |
| 11 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
| 13 #include "net/base/network_change_notifier.h" |
| 12 | 14 |
| 13 namespace net { | 15 namespace net { |
| 14 | 16 |
| 15 // DNSDomainFromDot - convert a domain string to DNS format. From DJB's | 17 // DNSDomainFromDot - convert a domain string to DNS format. From DJB's |
| 16 // public domain DNS library. | 18 // public domain DNS library. |
| 17 // | 19 // |
| 18 // dotted: a string in dotted form: "www.google.com" | 20 // dotted: a string in dotted form: "www.google.com" |
| 19 // out: a result in DNS form: "\x03www\x06google\x03com\x00" | 21 // out: a result in DNS form: "\x03www\x06google\x03com\x00" |
| 20 NET_EXPORT_PRIVATE bool DNSDomainFromDot(const base::StringPiece& dotted, | 22 NET_EXPORT_PRIVATE bool DNSDomainFromDot(const base::StringPiece& dotted, |
| 21 std::string* out); | 23 std::string* out); |
| 22 | 24 |
| 23 // DNSDomainToString converts a domain in DNS format to a dotted string. | 25 // DNSDomainToString converts a domain in DNS format to a dotted string. |
| 24 // Excludes the dot at the end. | 26 // Excludes the dot at the end. |
| 25 NET_EXPORT_PRIVATE std::string DNSDomainToString( | 27 NET_EXPORT_PRIVATE std::string DNSDomainToString( |
| 26 const base::StringPiece& domain); | 28 const base::StringPiece& domain); |
| 27 | 29 |
| 28 // Returns true if it can determine that only loopback addresses are configured. | 30 // Returns true if it can determine that only loopback addresses are configured. |
| 29 // i.e. if only 127.0.0.1 and ::1 are routable. | 31 // i.e. if only 127.0.0.1 and ::1 are routable. |
| 30 // Also returns false if it cannot determine this. | 32 // Also returns false if it cannot determine this. |
| 31 NET_EXPORT_PRIVATE bool HaveOnlyLoopbackAddresses(); | 33 NET_EXPORT_PRIVATE bool HaveOnlyLoopbackAddresses(); |
| 32 | 34 |
| 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 |
| 33 } // namespace net | 43 } // namespace net |
| 34 | 44 |
| 35 #endif // NET_DNS_DNS_UTIL_H_ | 45 #endif // NET_DNS_DNS_UTIL_H_ |
| OLD | NEW |