Coverage Report

Created: 2023-11-12 09:30

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