OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DNS_DNS_PROTOCOL_H_ | 5 #ifndef NET_DNS_DNS_PROTOCOL_H_ |
6 #define NET_DNS_DNS_PROTOCOL_H_ | 6 #define NET_DNS_DNS_PROTOCOL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "net/base/net_export.h" | 9 #include "net/base/net_export.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 | 12 |
13 namespace dns_protocol { | 13 namespace dns_protocol { |
14 | 14 |
15 static const uint16 kDefaultPort = 53; | 15 static const uint16 kDefaultPort = 53; |
| 16 static const uint16 kDefaultPortMulticast = 5353; |
16 | 17 |
17 // DNS packet consists of a header followed by questions and/or answers. | 18 // DNS packet consists of a header followed by questions and/or answers. |
18 // For the meaning of specific fields, please see RFC 1035 and 2535 | 19 // For the meaning of specific fields, please see RFC 1035 and 2535 |
19 | 20 |
20 // Header format. | 21 // Header format. |
21 // 1 1 1 1 1 1 | 22 // 1 1 1 1 1 1 |
22 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 | 23 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 |
23 // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | 24 // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
24 // | ID | | 25 // | ID | |
25 // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | 26 // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // "cache-flush bit", as described in http://www.rfc-editor.org/rfc/rfc6762.txt | 95 // "cache-flush bit", as described in http://www.rfc-editor.org/rfc/rfc6762.txt |
95 // section 10.2. | 96 // section 10.2. |
96 static const uint16 kMDnsClassMask = 0x7FFF; | 97 static const uint16 kMDnsClassMask = 0x7FFF; |
97 | 98 |
98 static const int kMaxNameLength = 255; | 99 static const int kMaxNameLength = 255; |
99 | 100 |
100 // RFC 1035, section 4.2.1: Messages carried by UDP are restricted to 512 | 101 // RFC 1035, section 4.2.1: Messages carried by UDP are restricted to 512 |
101 // bytes (not counting the IP nor UDP headers). | 102 // bytes (not counting the IP nor UDP headers). |
102 static const int kMaxUDPSize = 512; | 103 static const int kMaxUDPSize = 512; |
103 | 104 |
| 105 // RFC 6762, section 17: Messages over the local link are restricted by the |
| 106 // medium's MTU, and must be under 9000 bytes |
| 107 static const int kMaxMulticastSize = 9000; |
| 108 |
104 // DNS class types. | 109 // DNS class types. |
105 static const uint16 kClassIN = 1; | 110 static const uint16 kClassIN = 1; |
106 | 111 |
107 // DNS resource record types. See | 112 // DNS resource record types. See |
108 // http://www.iana.org/assignments/dns-parameters | 113 // http://www.iana.org/assignments/dns-parameters |
109 static const uint16 kTypeA = 1; | 114 static const uint16 kTypeA = 1; |
110 static const uint16 kTypeCNAME = 5; | 115 static const uint16 kTypeCNAME = 5; |
111 static const uint16 kTypePTR = 12; | 116 static const uint16 kTypePTR = 12; |
112 static const uint16 kTypeTXT = 16; | 117 static const uint16 kTypeTXT = 16; |
113 static const uint16 kTypeAAAA = 28; | 118 static const uint16 kTypeAAAA = 28; |
(...skipping 13 matching lines...) Expand all Loading... |
127 static const uint16 kFlagRA = 0x80; | 132 static const uint16 kFlagRA = 0x80; |
128 static const uint16 kFlagRD = 0x100; | 133 static const uint16 kFlagRD = 0x100; |
129 static const uint16 kFlagTC = 0x200; | 134 static const uint16 kFlagTC = 0x200; |
130 static const uint16 kFlagAA = 0x400; | 135 static const uint16 kFlagAA = 0x400; |
131 | 136 |
132 } // namespace dns_protocol | 137 } // namespace dns_protocol |
133 | 138 |
134 } // namespace net | 139 } // namespace net |
135 | 140 |
136 #endif // NET_DNS_DNS_PROTOCOL_H_ | 141 #endif // NET_DNS_DNS_PROTOCOL_H_ |
OLD | NEW |