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

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

Issue 8762001: Isolates generic DnsClient from AsyncHostResolver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: retrying to fix status of dns_session.h Created 9 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_DNS_DNS_SESSION_H_
6 #define NET_DNS_DNS_SESSION_H_
7 #pragma once
8
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/time.h"
12 #include "net/base/net_export.h"
13 #include "net/base/rand_callback.h"
14 #include "net/dns/dns_config_service.h"
15
16 namespace net {
17
18 class ClientSocketFactory;
19 class NetLog;
20
21 // Session parameters and state shared between DNS transactions.
22 // Ref-counted so that DnsClient::Request can keep working in absence of
23 // DnsClient. A DnsSession must be recreated when DnsConfig changes.
24 class NET_EXPORT_PRIVATE DnsSession
25 : NON_EXPORTED_BASE(public base::RefCounted<DnsSession>) {
26 public:
27 typedef base::Callback<int()> RandCallback;
28
29 DnsSession(const DnsConfig& config,
30 ClientSocketFactory* factory,
31 const RandIntCallback& rand_int_callback,
32 NetLog* net_log);
33
34 ClientSocketFactory* socket_factory() const { return socket_factory_.get(); }
35 const DnsConfig& config() const { return config_; }
36 NetLog* net_log() const { return net_log_; }
37
38 // Return the next random query ID.
39 int NextId() const;
40
41 // Return the next server address.
42 const IPEndPoint& NextServer();
43
44 // Return the timeout for the next transaction.
45 base::TimeDelta NextTimeout(int attempt);
46
47 private:
48 friend class base::RefCounted<DnsSession>;
49 ~DnsSession();
50
51 const DnsConfig config_;
52 scoped_ptr<ClientSocketFactory> socket_factory_;
53 RandCallback rand_callback_;
54 NetLog* net_log_;
55
56 // Current index into |config_.nameservers|.
57 int server_index_;
58
59 // 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
62 // TODO(szym): add UDP socket pool ?
63
64 DISALLOW_COPY_AND_ASSIGN(DnsSession);
65 };
66
67 } // namespace net
68
69 #endif // NET_DNS_DNS_SESSION_H_
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