blob: 3332cb84275acd75ffc4931c196434815423cb6f [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"
[email protected]172da1b2011-08-12 15:52:2611#include "net/base/net_export.h"
[email protected]b3ccac82010-08-04 15:54:4012
[email protected]c36f0642009-09-09 01:10:5013namespace 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]7556ea22011-12-08 19:29:1520NET_EXPORT_PRIVATE bool DNSDomainFromDot(const base::StringPiece& dotted,
[email protected]172da1b2011-08-12 15:52:2621 std::string* out);
[email protected]c36f0642009-09-09 01:10:5022
[email protected]d0d49dd82012-01-26 00:03:5923// DNSDomainToString converts a domain in DNS format to a dotted string.
24// Excludes the dot at the end.
[email protected]7556ea22011-12-08 19:29:1525NET_EXPORT_PRIVATE std::string DNSDomainToString(
26 const base::StringPiece& domain);
[email protected]f060be32011-02-17 17:20:2827
[email protected]c36f0642009-09-09 01:10:5028} // namespace net
29
tfarina77021d62015-10-11 20:19:0330#endif // NET_DNS_DNS_UTIL_H_