Kea 3.2.0-git
translator_database.h
Go to the documentation of this file.
1// Copyright (C) 2018-2026 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 ISC_TRANSLATOR_DATABASE_H
8#define ISC_TRANSLATOR_DATABASE_H 1
9
10#include <yang/translator.h>
11
12namespace isc {
13namespace yang {
14
101
108class TranslatorDatabase : virtual public Translator {
109public:
114 TranslatorDatabase(sysrepo::Session session, const std::string& model);
115
117 virtual ~TranslatorDatabase() = default;
118
126 isc::data::ElementPtr getDatabase(libyang::DataNode const& data_node);
127
140 isc::data::ElementPtr getDatabaseFromAbsoluteXpath(std::string const& xpath);
141
149 void setDatabase(const std::string& xpath,
151 bool has_mandatory_key);
152
153protected:
161 isc::data::ElementPtr getDatabaseKea(libyang::DataNode const& data_node);
162
169 void setDatabaseKea(const std::string& xpath,
171 bool has_mandatory_key);
172}; // TranslatorDatabase
173
179public:
184 TranslatorDatabases(sysrepo::Session session, const std::string& model);
185
187 virtual ~TranslatorDatabases() = default;
188
197 isc::data::ElementPtr getDatabases(libyang::DataNode const& data_node,
198 std::string const& xpath);
199
213
220 void setDatabases(const std::string& xpath,
222
223protected:
232 isc::data::ElementPtr getDatabasesKea(libyang::DataNode const& data_node,
233 std::string const& xpath);
234
241 void setDatabasesKea(const std::string& xpath,
243}; // TranslatorDatabases
244
245} // namespace yang
246} // namespace isc
247
248#endif // ISC_TRANSLATOR_DATABASE_H
isc::data::ElementPtr getDatabaseKea(libyang::DataNode const &data_node)
getDatabase JSON for kea-dhcp[46]-server models.
isc::data::ElementPtr getDatabase(libyang::DataNode const &data_node)
Translate a database access from YANG to JSON.
void setDatabase(const std::string &xpath, isc::data::ConstElementPtr elem, bool has_mandatory_key)
Translate and set database access from JSON to YANG.
TranslatorDatabase(sysrepo::Session session, const std::string &model)
Constructor.
isc::data::ElementPtr getDatabaseFromAbsoluteXpath(std::string const &xpath)
Translate a database access from YANG to JSON.
virtual ~TranslatorDatabase()=default
Destructor.
void setDatabaseKea(const std::string &xpath, isc::data::ConstElementPtr elem, bool has_mandatory_key)
setDatabase for kea-dhcp[46]-server models.
void setDatabasesKea(const std::string &xpath, isc::data::ConstElementPtr elem)
setDatabases for kea-dhcp[46]-server models.
isc::data::ElementPtr getDatabasesFromAbsoluteXpath(std::string const &xpath)
Translate database accesses from YANG to JSON.
void setDatabases(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set database accesses from JSON to YANG.
isc::data::ElementPtr getDatabases(libyang::DataNode const &data_node, std::string const &xpath)
Translate database accesses from YANG to JSON.
virtual ~TranslatorDatabases()=default
Destructor.
TranslatorDatabases(sysrepo::Session session, const std::string &model)
Constructor.
isc::data::ElementPtr getDatabasesKea(libyang::DataNode const &data_node, std::string const &xpath)
getDatabases JSON for kea-dhcp[46]-server models.
Translator(sysrepo::Session session, const std::string &model)
Constructor.
Definition translator.cc:27
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:30
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
Defines the logger used by the top-level component of kea-lfc.