| 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_HOST_RESOLVER_H_ | 5 #ifndef NET_DNS_HOST_RESOLVER_H_ |
| 6 #define NET_DNS_HOST_RESOLVER_H_ | 6 #define NET_DNS_HOST_RESOLVER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "net/base/address_family.h" | 15 #include "net/base/address_family.h" |
| 16 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
| 17 #include "net/base/host_port_pair.h" | 17 #include "net/base/host_port_pair.h" |
| 18 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
| 19 #include "net/base/prioritized_dispatcher.h" | 19 #include "net/base/prioritized_dispatcher.h" |
| 20 #include "net/base/request_priority.h" | 20 #include "net/base/request_priority.h" |
| 21 #include "net/dns/host_cache.h" | 21 #include "net/dns/host_cache.h" |
| 22 | 22 |
| 23 namespace base { | 23 namespace base { |
| 24 class Value; | 24 class Value; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace net { | 27 namespace net { |
| 28 | 28 |
| 29 class AddressList; | 29 class AddressList; |
| 30 class BoundNetLog; | 30 class NetLogWithSource; |
| 31 class HostResolverImpl; | 31 class HostResolverImpl; |
| 32 class HostResolverProc; | 32 class HostResolverProc; |
| 33 class NetLog; | 33 class NetLog; |
| 34 | 34 |
| 35 // This class represents the task of resolving hostnames (or IP address | 35 // This class represents the task of resolving hostnames (or IP address |
| 36 // literal) to an AddressList object. | 36 // literal) to an AddressList object. |
| 37 // | 37 // |
| 38 // HostResolver can handle multiple requests at a time, so when cancelling a | 38 // HostResolver can handle multiple requests at a time, so when cancelling a |
| 39 // request the RequestHandle that was returned by Resolve() needs to be | 39 // request the RequestHandle that was returned by Resolve() needs to be |
| 40 // given. A simpler alternative for consumers that only have 1 outstanding | 40 // given. A simpler alternative for consumers that only have 1 outstanding |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // | 175 // |
| 176 // Requests can be cancelled any time by deletion of the [out_req]. Deleting | 176 // Requests can be cancelled any time by deletion of the [out_req]. Deleting |
| 177 // |out_req| will cancel the request, and cause |callback| not to be invoked. | 177 // |out_req| will cancel the request, and cause |callback| not to be invoked. |
| 178 // | 178 // |
| 179 // Profiling information for the request is saved to |net_log| if non-NULL. | 179 // Profiling information for the request is saved to |net_log| if non-NULL. |
| 180 virtual int Resolve(const RequestInfo& info, | 180 virtual int Resolve(const RequestInfo& info, |
| 181 RequestPriority priority, | 181 RequestPriority priority, |
| 182 AddressList* addresses, | 182 AddressList* addresses, |
| 183 const CompletionCallback& callback, | 183 const CompletionCallback& callback, |
| 184 std::unique_ptr<Request>* out_req, | 184 std::unique_ptr<Request>* out_req, |
| 185 const BoundNetLog& net_log) = 0; | 185 const NetLogWithSource& net_log) = 0; |
| 186 | 186 |
| 187 // Resolves the given hostname (or IP address literal) out of cache or HOSTS | 187 // Resolves the given hostname (or IP address literal) out of cache or HOSTS |
| 188 // file (if enabled) only. This is guaranteed to complete synchronously. | 188 // file (if enabled) only. This is guaranteed to complete synchronously. |
| 189 // This acts like |Resolve()| if the hostname is IP literal, or cached value | 189 // This acts like |Resolve()| if the hostname is IP literal, or cached value |
| 190 // or HOSTS entry exists. Otherwise, ERR_DNS_CACHE_MISS is returned. | 190 // or HOSTS entry exists. Otherwise, ERR_DNS_CACHE_MISS is returned. |
| 191 virtual int ResolveFromCache(const RequestInfo& info, | 191 virtual int ResolveFromCache(const RequestInfo& info, |
| 192 AddressList* addresses, | 192 AddressList* addresses, |
| 193 const BoundNetLog& net_log) = 0; | 193 const NetLogWithSource& net_log) = 0; |
| 194 | 194 |
| 195 // Enable or disable the built-in asynchronous DnsClient. | 195 // Enable or disable the built-in asynchronous DnsClient. |
| 196 virtual void SetDnsClientEnabled(bool enabled); | 196 virtual void SetDnsClientEnabled(bool enabled); |
| 197 | 197 |
| 198 // Returns the HostResolverCache |this| uses, or NULL if there isn't one. | 198 // Returns the HostResolverCache |this| uses, or NULL if there isn't one. |
| 199 // Used primarily to clear the cache and for getting debug information. | 199 // Used primarily to clear the cache and for getting debug information. |
| 200 virtual HostCache* GetHostCache(); | 200 virtual HostCache* GetHostCache(); |
| 201 | 201 |
| 202 // Returns the current DNS configuration |this| is using, as a Value, or | 202 // Returns the current DNS configuration |this| is using, as a Value, or |
| 203 // nullptr if it's configured to always use the system host resolver. | 203 // nullptr if it's configured to always use the system host resolver. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 protected: | 235 protected: |
| 236 HostResolver(); | 236 HostResolver(); |
| 237 | 237 |
| 238 private: | 238 private: |
| 239 DISALLOW_COPY_AND_ASSIGN(HostResolver); | 239 DISALLOW_COPY_AND_ASSIGN(HostResolver); |
| 240 }; | 240 }; |
| 241 | 241 |
| 242 } // namespace net | 242 } // namespace net |
| 243 | 243 |
| 244 #endif // NET_DNS_HOST_RESOLVER_H_ | 244 #endif // NET_DNS_HOST_RESOLVER_H_ |
| OLD | NEW |