| Kea 3.0.2-git

translator_database.h
Go to the documentation of this file.
1// Copyright (C) 2018-2025 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
12 namespace isc {
13 namespace yang {
14
97
104 class TranslatorDatabase : virtual public Translator {
105 public:
110 TranslatorDatabase(sysrepo::Session session, const std::string& model);
111
113 virtual ~TranslatorDatabase() = default;
114
122 isc::data::ElementPtr getDatabase(libyang::DataNode const& data_node);
123
136 isc::data::ElementPtr getDatabaseFromAbsoluteXpath(std::string const& xpath);
137
145 void setDatabase(const std::string& xpath,
146 isc::data::ConstElementPtr elem,
147 bool has_mandatory_key);
148
149 protected:
157 isc::data::ElementPtr getDatabaseKea(libyang::DataNode const& data_node);
158
165 void setDatabaseKea(const std::string& xpath,
166 isc::data::ConstElementPtr elem,
167 bool has_mandatory_key);
168}; // TranslatorDatabase
169
174 class TranslatorDatabases : virtual public TranslatorDatabase {
175 public:
180 TranslatorDatabases(sysrepo::Session session, const std::string& model);
181
183 virtual ~TranslatorDatabases() = default;
184
193 isc::data::ElementPtr getDatabases(libyang::DataNode const& data_node,
194 std::string const& xpath);
195
208 isc::data::ElementPtr getDatabasesFromAbsoluteXpath(std::string const& xpath);
209
216 void setDatabases(const std::string& xpath,
217 isc::data::ConstElementPtr elem);
218
219 protected:
228 isc::data::ElementPtr getDatabasesKea(libyang::DataNode const& data_node,
229 std::string const& xpath);
230
237 void setDatabasesKea(const std::string& xpath,
238 isc::data::ConstElementPtr elem);
239}; // TranslatorDatabases
240
241} // namespace yang
242} // namespace isc
243
244#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:83
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:100
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:194
isc::yang::TranslatorDatabases::getDatabasesFromAbsoluteXpath
isc::data::ElementPtr getDatabasesFromAbsoluteXpath(std::string const &xpath)
Translate database accesses from YANG to JSON.
Definition translator_database.cc:161
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:176
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:145
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:138
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:170
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:29
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
isc::yang
Definition adaptor.cc:17
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148
translator.h