Kea: translator_database.h Source File

| 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
108 class 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,
150 isc::data::ConstElementPtr elem,
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,
170 isc::data::ConstElementPtr elem,
171 bool has_mandatory_key);
172}; // TranslatorDatabase
173
178 class TranslatorDatabases : virtual public TranslatorDatabase {
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
212 isc::data::ElementPtr getDatabasesFromAbsoluteXpath(std::string const& xpath);
213
220 void setDatabases(const std::string& xpath,
221 isc::data::ConstElementPtr elem);
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,
242 isc::data::ConstElementPtr elem);
243}; // TranslatorDatabases
244
245} // namespace yang
246} // namespace isc
247
248#endif // ISC_TRANSLATOR_DATABASE_H
isc::yang::TranslatorDatabase::getDatabaseKea
isc::data::ElementPtr getDatabaseKea(libyang::DataNode const &data_node)
getDatabase JSON for kea-dhcp[46]-server models.
Definition translator_database.cc:51
isc::yang::TranslatorDatabase::getDatabase
isc::data::ElementPtr getDatabase(libyang::DataNode const &data_node)
Translate a database access from YANG to JSON.
Definition translator_database.cc:27
isc::yang::TranslatorDatabase::setDatabase
void setDatabase(const std::string &xpath, isc::data::ConstElementPtr elem, bool has_mandatory_key)
Translate and set database access from JSON to YANG.
Definition translator_database.cc:84
isc::yang::TranslatorDatabase::TranslatorDatabase
TranslatorDatabase(sysrepo::Session session, const std::string &model)
Constructor.
Definition translator_database.cc:22
isc::yang::TranslatorDatabase::getDatabaseFromAbsoluteXpath
isc::data::ElementPtr getDatabaseFromAbsoluteXpath(std::string const &xpath)
Translate a database access from YANG to JSON.
Definition translator_database.cc:42
isc::yang::TranslatorDatabase::~TranslatorDatabase
virtual ~TranslatorDatabase()=default
Destructor.
isc::yang::TranslatorDatabase::setDatabaseKea
void setDatabaseKea(const std::string &xpath, isc::data::ConstElementPtr elem, bool has_mandatory_key)
setDatabase for kea-dhcp[46]-server models.
Definition translator_database.cc:101
isc::yang::TranslatorDatabases::setDatabasesKea
void setDatabasesKea(const std::string &xpath, isc::data::ConstElementPtr elem)
setDatabases for kea-dhcp[46]-server models.
Definition translator_database.cc:196
isc::yang::TranslatorDatabases::getDatabasesFromAbsoluteXpath
isc::data::ElementPtr getDatabasesFromAbsoluteXpath(std::string const &xpath)
Translate database accesses from YANG to JSON.
Definition translator_database.cc:163
isc::yang::TranslatorDatabases::setDatabases
void setDatabases(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set database accesses from JSON to YANG.
Definition translator_database.cc:178
isc::yang::TranslatorDatabases::getDatabases
isc::data::ElementPtr getDatabases(libyang::DataNode const &data_node, std::string const &xpath)
Translate database accesses from YANG to JSON.
Definition translator_database.cc:147
isc::yang::TranslatorDatabases::~TranslatorDatabases
virtual ~TranslatorDatabases()=default
Destructor.
isc::yang::TranslatorDatabases::TranslatorDatabases
TranslatorDatabases(sysrepo::Session session, const std::string &model)
Constructor.
Definition translator_database.cc:140
isc::yang::TranslatorDatabases::getDatabasesKea
isc::data::ElementPtr getDatabasesKea(libyang::DataNode const &data_node, std::string const &xpath)
getDatabases JSON for kea-dhcp[46]-server models.
Definition translator_database.cc:172
isc::yang::Translator::Translator
Translator(sysrepo::Session session, const std::string &model)
Constructor.
Definition translator.cc:27
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:30
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
isc::yang
Definition adaptor.cc:17
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
translator.h