Kea  1.9.9-git
ca_cfg_mgr.h
Go to the documentation of this file.
1 // Copyright (C) 2016-2021 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 
18 namespace isc {
19 namespace agent {
20 
23 typedef boost::shared_ptr<CtrlAgentCfgContext> CtrlAgentCfgContextPtr;
24 
33 public:
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 
107  void setAuthConfig(const isc::http::HttpAuthConfigPtr& auth_config) {
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 
204 private:
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 
254 public:
255 
257  CtrlAgentCfgMgr();
258 
260  virtual ~CtrlAgentCfgMgr();
261 
266  CtrlAgentCfgContextPtr getCtrlAgentCfgContext() {
267  return (boost::dynamic_pointer_cast<CtrlAgentCfgContext>(getContext()));
268  }
269 
276  virtual std::string getConfigSummary(const uint32_t selection) override;
277 
278 protected:
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
std::string getHttpHost() const
Returns http-host parameter.
Definition: ca_cfg_mgr.h:86
std::string getControlSocketInfoSummary() const
Returns socket configuration summary in a textual format.
Definition: ca_cfg_mgr.cc:164
std::string getCertFile() const
Returns cert-file parameter.
Definition: ca_cfg_mgr.h:145
const isc::hooks::HooksConfig & getHooksConfig() const
Returns const reference to configured hooks libraries.
Definition: ca_cfg_mgr.h:189
Base class for all configurations.
Definition: config_base.h:33
virtual std::string getConfigSummary(const uint32_t selection) override
Returns configuration summary in the textual format.
Definition: ca_cfg_mgr.cc:46
boost::shared_ptr< Element > ElementPtr
Definition: data.h:20
virtual process::ConfigPtr clone()
Creates a clone of this context object.
Definition: ca_cfg_mgr.h:44
Wrapper class that holds hooks libraries configuration.
Definition: hooks_config.h:36
boost::shared_ptr< CtrlAgentCfgMgr > CtrlAgentCfgMgrPtr
Defines a shared pointer to CtrlAgentCfgMgr.
Definition: ca_cfg_mgr.h:311
std::list< std::list< std::string > > jsonPathsToRedact() const finaloverride
Return a list of all paths that contain passwords or secrets.
Definition: ca_cfg_mgr.cc:143
Configuration Manager.
Definition: d_cfg_mgr.h:108
uint16_t getHttpPort() const
Returns the TCP post the HTTP server will listen on.
Definition: ca_cfg_mgr.h:98
virtual ~CtrlAgentCfgMgr()
Destructor.
Definition: ca_cfg_mgr.cc:42
void setCertRequired(bool required)
Sets cert-required parameter.
Definition: ca_cfg_mgr.h:167
void setKeyFile(const std::string &key)
Sets key-file parameter.
Definition: ca_cfg_mgr.h:152
CtrlAgentCfgContext()
Default constructor.
Definition: ca_cfg_mgr.cc:25
void setHttpHost(const std::string &host)
Sets http-host parameter.
Definition: ca_cfg_mgr.h:78
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: ca_cfg_mgr.cc:181
bool getCertRequired() const
Returns cert-required parameter.
Definition: ca_cfg_mgr.h:175
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
Defines the logger used by the top-level component of kea-dhcp-ddns.
void setControlSocketInfo(const isc::data::ConstElementPtr &control_socket, const std::string &service)
Sets information about the control socket.
Definition: ca_cfg_mgr.cc:158
void setAuthConfig(const isc::http::HttpAuthConfigPtr &auth_config)
Sets HTTP authentication configuration.
Definition: ca_cfg_mgr.h:107
void setHttpPort(const uint16_t port)
Sets http port.
Definition: ca_cfg_mgr.h:93
std::string getKeyFile() const
Returns key-file parameter.
Definition: ca_cfg_mgr.h:159
Ctrl Agent Configuration Manager.
Definition: ca_cfg_mgr.h:253
std::string getTrustAnchor() const
Returns trust-anchor parameter.
Definition: ca_cfg_mgr.h:131
const isc::http::HttpAuthConfigPtr & getAuthConfig() const
Returns HTTP authentication configuration.
Definition: ca_cfg_mgr.h:116
void setCertFile(const std::string &cert)
Sets cert-file parameter.
Definition: ca_cfg_mgr.h:138
isc::data::ConstElementPtr getControlSocketInfo(const std::string &service) const
Returns information about control socket.
Definition: ca_cfg_mgr.cc:152
isc::hooks::HooksConfig & getHooksConfig()
Returns non-const reference to configured hooks libraries.
Definition: ca_cfg_mgr.h:182
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
void setTrustAnchor(const std::string &ca)
Sets trust-anchor parameter.
Definition: ca_cfg_mgr.h:124
CtrlAgentCfgMgr()
Constructor.
Definition: ca_cfg_mgr.cc:38
boost::shared_ptr< CtrlAgentCfgContext > CtrlAgentCfgContextPtr
Pointer to a configuration context.
Definition: ca_cfg_mgr.h:21
CtrlAgentCfgContextPtr getCtrlAgentCfgContext()
Convenience method that returns the Control Agent configuration context.
Definition: ca_cfg_mgr.h:266
Control Agent Configuration Context.
Definition: ca_cfg_mgr.h:32
boost::shared_ptr< HttpAuthConfig > HttpAuthConfigPtr
Type of shared pointers to HTTP authentication configuration.
Definition: auth_config.h:79
virtual process::ConfigPtr createNewContext() override
Creates a new, blank CtrlAgentCfgContext context.
Definition: ca_cfg_mgr.cc:88
ConfigPtr & getContext()
Fetches the configuration context.
Definition: d_cfg_mgr.h:151
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
Definition: config_base.h:176