[email protected] | c36f064 | 2009-09-09 01:10:50 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef NET_BASE_DNS_UTIL_H_ | ||||
6 | #define NET_BASE_DNS_UTIL_H_ | ||||
[email protected] | 32b76ef | 2010-07-26 23:08:24 | [diff] [blame] | 7 | #pragma once |
[email protected] | c36f064 | 2009-09-09 01:10:50 | [diff] [blame] | 8 | |
9 | #include <string> | ||||
10 | |||||
[email protected] | b3ccac8 | 2010-08-04 15:54:40 | [diff] [blame] | 11 | #include "base/basictypes.h" |
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" | ||||
20 | bool DNSDomainFromDot(const std::string& dotted, std::string* out); | ||||
21 | |||||
22 | // 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) | ||||
24 | bool IsSTD3ASCIIValidCharacter(char c); | ||||
25 | |||||
[email protected] | 13c340e1 | 2010-03-08 19:29:41 | [diff] [blame] | 26 | // Returns the hostname by trimming the ending dot, if one exists. |
27 | std::string TrimEndingDot(const std::string& host); | ||||
28 | |||||
[email protected] | b3ccac8 | 2010-08-04 15:54:40 | [diff] [blame] | 29 | // DNS resource record types. See |
30 | // http://www.iana.org/assignments/dns-parameters | ||||
31 | |||||
32 | static const uint16 kDNS_TXT = 16; | ||||
[email protected] | b3ccac8 | 2010-08-04 15:54:40 | [diff] [blame] | 33 | static const uint16 kDNS_CERT = 37; |
[email protected] | b2471359 | 2010-08-11 19:50:02 | [diff] [blame^] | 34 | static const uint16 kDNS_DS = 43; |
35 | static const uint16 kDNS_RRSIG = 46; | ||||
36 | static const uint16 kDNS_DNSKEY = 48; | ||||
[email protected] | b3ccac8 | 2010-08-04 15:54:40 | [diff] [blame] | 37 | static const uint16 kDNS_ANY = 0xff; |
38 | |||||
[email protected] | b2471359 | 2010-08-11 19:50:02 | [diff] [blame^] | 39 | // http://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml |
40 | static const uint8 kDNSSEC_RSA_SHA1 = 5; | ||||
41 | static const uint8 kDNSSEC_RSA_SHA1_NSEC3 = 7; | ||||
42 | static const uint8 kDNSSEC_RSA_SHA256 = 8; | ||||
43 | |||||
44 | // RFC 4509 | ||||
45 | static const uint8 kDNSSEC_SHA1 = 1; | ||||
46 | static const uint8 kDNSSEC_SHA256 = 2; | ||||
47 | |||||
[email protected] | c36f064 | 2009-09-09 01:10:50 | [diff] [blame] | 48 | } // namespace net |
49 | |||||
50 | #endif // NET_BASE_DNS_UTIL_H_ |