1
#pragma once
2

            
3
#include <string>
4

            
5
#include "envoy/config/core/v3/health_check.pb.h"
6
#include "envoy/config/typed_config.h"
7
#include "envoy/event/dispatcher.h"
8
#include "envoy/init/manager.h"
9
#include "envoy/local_info/local_info.h"
10
#include "envoy/network/transport_socket.h"
11
#include "envoy/secret/secret_manager.h"
12
#include "envoy/server/factory_context.h"
13
#include "envoy/singleton/manager.h"
14
#include "envoy/ssl/context_manager.h"
15
#include "envoy/stats/scope.h"
16
#include "envoy/thread_local/thread_local.h"
17
#include "envoy/upstream/cluster_manager.h"
18

            
19
#include "source/common/protobuf/protobuf.h"
20

            
21
namespace Envoy {
22
namespace Server {
23
namespace Configuration {
24

            
25
using TransportSocketFactoryContext = GenericFactoryContext;
26
using TransportSocketFactoryContextPtr = std::unique_ptr<TransportSocketFactoryContext>;
27

            
28
class TransportSocketConfigFactory : public Config::TypedFactory {
29
public:
30
38
  ~TransportSocketConfigFactory() override = default;
31
};
32

            
33
/**
34
 * Implemented by each transport socket used for upstream connections. Registered via class
35
 * RegisterFactory.
36
 */
37
class UpstreamTransportSocketConfigFactory : public virtual TransportSocketConfigFactory {
38
public:
39
  /**
40
   * Create a particular transport socket factory implementation.
41
   * @param config const Protobuf::Message& supplies the config message for the transport socket
42
   *        implementation.
43
   * @param context TransportSocketFactoryContext& supplies the transport socket's context.
44
   * @return absl::StatusOr<Network::UpstreamTransportSocketFactoryPtr> the transport socket factory
45
   * instance or error status. The returned TransportSocketFactoryPtr should not be nullptr.
46
   *
47
   * @throw EnvoyException if the implementation is unable to produce a factory with the provided
48
   *        parameters.
49
   */
50
  virtual absl::StatusOr<Network::UpstreamTransportSocketFactoryPtr>
51
  createTransportSocketFactory(const Protobuf::Message& config,
52
                               TransportSocketFactoryContext& context) PURE;
53

            
54
3687
  std::string category() const override { return "envoy.transport_sockets.upstream"; }
55
};
56

            
57
/**
58
 * Implemented by each transport socket used for downstream connections. Registered via class
59
 * RegisterFactory.
60
 */
61
class DownstreamTransportSocketConfigFactory : public virtual TransportSocketConfigFactory {
62
public:
63
  /**
64
   * Create a particular downstream transport socket factory implementation.
65
   * @param server_names const std::vector<std::string>& the names of the server. This parameter is
66
   *        currently used by SNI implementation to know the expected server names.
67
   * @param config const Protobuf::Message& supplies the config message for the transport socket
68
   *        implementation.
69
   * @param context TransportSocketFactoryContext& supplies the transport socket's context.
70
   * @return absl::StatusOr<Network::DownstreamTransportSocketFactoryPtr> the transport socket
71
   * factory instance. The returned TransportSocketFactoryPtr should not be nullptr.
72
   *
73
   * @throw EnvoyException if the implementation is unable to produce a factory with the provided
74
   *        parameters.
75
   */
76
  virtual absl::StatusOr<Network::DownstreamTransportSocketFactoryPtr>
77
  createTransportSocketFactory(const Protobuf::Message& config,
78
                               TransportSocketFactoryContext& context,
79
                               const std::vector<std::string>& server_names) PURE;
80

            
81
2090
  std::string category() const override { return "envoy.transport_sockets.downstream"; }
82
};
83

            
84
} // namespace Configuration
85
} // namespace Server
86
} // namespace Envoy