Kea 2.7.5
d_cfg_mgr.h
Go to the documentation of this file.
1// Copyright (C) 2013-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 D_CFG_MGR_H
8#define D_CFG_MGR_H
9
10#include <cc/data.h>
11#include <cc/cfg_to_element.h>
12#include <cc/user_context.h>
13#include <process/config_base.h>
15
16#include <stdint.h>
17
18#include <functional>
19#include <list>
20#include <string>
21
22namespace isc {
23namespace process {
24
26typedef std::map<std::string, isc::data::ConstElementPtr> ElementMap;
27
30public:
31 DCfgMgrBaseError(const char* file, size_t line, const char* what) :
32 isc::Exception(file, line, what) { }
33};
34
109public:
116 DCfgMgrBase(ConfigPtr context);
117
119 virtual ~DCfgMgrBase();
120
145 bool check_only = false,
146 const std::function<void()>& post_config_cb = nullptr);
147
152 return (context_);
153 }
154
165 virtual std::string getConfigSummary(const uint32_t selection) = 0;
166
179 redactConfig(isc::data::ConstElementPtr const& config) const;
180
181protected:
188 virtual void setCfgDefaults(isc::data::ElementPtr mutable_config);
189
200
202 void resetContext();
203
209 void setContext(ConfigPtr& context);
210
227 bool check_only);
228
239 virtual std::list<std::list<std::string>> jsonPathsToRedact() const;
240
241private:
243 ConfigPtr context_;
244};
245
247typedef boost::shared_ptr<DCfgMgrBase> DCfgMgrBasePtr;
248
249} // end of isc::process namespace
250} // end of isc namespace
251
252#endif // D_CFG_MGR_H
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Exception thrown if the configuration manager encounters an error.
Definition d_cfg_mgr.h:29
DCfgMgrBaseError(const char *file, size_t line, const char *what)
Definition d_cfg_mgr.h:31
Configuration Manager.
Definition d_cfg_mgr.h:108
virtual void setCfgDefaults(isc::data::ElementPtr mutable_config)
Adds default values to the given config.
Definition d_cfg_mgr.cc:153
virtual std::list< std::list< std::string > > jsonPathsToRedact() const
Return a list of all paths that contain passwords or secrets.
Definition d_cfg_mgr.cc:68
DCfgMgrBase(ConfigPtr context)
Constructor.
Definition d_cfg_mgr.cc:37
virtual isc::data::ConstElementPtr parse(isc::data::ConstElementPtr config, bool check_only)
Parses actual configuration.
Definition d_cfg_mgr.cc:157
virtual ~DCfgMgrBase()
Destructor.
Definition d_cfg_mgr.cc:41
isc::data::ConstElementPtr simpleParseConfig(isc::data::ConstElementPtr config, bool check_only=false, const std::function< void()> &post_config_cb=nullptr)
Acts as the receiver of new configurations.
Definition d_cfg_mgr.cc:74
void resetContext()
Replaces existing context with a new, empty context.
Definition d_cfg_mgr.cc:45
void setContext(ConfigPtr &context)
Update the current context.
Definition d_cfg_mgr.cc:51
virtual ConfigPtr createNewContext()=0
Abstract factory which creates a context instance.
virtual std::string getConfigSummary(const uint32_t selection)=0
Returns configuration summary in the textual format.
ConfigPtr & getContext()
Fetches the configuration context.
Definition d_cfg_mgr.h:151
isc::data::ConstElementPtr redactConfig(isc::data::ConstElementPtr const &config) const
Redact the configuration.
Definition d_cfg_mgr.cc:60
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
boost::shared_ptr< DCfgMgrBase > DCfgMgrBasePtr
Defines a shared pointer to DCfgMgrBase.
Definition d_cfg_mgr.h:247
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
std::map< std::string, isc::data::ConstElementPtr > ElementMap
Defines a map of ConstElementPtrs keyed by name.
Definition d_cfg_mgr.h:26
Defines the logger used by the top-level component of kea-lfc.