Kea 2.7.5
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>
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;
24typedef boost::shared_ptr<CtrlAgentCfgContext> CtrlAgentCfgContextPtr;
25
34public:
35
38
46 return (process::ConfigPtr(new CtrlAgentCfgContext(*this)));
47 }
48
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
107 http_headers_ = headers;
108 }
109
114 return (http_headers_);
115 }
116
123 auth_config_ = auth_config;
124 }
125
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
198 return (hooks_config_);
199 }
200
205 return (hooks_config_);
206 }
207
217 virtual isc::data::ElementPtr toElement() const;
218
219private:
220
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
272public:
273
276
278 virtual ~CtrlAgentCfgMgr();
279
285 return (boost::dynamic_pointer_cast<CtrlAgentCfgContext>(getContext()));
286 }
287
294 virtual std::string getConfigSummary(const uint32_t selection) override;
295
296protected:
297
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
330
331} // namespace isc::agent
332} // namespace isc
333
334#endif // CTRL_AGENT_CFG_MGR_H
Control Agent Configuration Context.
Definition ca_cfg_mgr.h:33
isc::hooks::HooksConfig & getHooksConfig()
Returns non-const reference to configured hooks libraries.
Definition ca_cfg_mgr.h:197
void setTrustAnchor(const std::string &ca)
Sets trust-anchor parameter.
Definition ca_cfg_mgr.h:139
void setControlSocketInfo(const isc::data::ConstElementPtr &control_socket, const std::string &service)
Sets information about the control socket.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
void setCertFile(const std::string &cert)
Sets cert-file parameter.
Definition ca_cfg_mgr.h:153
std::string getTrustAnchor() const
Returns trust-anchor parameter.
Definition ca_cfg_mgr.h:146
void setKeyFile(const std::string &key)
Sets key-file parameter.
Definition ca_cfg_mgr.h:167
const isc::http::HttpAuthConfigPtr & getAuthConfig() const
Returns HTTP authentication configuration.
Definition ca_cfg_mgr.h:131
void setAuthConfig(const isc::http::HttpAuthConfigPtr &auth_config)
Sets HTTP authentication configuration.
Definition ca_cfg_mgr.h:122
bool getCertRequired() const
Returns cert-required parameter.
Definition ca_cfg_mgr.h:190
void setHttpHeaders(const isc::http::CfgHttpHeaders &headers)
Sets http-headers parameter.
Definition ca_cfg_mgr.h:106
void setHttpHost(const std::string &host)
Sets http-host parameter.
Definition ca_cfg_mgr.h:79
CtrlAgentCfgContext()
Default constructor.
Definition ca_cfg_mgr.cc:25
void setHttpPort(const uint16_t port)
Sets http port.
Definition ca_cfg_mgr.h:94
isc::data::ConstElementPtr getControlSocketInfo(const std::string &service) const
Returns information about control socket.
std::string getCertFile() const
Returns cert-file parameter.
Definition ca_cfg_mgr.h:160
std::string getHttpHost() const
Returns http-host parameter.
Definition ca_cfg_mgr.h:87
std::string getKeyFile() const
Returns key-file parameter.
Definition ca_cfg_mgr.h:174
const isc::http::CfgHttpHeaders & getHttpHeaders() const
Returns http-headers parameter.
Definition ca_cfg_mgr.h:113
std::string getControlSocketInfoSummary() const
Returns socket configuration summary in a textual format.
uint16_t getHttpPort() const
Returns the TCP post the HTTP server will listen on.
Definition ca_cfg_mgr.h:99
void setCertRequired(bool required)
Sets cert-required parameter.
Definition ca_cfg_mgr.h:182
const isc::hooks::HooksConfig & getHooksConfig() const
Returns const reference to configured hooks libraries.
Definition ca_cfg_mgr.h:204
virtual process::ConfigPtr clone()
Creates a clone of this context object.
Definition ca_cfg_mgr.h:45
Ctrl Agent Configuration Manager.
Definition ca_cfg_mgr.h:271
std::list< std::list< std::string > > jsonPathsToRedact() const final override
Return a list of all paths that contain passwords or secrets.
CtrlAgentCfgMgr()
Constructor.
Definition ca_cfg_mgr.cc:39
virtual process::ConfigPtr createNewContext() override
Creates a new, blank CtrlAgentCfgContext context.
Definition ca_cfg_mgr.cc:89
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
CtrlAgentCfgContextPtr getCtrlAgentCfgContext()
Convenience method that returns the Control Agent configuration context.
Definition ca_cfg_mgr.h:284
virtual std::string getConfigSummary(const uint32_t selection) override
Returns configuration summary in the textual format.
Definition ca_cfg_mgr.cc:47
virtual ~CtrlAgentCfgMgr()
Destructor.
Definition ca_cfg_mgr.cc:43
Wrapper class that holds hooks libraries configuration.
Base class for all configurations.
Definition config_base.h:33
Configuration Manager.
Definition d_cfg_mgr.h:108
ConfigPtr & getContext()
Fetches the configuration context.
Definition d_cfg_mgr.h:151
boost::shared_ptr< CtrlAgentCfgContext > CtrlAgentCfgContextPtr
Pointer to a configuration context.
Definition ca_cfg_mgr.h:24
boost::shared_ptr< CtrlAgentCfgMgr > CtrlAgentCfgMgrPtr
Defines a shared pointer to CtrlAgentCfgMgr.
Definition ca_cfg_mgr.h:329
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
boost::shared_ptr< HttpAuthConfig > HttpAuthConfigPtr
Type of shared pointers to HTTP authentication configuration.
Definition auth_config.h:97
std::vector< CfgHttpHeader > CfgHttpHeaders
Collection of config HTTP headers.
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
Defines the logger used by the top-level component of kea-lfc.