Kea 3.1.9
d_cfg_mgr.h
Go to the documentation of this file.
1// Copyright (C) 2013-2026 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
106public:
113 DCfgMgrBase(ConfigPtr context);
114
116 virtual ~DCfgMgrBase();
117
142 bool check_only = false,
143 const std::function<void()>& post_config_cb = nullptr);
144
149 return (context_);
150 }
151
162 virtual std::string getConfigSummary(const uint32_t selection) = 0;
163
177
178protected:
185 virtual void setCfgDefaults(isc::data::ElementPtr mutable_config);
186
197
199 void resetContext();
200
206 void setContext(ConfigPtr& context);
207
224 bool check_only);
225
236 virtual std::list<std::list<std::string>> jsonPathsToRedact() const;
237
238private:
240 ConfigPtr context_;
241};
242
244typedef boost::shared_ptr<DCfgMgrBase> DCfgMgrBasePtr;
245
246} // end of isc::process namespace
247} // end of isc namespace
248
249#endif // D_CFG_MGR_H
This is a base class for exceptions thrown from the DNS library module.
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
DCfgMgrBaseError(const char *file, size_t line, const char *what)
Definition d_cfg_mgr.h:31
virtual void setCfgDefaults(isc::data::ElementPtr mutable_config)
Adds default values to the given config.
Definition d_cfg_mgr.cc:166
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:170
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:148
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:30
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
boost::shared_ptr< DCfgMgrBase > DCfgMgrBasePtr
Defines a shared pointer to DCfgMgrBase.
Definition d_cfg_mgr.h:244
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.