Chromium Code Reviews| OLD | NEW |
|---|---|
| (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. | |
| 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 DnsConfig config_; | |
|
mmenke
2011/12/02 00:53:55
It looks to me like your intention is to create a
szym
2011/12/05 23:06:28
Done.
| |
| 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 | |
| OLD | NEW |