Kea: ca_cfg_mgr.h Source File

| Kea 3.0.3-git

ca_cfg_mgr.h
Go to the documentation of this file.
1// Copyright (C) 2016-2024 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef CTRL_AGENT_CFG_MGR_H
8#define CTRL_AGENT_CFG_MGR_H
9
10#include <cc/data.h>
11#include <hooks/hooks_config.h>
12#include <http/auth_config.h>
13#include <http/cfg_http_header.h>
14#include <process/d_cfg_mgr.h>
15#include <boost/pointer_cast.hpp>
16#include <map>
17#include <string>
18
19namespace isc {
20namespace agent {
21
22class CtrlAgentCfgContext;
24 typedef boost::shared_ptr<CtrlAgentCfgContext> CtrlAgentCfgContextPtr;
25
33 class CtrlAgentCfgContext : public process::ConfigBase {
34public:
35
37 CtrlAgentCfgContext();
38
45 virtual process::ConfigPtr clone() {
46 return (process::ConfigPtr(new CtrlAgentCfgContext(*this)));
47 }
48
58 isc::data::ConstElementPtr
59 getControlSocketInfo(const std::string& service) const;
60
69 void setControlSocketInfo(const isc::data::ConstElementPtr& control_socket,
70 const std::string& service);
71
73 std::string getControlSocketInfoSummary() const;
74
79 void setHttpHost(const std::string& host) {
80 http_host_ = host;
81 }
82
87 std::string getHttpHost() const {
88 return (http_host_);
89 }
90
94 void setHttpPort(const uint16_t port) {
95 http_port_ = port;
96 }
97
99 uint16_t getHttpPort() const {
100 return (http_port_);
101 }
102
106 void setHttpHeaders(const isc::http::CfgHttpHeaders& headers) {
107 http_headers_ = headers;
108 }
109
113 const isc::http::CfgHttpHeaders& getHttpHeaders() const {
114 return (http_headers_);
115 }
116
122 void setAuthConfig(const isc::http::HttpAuthConfigPtr& auth_config) {
123 auth_config_ = auth_config;
124 }
125
131 const isc::http::HttpAuthConfigPtr& getAuthConfig() const {
132 return (auth_config_);
133 }
134
139 void setTrustAnchor(const std::string& ca) {
140 trust_anchor_ = ca;
141 }
142
146 std::string getTrustAnchor() const {
147 return (trust_anchor_);
148 }
149
153 void setCertFile(const std::string& cert) {
154 cert_file_ = cert;
155 }
156
160 std::string getCertFile() const {
161 return (cert_file_);
162 }
163
167 void setKeyFile(const std::string& key) {
168 key_file_ = key;
169 }
170
174 std::string getKeyFile() const {
175 return (key_file_);
176 }
177
182 void setCertRequired(bool required) {
183 cert_required_ = required;
184 }
185
190 bool getCertRequired() const {
191 return (cert_required_);
192 }
193
197 isc::hooks::HooksConfig& getHooksConfig() {
198 return (hooks_config_);
199 }
200
204 const isc::hooks::HooksConfig& getHooksConfig() const {
205 return (hooks_config_);
206 }
207
217 virtual isc::data::ElementPtr toElement() const;
218
219private:
220
227 CtrlAgentCfgContext(const CtrlAgentCfgContext& orig);
228
232 CtrlAgentCfgContext& operator=(const CtrlAgentCfgContext& rhs);
233
235 std::map<std::string, isc::data::ConstElementPtr> ctrl_sockets_;
236
238 std::string http_host_;
239
241 uint16_t http_port_;
242
244 isc::http::CfgHttpHeaders http_headers_;
245
248 std::string trust_anchor_;
249
251 std::string cert_file_;
252
254 std::string key_file_;
255
258 bool cert_required_;
259
261 isc::hooks::HooksConfig hooks_config_;
262
264 isc::http::HttpAuthConfigPtr auth_config_;
265};
266
271 class CtrlAgentCfgMgr : public process::DCfgMgrBase {
272public:
273
275 CtrlAgentCfgMgr();
276
278 virtual ~CtrlAgentCfgMgr();
279
284 CtrlAgentCfgContextPtr getCtrlAgentCfgContext() {
285 return (boost::dynamic_pointer_cast<CtrlAgentCfgContext>(getContext()));
286 }
287
294 virtual std::string getConfigSummary(const uint32_t selection) override;
295
296protected:
297
304 virtual isc::data::ConstElementPtr
305 parse(isc::data::ConstElementPtr config, bool check_only) override;
306
317 virtual process::ConfigPtr createNewContext() override;
318
325 std::list<std::list<std::string>> jsonPathsToRedact() const final override;
326};
327
329typedef boost::shared_ptr<CtrlAgentCfgMgr> CtrlAgentCfgMgrPtr;
330
331} // namespace isc::agent
332} // namespace isc
333
334#endif // CTRL_AGENT_CFG_MGR_H
auth_config.h
cfg_http_header.h
isc::agent::CtrlAgentCfgContext
Control Agent Configuration Context.
Definition ca_cfg_mgr.h:33
isc::agent::CtrlAgentCfgContext::getHooksConfig
isc::hooks::HooksConfig & getHooksConfig()
Returns non-const reference to configured hooks libraries.
Definition ca_cfg_mgr.h:197
isc::agent::CtrlAgentCfgContext::setTrustAnchor
void setTrustAnchor(const std::string &ca)
Sets trust-anchor parameter.
Definition ca_cfg_mgr.h:139
isc::agent::CtrlAgentCfgContext::setControlSocketInfo
void setControlSocketInfo(const isc::data::ConstElementPtr &control_socket, const std::string &service)
Sets information about the control socket.
Definition ca_cfg_mgr.cc:159
isc::agent::CtrlAgentCfgContext::toElement
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition ca_cfg_mgr.cc:182
isc::agent::CtrlAgentCfgContext::setCertFile
void setCertFile(const std::string &cert)
Sets cert-file parameter.
Definition ca_cfg_mgr.h:153
isc::agent::CtrlAgentCfgContext::getTrustAnchor
std::string getTrustAnchor() const
Returns trust-anchor parameter.
Definition ca_cfg_mgr.h:146
isc::agent::CtrlAgentCfgContext::setKeyFile
void setKeyFile(const std::string &key)
Sets key-file parameter.
Definition ca_cfg_mgr.h:167
isc::agent::CtrlAgentCfgContext::getAuthConfig
const isc::http::HttpAuthConfigPtr & getAuthConfig() const
Returns HTTP authentication configuration.
Definition ca_cfg_mgr.h:131
isc::agent::CtrlAgentCfgContext::setAuthConfig
void setAuthConfig(const isc::http::HttpAuthConfigPtr &auth_config)
Sets HTTP authentication configuration.
Definition ca_cfg_mgr.h:122
isc::agent::CtrlAgentCfgContext::getCertRequired
bool getCertRequired() const
Returns cert-required parameter.
Definition ca_cfg_mgr.h:190
isc::agent::CtrlAgentCfgContext::setHttpHeaders
void setHttpHeaders(const isc::http::CfgHttpHeaders &headers)
Sets http-headers parameter.
Definition ca_cfg_mgr.h:106
isc::agent::CtrlAgentCfgContext::setHttpHost
void setHttpHost(const std::string &host)
Sets http-host parameter.
Definition ca_cfg_mgr.h:79
isc::agent::CtrlAgentCfgContext::CtrlAgentCfgContext
CtrlAgentCfgContext()
Default constructor.
Definition ca_cfg_mgr.cc:25
isc::agent::CtrlAgentCfgContext::setHttpPort
void setHttpPort(const uint16_t port)
Sets http port.
Definition ca_cfg_mgr.h:94
isc::agent::CtrlAgentCfgContext::getControlSocketInfo
isc::data::ConstElementPtr getControlSocketInfo(const std::string &service) const
Returns information about control socket.
Definition ca_cfg_mgr.cc:153
isc::agent::CtrlAgentCfgContext::getCertFile
std::string getCertFile() const
Returns cert-file parameter.
Definition ca_cfg_mgr.h:160
isc::agent::CtrlAgentCfgContext::getHttpHost
std::string getHttpHost() const
Returns http-host parameter.
Definition ca_cfg_mgr.h:87
isc::agent::CtrlAgentCfgContext::getKeyFile
std::string getKeyFile() const
Returns key-file parameter.
Definition ca_cfg_mgr.h:174
isc::agent::CtrlAgentCfgContext::getHttpHeaders
const isc::http::CfgHttpHeaders & getHttpHeaders() const
Returns http-headers parameter.
Definition ca_cfg_mgr.h:113
isc::agent::CtrlAgentCfgContext::getControlSocketInfoSummary
std::string getControlSocketInfoSummary() const
Returns socket configuration summary in a textual format.
Definition ca_cfg_mgr.cc:165
isc::agent::CtrlAgentCfgContext::getHttpPort
uint16_t getHttpPort() const
Returns the TCP post the HTTP server will listen on.
Definition ca_cfg_mgr.h:99
isc::agent::CtrlAgentCfgContext::setCertRequired
void setCertRequired(bool required)
Sets cert-required parameter.
Definition ca_cfg_mgr.h:182
isc::agent::CtrlAgentCfgContext::getHooksConfig
const isc::hooks::HooksConfig & getHooksConfig() const
Returns const reference to configured hooks libraries.
Definition ca_cfg_mgr.h:204
isc::agent::CtrlAgentCfgContext::clone
virtual process::ConfigPtr clone()
Creates a clone of this context object.
Definition ca_cfg_mgr.h:45
isc::agent::CtrlAgentCfgMgr
Ctrl Agent Configuration Manager.
Definition ca_cfg_mgr.h:271
isc::agent::CtrlAgentCfgMgr::jsonPathsToRedact
std::list< std::list< std::string > > jsonPathsToRedact() const final override
Return a list of all paths that contain passwords or secrets.
Definition ca_cfg_mgr.cc:144
isc::agent::CtrlAgentCfgMgr::CtrlAgentCfgMgr
CtrlAgentCfgMgr()
Constructor.
Definition ca_cfg_mgr.cc:39
isc::agent::CtrlAgentCfgMgr::createNewContext
virtual process::ConfigPtr createNewContext() override
Creates a new, blank CtrlAgentCfgContext context.
Definition ca_cfg_mgr.cc:89
isc::agent::CtrlAgentCfgMgr::parse
virtual isc::data::ConstElementPtr parse(isc::data::ConstElementPtr config, bool check_only) override
Parses configuration of the Control Agent.
Definition ca_cfg_mgr.cc:94
isc::agent::CtrlAgentCfgMgr::getCtrlAgentCfgContext
CtrlAgentCfgContextPtr getCtrlAgentCfgContext()
Convenience method that returns the Control Agent configuration context.
Definition ca_cfg_mgr.h:284
isc::agent::CtrlAgentCfgMgr::getConfigSummary
virtual std::string getConfigSummary(const uint32_t selection) override
Returns configuration summary in the textual format.
Definition ca_cfg_mgr.cc:47
isc::agent::CtrlAgentCfgMgr::~CtrlAgentCfgMgr
virtual ~CtrlAgentCfgMgr()
Destructor.
Definition ca_cfg_mgr.cc:43
isc::hooks::HooksConfig
Wrapper class that holds hooks libraries configuration.
Definition hooks_config.h:36
isc::process::ConfigBase
Base class for all configurations.
Definition config_base.h:33
isc::process::DCfgMgrBase
Configuration Manager.
Definition d_cfg_mgr.h:108
isc::process::DCfgMgrBase::getContext
ConfigPtr & getContext()
Fetches the configuration context.
Definition d_cfg_mgr.h:151
d_cfg_mgr.h
data.h
hooks_config.h
isc::agent
Definition agent_parser.cc:148
isc::agent::CtrlAgentCfgContextPtr
boost::shared_ptr< CtrlAgentCfgContext > CtrlAgentCfgContextPtr
Pointer to a configuration context.
Definition ca_cfg_mgr.h:24
isc::agent::CtrlAgentCfgMgrPtr
boost::shared_ptr< CtrlAgentCfgMgr > CtrlAgentCfgMgrPtr
Defines a shared pointer to CtrlAgentCfgMgr.
Definition ca_cfg_mgr.h:329
isc::config
Definition command_interpreter.cc:23
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:30
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
isc::http::HttpAuthConfigPtr
boost::shared_ptr< HttpAuthConfig > HttpAuthConfigPtr
Type of shared pointers to HTTP authentication configuration.
Definition auth_config.h:97
isc::http::CfgHttpHeaders
std::vector< CfgHttpHeader > CfgHttpHeaders
Collection of config HTTP headers.
Definition cfg_http_header.h:47
isc::process::ConfigPtr
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
Definition config_base.h:176
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148