Kea 2.7.0
adaptor_option.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_ADAPTOR_OPTION_H
8#define ISC_ADAPTOR_OPTION_H 1
9
11#include <yang/adaptor.h>
12
13#include <unordered_map>
14
15namespace isc {
16namespace yang {
17
23using OptionCodes = std::unordered_map<std::string, uint16_t>;
24
41public:
43 virtual ~AdaptorOption() = default;
44
49 static void setSpace(isc::data::ElementPtr option,
50 const std::string& space);
51
56 static void checkType(isc::data::ConstElementPtr option);
57
62 static void checkCode(isc::data::ConstElementPtr option);
63
72 static void collect(isc::data::ConstElementPtr option, OptionCodes& codes);
73
78 static void setCode(isc::data::ElementPtr option,
79 const OptionCodes& codes);
80
85 static void initCodes(OptionCodes& codes, const std::string& space);
86
87protected:
94 static void initCodesInternal(OptionCodes& codes, const std::string& space,
95 const isc::dhcp::OptionDefParams* params,
96 size_t params_size);
97}; // AdaptorOption
98
99} // namespace yang
100} // namespace isc
101
102#endif // ISC_ADAPTOR_OPTION_H
JSON adaptor for option data or definition setting defaults.
static void setCode(isc::data::ElementPtr option, const OptionCodes &codes)
Set code from name and definitions.
static void initCodes(OptionCodes &codes, const std::string &space)
Initialize code map.
virtual ~AdaptorOption()=default
Destructor.
static void setSpace(isc::data::ElementPtr option, const std::string &space)
Set space.
static void checkType(isc::data::ConstElementPtr option)
Checks if type is specified in option definition.
static void initCodesInternal(OptionCodes &codes, const std::string &space, const isc::dhcp::OptionDefParams *params, size_t params_size)
Initialize code map from option definition parameters.
static void collect(isc::data::ConstElementPtr option, OptionCodes &codes)
Collect definition.
static void checkCode(isc::data::ConstElementPtr option)
Check if code is specified in option defintion.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
std::unordered_map< std::string, uint16_t > OptionCodes
Map for DHCP option definitions handling code and an index built from space and name.
Defines the logger used by the top-level component of kea-lfc.
Parameters being used to make up an option definition.