blob: 78dca4703d99e3ec3501f8f8755d492bf26debec [file] [log] [blame]
[email protected]c36f0642009-09-09 01:10:501// 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]32b76ef2010-07-26 23:08:247#pragma once
[email protected]c36f0642009-09-09 01:10:508
9#include <string>
10
[email protected]b3ccac82010-08-04 15:54:4011#include "base/basictypes.h"
12
[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"
20bool 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)
24bool IsSTD3ASCIIValidCharacter(char c);
25
[email protected]13c340e12010-03-08 19:29:4126// Returns the hostname by trimming the ending dot, if one exists.
27std::string TrimEndingDot(const std::string& host);
28
[email protected]b3ccac82010-08-04 15:54:4029// DNS resource record types. See
30// http://www.iana.org/assignments/dns-parameters
31
32static const uint16 kDNS_TXT = 16;
[email protected]b3ccac82010-08-04 15:54:4033static const uint16 kDNS_CERT = 37;
[email protected]b24713592010-08-11 19:50:0234static const uint16 kDNS_DS = 43;
35static const uint16 kDNS_RRSIG = 46;
36static const uint16 kDNS_DNSKEY = 48;
[email protected]b3ccac82010-08-04 15:54:4037static const uint16 kDNS_ANY = 0xff;
38
[email protected]b24713592010-08-11 19:50:0239// http://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml
40static const uint8 kDNSSEC_RSA_SHA1 = 5;
41static const uint8 kDNSSEC_RSA_SHA1_NSEC3 = 7;
42static const uint8 kDNSSEC_RSA_SHA256 = 8;
43
44// RFC 4509
45static const uint8 kDNSSEC_SHA1 = 1;
46static const uint8 kDNSSEC_SHA256 = 2;
47
[email protected]c36f0642009-09-09 01:10:5048} // namespace net
49
50#endif // NET_BASE_DNS_UTIL_H_