Kea  1.5.0
config_ctl_info.h
Go to the documentation of this file.
1 // Copyright (C) 2018 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 
13 #include <boost/shared_ptr.hpp>
14 #include <stdint.h>
15 #include <vector>
16 
17 namespace isc {
18 namespace process {
19 
24 public:
27 
37  void setAccessString(const std::string& access_str);
38 
42  std::string getAccessString() const {
43  return (access_str_);
44  }
45 
49  std::string redactedAccessString() const {
50  return(db::DatabaseConnection::redactedAccessString(access_params_));
51  }
52 
57  return (access_params_);
58  }
59 
68  bool getParameterValue(const std::string& name,
69  std::string& value) const;
70 
74  virtual isc::data::ElementPtr toElement() const;
75 
81  bool equals(const ConfigDbInfo& other) const;
82 
88  bool operator==(const ConfigDbInfo& other) const {
89  return (equals(other));
90  }
91 
97  bool operator!=(const ConfigDbInfo& other) const {
98  return (!equals(other));
99  }
100 
101 private:
103  std::string access_str_;
104 
107 };
108 
109 typedef std::vector<ConfigDbInfo> ConfigDbInfoList;
110 
139 public:
140 
143 
145  ConfigControlInfo(const ConfigControlInfo& other);
146 
153  void addConfigDatabase(const std::string& access_str);
154 
162  return (db_infos_);
163  }
164 
169  const ConfigDbInfo& findConfigDb(const std::string& param_name,
170  const std::string& param_value);
171 
173  void clear();
174 
178  virtual isc::data::ElementPtr toElement() const;
179 
183  static const ConfigDbInfo& EMPTY_DB();
184 
190  bool equals(const ConfigControlInfo& other) const;
191 
192 private:
193 
195  ConfigDbInfoList db_infos_;
196 };
197 
199 typedef boost::shared_ptr<ConfigControlInfo> ConfigControlInfoPtr;
201 typedef boost::shared_ptr<const ConfigControlInfo> ConstConfigControlInfoPtr;
202 
203 } // namespace process
204 } // end namespace isc
205 
206 #endif // PROCESS_CONFIG_CTL_INFO_H
std::string getAccessString() const
Retrieves the database access string.
void addConfigDatabase(const std::string &access_str)
Sets configuration database access string.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
std::string redactedAccessString() const
Retrieves the database access string with password redacted.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Embodies configuration information used during a server's configuration process.
boost::shared_ptr< Element > ElementPtr
Definition: data.h:20
bool getParameterValue(const std::string &name, std::string &value) const
Fetch the value of a given parmeter.
void setAccessString(const std::string &access_str)
Set the access string.
bool equals(const ConfigDbInfo &other) const
Compares two objects for equality.
Abstract class for configuration Cfg_* classes.
void clear()
Empties the contents of the class, including the database list.
bool equals(const ConfigControlInfo &other) const
Compares two objects for equality.
bool operator!=(const ConfigDbInfo &other) const
Compares two objects for inequality.
const db::DatabaseConnection::ParameterMap & getParameters() const
Retrieve the map of parameter values.
Defines the logger used by the top-level component of kea-dhcp-ddns.
bool operator==(const ConfigDbInfo &other) const
Compares two objects for equality.
Provides configuration information used during a server's configuration process.
const ConfigDbInfo & findConfigDb(const std::string &param_name, const std::string &param_value)
Retrieves the datbase with the given access parameter value.
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
boost::shared_ptr< ConfigControlInfo > ConfigControlInfoPtr
Defines a pointer to a ConfigControlInfo.
const ConfigDbInfoList & getConfigDatabases() const
Retrieves the list of databases.
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.