[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_ |
[email protected] | 32b76ef | 2010-07-26 23:08:24 | [diff] [blame] | 7 | #pragma once |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 8 | |
| 9 | #include <string> |
| 10 | |
[email protected] | 4f4de7e6 | 2010-11-12 19:55:27 | [diff] [blame] | 11 | #include "base/basictypes.h" |
[email protected] | f898601 | 2011-05-19 21:53:58 | [diff] [blame] | 12 | #include "net/base/net_api.h" |
[email protected] | 0a0b768 | 2010-08-25 17:08:07 | [diff] [blame] | 13 | #include "net/base/net_log.h" |
| 14 | |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 15 | namespace net { |
| 16 | |
| 17 | class AddressList; |
[email protected] | 822581d | 2010-12-16 17:27:15 | [diff] [blame] | 18 | class CertVerifier; |
[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] | 345c613b | 2010-11-22 19:33:18 | [diff] [blame] | 21 | class DnsCertProvenanceChecker; |
[email protected] | 4f4de7e6 | 2010-11-12 19:55:27 | [diff] [blame] | 22 | class HostPortPair; |
[email protected] | aaead50 | 2008-10-15 00:20:11 | [diff] [blame] | 23 | class SSLClientSocket; |
| 24 | struct SSLConfig; |
[email protected] | 7ab5bbd1 | 2010-10-19 13:33:21 | [diff] [blame] | 25 | class SSLHostInfo; |
[email protected] | 3268023f | 2011-05-05 00:08:10 | [diff] [blame] | 26 | class StreamSocket; |
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] | f898601 | 2011-05-19 21:53:58 | [diff] [blame] | 30 | class NET_API 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 | |
[email protected] | 0a0b768 | 2010-08-25 17:08:07 | [diff] [blame] | 34 | // |source| is the NetLog::Source for the entity trying to create the socket, |
| 35 | // if it has one. |
[email protected] | 98b0e58 | 2011-06-22 14:31:41 | [diff] [blame^] | 36 | virtual DatagramClientSocket* CreateDatagramClientSocket( |
| 37 | NetLog* net_log, |
| 38 | const NetLog::Source& source) = 0; |
| 39 | |
[email protected] | 3268023f | 2011-05-05 00:08:10 | [diff] [blame] | 40 | virtual StreamSocket* CreateTransportClientSocket( |
[email protected] | 0a0b768 | 2010-08-25 17:08:07 | [diff] [blame] | 41 | const AddressList& addresses, |
| 42 | NetLog* net_log, |
| 43 | const NetLog::Source& source) = 0; |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 44 | |
[email protected] | aaead50 | 2008-10-15 00:20:11 | [diff] [blame] | 45 | virtual SSLClientSocket* CreateSSLClientSocket( |
[email protected] | e60e47a | 2010-07-14 03:37:18 | [diff] [blame] | 46 | ClientSocketHandle* transport_socket, |
[email protected] | 4f4de7e6 | 2010-11-12 19:55:27 | [diff] [blame] | 47 | const HostPortPair& host_and_port, |
[email protected] | 7ab5bbd1 | 2010-10-19 13:33:21 | [diff] [blame] | 48 | const SSLConfig& ssl_config, |
[email protected] | d8fbf58 | 2010-11-04 21:51:12 | [diff] [blame] | 49 | SSLHostInfo* ssl_host_info, |
[email protected] | 822581d | 2010-12-16 17:27:15 | [diff] [blame] | 50 | CertVerifier* cert_verifier, |
[email protected] | 345c613b | 2010-11-22 19:33:18 | [diff] [blame] | 51 | DnsCertProvenanceChecker* dns_cert_checker) = 0; |
[email protected] | e60e47a | 2010-07-14 03:37:18 | [diff] [blame] | 52 | |
[email protected] | 3268023f | 2011-05-05 00:08:10 | [diff] [blame] | 53 | // Deprecated function (http://crbug.com/37810) that takes a StreamSocket. |
[email protected] | 4f4de7e6 | 2010-11-12 19:55:27 | [diff] [blame] | 54 | virtual SSLClientSocket* CreateSSLClientSocket( |
[email protected] | 3268023f | 2011-05-05 00:08:10 | [diff] [blame] | 55 | StreamSocket* transport_socket, |
[email protected] | 4f4de7e6 | 2010-11-12 19:55:27 | [diff] [blame] | 56 | const HostPortPair& host_and_port, |
| 57 | const SSLConfig& ssl_config, |
[email protected] | 822581d | 2010-12-16 17:27:15 | [diff] [blame] | 58 | SSLHostInfo* ssl_host_info, |
| 59 | CertVerifier* cert_verifier); |
[email protected] | e60e47a | 2010-07-14 03:37:18 | [diff] [blame] | 60 | |
[email protected] | 25f4735 | 2011-02-25 16:31:59 | [diff] [blame] | 61 | // Clears cache used for SSL session resumption. |
| 62 | virtual void ClearSSLSessionCache() = 0; |
| 63 | |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 64 | // Returns the default ClientSocketFactory. |
| 65 | static ClientSocketFactory* GetDefaultFactory(); |
[email protected] | abe48d3 | 2010-02-03 02:09:36 | [diff] [blame] | 66 | |
[email protected] | 2380f37 | 2011-02-23 21:35:19 | [diff] [blame] | 67 | // Instructs the default ClientSocketFactory to use the system SSL library. |
| 68 | static void UseSystemSSL(); |
initial.commit | 586acc5fe | 2008-07-26 22:42:52 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | } // namespace net |
| 72 | |
[email protected] | f7984fc6 | 2009-06-22 23:26:44 | [diff] [blame] | 73 | #endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ |