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>
13#include <process/d_cfg_mgr.h>
14#include <boost/pointer_cast.hpp>
15#include <map>
16#include <string>
17
18namespace isc {
19namespace agent {
20
21class CtrlAgentCfgContext;
23typedef boost::shared_ptr<CtrlAgentCfgContext> CtrlAgentCfgContextPtr;
24
33public:
34
37
45 return (process::ConfigPtr(new CtrlAgentCfgContext(*this)));
46 }
47
58 getControlSocketInfo(const std::string& service) const;
59
68 void setControlSocketInfo(const isc::data::ConstElementPtr& control_socket,
69 const std::string& service);
70
72 std::string getControlSocketInfoSummary() const;
73
78 void setHttpHost(const std::string& host) {
79 http_host_ = host;
80 }
81
86 std::string getHttpHost() const {
87 return (http_host_);
88 }
89
93 void setHttpPort(const uint16_t port) {
94 http_port_ = port;
95 }
96
98 uint16_t getHttpPort() const {
99 return (http_port_);
100 }
101
108 auth_config_ = auth_config;
109 }
110
117 return (auth_config_);
118 }
119
124 void setTrustAnchor(const std::string& ca) {
125 trust_anchor_ = ca;
126 }
127
131 std::string getTrustAnchor() const {
132 return (trust_anchor_);
133 }
134
138 void setCertFile(const std::string& cert) {
139 cert_file_ = cert;
140 }
141
145 std::string getCertFile() const {
146 return (cert_file_);
147 }
148
152 void setKeyFile(const std::string& key) {
153 key_file_ = key;
154 }
155
159 std::string getKeyFile() const {
160 return (key_file_);
161 }
162
167 void setCertRequired(bool required) {
168 cert_required_ = required;
169 }
170
175 bool getCertRequired() const {
176 return (cert_required_);
177 }
178
183 return (hooks_config_);
184 }
185
190 return (hooks_config_);
191 }
192
202 virtual isc::data::ElementPtr toElement() const;
203
204private:
205
213
217 CtrlAgentCfgContext& operator=(const CtrlAgentCfgContext& rhs);
218
220 std::map<std::string, isc::data::ConstElementPtr> ctrl_sockets_;
221
223 std::string http_host_;
224
226 uint16_t http_port_;
227
230 std::string trust_anchor_;
231
233 std::string cert_file_;
234
236 std::string key_file_;
237
240 bool cert_required_;
241
243 isc::hooks::HooksConfig hooks_config_;
244
246 isc::http::HttpAuthConfigPtr auth_config_;
247};
248
254public:
255
258
260 virtual ~CtrlAgentCfgMgr();
261
267 return (boost::dynamic_pointer_cast<CtrlAgentCfgContext>(getContext()));
268 }
269
276 virtual std::string getConfigSummary(const uint32_t selection) override;
277
278protected:
279
287 parse(isc::data::ConstElementPtr config, bool check_only) override;
288
299 virtual process::ConfigPtr createNewContext() override;
300
307 std::list<std::list<std::string>> jsonPathsToRedact() const final override;
308};
309
312
313} // namespace isc::agent
314} // namespace isc
315
316#endif // CTRL_AGENT_CFG_MGR_H
Control Agent Configuration Context.
Definition ca_cfg_mgr.h:32
isc::hooks::HooksConfig & getHooksConfig()
Returns non-const reference to configured hooks libraries.
Definition ca_cfg_mgr.h:182
void setTrustAnchor(const std::string &ca)
Sets trust-anchor parameter.
Definition ca_cfg_mgr.h:124
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:138
std::string getTrustAnchor() const
Returns trust-anchor parameter.
Definition ca_cfg_mgr.h:131
void setKeyFile(const std::string &key)
Sets key-file parameter.
Definition ca_cfg_mgr.h:152
const isc::http::HttpAuthConfigPtr & getAuthConfig() const
Returns HTTP authentication configuration.
Definition ca_cfg_mgr.h:116
void setAuthConfig(const isc::http::HttpAuthConfigPtr &auth_config)
Sets HTTP authentication configuration.
Definition ca_cfg_mgr.h:107
bool getCertRequired() const
Returns cert-required parameter.
Definition ca_cfg_mgr.h:175
void setHttpHost(const std::string &host)
Sets http-host parameter.
Definition ca_cfg_mgr.h:78
CtrlAgentCfgContext()
Default constructor.
Definition ca_cfg_mgr.cc:25
void setHttpPort(const uint16_t port)
Sets http port.
Definition ca_cfg_mgr.h:93
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:145
std::string getHttpHost() const
Returns http-host parameter.
Definition ca_cfg_mgr.h:86
std::string getKeyFile() const
Returns key-file parameter.
Definition ca_cfg_mgr.h:159
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:98
void setCertRequired(bool required)
Sets cert-required parameter.
Definition ca_cfg_mgr.h:167
const isc::hooks::HooksConfig & getHooksConfig() const
Returns const reference to configured hooks libraries.
Definition ca_cfg_mgr.h:189
virtual process::ConfigPtr clone()
Creates a clone of this context object.
Definition ca_cfg_mgr.h:44
Ctrl Agent Configuration Manager.
Definition ca_cfg_mgr.h:253
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:38
virtual process::ConfigPtr createNewContext() override
Creates a new, blank CtrlAgentCfgContext context.
Definition ca_cfg_mgr.cc:88
virtual isc::data::ConstElementPtr parse(isc::data::ConstElementPtr config, bool check_only) override
Parses configuration of the Control Agent.
Definition ca_cfg_mgr.cc:93
CtrlAgentCfgContextPtr getCtrlAgentCfgContext()
Convenience method that returns the Control Agent configuration context.
Definition ca_cfg_mgr.h:266
virtual std::string getConfigSummary(const uint32_t selection) override
Returns configuration summary in the textual format.
Definition ca_cfg_mgr.cc:46
virtual ~CtrlAgentCfgMgr()
Destructor.
Definition ca_cfg_mgr.cc:42
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:23
boost::shared_ptr< CtrlAgentCfgMgr > CtrlAgentCfgMgrPtr
Defines a shared pointer to CtrlAgentCfgMgr.
Definition ca_cfg_mgr.h:311
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
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
Defines the logger used by the top-level component of kea-lfc.