| Kea 3.0.2-git

translator_option_def.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 ISC_TRANSLATOR_OPTION_DEF_H
8#define ISC_TRANSLATOR_OPTION_DEF_H 1
9
10#include <yang/translator.h>
11
12 namespace isc {
13 namespace yang {
14
72
78 class TranslatorOptionDef : virtual public Translator {
79 public:
84 TranslatorOptionDef(sysrepo::Session session, const std::string& model);
85
87 virtual ~TranslatorOptionDef() = default;
88
96 isc::data::ElementPtr getOptionDef(libyang::DataNode const& data_node);
97
105 isc::data::ElementPtr getOptionDefFromAbsoluteXpath(std::string const& xpath);
106
111 void setOptionDef(const std::string& xpath,
112 isc::data::ConstElementPtr elem);
113
114 protected:
123 isc::data::ElementPtr getOptionDefKea(libyang::DataNode const& data_node);
124
130 void setOptionDefKea(const std::string& xpath,
131 isc::data::ConstElementPtr elem);
132}; // TranslatorOptionDef
133
134// @brief A translator class for converting an option definition list
135// between YANG and JSON.
136//
139 class TranslatorOptionDefList : virtual public TranslatorOptionDef {
140 public:
145 TranslatorOptionDefList(sysrepo::Session session,
146 const std::string& model);
147
149 virtual ~TranslatorOptionDefList() = default;
150
158 isc::data::ConstElementPtr getOptionDefList(libyang::DataNode const& data_node);
159
167 isc::data::ConstElementPtr getOptionDefListFromAbsoluteXpath(std::string const& xpath);
168
173 void setOptionDefList(const std::string& xpath,
174 isc::data::ConstElementPtr elem);
175
176 protected:
183 isc::data::ConstElementPtr getOptionDefListKea(libyang::DataNode const& data_node);
184
191 void setOptionDefListKea(const std::string& xpath,
192 isc::data::ConstElementPtr elem);
193}; // TranslatorOptionDefList
194
195} // namespace yang
196} // namespace isc
197
198#endif // ISC_TRANSLATOR_OPTION_DEF_H
isc::yang::TranslatorOptionDefList::getOptionDefListKea
isc::data::ConstElementPtr getOptionDefListKea(libyang::DataNode const &data_node)
getOptionDefList implementation specific to kea-dhcp[46]-server models.
Definition translator_option_def.cc:139
isc::yang::TranslatorOptionDefList::~TranslatorOptionDefList
virtual ~TranslatorOptionDefList()=default
Destructor.
isc::yang::TranslatorOptionDefList::setOptionDefListKea
void setOptionDefListKea(const std::string &xpath, isc::data::ConstElementPtr elem)
setOptionDefList implementation specific to kea-dhcp[46]-server models.
Definition translator_option_def.cc:164
isc::yang::TranslatorOptionDefList::getOptionDefList
isc::data::ConstElementPtr getOptionDefList(libyang::DataNode const &data_node)
Translate option definition list from YANG to JSON.
Definition translator_option_def.cc:114
isc::yang::TranslatorOptionDefList::TranslatorOptionDefList
TranslatorOptionDefList(sysrepo::Session session, const std::string &model)
Constructor.
Definition translator_option_def.cc:107
isc::yang::TranslatorOptionDefList::getOptionDefListFromAbsoluteXpath
isc::data::ConstElementPtr getOptionDefListFromAbsoluteXpath(std::string const &xpath)
Translate option definition list from YANG to JSON.
Definition translator_option_def.cc:130
isc::yang::TranslatorOptionDefList::setOptionDefList
void setOptionDefList(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set option definition list from JSON to YANG.
Definition translator_option_def.cc:145
isc::yang::TranslatorOptionDef::getOptionDefFromAbsoluteXpath
isc::data::ElementPtr getOptionDefFromAbsoluteXpath(std::string const &xpath)
Translate an option definition from YANG to JSON.
Definition translator_option_def.cc:44
isc::yang::TranslatorOptionDef::getOptionDefKea
isc::data::ElementPtr getOptionDefKea(libyang::DataNode const &data_node)
getOptionDef implementation specific to kea-dhcp[46]-server models.
Definition translator_option_def.cc:53
isc::yang::TranslatorOptionDef::~TranslatorOptionDef
virtual ~TranslatorOptionDef()=default
Destructor.
isc::yang::TranslatorOptionDef::setOptionDef
void setOptionDef(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set option definition from JSON to YANG.
Definition translator_option_def.cc:71
isc::yang::TranslatorOptionDef::setOptionDefKea
void setOptionDefKea(const std::string &xpath, isc::data::ConstElementPtr elem)
setOptionDef implementation specific to kea-dhcp[46]-server models.
Definition translator_option_def.cc:89
isc::yang::TranslatorOptionDef::TranslatorOptionDef
TranslatorOptionDef(sysrepo::Session session, const std::string &model)
Constructor.
Definition translator_option_def.cc:22
isc::yang::TranslatorOptionDef::getOptionDef
isc::data::ElementPtr getOptionDef(libyang::DataNode const &data_node)
Translate an option definition from YANG to JSON.
Definition translator_option_def.cc:28
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