Line data Source code
1 : #pragma once 2 : 3 : #include "envoy/network/listen_socket.h" 4 : #include "envoy/server/admin.h" 5 : #include "envoy/server/instance.h" 6 : 7 : #include "source/common/common/assert.h" 8 : #include "source/common/network/listen_socket_impl.h" 9 : #include "source/server/admin/config_tracker_impl.h" 10 : 11 : namespace Envoy { 12 : namespace Server { 13 : 14 : /** 15 : * Config-validation-only implementation Server::Admin. This implementation is 16 : * needed because Admin is referenced by components of the server that add and 17 : * remove handlers. 18 : */ 19 : class ValidationAdmin : public Admin { 20 : public: 21 : // We want to implement the socket interface without implementing the http listener function. 22 : // This is useful for TAP because it wants to emit warnings when the address type is UDS 23 : explicit ValidationAdmin(Network::Address::InstanceConstSharedPtr address) 24 : : socket_(address ? std::make_shared<Network::TcpListenSocket>(nullptr, std::move(address), 25 : nullptr) 26 110 : : nullptr) {} 27 : bool addHandler(const std::string&, const std::string&, HandlerCb, bool, bool, 28 : const ParamDescriptorVec& = {}) override; 29 : bool addStreamingHandler(const std::string&, const std::string&, GenRequestFn, bool, bool, 30 : const ParamDescriptorVec& = {}) override; 31 : bool removeHandler(const std::string&) override; 32 : const Network::Socket& socket() override; 33 : ConfigTracker& getConfigTracker() override; 34 : void startHttpListener(std::list<AccessLog::InstanceSharedPtr> access_logs, 35 : Network::Address::InstanceConstSharedPtr address, 36 : Network::Socket::OptionsSharedPtr) override; 37 : Http::Code request(absl::string_view path_and_query, absl::string_view method, 38 : Http::ResponseHeaderMap& response_headers, std::string& body) override; 39 : void addListenerToHandler(Network::ConnectionHandler* handler) override; 40 0 : uint32_t concurrency() const override { return 1; } 41 0 : void closeSocket() override {} 42 : 43 : private: 44 : ConfigTrackerImpl config_tracker_; 45 : Network::SocketSharedPtr socket_; 46 : }; 47 : 48 : } // namespace Server 49 : } // namespace Envoy