blob: 1acbd668cdcd7670ed60ba13159ccc5cb79758e7 [file] [log] [blame]
[email protected]d0d49dd82012-01-26 00:03:591// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]c36f0642009-09-09 01:10:502// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
tfarina77021d62015-10-11 20:19:035#ifndef NET_DNS_DNS_UTIL_H_
6#define NET_DNS_DNS_UTIL_H_
[email protected]c36f0642009-09-09 01:10:507
8#include <string>
9
[email protected]d069c11a2013-04-13 00:01:5510#include "base/strings/string_piece.h"
ttuttlecf1158bf2016-03-18 16:37:4411#include "base/time/time.h"
[email protected]172da1b2011-08-12 15:52:2612#include "net/base/net_export.h"
ttuttlecf1158bf2016-03-18 16:37:4413#include "net/base/network_change_notifier.h"
[email protected]b3ccac82010-08-04 15:54:4014
[email protected]c36f0642009-09-09 01:10:5015namespace 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]7556ea22011-12-08 19:29:1522NET_EXPORT_PRIVATE bool DNSDomainFromDot(const base::StringPiece& dotted,
[email protected]172da1b2011-08-12 15:52:2623 std::string* out);
[email protected]c36f0642009-09-09 01:10:5024
[email protected]d0d49dd82012-01-26 00:03:5925// DNSDomainToString converts a domain in DNS format to a dotted string.
26// Excludes the dot at the end.
[email protected]7556ea22011-12-08 19:29:1527NET_EXPORT_PRIVATE std::string DNSDomainToString(
28 const base::StringPiece& domain);
[email protected]f060be32011-02-17 17:20:2829
tfarinaecc304ec2015-12-16 05:37:5430// 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.
33NET_EXPORT_PRIVATE bool HaveOnlyLoopbackAddresses();
34
ttuttlecf1158bf2016-03-18 16:37:4435#if !defined(OS_NACL)
36NET_EXPORT_PRIVATE
37base::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]c36f0642009-09-09 01:10:5043} // namespace net
44
tfarina77021d62015-10-11 20:19:0345#endif // NET_DNS_DNS_UTIL_H_