[email protected] | f898601 | 2011-05-19 21:53:58 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 4 | |
[email protected] | f7984fc6 | 2009-06-22 23:26:44 | [diff] [blame] | 5 | #ifndef NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ |
6 | #define NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ | ||||
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 7 | |
danakj | 655b66c | 2016-04-16 00:51:38 | [diff] [blame] | 8 | #include <memory> |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 9 | #include <string> |
10 | |||||
[email protected] | 172da1b | 2011-08-12 15:52:26 | [diff] [blame] | 11 | #include "net/base/net_export.h" |
tfarina | 5dd13c2 | 2016-11-16 12:08:26 | [diff] [blame] | 12 | #include "net/socket/datagram_socket.h" |
tbansal | ca83c00 | 2016-04-28 20:56:28 | [diff] [blame] | 13 | #include "net/socket/socket_performance_watcher.h" |
Helen Li | d5bb922 | 2018-04-12 15:33:09 | [diff] [blame^] | 14 | #include "net/socket/transport_client_socket.h" |
[email protected] | 0a0b768 | 2010-08-25 17:08:07 | [diff] [blame] | 15 | |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 16 | namespace net { |
17 | |||||
18 | class AddressList; | ||||
[email protected] | e60e47a | 2010-07-14 03:37:18 | [diff] [blame] | 19 | class ClientSocketHandle; |
[email protected] | 98b0e58 | 2011-06-22 14:31:41 | [diff] [blame] | 20 | class DatagramClientSocket; |
[email protected] | 4f4de7e6 | 2010-11-12 19:55:27 | [diff] [blame] | 21 | class HostPortPair; |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 22 | class NetLog; |
23 | struct NetLogSource; | ||||
[email protected] | aaead50 | 2008-10-15 00:20:11 | [diff] [blame] | 24 | class SSLClientSocket; |
[email protected] | feb79bcd | 2011-07-21 16:55:17 | [diff] [blame] | 25 | struct SSLClientSocketContext; |
[email protected] | aaead50 | 2008-10-15 00:20:11 | [diff] [blame] | 26 | struct SSLConfig; |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 27 | |
[email protected] | 3268023f | 2011-05-05 00:08:10 | [diff] [blame] | 28 | // An interface used to instantiate StreamSocket objects. Used to facilitate |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 29 | // testing code with mock socket implementations. |
[email protected] | 172da1b | 2011-08-12 15:52:26 | [diff] [blame] | 30 | class NET_EXPORT ClientSocketFactory { |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 31 | public: |
[email protected] | 836dff3 | 2008-08-05 23:15:36 | [diff] [blame] | 32 | virtual ~ClientSocketFactory() {} |
33 | |||||
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 34 | // |source| is the NetLogSource for the entity trying to create the socket, |
[email protected] | 0a0b768 | 2010-08-25 17:08:07 | [diff] [blame] | 35 | // if it has one. |
danakj | 655b66c | 2016-04-16 00:51:38 | [diff] [blame] | 36 | virtual std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket( |
[email protected] | 5370c01 | 2011-06-29 03:47:04 | [diff] [blame] | 37 | DatagramSocket::BindType bind_type, |
[email protected] | 98b0e58 | 2011-06-22 14:31:41 | [diff] [blame] | 38 | NetLog* net_log, |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 39 | const NetLogSource& source) = 0; |
[email protected] | 98b0e58 | 2011-06-22 14:31:41 | [diff] [blame] | 40 | |
Helen Li | d5bb922 | 2018-04-12 15:33:09 | [diff] [blame^] | 41 | virtual std::unique_ptr<TransportClientSocket> CreateTransportClientSocket( |
[email protected] | 0a0b768 | 2010-08-25 17:08:07 | [diff] [blame] | 42 | const AddressList& addresses, |
danakj | 655b66c | 2016-04-16 00:51:38 | [diff] [blame] | 43 | std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, |
[email protected] | 0a0b768 | 2010-08-25 17:08:07 | [diff] [blame] | 44 | NetLog* net_log, |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 45 | const NetLogSource& source) = 0; |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 46 | |
[email protected] | b442da3 | 2011-08-16 19:32:28 | [diff] [blame] | 47 | // It is allowed to pass in a |transport_socket| that is not obtained from a |
48 | // socket pool. The caller could create a ClientSocketHandle directly and call | ||||
49 | // set_socket() on it to set a valid StreamSocket instance. | ||||
danakj | 655b66c | 2016-04-16 00:51:38 | [diff] [blame] | 50 | virtual std::unique_ptr<SSLClientSocket> CreateSSLClientSocket( |
51 | std::unique_ptr<ClientSocketHandle> transport_socket, | ||||
[email protected] | 4f4de7e6 | 2010-11-12 19:55:27 | [diff] [blame] | 52 | const HostPortPair& host_and_port, |
[email protected] | 7ab5bbd1 | 2010-10-19 13:33:21 | [diff] [blame] | 53 | const SSLConfig& ssl_config, |
[email protected] | feb79bcd | 2011-07-21 16:55:17 | [diff] [blame] | 54 | const SSLClientSocketContext& context) = 0; |
[email protected] | e60e47a | 2010-07-14 03:37:18 | [diff] [blame] | 55 | |
[email protected] | 25f4735 | 2011-02-25 16:31:59 | [diff] [blame] | 56 | // Clears cache used for SSL session resumption. |
57 | virtual void ClearSSLSessionCache() = 0; | ||||
58 | |||||
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 59 | // Returns the default ClientSocketFactory. |
60 | static ClientSocketFactory* GetDefaultFactory(); | ||||
61 | }; | ||||
62 | |||||
63 | } // namespace net | ||||
64 | |||||
[email protected] | f7984fc6 | 2009-06-22 23:26:44 | [diff] [blame] | 65 | #endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ |