[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" |
[email protected] | 172da1b | 2011-08-12 15:52:26 | [diff] [blame] | 11 | #include "net/base/net_export.h" |
[email protected] | b3ccac8 | 2010-08-04 15:54:40 | [diff] [blame] | 12 | |
[email protected] | c36f064 | 2009-09-09 01:10:50 | [diff] [blame] | 13 | namespace net { |
14 | |||||
15 | // DNSDomainFromDot - convert a domain string to DNS format. From DJB's | ||||
16 | // public domain DNS library. | ||||
17 | // | ||||
18 | // dotted: a string in dotted form: "www.google.com" | ||||
19 | // out: a result in DNS form: "\x03www\x06google\x03com\x00" | ||||
[email protected] | 7556ea2 | 2011-12-08 19:29:15 | [diff] [blame] | 20 | NET_EXPORT_PRIVATE bool DNSDomainFromDot(const base::StringPiece& dotted, |
[email protected] | 172da1b | 2011-08-12 15:52:26 | [diff] [blame] | 21 | std::string* out); |
[email protected] | c36f064 | 2009-09-09 01:10:50 | [diff] [blame] | 22 | |
[email protected] | d0d49dd8 | 2012-01-26 00:03:59 | [diff] [blame] | 23 | // DNSDomainToString converts a domain in DNS format to a dotted string. |
24 | // Excludes the dot at the end. | ||||
[email protected] | 7556ea2 | 2011-12-08 19:29:15 | [diff] [blame] | 25 | NET_EXPORT_PRIVATE std::string DNSDomainToString( |
26 | const base::StringPiece& domain); | ||||
[email protected] | f060be3 | 2011-02-17 17:20:28 | [diff] [blame] | 27 | |
[email protected] | c36f064 | 2009-09-09 01:10:50 | [diff] [blame] | 28 | } // namespace net |
29 | |||||
tfarina | 77021d6 | 2015-10-11 20:19:03 | [diff] [blame^] | 30 | #endif // NET_DNS_DNS_UTIL_H_ |