Kea  2.1.7-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>
12 #include <cc/cfg_to_element.h>
13 #include <string>
14 
15 namespace isc {
16 namespace dhcp {
17 
31 public:
32 
41  void copyTo(CfgOptionDef& new_config) const;
42 
45 
46  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 
132  return (option_definitions_);
133  }
134 
138  virtual isc::data::ElementPtr toElement() const;
139 
148  toElementWithMetadata(const bool include_metadata) const;
149 
171  void merge(CfgOptionDef& other);
172 
173 private:
174 
179  OptionDefSpaceContainer option_definitions_;
180 
181 };
182 
184 
185 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
bool operator==(const CfgOptionDef &other) const
Equality operator.
boost::shared_ptr< const CfgOptionDef > ConstCfgOptionDefPtr
Const pointer.
uint64_t del(const uint64_t id)
Deletes all option definitions having a given database id.
isc::data::ElementPtr toElementWithMetadata(const bool include_metadata) const
Unparse a configuration object with optionally including the metadata.
void add(const OptionDefinitionPtr &def)
Add new option definition.
bool operator!=(const CfgOptionDef &other) const
Inequality operator.
boost::shared_ptr< Element > ElementPtr
Definition: data.h:24
const OptionDefSpaceContainer & getContainer() const
Returns reference to container holding option definitions.
boost::shared_ptr< CfgOptionDef > CfgOptionDefPtr
Non-const pointer.
Class of option definition space container.
void merge(CfgOptionDef &other)
Merges specified option definitions from a configuration into this configuration. ...
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
OptionDefContainerPtr getAll(const std::string &option_space) const
Return option definitions for particular option space.
Abstract class for configuration Cfg_* classes.
Represents option definitions used by the DHCP server.
boost::shared_ptr< OptionDefContainer > OptionDefContainerPtr
Pointer to an option definition container.
Defines the logger used by the top-level component of kea-lfc.
bool equals(const CfgOptionDef &other) const
Check if configuration is equal to other configuration.
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
void copyTo(CfgOptionDef &new_config) const
Copies this configuration to a new configuration.