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

Side by Side Diff: net/dns/dns_session.h

Issue 9190031: DnsClient refactoring + features (timeout, suffix search, server rotation). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Delinted. Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « net/dns/dns_response_unittest.cc ('k') | net/dns/dns_session.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) 2011 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_SESSION_H_ 5 #ifndef NET_DNS_DNS_SESSION_H_
6 #define NET_DNS_DNS_SESSION_H_ 6 #define NET_DNS_DNS_SESSION_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/time.h" 11 #include "base/time.h"
(...skipping 12 matching lines...) Expand all
24 class NET_EXPORT_PRIVATE DnsSession 24 class NET_EXPORT_PRIVATE DnsSession
25 : NON_EXPORTED_BASE(public base::RefCounted<DnsSession>) { 25 : NON_EXPORTED_BASE(public base::RefCounted<DnsSession>) {
26 public: 26 public:
27 typedef base::Callback<int()> RandCallback; 27 typedef base::Callback<int()> RandCallback;
28 28
29 DnsSession(const DnsConfig& config, 29 DnsSession(const DnsConfig& config,
30 ClientSocketFactory* factory, 30 ClientSocketFactory* factory,
31 const RandIntCallback& rand_int_callback, 31 const RandIntCallback& rand_int_callback,
32 NetLog* net_log); 32 NetLog* net_log);
33 33
34 ClientSocketFactory* socket_factory() const { return socket_factory_.get(); }
35 const DnsConfig& config() const { return config_; } 34 const DnsConfig& config() const { return config_; }
36 NetLog* net_log() const { return net_log_; } 35 NetLog* net_log() const { return net_log_; }
37 36
37 ClientSocketFactory* socket_factory() { return socket_factory_.get(); }
38
38 // Return the next random query ID. 39 // Return the next random query ID.
39 int NextId() const; 40 int NextQueryId() const;
40 41
41 // Return the next server address. 42 // Return the index of the first configured server to use on first attempt.
42 const IPEndPoint& NextServer(); 43 int NextFirstServerIndex();
43 44
44 // Return the timeout for the next transaction. 45 // Return the timeout for the next query.
45 base::TimeDelta NextTimeout(int attempt); 46 base::TimeDelta NextTimeout(int attempt);
46 47
47 private: 48 private:
48 friend class base::RefCounted<DnsSession>; 49 friend class base::RefCounted<DnsSession>;
49 ~DnsSession(); 50 ~DnsSession();
50 51
51 const DnsConfig config_; 52 const DnsConfig config_;
52 scoped_ptr<ClientSocketFactory> socket_factory_; 53 scoped_ptr<ClientSocketFactory> socket_factory_;
53 RandCallback rand_callback_; 54 RandCallback rand_callback_;
54 NetLog* net_log_; 55 NetLog* net_log_;
55 56
56 // Current index into |config_.nameservers|. 57 // Current index into |config_.nameservers| to begin resolution with.
57 int server_index_; 58 int server_index_;
58 59
59 // TODO(szym): add current RTT estimate 60 // TODO(szym): Add current RTT estimate.
60 // TODO(szym): add flag to indicate DNSSEC is supported 61 // TODO(szym): Add TCP connection pool to support DNS over TCP.
61 // TODO(szym): add TCP connection pool to support DNS over TCP 62 // TODO(szym): Add UDP port pool to avoid NAT table overload.
62 // TODO(szym): add UDP socket pool ?
63 63
64 DISALLOW_COPY_AND_ASSIGN(DnsSession); 64 DISALLOW_COPY_AND_ASSIGN(DnsSession);
65 }; 65 };
66 66
67 } // namespace net 67 } // namespace net
68 68
69 #endif // NET_DNS_DNS_SESSION_H_ 69 #endif // NET_DNS_DNS_SESSION_H_
70 70
OLDNEW
« no previous file with comments | « net/dns/dns_response_unittest.cc ('k') | net/dns/dns_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698