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

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

Issue 11567031: [net/dns] Handle TC bit on DNS response in DnsTransaction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add test for timeout and fix timeout logic Created 8 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
OLDNEW
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_DNS_SOCKET_POOL_H_ 5 #ifndef NET_DNS_DNS_SOCKET_POOL_H_
6 #define NET_DNS_DNS_SOCKET_POOL_H_ 6 #define NET_DNS_DNS_SOCKET_POOL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
12 #include "net/base/net_log.h"
12 13
13 namespace net { 14 namespace net {
14 15
15 class ClientSocketFactory; 16 class ClientSocketFactory;
16 class DatagramClientSocket; 17 class DatagramClientSocket;
17 class IPEndPoint; 18 class IPEndPoint;
18 class NetLog; 19 class NetLog;
20 class StreamSocket;
19 21
20 // A DnsSocketPool is an abstraction layer around a ClientSocketFactory that 22 // A DnsSocketPool is an abstraction layer around a ClientSocketFactory that
21 // allows preallocation, reuse, or other strategies to manage sockets connected 23 // allows preallocation, reuse, or other strategies to manage sockets connected
22 // to DNS servers. 24 // to DNS servers.
23 class NET_EXPORT_PRIVATE DnsSocketPool { 25 class NET_EXPORT_PRIVATE DnsSocketPool {
24 public: 26 public:
25 virtual ~DnsSocketPool() { } 27 virtual ~DnsSocketPool() { }
26 28
27 // Creates a DnsSocketPool that implements the default strategy for managing 29 // Creates a DnsSocketPool that implements the default strategy for managing
28 // sockets. (This varies by platform; see DnsSocketPoolImpl in 30 // sockets. (This varies by platform; see DnsSocketPoolImpl in
(...skipping 23 matching lines...) Expand all
52 // one on which Connect fails). 54 // one on which Connect fails).
53 virtual scoped_ptr<DatagramClientSocket> AllocateSocket( 55 virtual scoped_ptr<DatagramClientSocket> AllocateSocket(
54 unsigned server_index) = 0; 56 unsigned server_index) = 0;
55 57
56 // Frees a socket allocated by AllocateSocket. |server_index| must be the 58 // Frees a socket allocated by AllocateSocket. |server_index| must be the
57 // same index passed to AllocateSocket. 59 // same index passed to AllocateSocket.
58 virtual void FreeSocket( 60 virtual void FreeSocket(
59 unsigned server_index, 61 unsigned server_index,
60 scoped_ptr<DatagramClientSocket> socket) = 0; 62 scoped_ptr<DatagramClientSocket> socket) = 0;
61 63
64 // TODO(szym): add comment
mmenke 2012/12/19 16:44:09 Assume you're going to take care of that in this C
szym 2012/12/19 23:35:56 Done.
65 scoped_ptr<StreamSocket> AllocateTCPSocket(
66 unsigned server_index,
67 const NetLog::Source& source);
68
62 protected: 69 protected:
63 DnsSocketPool(ClientSocketFactory* socket_factory); 70 DnsSocketPool(ClientSocketFactory* socket_factory);
64 71
65 void InitializeInternal( 72 void InitializeInternal(
66 const std::vector<IPEndPoint>* nameservers, 73 const std::vector<IPEndPoint>* nameservers,
67 NetLog* net_log); 74 NetLog* net_log);
68 75
69 scoped_ptr<DatagramClientSocket> CreateConnectedSocket( 76 scoped_ptr<DatagramClientSocket> CreateConnectedSocket(
70 unsigned server_index); 77 unsigned server_index);
71 78
72 private: 79 private:
73 ClientSocketFactory* socket_factory_; 80 ClientSocketFactory* socket_factory_;
74 NetLog* net_log_; 81 NetLog* net_log_;
75 const std::vector<IPEndPoint>* nameservers_; 82 const std::vector<IPEndPoint>* nameservers_;
76 bool initialized_; 83 bool initialized_;
77 84
78 DISALLOW_COPY_AND_ASSIGN(DnsSocketPool); 85 DISALLOW_COPY_AND_ASSIGN(DnsSocketPool);
79 }; 86 };
80 87
81 } // namespace net 88 } // namespace net
82 89
83 #endif // NET_DNS_DNS_SOCKET_POOL_H_ 90 #endif // NET_DNS_DNS_SOCKET_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698