Kea: cfg_option_def.h Source File

| Kea 3.2.0-git

cfg_option_def.h
Go to the documentation of this file.
1// Copyright (C) 2014-2021 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 CFG_OPTION_DEF_H
8#define CFG_OPTION_DEF_H
9
10#include <dhcp/option_definition.h>
11#include <dhcp/option_space_container.h>
12#include <cc/cfg_to_element.h>
13#include <string>
14
15namespace isc {
16namespace dhcp {
17
30 class CfgOptionDef : public isc::data::CfgToElement {
31public:
32
41 void copyTo(CfgOptionDef& new_config) const;
42
45
46
51 bool equals(const CfgOptionDef& other) const;
52
58 bool operator==(const CfgOptionDef& other) const {
59 return (equals(other));
60 }
61
67 bool operator!=(const CfgOptionDef& other) const {
68 return (!equals(other));
69 }
70
72
84 void add(const OptionDefinitionPtr& def);
85
93 OptionDefContainerPtr getAll(const std::string& option_space) const;
94
102 OptionDefinitionPtr get(const std::string& option_space,
103 const uint16_t option_code) const;
104
112 OptionDefinitionPtr get(const std::string& option_space,
113 const std::string& option_name) const;
114
128 uint64_t del(const uint64_t id);
129
131 const OptionDefSpaceContainer& getContainer() const {
132 return (option_definitions_);
133 }
134
138 virtual isc::data::ElementPtr toElement() const;
139
147 isc::data::ElementPtr
148 toElementWithMetadata(const bool include_metadata) const;
149
171 void merge(CfgOptionDef& other);
172
173private:
174
179 OptionDefSpaceContainer option_definitions_;
180
181};
182
184
185
186 typedef boost::shared_ptr<CfgOptionDef> CfgOptionDefPtr;
187
189 typedef boost::shared_ptr<const CfgOptionDef> ConstCfgOptionDefPtr;
190
192
193}
194}
195
196#endif // CFG_OPTION_DEF_H
cfg_to_element.h
isc::dhcp::CfgOptionDef
Represents option definitions used by the DHCP server.
Definition cfg_option_def.h:30
isc::dhcp::CfgOptionDef::add
void add(const OptionDefinitionPtr &def)
Add new option definition.
Definition cfg_option_def.cc:74
isc::dhcp::CfgOptionDef::operator!=
bool operator!=(const CfgOptionDef &other) const
Inequality operator.
Definition cfg_option_def.h:67
isc::dhcp::CfgOptionDef::toElement
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition cfg_option_def.cc:162
isc::dhcp::CfgOptionDef::toElementWithMetadata
isc::data::ElementPtr toElementWithMetadata(const bool include_metadata) const
Unparse a configuration object with optionally including the metadata.
Definition cfg_option_def.cc:167
isc::dhcp::CfgOptionDef::del
uint64_t del(const uint64_t id)
Deletes all option definitions having a given database id.
Definition cfg_option_def.cc:157
isc::dhcp::CfgOptionDef::getContainer
const OptionDefSpaceContainer & getContainer() const
Returns reference to container holding option definitions.
Definition cfg_option_def.h:131
isc::dhcp::CfgOptionDef::getAll
OptionDefContainerPtr getAll(const std::string &option_space) const
Return option definitions for particular option space.
Definition cfg_option_def.cc:107
isc::dhcp::CfgOptionDef::equals
bool equals(const CfgOptionDef &other) const
Check if configuration is equal to other configuration.
Definition cfg_option_def.cc:37
isc::dhcp::CfgOptionDef::merge
void merge(CfgOptionDef &other)
Merges specified option definitions from a configuration into this configuration.
Definition cfg_option_def.cc:226
isc::dhcp::CfgOptionDef::get
OptionDefinitionPtr get(const std::string &option_space, const uint16_t option_code) const
Return option definition for a particular option space and code.
Definition cfg_option_def.cc:113
isc::dhcp::CfgOptionDef::operator==
bool operator==(const CfgOptionDef &other) const
Equality operator.
Definition cfg_option_def.h:58
isc::dhcp::CfgOptionDef::copyTo
void copyTo(CfgOptionDef &new_config) const
Copies this configuration to a new configuration.
Definition cfg_option_def.cc:21
isc::dhcp::OptionDefSpaceContainer
Class of option definition space container.
Definition option_definition.h:891
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
isc::dhcp
Definition dhcp4/client_handler.cc:20
isc::dhcp::ConstCfgOptionDefPtr
boost::shared_ptr< const CfgOptionDef > ConstCfgOptionDefPtr
Const pointer.
Definition cfg_option_def.h:189
isc::dhcp::CfgOptionDefPtr
boost::shared_ptr< CfgOptionDef > CfgOptionDefPtr
Non-const pointer.
Definition cfg_option_def.h:186
isc::dhcp::OptionDefinitionPtr
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
Definition option_definition.h:55
isc::dhcp::OptionDefContainerPtr
boost::shared_ptr< OptionDefContainer > OptionDefContainerPtr
Pointer to an option definition container.
Definition option_definition.h:859
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
option_definition.h
option_space_container.h
isc::data::CfgToElement
Abstract class for configuration Cfg_* classes.
Definition cfg_to_element.h:29