Kea: netconf_cfg_mgr.h Source File

| Kea 3.0.2-git

netconf_cfg_mgr.h
Go to the documentation of this file.
1// Copyright (C) 2018-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 NETCONF_CFG_MGR_H
8#define NETCONF_CFG_MGR_H
9
10#include <cc/data.h>
11#include <hooks/hooks_config.h>
12#include <netconf/netconf_config.h>
13#include <process/d_cfg_mgr.h>
14
15#include <string>
16
17namespace isc {
18namespace netconf {
19
20class NetconfConfig;
22 using NetconfConfigPtr = boost::shared_ptr<NetconfConfig>;
23
31 class NetconfConfig : public process::ConfigBase {
32public:
34 NetconfConfig();
35
39 isc::data::ElementPtr getConfiguredGlobals() const {
40 return (isc::data::ElementPtr(configured_globals_));
41 }
42
44 void extractConfiguredGlobals(isc::data::ConstElementPtr config);
45
50 void addConfiguredGlobal(const std::string& name,
51 isc::data::ConstElementPtr value) {
52 configured_globals_->set(name, value);
53 }
54
58 CfgServersMapPtr& getCfgServersMap() {
59 return (servers_map_);
60 }
61
65 const CfgServersMapPtr& getCfgServersMap() const {
66 return (servers_map_);
67 }
68
72 isc::hooks::HooksConfig& getHooksConfig() {
73 return (hooks_config_);
74 }
75
79 const isc::hooks::HooksConfig& getHooksConfig() const {
80 return (hooks_config_);
81 }
82
92 isc::data::ElementPtr toElement() const override final;
93
94private:
100 NetconfConfig(const NetconfConfig& orig);
101
105 NetconfConfig& operator=(const NetconfConfig& rhs);
106
108 isc::data::ElementPtr configured_globals_;
109
111 CfgServersMapPtr servers_map_;
112
114 isc::hooks::HooksConfig hooks_config_;
115}; // NetconfConfig
116
121class NetconfCfgMgr : public process::DCfgMgrBase {
122public:
124 NetconfCfgMgr();
125
127 virtual ~NetconfCfgMgr() = default;
128
133 NetconfConfigPtr getNetconfConfig() {
134 return (boost::dynamic_pointer_cast<NetconfConfig>(getContext()));
135 }
136
143 std::string getConfigSummary(const uint32_t selection) override final;
144
150 std::list<std::list<std::string>> jsonPathsToRedact() const override final;
151
152protected:
159 isc::data::ConstElementPtr
160 parse(isc::data::ConstElementPtr config, bool check_only) override final;
161
172 process::ConfigPtr createNewContext() override final;
173}; // NetconfCfgMgr
174
176using NetconfCfgMgrPtr = boost::shared_ptr<NetconfCfgMgr>;
177
178} // namespace netconf
179} // namespace isc
180
181#endif // NETCONF_CFG_MGR_H
isc::hooks::HooksConfig
Wrapper class that holds hooks libraries configuration.
Definition hooks_config.h:36
isc::netconf::NetconfCfgMgr
Ctrl Netconf Configuration Manager.
Definition netconf_cfg_mgr.h:121
isc::netconf::NetconfCfgMgr::NetconfCfgMgr
NetconfCfgMgr()
Constructor.
Definition netconf_cfg_mgr.cc:55
isc::netconf::NetconfCfgMgr::getNetconfConfig
NetconfConfigPtr getNetconfConfig()
Convenience method that returns the Netconf configuration context.
Definition netconf_cfg_mgr.h:133
isc::netconf::NetconfCfgMgr::~NetconfCfgMgr
virtual ~NetconfCfgMgr()=default
Destructor.
isc::netconf::NetconfConfig
Netconf Configuration Context.
Definition netconf_cfg_mgr.h:31
isc::netconf::NetconfConfig::NetconfConfig
NetconfConfig()
Default constructor.
Definition netconf_cfg_mgr.cc:30
isc::netconf::NetconfConfig::getConfiguredGlobals
isc::data::ElementPtr getConfiguredGlobals() const
Returns pointer to configured global parameters.
Definition netconf_cfg_mgr.h:39
isc::netconf::NetconfConfig::getHooksConfig
const isc::hooks::HooksConfig & getHooksConfig() const
Returns const reference to configured hooks libraries.
Definition netconf_cfg_mgr.h:79
isc::netconf::NetconfConfig::getCfgServersMap
CfgServersMapPtr & getCfgServersMap()
Returns non-const reference to the managed servers map.
Definition netconf_cfg_mgr.h:58
isc::netconf::NetconfConfig::getCfgServersMap
const CfgServersMapPtr & getCfgServersMap() const
Returns const reference to the managed servers map.
Definition netconf_cfg_mgr.h:65
isc::netconf::NetconfConfig::getHooksConfig
isc::hooks::HooksConfig & getHooksConfig()
Returns non-const reference to configured hooks libraries.
Definition netconf_cfg_mgr.h:72
isc::netconf::NetconfConfig::extractConfiguredGlobals
void extractConfiguredGlobals(isc::data::ConstElementPtr config)
Saves scalar elements from the global scope of a configuration.
Definition netconf_cfg_mgr.cc:41
isc::netconf::NetconfConfig::toElement
isc::data::ElementPtr toElement() const override final
Unparse a configuration object.
Definition netconf_cfg_mgr.cc:147
isc::netconf::NetconfConfig::addConfiguredGlobal
void addConfiguredGlobal(const std::string &name, isc::data::ConstElementPtr value)
Adds a parameter to the collection configured globals.
Definition netconf_cfg_mgr.h:50
isc::process::ConfigBase
Base class for all configurations.
Definition config_base.h:33
isc::process::DCfgMgrBase::DCfgMgrBase
DCfgMgrBase(ConfigPtr context)
Constructor.
Definition d_cfg_mgr.cc:37
ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
d_cfg_mgr.h
data.h
hooks_config.h
isc::config
Definition command_interpreter.cc:23
isc::data
Definition base_stamped_element.cc:12
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
isc::hooks
Definition callout_handle.cc:21
isc::netconf
Definition control_socket.cc:20
isc::netconf::NetconfConfigPtr
boost::shared_ptr< NetconfConfig > NetconfConfigPtr
Pointer to a configuration context.
Definition netconf_cfg_mgr.h:22
isc::netconf::NetconfCfgMgrPtr
boost::shared_ptr< NetconfCfgMgr > NetconfCfgMgrPtr
Defines a shared pointer to NetconfCfgMgr.
Definition netconf_cfg_mgr.h:176
isc::netconf::CfgServersMapPtr
std::shared_ptr< CfgServersMap > CfgServersMapPtr
Defines a pointer to map of CfgServers.
Definition netconf_config.h:281
isc::process
Definition cb_ctl_base.h:22
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148
netconf_config.h
A collection of classes for housing and parsing the application configuration necessary for the Netco...
isc::data::UserContext::getContext
data::ConstElementPtr getContext() const
Returns const pointer to the user context.
Definition user_context.h:24