blob: 39d14a80fd153639af3350548d8906ecde7efb34 [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"
tfarina5dd13c22016-11-16 12:08:2612#include "net/socket/datagram_socket.h"
tbansalca83c002016-04-28 20:56:2813#include "net/socket/socket_performance_watcher.h"
Helen Lid5bb9222018-04-12 15:33:0914#include "net/socket/transport_client_socket.h"
[email protected]0a0b7682010-08-25 17:08:0715
initial.commit586acc5fe2008-07-26 22:42:5216namespace net {
17
18class AddressList;
[email protected]e60e47a2010-07-14 03:37:1819class ClientSocketHandle;
[email protected]98b0e582011-06-22 14:31:4120class DatagramClientSocket;
[email protected]4f4de7e62010-11-12 19:55:2721class HostPortPair;
mikecironef22f9812016-10-04 03:40:1922class NetLog;
23struct NetLogSource;
[email protected]aaead502008-10-15 00:20:1124class SSLClientSocket;
[email protected]feb79bcd2011-07-21 16:55:1725struct SSLClientSocketContext;
[email protected]aaead502008-10-15 00:20:1126struct SSLConfig;
initial.commit586acc5fe2008-07-26 22:42:5227
[email protected]3268023f2011-05-05 00:08:1028// An interface used to instantiate StreamSocket objects. Used to facilitate
initial.commit586acc5fe2008-07-26 22:42:5229// testing code with mock socket implementations.
[email protected]172da1b2011-08-12 15:52:2630class NET_EXPORT ClientSocketFactory {
initial.commit586acc5fe2008-07-26 22:42:5231 public:
[email protected]836dff32008-08-05 23:15:3632 virtual ~ClientSocketFactory() {}
33
mikecironef22f9812016-10-04 03:40:1934 // |source| is the NetLogSource for the entity trying to create the socket,
[email protected]0a0b7682010-08-25 17:08:0735 // if it has one.
danakj655b66c2016-04-16 00:51:3836 virtual std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket(
[email protected]5370c012011-06-29 03:47:0437 DatagramSocket::BindType bind_type,
[email protected]98b0e582011-06-22 14:31:4138 NetLog* net_log,
mikecironef22f9812016-10-04 03:40:1939 const NetLogSource& source) = 0;
[email protected]98b0e582011-06-22 14:31:4140
Helen Lid5bb9222018-04-12 15:33:0941 virtual std::unique_ptr<TransportClientSocket> CreateTransportClientSocket(
[email protected]0a0b7682010-08-25 17:08:0742 const AddressList& addresses,
danakj655b66c2016-04-16 00:51:3843 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher,
[email protected]0a0b7682010-08-25 17:08:0744 NetLog* net_log,
mikecironef22f9812016-10-04 03:40:1945 const NetLogSource& source) = 0;
initial.commit586acc5fe2008-07-26 22:42:5246
[email protected]b442da32011-08-16 19:32:2847 // It is allowed to pass in a |transport_socket| that is not obtained from a
48 // socket pool. The caller could create a ClientSocketHandle directly and call
49 // set_socket() on it to set a valid StreamSocket instance.
danakj655b66c2016-04-16 00:51:3850 virtual std::unique_ptr<SSLClientSocket> CreateSSLClientSocket(
51 std::unique_ptr<ClientSocketHandle> transport_socket,
[email protected]4f4de7e62010-11-12 19:55:2752 const HostPortPair& host_and_port,
[email protected]7ab5bbd12010-10-19 13:33:2153 const SSLConfig& ssl_config,
[email protected]feb79bcd2011-07-21 16:55:1754 const SSLClientSocketContext& context) = 0;
[email protected]e60e47a2010-07-14 03:37:1855
[email protected]25f47352011-02-25 16:31:5956 // Clears cache used for SSL session resumption.
57 virtual void ClearSSLSessionCache() = 0;
58
initial.commit586acc5fe2008-07-26 22:42:5259 // Returns the default ClientSocketFactory.
60 static ClientSocketFactory* GetDefaultFactory();
61};
62
63} // namespace net
64
[email protected]f7984fc62009-06-22 23:26:4465#endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_