blob: dddf1de8d664deb848fae5a17fb0ade3834ad105 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_SOCKET_CLIENT_SOCKET_FACTORY_H_
#define NET_SOCKET_CLIENT_SOCKET_FACTORY_H_
#include <string>
namespace net {
class AddressList;
class ClientSocket;
class ClientSocketHandle;
class NetLog;
class SSLClientSocket;
struct SSLConfig;
// Callback function to create new SSLClientSocket objects.
typedef SSLClientSocket* (*SSLClientSocketFactory)(
ClientSocketHandle* transport_socket,
const std::string& hostname,
const SSLConfig& ssl_config);
// An interface used to instantiate ClientSocket objects. Used to facilitate
// testing code with mock socket implementations.
class ClientSocketFactory {
public:
virtual ~ClientSocketFactory() {}
virtual ClientSocket* CreateTCPClientSocket(
const AddressList& addresses, NetLog* net_log) = 0;
virtual SSLClientSocket* CreateSSLClientSocket(
ClientSocketHandle* transport_socket,
const std::string& hostname,
const SSLConfig& ssl_config) = 0;
// Deprecated function (http://crbug.com/37810) that takes a ClientSocket.
virtual SSLClientSocket* CreateSSLClientSocket(ClientSocket* transport_socket,
const std::string& hostname,
const SSLConfig& ssl_config);
// Returns the default ClientSocketFactory.
static ClientSocketFactory* GetDefaultFactory();
// Instructs the default ClientSocketFactory to use |factory| to create
// SSLClientSocket objects.
static void SetSSLClientSocketFactory(SSLClientSocketFactory factory);
};
} // namespace net
#endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_
|