Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: net/base/host_resolver.h

Issue 1566012: HostResolver supports optional CNAME lookups. (Closed)
Patch Set: Added CNAME details to about:net-internals Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/base/host_cache_unittest.cc ('k') | net/base/host_resolver_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_HOST_RESOLVER_H_ 5 #ifndef NET_BASE_HOST_RESOLVER_H_
6 #define NET_BASE_HOST_RESOLVER_H_ 6 #define NET_BASE_HOST_RESOLVER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/ref_counted.h" 10 #include "base/ref_counted.h"
(...skipping 23 matching lines...) Expand all
34 // goes out of scope). 34 // goes out of scope).
35 class HostResolver : public base::RefCountedThreadSafe<HostResolver> { 35 class HostResolver : public base::RefCountedThreadSafe<HostResolver> {
36 public: 36 public:
37 // The parameters for doing a Resolve(). |hostname| and |port| are required, 37 // The parameters for doing a Resolve(). |hostname| and |port| are required,
38 // the rest are optional (and have reasonable defaults). 38 // the rest are optional (and have reasonable defaults).
39 class RequestInfo { 39 class RequestInfo {
40 public: 40 public:
41 RequestInfo(const std::string& hostname, int port) 41 RequestInfo(const std::string& hostname, int port)
42 : hostname_(hostname), 42 : hostname_(hostname),
43 address_family_(ADDRESS_FAMILY_UNSPECIFIED), 43 address_family_(ADDRESS_FAMILY_UNSPECIFIED),
44 host_resolver_flags_(0),
44 port_(port), 45 port_(port),
45 allow_cached_response_(true), 46 allow_cached_response_(true),
46 is_speculative_(false), 47 is_speculative_(false),
47 priority_(MEDIUM) {} 48 priority_(MEDIUM) {}
48 49
49 int port() const { return port_; } 50 int port() const { return port_; }
50 void set_port(int port) { 51 void set_port(int port) {
51 port_ = port; 52 port_ = port;
52 } 53 }
53 54
54 const std::string& hostname() const { return hostname_; } 55 const std::string& hostname() const { return hostname_; }
55 void set_hostname(const std::string& hostname) { 56 void set_hostname(const std::string& hostname) {
56 hostname_ = hostname; 57 hostname_ = hostname;
57 } 58 }
58 59
59 AddressFamily address_family() const { return address_family_; } 60 AddressFamily address_family() const { return address_family_; }
60 void set_address_family(AddressFamily address_family) { 61 void set_address_family(AddressFamily address_family) {
61 address_family_ = address_family; 62 address_family_ = address_family;
62 } 63 }
63 64
65 HostResolverFlags host_resolver_flags() const {
66 return host_resolver_flags_;
67 }
68 void set_host_resolver_flags(HostResolverFlags host_resolver_flags) {
69 host_resolver_flags_ = host_resolver_flags;
70 }
71
64 bool allow_cached_response() const { return allow_cached_response_; } 72 bool allow_cached_response() const { return allow_cached_response_; }
65 void set_allow_cached_response(bool b) { allow_cached_response_ = b; } 73 void set_allow_cached_response(bool b) { allow_cached_response_ = b; }
66 74
67 bool is_speculative() const { return is_speculative_; } 75 bool is_speculative() const { return is_speculative_; }
68 void set_is_speculative(bool b) { is_speculative_ = b; } 76 void set_is_speculative(bool b) { is_speculative_ = b; }
69 77
70 RequestPriority priority() const { return priority_; } 78 RequestPriority priority() const { return priority_; }
71 void set_priority(RequestPriority priority) { priority_ = priority; } 79 void set_priority(RequestPriority priority) { priority_ = priority; }
72 80
73 const GURL& referrer() const { return referrer_; } 81 const GURL& referrer() const { return referrer_; }
74 void set_referrer(const GURL& referrer) { referrer_ = referrer; } 82 void set_referrer(const GURL& referrer) { referrer_ = referrer; }
75 83
76 private: 84 private:
77 // The hostname to resolve. 85 // The hostname to resolve.
78 std::string hostname_; 86 std::string hostname_;
79 87
80 // The address family to restrict results to. 88 // The address family to restrict results to.
81 AddressFamily address_family_; 89 AddressFamily address_family_;
82 90
91 // Flags for the address.
92 HostResolverFlags host_resolver_flags_;
93
83 // The port number to set in the result's sockaddrs. 94 // The port number to set in the result's sockaddrs.
84 int port_; 95 int port_;
85 96
86 // Whether it is ok to return a result from the host cache. 97 // Whether it is ok to return a result from the host cache.
87 bool allow_cached_response_; 98 bool allow_cached_response_;
88 99
89 // Whether this request was started by the DNS prefetcher. 100 // Whether this request was started by the DNS prefetcher.
90 bool is_speculative_; 101 bool is_speculative_;
91 102
92 // The priority for the request. 103 // The priority for the request.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // (Except if a unit-test has changed the global HostResolverProc using 237 // (Except if a unit-test has changed the global HostResolverProc using
227 // ScopedHostResolverProc to intercept requests to the system). 238 // ScopedHostResolverProc to intercept requests to the system).
228 // |network_change_notifier| must outlive HostResolver. It can optionally be 239 // |network_change_notifier| must outlive HostResolver. It can optionally be
229 // NULL, in which case HostResolver will not respond to network changes. 240 // NULL, in which case HostResolver will not respond to network changes.
230 HostResolver* CreateSystemHostResolver( 241 HostResolver* CreateSystemHostResolver(
231 NetworkChangeNotifier* network_change_notifier); 242 NetworkChangeNotifier* network_change_notifier);
232 243
233 } // namespace net 244 } // namespace net
234 245
235 #endif // NET_BASE_HOST_RESOLVER_H_ 246 #endif // NET_BASE_HOST_RESOLVER_H_
OLDNEW
« no previous file with comments | « net/base/host_cache_unittest.cc ('k') | net/base/host_resolver_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698