Line data Source code
1 : #pragma once 2 : 3 : #include "envoy/server/transport_socket_config.h" 4 : #include "envoy/stats/scope.h" 5 : 6 : namespace Envoy { 7 : namespace Server { 8 : namespace Configuration { 9 : 10 : /** 11 : * Implementation of TransportSocketFactoryContext. 12 : */ 13 : class TransportSocketFactoryContextImpl : public TransportSocketFactoryContext { 14 : public: 15 : TransportSocketFactoryContextImpl(Server::Configuration::ServerFactoryContext& server_context, 16 : Ssl::ContextManager& context_manager, Stats::Scope& stats_scope, 17 : Upstream::ClusterManager& cm, 18 : ProtobufMessage::ValidationVisitor& validation_visitor) 19 : : server_context_(server_context), context_manager_(context_manager), 20 293 : stats_scope_(stats_scope), cluster_manager_(cm), validation_visitor_(validation_visitor) {} 21 : 22 : /** 23 : * Pass an init manager to register dynamic secret provider. 24 : * @param init_manager instance of init manager. 25 : */ 26 303 : void setInitManager(Init::Manager& init_manager) { init_manager_ = &init_manager; } 27 : 28 : // TransportSocketFactoryContext 29 119 : ServerFactoryContext& serverFactoryContext() override { return server_context_; } 30 1328 : Upstream::ClusterManager& clusterManager() override { return cluster_manager_; } 31 556 : ProtobufMessage::ValidationVisitor& messageValidationVisitor() override { 32 556 : return validation_visitor_; 33 556 : } 34 0 : Ssl::ContextManager& sslContextManager() override { return context_manager_; } 35 0 : Stats::Scope& statsScope() override { return stats_scope_; } 36 0 : Secret::SecretManager& secretManager() override { 37 0 : return clusterManager().clusterManagerFactory().secretManager(); 38 0 : } 39 0 : Init::Manager& initManager() override { 40 0 : ASSERT(init_manager_ != nullptr); 41 0 : return *init_manager_; 42 0 : } 43 : 44 : private: 45 : Server::Configuration::ServerFactoryContext& server_context_; 46 : Ssl::ContextManager& context_manager_; 47 : Stats::Scope& stats_scope_; 48 : Upstream::ClusterManager& cluster_manager_; 49 : ProtobufMessage::ValidationVisitor& validation_visitor_; 50 : 51 : Init::Manager* init_manager_{}; 52 : }; 53 : 54 : using TransportSocketFactoryContextImplPtr = std::unique_ptr<TransportSocketFactoryContextImpl>; 55 : 56 : } // namespace Configuration 57 : } // namespace Server 58 : } // namespace Envoy