blob: ad2cc54867d148991f27976bd5abd669b5ad3ee6 [file] [log] [blame]
[email protected]a2006ece2010-04-23 16:44:021// Copyright (c) 2010 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]0a0b7682010-08-25 17:08:0711#include "net/base/net_log.h"
12
initial.commit586acc5fe2008-07-26 22:42:5213namespace net {
14
15class AddressList;
16class ClientSocket;
[email protected]e60e47a2010-07-14 03:37:1817class ClientSocketHandle;
[email protected]aaead502008-10-15 00:20:1118class SSLClientSocket;
19struct SSLConfig;
[email protected]7ab5bbd12010-10-19 13:33:2120class SSLHostInfo;
initial.commit586acc5fe2008-07-26 22:42:5221
[email protected]abe48d32010-02-03 02:09:3622// Callback function to create new SSLClientSocket objects.
23typedef SSLClientSocket* (*SSLClientSocketFactory)(
[email protected]e60e47a2010-07-14 03:37:1824 ClientSocketHandle* transport_socket,
[email protected]abe48d32010-02-03 02:09:3625 const std::string& hostname,
[email protected]7ab5bbd12010-10-19 13:33:2126 const SSLConfig& ssl_config,
27 SSLHostInfo* ssl_host_info);
[email protected]abe48d32010-02-03 02:09:3628
initial.commit586acc5fe2008-07-26 22:42:5229// An interface used to instantiate ClientSocket objects. Used to facilitate
30// testing code with mock socket implementations.
31class ClientSocketFactory {
32 public:
[email protected]836dff32008-08-05 23:15:3633 virtual ~ClientSocketFactory() {}
34
[email protected]0a0b7682010-08-25 17:08:0735 // |source| is the NetLog::Source for the entity trying to create the socket,
36 // if it has one.
initial.commit586acc5fe2008-07-26 22:42:5237 virtual ClientSocket* CreateTCPClientSocket(
[email protected]0a0b7682010-08-25 17:08:0738 const AddressList& addresses,
39 NetLog* net_log,
40 const NetLog::Source& source) = 0;
initial.commit586acc5fe2008-07-26 22:42:5241
[email protected]aaead502008-10-15 00:20:1142 virtual SSLClientSocket* CreateSSLClientSocket(
[email protected]e60e47a2010-07-14 03:37:1843 ClientSocketHandle* transport_socket,
[email protected]c5949a32008-10-08 17:28:2344 const std::string& hostname,
[email protected]7ab5bbd12010-10-19 13:33:2145 const SSLConfig& ssl_config,
46 SSLHostInfo* ssl_host_info) = 0;
[email protected]e60e47a2010-07-14 03:37:1847
48 // Deprecated function (http://crbug.com/37810) that takes a ClientSocket.
49 virtual SSLClientSocket* CreateSSLClientSocket(ClientSocket* transport_socket,
50 const std::string& hostname,
[email protected]7ab5bbd12010-10-19 13:33:2151 const SSLConfig& ssl_config,
52 SSLHostInfo* ssl_host_info);
[email protected]e60e47a2010-07-14 03:37:1853
initial.commit586acc5fe2008-07-26 22:42:5254 // Returns the default ClientSocketFactory.
55 static ClientSocketFactory* GetDefaultFactory();
[email protected]abe48d32010-02-03 02:09:3656
57 // Instructs the default ClientSocketFactory to use |factory| to create
58 // SSLClientSocket objects.
59 static void SetSSLClientSocketFactory(SSLClientSocketFactory factory);
initial.commit586acc5fe2008-07-26 22:42:5260};
61
62} // namespace net
63
[email protected]f7984fc62009-06-22 23:26:4464#endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_