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