Kea 2.7.1
cfg_db_access.h
Go to the documentation of this file.
1// Copyright (C) 2016-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 CFG_DBACCESS_H
8#define CFG_DBACCESS_H
9
10#include <cc/cfg_to_element.h>
12
13#include <boost/shared_ptr.hpp>
14#include <string>
15#include <list>
16
17namespace isc {
18namespace dhcp {
19
26public:
29
35 void setAppendedParameters(const std::string& appended_parameters) {
36 appended_parameters_ = appended_parameters;
37 }
38
43 std::string getLeaseDbAccessString() const;
44
48 void setLeaseDbAccessString(const std::string& lease_db_access) {
49 lease_db_access_ = lease_db_access;
50 }
51
56 std::string getHostDbAccessString() const;
57
62 void setHostDbAccessString(const std::string& host_db_access,
63 bool front = false) {
64 if (front) {
65 host_db_access_.push_front(host_db_access);
66 } else {
67 host_db_access_.push_back(host_db_access);
68 }
69 }
70
75 std::list<std::string> getHostDbAccessStringList() const;
76
90 void setIPReservationsUnique(const bool unique) {
92 }
93
101 }
102
107 void setExtendedInfoTablesEnabled(const bool enabled) {
109 }
110
119
122 void createManagers() const;
123
124protected:
125
129 std::string getAccessString(const std::string& access_string) const;
130
134
136 std::string lease_db_access_;
137
139 std::list<std::string> host_db_access_;
140
144
148};
149
151typedef boost::shared_ptr<CfgDbAccess> CfgDbAccessPtr;
152
154typedef boost::shared_ptr<const CfgDbAccess> ConstCfgDbAccessPtr;
155
170
173 CfgHostDbAccess(const CfgDbAccess& super) : CfgDbAccess(super) { }
174
182 for (const std::string& dbaccess : host_db_access_) {
185 if (entry->size() > 0) {
186 result->add(entry);
187 }
188 }
189 return (result);
190 }
191};
192
193}
194}
195
196#endif // CFG_DBACCESS_H
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Definition data.cc:299
static isc::data::ElementPtr toElementDbAccessString(const std::string &dbaccess)
Unparse an access string.
Holds access parameters and the configuration of the lease and hosts database connection.
void setLeaseDbAccessString(const std::string &lease_db_access)
Sets lease database access string.
bool ip_reservations_unique_
Holds the setting whether IP reservations should be unique or can be non-unique.
std::string getAccessString(const std::string &access_string) const
Returns lease or host database access string.
void createManagers() const
Creates instance of lease manager and host data sources according to the configuration specified.
std::string getHostDbAccessString() const
Retrieves host database access string.
bool getIPReservationsUnique() const
Returns the setting indicating if the IP reservations are unique or can be non unique.
bool getExtendedInfoTablesEnabled() const
Returns the setting indicating if lease extended info tables are enabled.
std::list< std::string > host_db_access_
Holds host database access strings.
std::string appended_parameters_
Parameters to be appended to the database access strings.
CfgDbAccess()
Constructor.
bool extended_info_tables_enabled_
Holds the setting whether the lease extended info tables are enabled or disabled.
std::list< std::string > getHostDbAccessStringList() const
Retrieves host database access string.
void setIPReservationsUnique(const bool unique)
Modifies the setting imposing whether the IP reservations are unique or can be non unique.
void setHostDbAccessString(const std::string &host_db_access, bool front=false)
Sets host database access string.
void setAppendedParameters(const std::string &appended_parameters)
Sets parameters which will be appended to the database access strings.
void setExtendedInfoTablesEnabled(const bool enabled)
Modifies the setting whether the lease extended info tables are enabled.
std::string lease_db_access_
Holds lease database access string.
std::string getLeaseDbAccessString() const
Retrieves lease database access string.
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
boost::shared_ptr< CfgDbAccess > CfgDbAccessPtr
A pointer to the CfgDbAccess.
boost::shared_ptr< const CfgDbAccess > ConstCfgDbAccessPtr
A pointer to the const CfgDbAccess.
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.
CfgHostDbAccess(const CfgDbAccess &super)
Constructor.
virtual isc::data::ElementPtr toElement() const
Unparse.
utility class for unparsing
virtual isc::data::ElementPtr toElement() const
Unparse.
CfgLeaseDbAccess(const CfgDbAccess &super)
Constructor.