blob: 009c4e1221b4870e1f5174af497843b338198237 [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_
initial.commit586acc5fe2008-07-26 22:42:527
danakj655b66c2016-04-16 00:51:388#include <memory>
initial.commit586acc5fe2008-07-26 22:42:529#include <string>
10
[email protected]172da1b2011-08-12 15:52:2611#include "net/base/net_export.h"
Helen Liac3c51e2018-04-24 00:02:1312#include "net/http/proxy_client_socket.h"
tfarina5dd13c22016-11-16 12:08:2613#include "net/socket/datagram_socket.h"
tbansalca83c002016-04-28 20:56:2814#include "net/socket/socket_performance_watcher.h"
Helen Lid5bb9222018-04-12 15:33:0915#include "net/socket/transport_client_socket.h"
Helen Liac3c51e2018-04-24 00:02:1316#include "net/traffic_annotation/network_traffic_annotation.h"
[email protected]0a0b7682010-08-25 17:08:0717
initial.commit586acc5fe2008-07-26 22:42:5218namespace net {
19
20class AddressList;
[email protected]e60e47a2010-07-14 03:37:1821class ClientSocketHandle;
[email protected]98b0e582011-06-22 14:31:4122class DatagramClientSocket;
[email protected]4f4de7e62010-11-12 19:55:2723class HostPortPair;
mikecironef22f9812016-10-04 03:40:1924class NetLog;
25struct NetLogSource;
[email protected]aaead502008-10-15 00:20:1126class SSLClientSocket;
[email protected]feb79bcd2011-07-21 16:55:1727struct SSLClientSocketContext;
[email protected]aaead502008-10-15 00:20:1128struct SSLConfig;
Helen Liac3c51e2018-04-24 00:02:1329class ProxyClientSocket;
30class HttpAuthController;
initial.commit586acc5fe2008-07-26 22:42:5231
[email protected]3268023f2011-05-05 00:08:1032// An interface used to instantiate StreamSocket objects. Used to facilitate
initial.commit586acc5fe2008-07-26 22:42:5233// testing code with mock socket implementations.
[email protected]172da1b2011-08-12 15:52:2634class NET_EXPORT ClientSocketFactory {
initial.commit586acc5fe2008-07-26 22:42:5235 public:
[email protected]836dff32008-08-05 23:15:3636 virtual ~ClientSocketFactory() {}
37
mikecironef22f9812016-10-04 03:40:1938 // |source| is the NetLogSource for the entity trying to create the socket,
[email protected]0a0b7682010-08-25 17:08:0739 // if it has one.
danakj655b66c2016-04-16 00:51:3840 virtual std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket(
[email protected]5370c012011-06-29 03:47:0441 DatagramSocket::BindType bind_type,
[email protected]98b0e582011-06-22 14:31:4142 NetLog* net_log,
mikecironef22f9812016-10-04 03:40:1943 const NetLogSource& source) = 0;
[email protected]98b0e582011-06-22 14:31:4144
Helen Lid5bb9222018-04-12 15:33:0945 virtual std::unique_ptr<TransportClientSocket> CreateTransportClientSocket(
[email protected]0a0b7682010-08-25 17:08:0746 const AddressList& addresses,
danakj655b66c2016-04-16 00:51:3847 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher,
[email protected]0a0b7682010-08-25 17:08:0748 NetLog* net_log,
mikecironef22f9812016-10-04 03:40:1949 const NetLogSource& source) = 0;
initial.commit586acc5fe2008-07-26 22:42:5250
[email protected]b442da32011-08-16 19:32:2851 // It is allowed to pass in a |transport_socket| that is not obtained from a
52 // socket pool. The caller could create a ClientSocketHandle directly and call
53 // set_socket() on it to set a valid StreamSocket instance.
danakj655b66c2016-04-16 00:51:3854 virtual std::unique_ptr<SSLClientSocket> CreateSSLClientSocket(
55 std::unique_ptr<ClientSocketHandle> transport_socket,
[email protected]4f4de7e62010-11-12 19:55:2756 const HostPortPair& host_and_port,
[email protected]7ab5bbd12010-10-19 13:33:2157 const SSLConfig& ssl_config,
[email protected]feb79bcd2011-07-21 16:55:1758 const SSLClientSocketContext& context) = 0;
[email protected]e60e47a2010-07-14 03:37:1859
Helen Liac3c51e2018-04-24 00:02:1360 virtual std::unique_ptr<ProxyClientSocket> CreateProxyClientSocket(
61 std::unique_ptr<ClientSocketHandle> transport_socket,
62 const std::string& user_agent,
63 const HostPortPair& endpoint,
64 HttpAuthController* http_auth_controller,
65 bool tunnel,
66 bool using_spdy,
67 NextProto negotiated_protocol,
68 bool is_https_proxy,
69 const NetworkTrafficAnnotationTag& traffic_annotation) = 0;
70
[email protected]25f47352011-02-25 16:31:5971 // Clears cache used for SSL session resumption.
72 virtual void ClearSSLSessionCache() = 0;
73
initial.commit586acc5fe2008-07-26 22:42:5274 // Returns the default ClientSocketFactory.
75 static ClientSocketFactory* GetDefaultFactory();
76};
77
78} // namespace net
79
[email protected]f7984fc62009-06-22 23:26:4480#endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_