Kea  1.9.9-git
config_ctl_info.h
Go to the documentation of this file.
1 // Copyright (C) 2018-2020 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 PROCESS_CONFIG_CTL_INFO_H
8 #define PROCESS_CONFIG_CTL_INFO_H
9 
10 #include <cc/cfg_to_element.h>
12 #include <util/optional.h>
13 
14 #include <boost/shared_ptr.hpp>
15 #include <stdint.h>
16 #include <vector>
17 
18 namespace isc {
19 namespace process {
20 
25 public:
28 
40  void setAccessString(const std::string& access_str, bool test_mode = false);
41 
45  std::string getAccessString() const {
46  return (access_str_);
47  }
48 
52  std::string redactedAccessString() const {
53  return(db::DatabaseConnection::redactedAccessString(access_params_));
54  }
55 
60  return (access_params_);
61  }
62 
71  bool getParameterValue(const std::string& name,
72  std::string& value) const;
73 
77  virtual isc::data::ElementPtr toElement() const;
78 
84  bool equals(const ConfigDbInfo& other) const;
85 
91  bool operator==(const ConfigDbInfo& other) const {
92  return (equals(other));
93  }
94 
100  bool operator!=(const ConfigDbInfo& other) const {
101  return (!equals(other));
102  }
103 
104 private:
106  std::string access_str_;
107 
110 };
111 
112 typedef std::vector<ConfigDbInfo> ConfigDbInfoList;
113 
142 public:
143 
146  : config_fetch_wait_time_(30, true) {};
147 
149  ConfigControlInfo(const ConfigControlInfo& other);
150 
157  void setConfigFetchWaitTime(const util::Optional<uint16_t>& config_fetch_wait_time) {
158  config_fetch_wait_time_ = config_fetch_wait_time;
159  }
160 
172  return (config_fetch_wait_time_);
173  }
174 
181  void addConfigDatabase(const std::string& access_str);
182 
189  const ConfigDbInfoList& getConfigDatabases() const {
190  return (db_infos_);
191  }
192 
197  const ConfigDbInfo& findConfigDb(const std::string& param_name,
198  const std::string& param_value);
199 
201  void clear();
202 
210  void merge(const ConfigControlInfo& other);
211 
215  virtual isc::data::ElementPtr toElement() const;
216 
220  static const ConfigDbInfo& EMPTY_DB();
221 
227  bool equals(const ConfigControlInfo& other) const;
228 
229 private:
230 
232  util::Optional<uint16_t> config_fetch_wait_time_;
233 
235  ConfigDbInfoList db_infos_;
236 };
237 
239 typedef boost::shared_ptr<ConfigControlInfo> ConfigControlInfoPtr;
240 
242 typedef boost::shared_ptr<const ConfigControlInfo> ConstConfigControlInfoPtr;
243 
244 } // namespace process
245 } // end namespace isc
246 
247 #endif // PROCESS_CONFIG_CTL_INFO_H
void addConfigDatabase(const std::string &access_str)
Sets configuration database access string.
const ConfigDbInfoList & getConfigDatabases() const
Retrieves the list of databases.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
void setConfigFetchWaitTime(const util::Optional< uint16_t > &config_fetch_wait_time)
Sets new value of the config-fetch-wait-time.
Embodies configuration information used during a server's configuration process.
boost::shared_ptr< Element > ElementPtr
Definition: data.h:20
const util::Optional< uint16_t > & getConfigFetchWaitTime() const
Returns configured config-fetch-wait-time value.
void merge(const ConfigControlInfo &other)
Merges specified configuration into this configuration.
bool equals(const ConfigDbInfo &other) const
Compares two objects for equality.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Abstract class for configuration Cfg_* classes.
void clear()
Empties the contents of the class, including the database list.
const db::DatabaseConnection::ParameterMap & getParameters() const
Retrieve the map of parameter values.
bool equals(const ConfigControlInfo &other) const
Compares two objects for equality.
void setAccessString(const std::string &access_str, bool test_mode=false)
Set the access string.
bool getParameterValue(const std::string &name, std::string &value) const
Fetch the value of a given parameter.
bool operator==(const ConfigDbInfo &other) const
Compares two objects for equality.
Defines the logger used by the top-level component of kea-dhcp-ddns.
bool operator!=(const ConfigDbInfo &other) const
Compares two objects for inequality.
Provides configuration information used during a server's configuration process.
std::string getAccessString() const
Retrieves the database access string.
const ConfigDbInfo & findConfigDb(const std::string &param_name, const std::string &param_value)
Retrieves the database with the given access parameter value.
std::string redactedAccessString() const
Retrieves the database access string with password redacted.
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
boost::shared_ptr< ConfigControlInfo > ConfigControlInfoPtr
Defines a pointer to a ConfigControlInfo.
static std::string redactedAccessString(const ParameterMap &parameters)
Redact database access string.
static const ConfigDbInfo & EMPTY_DB()
Fetches the not-found value returned by database list searches.
std::vector< ConfigDbInfo > ConfigDbInfoList
boost::shared_ptr< const ConfigControlInfo > ConstConfigControlInfoPtr
Defines a pointer to a const ConfigControlInfo.