24 const std::list<std::string>& names =
26 for (std::list<std::string>::const_iterator name = names.begin();
27 name != names.end(); ++name) {
29 for (OptionDefContainer::const_iterator def = defs->begin();
30 def != defs->end(); ++def) {
33 new_config.
add(new_def, *name);
43 const std::list<std::string>&
47 if (names.size() != other_names.size()) {
52 for (std::list<std::string>::const_iterator name = names.begin();
53 name != names.end(); ++name) {
59 if (defs->size() != defs->size()) {
63 for (OptionDefContainer::const_iterator def = defs->begin();
64 def != defs->end(); ++def) {
66 other_def = other.
get(*name, (*def)->getCode());
68 if (!other_def || (*other_def != **def)) {
80 const std::string& option_space) {
83 << option_space <<
"'");
88 "option definition must not be NULL");
90 }
else if (
get(option_space, def->getCode())) {
92 << def->getCode() <<
"' already exists in option"
93 " space '" << option_space <<
"'");
98 << def->getCode() <<
"' in standard option space '"
99 << option_space <<
"'");
102 option_definitions_.
addItem(def, option_space);
108 return (option_definitions_.
getItems(option_space));
113 const uint16_t option_code)
const {
119 if (defs && !defs->empty()) {
125 if (std::distance(range.first, range.second) > 0) {
126 return (*range.first);
135 const std::string& option_name)
const {
141 if (defs && !defs->empty()) {
147 if (std::distance(range.first, range.second) > 0) {
148 return (*range.first);
160 const std::list<std::string>& names =
162 for (std::list<std::string>::const_iterator name = names.begin();
163 name != names.end(); ++name) {
165 for (OptionDefContainer::const_iterator def = defs->begin();
166 def != defs->end(); ++def) {
170 (*def)->contextToElement(map);
176 std::string data_type =
180 bool array_type = (*def)->getArrayType();
183 std::string encapsulates = (*def)->getEncapsulatedSpace();
187 (*def)->getRecordFields();
188 if (!fields.empty()) {
189 std::ostringstream oss;
190 for (OptionDefinition::RecordFieldsCollection::const_iterator
191 field = fields.begin();
192 field != fields.end(); ++field) {
193 if (field != fields.begin()) {
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Represents option definitions used by the DHCP server.
void add(const OptionDefinitionPtr &def, const std::string &option_space)
Add new option definition.
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.
bool equals(const CfgOptionDef &other) const
Check if configuration is equal to other configuration.
OptionDefinitionPtr get(const std::string &option_space, const uint16_t option_code) const
Return option definition for a particular option space and code.
void copyTo(CfgOptionDef &new_config) const
Copies this configuration to a new configuration.
Exception to be thrown when the particular option definition duplicates existing option definition.
static OptionDefinitionPtr getOptionDef(const std::string &space, const uint16_t code)
Return the first option definition matching a particular option code.
static const std::string & getDataTypeName(const OptionDataType data_type)
Return option data type name from the data type enumerator.
Base class representing a DHCP option definition.
std::vector< OptionDataType > RecordFieldsCollection
List of fields within the record.
void addItem(const ItemType &item, const Selector &option_space)
Adds a new item to the option_space.
void clearItems()
Remove all items from the container.
std::list< Selector > getOptionSpaceNames() const
Get a list of existing option spaces.
ItemsContainerPtr getItems(const Selector &option_space) const
Get all items for the particular option space.
static bool validateName(const std::string &name)
Checks that the provided option space name is valid.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
std::pair< OptionDefContainerNameIndex::const_iterator, OptionDefContainerNameIndex::const_iterator > OptionDefContainerNameRange
Pair of iterators to represent the range of options definitions having the same option name.
OptionDefContainer::nth_index< 2 >::type OptionDefContainerNameIndex
Type of the index #2 - option name.
std::pair< OptionDefContainerTypeIndex::const_iterator, OptionDefContainerTypeIndex::const_iterator > OptionDefContainerTypeRange
Pair of iterators to represent the range of options definitions having the same option type value.
OptionDefContainer::nth_index< 1 >::type OptionDefContainerTypeIndex
Type of the index #1 - option type.
boost::shared_ptr< OptionDefContainer > OptionDefContainerPtr
Pointer to an option definition container.
Defines the logger used by the top-level component of kea-dhcp-ddns.