Kea  2.5.3
netconf_cfg_mgr.h
Go to the documentation of this file.
1 // Copyright (C) 2018-2022 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 
17 namespace isc {
18 namespace netconf {
19 
20 class NetconfConfig;
22 using NetconfConfigPtr = boost::shared_ptr<NetconfConfig>;
23 
32 public:
33 
35  NetconfConfig();
36 
41  return (isc::data::ElementPtr(configured_globals_));
42  }
43 
46 
51  void addConfiguredGlobal(const std::string& name,
53  configured_globals_->set(name, value);
54  }
55 
60  return (servers_map_);
61  }
62 
67  return (servers_map_);
68  }
69 
74  return (hooks_config_);
75  }
76 
81  return (hooks_config_);
82  }
83 
93  isc::data::ElementPtr toElement() const override final;
94 
95 private:
96 
102  NetconfConfig(const NetconfConfig& orig);
103 
107  NetconfConfig& operator=(const NetconfConfig& rhs);
108 
110  isc::data::ElementPtr configured_globals_;
111 
113  CfgServersMapPtr servers_map_;
114 
116  isc::hooks::HooksConfig hooks_config_;
117 }; // NetconfConfig
118 
123 class NetconfCfgMgr : public process::DCfgMgrBase {
124 public:
126  NetconfCfgMgr();
127 
129  virtual ~NetconfCfgMgr() = default;
130 
136  return (boost::dynamic_pointer_cast<NetconfConfig>(getContext()));
137  }
138 
145  std::string getConfigSummary(const uint32_t selection) override final;
146 
152  std::list<std::list<std::string>> jsonPathsToRedact() const override final;
153 
154 protected:
161  isc::data::ConstElementPtr
162  parse(isc::data::ConstElementPtr config, bool check_only) override final;
163 
174  process::ConfigPtr createNewContext() override final;
175 }; // NetconfCfgMgr
176 
178 using NetconfCfgMgrPtr = boost::shared_ptr<NetconfCfgMgr>;
179 
180 } // namespace netconf
181 } // namespace isc
182 
183 #endif // NETCONF_CFG_MGR_H
Wrapper class that holds hooks libraries configuration.
Definition: hooks_config.h:36
Ctrl Netconf Configuration Manager.
NetconfConfigPtr getNetconfConfig()
Convenience method that returns the Netconf configuration context.
virtual ~NetconfCfgMgr()=default
Destructor.
Netconf Configuration Context.
NetconfConfig()
Default constructor.
isc::data::ElementPtr getConfiguredGlobals() const
Returns pointer to configured global parameters.
CfgServersMapPtr & getCfgServersMap()
Returns non-const reference to the managed servers map.
isc::hooks::HooksConfig & getHooksConfig()
Returns non-const reference to configured hooks libraries.
const isc::hooks::HooksConfig & getHooksConfig() const
Returns const reference to configured hooks libraries.
const CfgServersMapPtr & getCfgServersMap() const
Returns const reference to the managed servers map.
void extractConfiguredGlobals(isc::data::ConstElementPtr config)
Saves scalar elements from the global scope of a configuration.
isc::data::ElementPtr toElement() const override final
Unparse a configuration object.
void addConfiguredGlobal(const std::string &name, isc::data::ConstElementPtr value)
Adds a parameter to the collection configured globals.
Base class for all configurations.
Definition: config_base.h:33
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:29
boost::shared_ptr< Element > ElementPtr
Definition: data.h:26
boost::shared_ptr< NetconfConfig > NetconfConfigPtr
Pointer to a configuration context.
std::shared_ptr< CfgServersMap > CfgServersMapPtr
Defines a pointer to map of CfgServers.
boost::shared_ptr< NetconfCfgMgr > NetconfCfgMgrPtr
Defines a shared pointer to NetconfCfgMgr.
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
Definition: config_base.h:176
Defines the logger used by the top-level component of kea-lfc.
A collection of classes for housing and parsing the application configuration necessary for the Netco...
data::ConstElementPtr getContext() const
Returns const pointer to the user context.
Definition: user_context.h:24