OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_BASE_DNS_UTIL_H_ | 5 #ifndef NET_BASE_DNS_UTIL_H_ |
6 #define NET_BASE_DNS_UTIL_H_ | 6 #define NET_BASE_DNS_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 // DNSDomainFromDot - convert a domain string to DNS format. From DJB's | 15 // DNSDomainFromDot - convert a domain string to DNS format. From DJB's |
16 // public domain DNS library. | 16 // public domain DNS library. |
17 // | 17 // |
18 // dotted: a string in dotted form: "www.google.com" | 18 // dotted: a string in dotted form: "www.google.com" |
19 // out: a result in DNS form: "\x03www\x06google\x03com\x00" | 19 // out: a result in DNS form: "\x03www\x06google\x03com\x00" |
20 bool DNSDomainFromDot(const std::string& dotted, std::string* out); | 20 bool DNSDomainFromDot(const std::string& dotted, std::string* out); |
21 | 21 |
| 22 // DNSDomainToString coverts a domain in DNS format to a dotted string. |
| 23 std::string DNSDomainToString(const std::string& domain); |
| 24 |
22 // Returns true iff the given character is in the set of valid DNS label | 25 // Returns true iff the given character is in the set of valid DNS label |
23 // characters as given in RFC 3490, 4.1, 3(a) | 26 // characters as given in RFC 3490, 4.1, 3(a) |
24 bool IsSTD3ASCIIValidCharacter(char c); | 27 bool IsSTD3ASCIIValidCharacter(char c); |
25 | 28 |
26 // Returns the hostname by trimming the ending dot, if one exists. | 29 // Returns the hostname by trimming the ending dot, if one exists. |
27 std::string TrimEndingDot(const std::string& host); | 30 std::string TrimEndingDot(const std::string& host); |
28 | 31 |
29 // DNS resource record types. See | 32 // DNS resource record types. See |
30 // http://www.iana.org/assignments/dns-parameters | 33 // http://www.iana.org/assignments/dns-parameters |
31 // WARNING: if you're adding any new values here you may need to add them to | 34 // WARNING: if you're adding any new values here you may need to add them to |
(...skipping 14 matching lines...) Expand all Loading... |
46 static const uint8 kDNSSEC_RSA_SHA1_NSEC3 = 7; | 49 static const uint8 kDNSSEC_RSA_SHA1_NSEC3 = 7; |
47 static const uint8 kDNSSEC_RSA_SHA256 = 8; | 50 static const uint8 kDNSSEC_RSA_SHA256 = 8; |
48 | 51 |
49 // RFC 4509 | 52 // RFC 4509 |
50 static const uint8 kDNSSEC_SHA1 = 1; | 53 static const uint8 kDNSSEC_SHA1 = 1; |
51 static const uint8 kDNSSEC_SHA256 = 2; | 54 static const uint8 kDNSSEC_SHA256 = 2; |
52 | 55 |
53 } // namespace net | 56 } // namespace net |
54 | 57 |
55 #endif // NET_BASE_DNS_UTIL_H_ | 58 #endif // NET_BASE_DNS_UTIL_H_ |
OLD | NEW |