Kea 2.7.4
config_ctl_info.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 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
18namespace isc {
19namespace process {
20
25public:
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
104private:
106 std::string access_str_;
107
110};
111
112typedef std::vector<ConfigDbInfo> ConfigDbInfoList;
113
142public:
143
146 : config_fetch_wait_time_(30, true) {};
147
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
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
229private:
230
232 util::Optional<uint16_t> config_fetch_wait_time_;
233
235 ConfigDbInfoList db_infos_;
236};
237
239typedef boost::shared_ptr<ConfigControlInfo> ConfigControlInfoPtr;
240
242typedef boost::shared_ptr<const ConfigControlInfo> ConstConfigControlInfoPtr;
243
244} // namespace process
245} // end namespace isc
246
247#endif // PROCESS_CONFIG_CTL_INFO_H
static std::string redactedAccessString(const ParameterMap &parameters)
Redact database access string.
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
Embodies configuration information used during a server's configuration process.
const ConfigDbInfoList & getConfigDatabases() const
Retrieves the list of databases.
void setConfigFetchWaitTime(const util::Optional< uint16_t > &config_fetch_wait_time)
Sets new value of the config-fetch-wait-time.
static const ConfigDbInfo & EMPTY_DB()
Fetches the not-found value returned by database list searches.
void merge(const ConfigControlInfo &other)
Merges specified configuration into this configuration.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
void addConfigDatabase(const std::string &access_str)
Sets configuration database access string.
const util::Optional< uint16_t > & getConfigFetchWaitTime() const
Returns configured config-fetch-wait-time value.
bool equals(const ConfigControlInfo &other) const
Compares two objects for equality.
const ConfigDbInfo & findConfigDb(const std::string &param_name, const std::string &param_value)
Retrieves the database with the given access parameter value.
void clear()
Empties the contents of the class, including the database list.
Provides configuration information used during a server's configuration process.
std::string getAccessString() const
Retrieves the database access string.
bool equals(const ConfigDbInfo &other) const
Compares two objects for equality.
bool getParameterValue(const std::string &name, std::string &value) const
Fetch the value of a given parameter.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
const db::DatabaseConnection::ParameterMap & getParameters() const
Retrieve the map of parameter values.
bool operator!=(const ConfigDbInfo &other) const
Compares two objects for inequality.
bool operator==(const ConfigDbInfo &other) const
Compares two objects for equality.
std::string redactedAccessString() const
Retrieves the database access string with password redacted.
void setAccessString(const std::string &access_str, bool test_mode=false)
Set the access string.
A template representing an optional value.
Definition optional.h:36
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
boost::shared_ptr< const ConfigControlInfo > ConstConfigControlInfoPtr
Defines a pointer to a const ConfigControlInfo.
std::vector< ConfigDbInfo > ConfigDbInfoList
boost::shared_ptr< ConfigControlInfo > ConfigControlInfoPtr
Defines a pointer to a ConfigControlInfo.
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.