Kea 2.7.6
translator_pool.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_POOL_H
8#define ISC_TRANSLATOR_POOL_H 1
9
11
12namespace isc {
13namespace yang {
14
125public:
130 TranslatorPool(sysrepo::Session session, const std::string& model);
131
133 virtual ~TranslatorPool() = default;
134
142 isc::data::ElementPtr getPool(libyang::DataNode const& data_node);
143
151 isc::data::ElementPtr getPoolFromAbsoluteXpath(std::string const& xpath);
152
157 void setPool(const std::string& xpath, isc::data::ConstElementPtr elem);
158
165 static void getAddresses(const std::string& prefix,
166 std::string& start_address,
167 std::string& end_address);
168
169protected:
177 isc::data::ElementPtr getPoolIetf6(libyang::DataNode const& data_node);
178
185 void setPoolIetf6(const std::string& xpath,
187
195 isc::data::ElementPtr getPoolKea(libyang::DataNode const& data_node);
196
202 void setPoolKea(const std::string& xpath, isc::data::ConstElementPtr elem);
203}; // TranslatorPool
204
208class TranslatorPools : virtual public TranslatorPool {
209public:
214 TranslatorPools(sysrepo::Session session, const std::string& model);
215
217 virtual ~TranslatorPools() = default;
218
226 isc::data::ElementPtr getPools(libyang::DataNode const& data_node);
227
235 isc::data::ElementPtr getPoolsFromAbsoluteXpath(std::string const& xpath);
236
241 void setPools(const std::string& xpath, isc::data::ConstElementPtr elem);
242
243protected:
249 isc::data::ElementPtr getPoolsIetf(libyang::DataNode const& data_node);
250
256 isc::data::ElementPtr getPoolsKea(libyang::DataNode const& data_node);
257
262 void setPoolsById(const std::string& xpath,
264
270 void setPoolsByAddresses(const std::string& xpath,
272}; // TranslatorPools
273
274} // namespace yang
275} // namespace isc
276
277#endif // ISC_TRANSLATOR_POOL_H
A translator class for converting an option data list between YANG and JSON.
A translator class for converting a pool between YANG and JSON.
void setPool(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set (address) pool from JSON to YANG.
void setPoolKea(const std::string &xpath, isc::data::ConstElementPtr elem)
setPool for kea-dhcp[46]-server.
isc::data::ElementPtr getPoolIetf6(libyang::DataNode const &data_node)
getPool for ietf-dhcpv6-server.
isc::data::ElementPtr getPool(libyang::DataNode const &data_node)
Translate a pool from YANG to JSON.
isc::data::ElementPtr getPoolKea(libyang::DataNode const &data_node)
getPool for kea-dhcp[46]-server.
virtual ~TranslatorPool()=default
Destructor.
TranslatorPool(sysrepo::Session session, const std::string &model)
Constructor.
isc::data::ElementPtr getPoolFromAbsoluteXpath(std::string const &xpath)
Translate a pool from YANG to JSON.
static void getAddresses(const std::string &prefix, std::string &start_address, std::string &end_address)
Get start and end addresses from prefix.
void setPoolIetf6(const std::string &xpath, isc::data::ConstElementPtr elem)
setPool for ietf-dhcpv6-server.
A translator class for converting pools between YANG and JSON.
void setPoolsByAddresses(const std::string &xpath, isc::data::ConstElementPtr elem)
setPools using address pair.
void setPoolsById(const std::string &xpath, isc::data::ConstElementPtr elem)
setPools using pool-id.
isc::data::ElementPtr getPoolsKea(libyang::DataNode const &data_node)
getPools for kea-dhcp[46]-server.
isc::data::ElementPtr getPoolsFromAbsoluteXpath(std::string const &xpath)
Translate pools from YANG to JSON.
TranslatorPools(sysrepo::Session session, const std::string &model)
Constructor.
virtual ~TranslatorPools()=default
Destructor.
void setPools(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set (address) pools from JSON to YANG.
isc::data::ElementPtr getPoolsIetf(libyang::DataNode const &data_node)
getPools for ietf-dhcpv6-server.
isc::data::ElementPtr getPools(libyang::DataNode const &data_node)
Translate pools from YANG to JSON.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
Defines the logger used by the top-level component of kea-lfc.