| 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" |
| 12 |
| 11 namespace net { | 13 namespace net { |
| 12 | 14 |
| 13 // DNSDomainFromDot - convert a domain string to DNS format. From DJB's | 15 // DNSDomainFromDot - convert a domain string to DNS format. From DJB's |
| 14 // public domain DNS library. | 16 // public domain DNS library. |
| 15 // | 17 // |
| 16 // dotted: a string in dotted form: "www.google.com" | 18 // dotted: a string in dotted form: "www.google.com" |
| 17 // out: a result in DNS form: "\x03www\x06google\x03com\x00" | 19 // out: a result in DNS form: "\x03www\x06google\x03com\x00" |
| 18 bool DNSDomainFromDot(const std::string& dotted, std::string* out); | 20 bool DNSDomainFromDot(const std::string& dotted, std::string* out); |
| 19 | 21 |
| 20 // Returns true iff the given character is in the set of valid DNS label | 22 // Returns true iff the given character is in the set of valid DNS label |
| 21 // characters as given in RFC 3490, 4.1, 3(a) | 23 // characters as given in RFC 3490, 4.1, 3(a) |
| 22 bool IsSTD3ASCIIValidCharacter(char c); | 24 bool IsSTD3ASCIIValidCharacter(char c); |
| 23 | 25 |
| 24 // Returns the hostname by trimming the ending dot, if one exists. | 26 // Returns the hostname by trimming the ending dot, if one exists. |
| 25 std::string TrimEndingDot(const std::string& host); | 27 std::string TrimEndingDot(const std::string& host); |
| 26 | 28 |
| 29 // DNS resource record types. See |
| 30 // http://www.iana.org/assignments/dns-parameters |
| 31 |
| 32 static const uint16 kDNS_TXT = 16; |
| 33 static const uint16 kDNS_RRSIG = 46; |
| 34 static const uint16 kDNS_CERT = 37; |
| 35 static const uint16 kDNS_ANY = 0xff; |
| 36 |
| 27 } // namespace net | 37 } // namespace net |
| 28 | 38 |
| 29 #endif // NET_BASE_DNS_UTIL_H_ | 39 #endif // NET_BASE_DNS_UTIL_H_ |
| OLD | NEW |