blob: 0f351941cab8a1e6e28010658e50f9e883239527 [file] [log] [blame]
[email protected]f8986012011-05-19 21:53:581// Copyright (c) 2011 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit586acc5fe2008-07-26 22:42:524
[email protected]f7984fc62009-06-22 23:26:445#ifndef NET_SOCKET_CLIENT_SOCKET_FACTORY_H_
6#define NET_SOCKET_CLIENT_SOCKET_FACTORY_H_
[email protected]32b76ef2010-07-26 23:08:247#pragma once
initial.commit586acc5fe2008-07-26 22:42:528
9#include <string>
10
[email protected]4f4de7e62010-11-12 19:55:2711#include "base/basictypes.h"
[email protected]172da1b2011-08-12 15:52:2612#include "net/base/net_export.h"
[email protected]0a0b7682010-08-25 17:08:0713#include "net/base/net_log.h"
[email protected]5370c012011-06-29 03:47:0414#include "net/base/rand_callback.h"
15#include "net/udp/datagram_socket.h"
[email protected]0a0b7682010-08-25 17:08:0716
initial.commit586acc5fe2008-07-26 22:42:5217namespace net {
18
19class AddressList;
[email protected]822581d2010-12-16 17:27:1520class CertVerifier;
[email protected]e60e47a2010-07-14 03:37:1821class ClientSocketHandle;
[email protected]98b0e582011-06-22 14:31:4122class DatagramClientSocket;
[email protected]345c613b2010-11-22 19:33:1823class DnsCertProvenanceChecker;
[email protected]4f4de7e62010-11-12 19:55:2724class HostPortPair;
[email protected]aaead502008-10-15 00:20:1125class SSLClientSocket;
[email protected]feb79bcd2011-07-21 16:55:1726struct SSLClientSocketContext;
[email protected]aaead502008-10-15 00:20:1127struct SSLConfig;
[email protected]7ab5bbd12010-10-19 13:33:2128class SSLHostInfo;
[email protected]3268023f2011-05-05 00:08:1029class StreamSocket;
initial.commit586acc5fe2008-07-26 22:42:5230
[email protected]3268023f2011-05-05 00:08:1031// An interface used to instantiate StreamSocket objects. Used to facilitate
initial.commit586acc5fe2008-07-26 22:42:5232// testing code with mock socket implementations.
[email protected]172da1b2011-08-12 15:52:2633class NET_EXPORT ClientSocketFactory {
initial.commit586acc5fe2008-07-26 22:42:5234 public:
[email protected]836dff32008-08-05 23:15:3635 virtual ~ClientSocketFactory() {}
36
[email protected]0a0b7682010-08-25 17:08:0737 // |source| is the NetLog::Source for the entity trying to create the socket,
38 // if it has one.
[email protected]98b0e582011-06-22 14:31:4139 virtual DatagramClientSocket* CreateDatagramClientSocket(
[email protected]5370c012011-06-29 03:47:0440 DatagramSocket::BindType bind_type,
41 const RandIntCallback& rand_int_cb,
[email protected]98b0e582011-06-22 14:31:4142 NetLog* net_log,
43 const NetLog::Source& source) = 0;
44
[email protected]3268023f2011-05-05 00:08:1045 virtual StreamSocket* CreateTransportClientSocket(
[email protected]0a0b7682010-08-25 17:08:0746 const AddressList& addresses,
47 NetLog* net_log,
48 const NetLog::Source& source) = 0;
initial.commit586acc5fe2008-07-26 22:42:5249
[email protected]b442da32011-08-16 19:32:2850 // It is allowed to pass in a |transport_socket| that is not obtained from a
51 // socket pool. The caller could create a ClientSocketHandle directly and call
52 // set_socket() on it to set a valid StreamSocket instance.
[email protected]aaead502008-10-15 00:20:1153 virtual SSLClientSocket* CreateSSLClientSocket(
[email protected]e60e47a2010-07-14 03:37:1854 ClientSocketHandle* transport_socket,
[email protected]4f4de7e62010-11-12 19:55:2755 const HostPortPair& host_and_port,
[email protected]7ab5bbd12010-10-19 13:33:2156 const SSLConfig& ssl_config,
[email protected]d8fbf582010-11-04 21:51:1257 SSLHostInfo* ssl_host_info,
[email protected]feb79bcd2011-07-21 16:55:1758 const SSLClientSocketContext& context) = 0;
[email protected]e60e47a2010-07-14 03:37:1859
[email protected]3268023f2011-05-05 00:08:1060 // Deprecated function (http://crbug.com/37810) that takes a StreamSocket.
[email protected]4f4de7e62010-11-12 19:55:2761 virtual SSLClientSocket* CreateSSLClientSocket(
[email protected]3268023f2011-05-05 00:08:1062 StreamSocket* transport_socket,
[email protected]4f4de7e62010-11-12 19:55:2763 const HostPortPair& host_and_port,
64 const SSLConfig& ssl_config,
[email protected]822581d2010-12-16 17:27:1565 SSLHostInfo* ssl_host_info,
[email protected]feb79bcd2011-07-21 16:55:1766 const SSLClientSocketContext& context);
[email protected]e60e47a2010-07-14 03:37:1867
[email protected]25f47352011-02-25 16:31:5968 // Clears cache used for SSL session resumption.
69 virtual void ClearSSLSessionCache() = 0;
70
initial.commit586acc5fe2008-07-26 22:42:5271 // Returns the default ClientSocketFactory.
72 static ClientSocketFactory* GetDefaultFactory();
[email protected]abe48d32010-02-03 02:09:3673
[email protected]2380f372011-02-23 21:35:1974 // Instructs the default ClientSocketFactory to use the system SSL library.
75 static void UseSystemSSL();
initial.commit586acc5fe2008-07-26 22:42:5276};
77
78} // namespace net
79
[email protected]f7984fc62009-06-22 23:26:4480#endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_