1
#pragma once
2

            
3
#include "envoy/config/typed_config.h"
4
#include "envoy/network/address.h"
5
#include "envoy/network/connection.h"
6
#include "envoy/network/listen_socket.h"
7
#include "envoy/network/transport_socket.h"
8

            
9
namespace Envoy {
10
namespace Network {
11

            
12
// The factory to create a client connection. This factory hides the details of various remote
13
// address type and transport socket.
14
class ClientConnectionFactory : public Config::UntypedFactory {
15
public:
16
  ~ClientConnectionFactory() override = default;
17

            
18
  // Config::UntypedFactory
19
3351
  std::string category() const override { return "network.connection.client"; }
20

            
21
  /**
22
   * @param address The target remote address.
23
   * @param source_address Optional source address.
24
   * @param transport_socket The transport socket which supports this client connection.
25
   * @param options The optional socket options.
26
   * @param transport socket options used to create the transport socket.
27
   * @return Network::ClientConnectionPtr The created connection. It's never nullptr but the return
28
   * connection may be closed upon return.
29
   */
30
  virtual Network::ClientConnectionPtr createClientConnection(
31
      Event::Dispatcher& dispatcher, Network::Address::InstanceConstSharedPtr address,
32
      Network::Address::InstanceConstSharedPtr source_address,
33
      Network::TransportSocketPtr&& transport_socket,
34
      const Network::ConnectionSocket::OptionsSharedPtr& options,
35
      const Network::TransportSocketOptionsConstSharedPtr& transport_options) PURE;
36
};
37

            
38
} // namespace Network
39
} // namespace Envoy