1
#pragma once
2

            
3
#include "envoy/extensions/upstreams/tcp/generic/v3/generic_connection_pool.pb.h"
4
#include "envoy/http/filter.h"
5
#include "envoy/registry/registry.h"
6
#include "envoy/tcp/upstream.h"
7

            
8
namespace Envoy {
9
namespace Extensions {
10
namespace Upstreams {
11
namespace Tcp {
12
namespace Generic {
13

            
14
/**
15
 * Config registration for the GenericConnPool. * @see TcpProxy::GenericConnPoolFactory
16
 */
17
class GenericConnPoolFactory : public TcpProxy::GenericConnPoolFactory {
18
public:
19
282
  std::string name() const override { return "envoy.filters.connection_pools.tcp.generic"; }
20
123
  std::string category() const override { return "envoy.upstreams"; }
21
  TcpProxy::GenericConnPoolPtr createGenericConnPool(
22
      Upstream::HostConstSharedPtr host, Upstream::ThreadLocalCluster& thread_local_cluster,
23
      TcpProxy::TunnelingConfigHelperOptConstRef config, Upstream::LoadBalancerContext* context,
24
      Envoy::Tcp::ConnectionPool::UpstreamCallbacks& upstream_callbacks,
25
      Http::StreamDecoderFilterCallbacks& stream_decoder_callbacks,
26
      StreamInfo::StreamInfo& downstream_info) const override;
27

            
28
26
  ProtobufTypes::MessagePtr createEmptyConfigProto() override {
29
26
    return std::make_unique<
30
26
        envoy::extensions::upstreams::tcp::generic::v3::GenericConnectionPoolProto>();
31
26
  }
32

            
33
private:
34
  bool disableTunnelingByFilterState(StreamInfo::StreamInfo& downstream_info) const;
35
};
36

            
37
DECLARE_FACTORY(GenericConnPoolFactory);
38

            
39
} // namespace Generic
40
} // namespace Tcp
41
} // namespace Upstreams
42
} // namespace Extensions
43
} // namespace Envoy