OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_DNSRR_RESOLVER_H_ | 5 #ifndef NET_BASE_DNSRR_RESOLVER_H_ |
6 #define NET_BASE_DNSRR_RESOLVER_H_ | 6 #define NET_BASE_DNSRR_RESOLVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
17 #include "base/time.h" | 17 #include "base/time.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "net/base/completion_callback.h" | 19 #include "net/base/completion_callback.h" |
| 20 #include "net/base/net_api.h" |
20 #include "net/base/network_change_notifier.h" | 21 #include "net/base/network_change_notifier.h" |
21 | 22 |
22 namespace net { | 23 namespace net { |
23 | 24 |
24 // RRResponse contains the result of a successful request for a resource record. | 25 // RRResponse contains the result of a successful request for a resource record. |
25 struct RRResponse { | 26 struct NET_TEST RRResponse { |
26 RRResponse(); | 27 RRResponse(); |
27 ~RRResponse(); | 28 ~RRResponse(); |
28 | 29 |
29 // HasExpired returns true if |fetch_time| + |ttl| is less than | 30 // HasExpired returns true if |fetch_time| + |ttl| is less than |
30 // |current_time|. | 31 // |current_time|. |
31 bool HasExpired(base::Time current_time) const; | 32 bool HasExpired(base::Time current_time) const; |
32 | 33 |
33 // For testing only | 34 // For testing only |
34 bool ParseFromResponse(const uint8* data, unsigned len, | 35 bool ParseFromResponse(const uint8* data, unsigned len, |
35 uint16 rrtype_requested); | 36 uint16 rrtype_requested); |
(...skipping 23 matching lines...) Expand all Loading... |
59 // DnsRRResolver resolves arbitary DNS resource record types. It should not be | 60 // DnsRRResolver resolves arbitary DNS resource record types. It should not be |
60 // confused with HostResolver and should not be used to resolve A/AAAA records. | 61 // confused with HostResolver and should not be used to resolve A/AAAA records. |
61 // | 62 // |
62 // HostResolver exists to lookup addresses and there are many details about | 63 // HostResolver exists to lookup addresses and there are many details about |
63 // address resolution over and above DNS (i.e. Bonjour, VPNs etc). | 64 // address resolution over and above DNS (i.e. Bonjour, VPNs etc). |
64 // | 65 // |
65 // DnsRRResolver should only be used when the data is specifically DNS data and | 66 // DnsRRResolver should only be used when the data is specifically DNS data and |
66 // the name is a fully qualified DNS domain. | 67 // the name is a fully qualified DNS domain. |
67 // | 68 // |
68 // A DnsRRResolver must be used from the MessageLoop which created it. | 69 // A DnsRRResolver must be used from the MessageLoop which created it. |
69 class DnsRRResolver : public base::NonThreadSafe, | 70 MSVC_PUSH_DISABLE_WARNING(4275) |
70 public NetworkChangeNotifier::IPAddressObserver { | 71 class NET_API DnsRRResolver : public base::NonThreadSafe, |
| 72 public NetworkChangeNotifier::IPAddressObserver { |
| 73 MSVC_POP_WARNING() |
71 public: | 74 public: |
72 typedef intptr_t Handle; | 75 typedef intptr_t Handle; |
73 | 76 |
74 enum { | 77 enum { |
75 kInvalidHandle = 0, | 78 kInvalidHandle = 0, |
76 }; | 79 }; |
77 | 80 |
78 enum { | 81 enum { |
79 // Try harder to get a DNSSEC signed response. This doesn't mean that the | 82 // Try harder to get a DNSSEC signed response. This doesn't mean that the |
80 // RRResponse will always have the dnssec bit set. | 83 // RRResponse will always have the dnssec bit set. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 uint64 inflight_joins_; | 130 uint64 inflight_joins_; |
128 | 131 |
129 bool in_destructor_; | 132 bool in_destructor_; |
130 | 133 |
131 DISALLOW_COPY_AND_ASSIGN(DnsRRResolver); | 134 DISALLOW_COPY_AND_ASSIGN(DnsRRResolver); |
132 }; | 135 }; |
133 | 136 |
134 } // namespace net | 137 } // namespace net |
135 | 138 |
136 #endif // NET_BASE_DNSRR_RESOLVER_H_ | 139 #endif // NET_BASE_DNSRR_RESOLVER_H_ |
OLD | NEW |