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_TEST_UTIL_H_ | 5 #ifndef NET_DNS_DNS_TEST_UTIL_H_ |
6 #define NET_DNS_DNS_TEST_UTIL_H_ | 6 #define NET_DNS_DNS_TEST_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "net/dns/dns_protocol.h" | 10 #include "net/dns/dns_protocol.h" |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 | 13 |
14 //----------------------------------------------------------------------------- | 14 //----------------------------------------------------------------------------- |
15 // Query/response set for www.google.com, ID is fixed to 0. | 15 // Query/response set for www.google.com, ID is fixed to 0. |
16 static const char kT0HostName[] = "www.google.com"; | 16 static const char kT0HostName[] = "www.google.com"; |
17 static const uint16 kT0Qtype = dns_protocol::kTypeA; | 17 static const uint16 kT0Qtype = dns_protocol::kTypeA; |
18 static const char kT0DnsName[] = { | 18 static const char kT0DnsName[] = { |
19 0x03, 'w', 'w', 'w', | 19 0x03, 'w', 'w', 'w', |
20 0x06, 'g', 'o', 'o', 'g', 'l', 'e', | 20 0x06, 'g', 'o', 'o', 'g', 'l', 'e', |
21 0x03, 'c', 'o', 'm', | 21 0x03, 'c', 'o', 'm', |
22 0x00 | 22 0x00 |
23 }; | 23 }; |
24 static const uint8 kT0QueryDatagram[] = { | 24 static const size_t kT0QuerySize = 32; |
25 // query for www.google.com, type A. | |
26 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, | |
27 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, | |
28 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03, | |
29 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01 | |
30 }; | |
31 static const uint8 kT0ResponseDatagram[] = { | 25 static const uint8 kT0ResponseDatagram[] = { |
32 // response contains one CNAME for www.l.google.com and the following | 26 // response contains one CNAME for www.l.google.com and the following |
33 // IP addresses: 74.125.226.{179,180,176,177,178} | 27 // IP addresses: 74.125.226.{179,180,176,177,178} |
34 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x06, | 28 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x06, |
35 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, | 29 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, |
36 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03, | 30 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03, |
37 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01, | 31 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01, |
38 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, | 32 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, |
39 0x4d, 0x13, 0x00, 0x08, 0x03, 0x77, 0x77, 0x77, | 33 0x4d, 0x13, 0x00, 0x08, 0x03, 0x77, 0x77, 0x77, |
40 0x01, 0x6c, 0xc0, 0x10, 0xc0, 0x2c, 0x00, 0x01, | 34 0x01, 0x6c, 0xc0, 0x10, 0xc0, 0x2c, 0x00, 0x01, |
41 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, | 35 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, |
42 0x4a, 0x7d, 0xe2, 0xb3, 0xc0, 0x2c, 0x00, 0x01, | 36 0x4a, 0x7d, 0xe2, 0xb3, 0xc0, 0x2c, 0x00, 0x01, |
43 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, | 37 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, |
44 0x4a, 0x7d, 0xe2, 0xb4, 0xc0, 0x2c, 0x00, 0x01, | 38 0x4a, 0x7d, 0xe2, 0xb4, 0xc0, 0x2c, 0x00, 0x01, |
45 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, | 39 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, |
46 0x4a, 0x7d, 0xe2, 0xb0, 0xc0, 0x2c, 0x00, 0x01, | 40 0x4a, 0x7d, 0xe2, 0xb0, 0xc0, 0x2c, 0x00, 0x01, |
47 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, | 41 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, |
48 0x4a, 0x7d, 0xe2, 0xb1, 0xc0, 0x2c, 0x00, 0x01, | 42 0x4a, 0x7d, 0xe2, 0xb1, 0xc0, 0x2c, 0x00, 0x01, |
49 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, | 43 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, |
50 0x4a, 0x7d, 0xe2, 0xb2 | 44 0x4a, 0x7d, 0xe2, 0xb2 |
51 }; | 45 }; |
52 static const char* const kT0IpAddresses[] = { | 46 static const char* const kT0IpAddresses[] = { |
53 "74.125.226.179", "74.125.226.180", "74.125.226.176", | 47 "74.125.226.179", "74.125.226.180", "74.125.226.176", |
54 "74.125.226.177", "74.125.226.178" | 48 "74.125.226.177", "74.125.226.178" |
55 }; | 49 }; |
| 50 static const char kT0CanonName[] = "www.l.google.com"; |
| 51 static const int kT0TTL = 0x000000e4; |
56 | 52 |
57 //----------------------------------------------------------------------------- | 53 //----------------------------------------------------------------------------- |
58 // Query/response set for codereview.chromium.org, ID is fixed to 1. | 54 // Query/response set for codereview.chromium.org, ID is fixed to 1. |
59 static const char kT1HostName[] = "codereview.chromium.org"; | 55 static const char kT1HostName[] = "codereview.chromium.org"; |
60 static const uint16 kT1Qtype = dns_protocol::kTypeA; | 56 static const uint16 kT1Qtype = dns_protocol::kTypeA; |
61 static const char kT1DnsName[] = { | 57 static const char kT1DnsName[] = { |
62 0x0a, 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w', | 58 0x0a, 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w', |
63 0x08, 'c', 'h', 'r', 'o', 'm', 'i', 'u', 'm', | 59 0x08, 'c', 'h', 'r', 'o', 'm', 'i', 'u', 'm', |
64 0x03, 'o', 'r', 'g', | 60 0x03, 'o', 'r', 'g', |
65 0x00 | 61 0x00 |
66 }; | 62 }; |
67 static const uint8 kT1QueryDatagram[] = { | 63 static const size_t kT1QuerySize = 41; |
68 // query for codereview.chromium.org, type A. | |
69 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, | |
70 0x00, 0x00, 0x00, 0x00, 0x0a, 0x63, 0x6f, 0x64, | |
71 0x65, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x08, | |
72 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75, 0x6d, | |
73 0x03, 0x6f, 0x72, 0x67, 0x00, 0x00, 0x01, 0x00, | |
74 0x01 | |
75 }; | |
76 static const uint8 kT1ResponseDatagram[] = { | 64 static const uint8 kT1ResponseDatagram[] = { |
77 // response contains one CNAME for ghs.l.google.com and the following | 65 // response contains one CNAME for ghs.l.google.com and the following |
78 // IP address: 64.233.169.121 | 66 // IP address: 64.233.169.121 |
79 0x00, 0x01, 0x81, 0x80, 0x00, 0x01, 0x00, 0x02, | 67 0x00, 0x01, 0x81, 0x80, 0x00, 0x01, 0x00, 0x02, |
80 0x00, 0x00, 0x00, 0x00, 0x0a, 0x63, 0x6f, 0x64, | 68 0x00, 0x00, 0x00, 0x00, 0x0a, 0x63, 0x6f, 0x64, |
81 0x65, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x08, | 69 0x65, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x08, |
82 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75, 0x6d, | 70 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75, 0x6d, |
83 0x03, 0x6f, 0x72, 0x67, 0x00, 0x00, 0x01, 0x00, | 71 0x03, 0x6f, 0x72, 0x67, 0x00, 0x00, 0x01, 0x00, |
84 0x01, 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, | 72 0x01, 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, |
85 0x01, 0x41, 0x75, 0x00, 0x12, 0x03, 0x67, 0x68, | 73 0x01, 0x41, 0x75, 0x00, 0x12, 0x03, 0x67, 0x68, |
86 0x73, 0x01, 0x6c, 0x06, 0x67, 0x6f, 0x6f, 0x67, | 74 0x73, 0x01, 0x6c, 0x06, 0x67, 0x6f, 0x6f, 0x67, |
87 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0xc0, | 75 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0xc0, |
88 0x35, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, | 76 0x35, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, |
89 0x0b, 0x00, 0x04, 0x40, 0xe9, 0xa9, 0x79 | 77 0x0b, 0x00, 0x04, 0x40, 0xe9, 0xa9, 0x79 |
90 }; | 78 }; |
91 static const char* const kT1IpAddresses[] = { | 79 static const char* const kT1IpAddresses[] = { |
92 "64.233.169.121" | 80 "64.233.169.121" |
93 }; | 81 }; |
| 82 static const char kT1CanonName[] = "ghs.l.google.com"; |
| 83 static const int kT1TTL = 0x0000010b; |
94 | 84 |
95 //----------------------------------------------------------------------------- | 85 //----------------------------------------------------------------------------- |
96 // Query/response set for www.ccs.neu.edu, ID is fixed to 2. | 86 // Query/response set for www.ccs.neu.edu, ID is fixed to 2. |
97 static const char kT2HostName[] = "www.ccs.neu.edu"; | 87 static const char kT2HostName[] = "www.ccs.neu.edu"; |
98 static const uint16 kT2Qtype = dns_protocol::kTypeA; | 88 static const uint16 kT2Qtype = dns_protocol::kTypeA; |
99 static const char kT2DnsName[] = { | 89 static const char kT2DnsName[] = { |
100 0x03, 'w', 'w', 'w', | 90 0x03, 'w', 'w', 'w', |
101 0x03, 'c', 'c', 's', | 91 0x03, 'c', 'c', 's', |
102 0x03, 'n', 'e', 'u', | 92 0x03, 'n', 'e', 'u', |
103 0x03, 'e', 'd', 'u', | 93 0x03, 'e', 'd', 'u', |
104 0x00 | 94 0x00 |
105 }; | 95 }; |
106 static const uint8 kT2QueryDatagram[] = { | 96 static const size_t kT2QuerySize = 33; |
107 // query for www.ccs.neu.edu, type A. | |
108 0x00, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, | |
109 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, | |
110 0x03, 0x63, 0x63, 0x73, 0x03, 0x6e, 0x65, 0x75, | |
111 0x03, 0x65, 0x64, 0x75, 0x00, 0x00, 0x01, 0x00, | |
112 0x01 | |
113 }; | |
114 static const uint8 kT2ResponseDatagram[] = { | 97 static const uint8 kT2ResponseDatagram[] = { |
115 // response contains one CNAME for vulcan.ccs.neu.edu and the following | 98 // response contains one CNAME for vulcan.ccs.neu.edu and the following |
116 // IP address: 129.10.116.81 | 99 // IP address: 129.10.116.81 |
117 0x00, 0x02, 0x81, 0x80, 0x00, 0x01, 0x00, 0x02, | 100 0x00, 0x02, 0x81, 0x80, 0x00, 0x01, 0x00, 0x02, |
118 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, | 101 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, |
119 0x03, 0x63, 0x63, 0x73, 0x03, 0x6e, 0x65, 0x75, | 102 0x03, 0x63, 0x63, 0x73, 0x03, 0x6e, 0x65, 0x75, |
120 0x03, 0x65, 0x64, 0x75, 0x00, 0x00, 0x01, 0x00, | 103 0x03, 0x65, 0x64, 0x75, 0x00, 0x00, 0x01, 0x00, |
121 0x01, 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, | 104 0x01, 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, |
122 0x00, 0x01, 0x2c, 0x00, 0x09, 0x06, 0x76, 0x75, | 105 0x00, 0x01, 0x2c, 0x00, 0x09, 0x06, 0x76, 0x75, |
123 0x6c, 0x63, 0x61, 0x6e, 0xc0, 0x10, 0xc0, 0x2d, | 106 0x6c, 0x63, 0x61, 0x6e, 0xc0, 0x10, 0xc0, 0x2d, |
124 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x2c, | 107 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x2c, |
125 0x00, 0x04, 0x81, 0x0a, 0x74, 0x51 | 108 0x00, 0x04, 0x81, 0x0a, 0x74, 0x51 |
126 }; | 109 }; |
127 static const char* const kT2IpAddresses[] = { | 110 static const char* const kT2IpAddresses[] = { |
128 "129.10.116.81" | 111 "129.10.116.81" |
129 }; | 112 }; |
| 113 static const char kT2CanonName[] = "vulcan.ccs.neu.edu"; |
| 114 static const int kT2TTL = 0x0000012c; |
130 | 115 |
131 //----------------------------------------------------------------------------- | 116 //----------------------------------------------------------------------------- |
132 // Query/response set for www.google.az, ID is fixed to 3. | 117 // Query/response set for www.google.az, ID is fixed to 3. |
133 static const char kT3HostName[] = "www.google.az"; | 118 static const char kT3HostName[] = "www.google.az"; |
134 static const uint16 kT3Qtype = dns_protocol::kTypeA; | 119 static const uint16 kT3Qtype = dns_protocol::kTypeA; |
135 static const char kT3DnsName[] = { | 120 static const char kT3DnsName[] = { |
136 0x03, 'w', 'w', 'w', | 121 0x03, 'w', 'w', 'w', |
137 0x06, 'g', 'o', 'o', 'g', 'l', 'e', | 122 0x06, 'g', 'o', 'o', 'g', 'l', 'e', |
138 0x02, 'a', 'z', | 123 0x02, 'a', 'z', |
139 0x00 | 124 0x00 |
140 }; | 125 }; |
141 static const uint8 kT3QueryDatagram[] = { | 126 static const size_t kT3QuerySize = 31; |
142 // query for www.google.az, type A. | |
143 0x00, 0x03, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, | |
144 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, | |
145 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x02, | |
146 0x61, 0x7a, 0x00, 0x00, 0x01, 0x00, 0x01 | |
147 }; | |
148 static const uint8 kT3ResponseDatagram[] = { | 127 static const uint8 kT3ResponseDatagram[] = { |
149 // response contains www.google.com as CNAME for www.google.az and | 128 // response contains www.google.com as CNAME for www.google.az and |
150 // www.l.google.com as CNAME for www.google.com and the following | 129 // www.l.google.com as CNAME for www.google.com and the following |
151 // IP addresses: 74.125.226.{178,179,180,176,177} | 130 // IP addresses: 74.125.226.{178,179,180,176,177} |
152 0x00, 0x03, 0x81, 0x80, 0x00, 0x01, 0x00, 0x07, | 131 0x00, 0x03, 0x81, 0x80, 0x00, 0x01, 0x00, 0x07, |
153 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, | 132 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, |
154 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x02, | 133 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x02, |
155 0x61, 0x7a, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, | 134 0x61, 0x7a, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, |
156 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x50, | 135 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x50, |
157 0x99, 0x00, 0x10, 0x03, 0x77, 0x77, 0x77, 0x06, | 136 0x99, 0x00, 0x10, 0x03, 0x77, 0x77, 0x77, 0x06, |
158 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03, 0x63, | 137 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03, 0x63, |
159 0x6f, 0x6d, 0x00, 0xc0, 0x2b, 0x00, 0x05, 0x00, | 138 0x6f, 0x6d, 0x00, 0xc0, 0x2b, 0x00, 0x05, 0x00, |
160 0x01, 0x00, 0x01, 0x50, 0x99, 0x00, 0x08, 0x03, | 139 0x01, 0x00, 0x01, 0x50, 0x99, 0x00, 0x08, 0x03, |
161 0x77, 0x77, 0x77, 0x01, 0x6c, 0xc0, 0x2f, 0xc0, | 140 0x77, 0x77, 0x77, 0x01, 0x6c, 0xc0, 0x2f, 0xc0, |
162 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, | 141 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, |
163 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb2, 0xc0, | 142 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb2, 0xc0, |
164 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, | 143 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, |
165 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb3, 0xc0, | 144 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb3, 0xc0, |
166 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, | 145 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, |
167 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb4, 0xc0, | 146 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb4, 0xc0, |
168 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, | 147 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, |
169 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb0, 0xc0, | 148 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb0, 0xc0, |
170 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, | 149 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, |
171 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb1 | 150 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb1 |
172 }; | 151 }; |
173 static const char* const kT3IpAddresses[] = { | 152 static const char* const kT3IpAddresses[] = { |
174 "74.125.226.178", "74.125.226.179", "74.125.226.180", | 153 "74.125.226.178", "74.125.226.179", "74.125.226.180", |
175 "74.125.226.176", "74.125.226.177" | 154 "74.125.226.176", "74.125.226.177" |
176 }; | 155 }; |
| 156 static const char kT3CanonName[] = "www.l.google.com"; |
| 157 static const int kT3TTL = 0x00000015; |
177 | 158 |
178 } // namespace net | 159 } // namespace net |
179 | 160 |
180 #endif // NET_DNS_DNS_TEST_UTIL_H_ | 161 #endif // NET_DNS_DNS_TEST_UTIL_H_ |
OLD | NEW |