Kea 2.7.5
cfg_option.cc
Go to the documentation of this file.
1// Copyright (C) 2014-2024 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#include <config.h>
8
9#include <dhcp/libdhcp++.h>
10#include <dhcpsrv/cfg_option.h>
11#include <dhcp/dhcp6.h>
12#include <dhcp/option_space.h>
13#include <util/encode/encode.h>
14#include <boost/algorithm/string/split.hpp>
15#include <boost/algorithm/string/classification.hpp>
16#include <boost/make_shared.hpp>
17#include <string>
18#include <sstream>
19#include <vector>
20
21using namespace isc::data;
22
23namespace isc {
24namespace dhcp {
25
27OptionDescriptor::create(const OptionPtr& opt, bool persist, bool cancel,
28 const std::string& formatted_value,
29 ConstElementPtr user_context) {
30 return (boost::make_shared<OptionDescriptor>(opt, persist, cancel,
31 formatted_value,
32 user_context));
33}
34
36OptionDescriptor::create(bool persist, bool cancel) {
37 return (boost::make_shared<OptionDescriptor>(persist, cancel));
38}
39
42 return (boost::make_shared<OptionDescriptor>(desc));
43}
44
45bool
47 return ((persistent_ == other.persistent_) &&
48 (cancelled_ == other.cancelled_) &&
49 (formatted_value_ == other.formatted_value_) &&
50 (space_name_ == other.space_name_) &&
51 option_->equals(other.option_));
52}
53
54void
55OptionDescriptor::addClientClass(const std::string& class_name) {
56 std::string trimmed = util::str::trim(class_name);
57 if (!trimmed.empty()) {
59 }
60}
61
62bool
64 if (client_classes_.empty()) {
65 return (true);
66 }
67
68 return (client_classes_.intersects(cclasses));
69}
70
72 : encapsulated_(false) {
73}
74
75bool
77 return (options_.empty() && vendor_options_.empty());
78}
79
80bool
81CfgOption::equals(const CfgOption& other) const {
82 return (options_.equals(other.options_) &&
83 vendor_options_.equals(other.vendor_options_));
84}
85
86void
88 const bool persistent,
89 const bool cancelled,
90 const std::string& option_space,
91 const uint64_t id) {
92 OptionDescriptor desc(option, persistent, cancelled);
93 if (id > 0) {
94 desc.setId(id);
95 }
96 add(desc, option_space);
97}
98
99void
100CfgOption::add(const OptionDescriptor& desc, const std::string& option_space) {
101 if (!desc.option_) {
102 isc_throw(isc::BadValue, "option being configured must not be NULL");
103
104 } else if (!OptionSpace::validateName(option_space)) {
105 isc_throw(isc::BadValue, "invalid option space name: '"
106 << option_space << "'");
107 }
108
109 const uint32_t vendor_id = LibDHCP::optionSpaceToVendorId(option_space);
110 if (vendor_id) {
111 vendor_options_.addItem(desc, vendor_id);
112 } else {
113 options_.addItem(desc, option_space);
114 }
115}
116
117void
118CfgOption::replace(const OptionDescriptor& desc, const std::string& option_space) {
119 if (!desc.option_) {
120 isc_throw(isc::BadValue, "option being replaced must not be NULL");
121 }
122
123 // Check for presence of options.
124 OptionContainerPtr options = getAll(option_space);
125 if (!options) {
126 isc_throw(isc::BadValue, "option space " << option_space
127 << " does not exist");
128 }
129
130 // Find the option we want to replace.
131 OptionContainerTypeIndex& idx = options->get<1>();
132 auto const& od_itr = idx.find(desc.option_->getType());
133 if (od_itr == idx.end()) {
134 isc_throw(isc::BadValue, "cannot replace option: "
135 << option_space << ":" << desc.option_->getType()
136 << ", it does not exist");
137 }
138
139 idx.replace(od_itr, desc);
140}
141
142std::list<std::string>
144 std::list<uint32_t> ids = getVendorIds();
145 std::list<std::string> names;
146 for (auto const& id : ids) {
147 std::ostringstream s;
148 // Vendor space name is constructed as "vendor-XYZ" where XYZ is an
149 // uint32_t value, without leading zeros.
150 s << "vendor-" << id;
151 names.push_back(s.str());
152 }
153 return (names);
154}
155
156void
158 // First we merge our options into other.
159 // This adds my options that are not
160 // in other, to other (i.e we skip over
161 // duplicates).
162 mergeTo(other);
163
164 // Create option instances based on the given definitions.
165 other.createOptions(cfg_def);
166
167 // Next we copy "other" on top of ourself.
168 other.copyTo(*this);
169
170 // If we copied new options we may need to populate the
171 // sub-options into the upper level options. The server
172 // expects that the top-level options have suitable
173 // suboptions appended.
174 encapsulate();
175}
176
177void
179 // Iterate over all the option descriptors in
180 // all the spaces and instantiate the options
181 // based on the given definitions.
182 for (auto const& space : getOptionSpaceNames()) {
183 for (auto opt_desc : *(getAll(space))) {
184 if (createDescriptorOption(cfg_def, space, opt_desc)) {
185 // Option was recreated, let's replace the descriptor.
186 replace(opt_desc, space);
187 }
188 }
189 }
190}
191
192bool
193CfgOption::createDescriptorOption(CfgOptionDefPtr cfg_def, const std::string& space,
194 OptionDescriptor& opt_desc) {
195 if (!opt_desc.option_) {
197 "validateCreateOption: descriptor has no option instance");
198 }
199
200 Option::Universe universe = opt_desc.option_->getUniverse();
201 uint16_t code = opt_desc.option_->getType();
202
203 // Find the option's defintion, if it has one.
204 // First, check for a standard definition.
206
207 // If there is no standard definition but the option is vendor specific,
208 // we should search the definition within the vendor option space.
209 if (!def && (space != DHCP4_OPTION_SPACE) && (space != DHCP6_OPTION_SPACE)) {
210 uint32_t vendor_id = LibDHCP::optionSpaceToVendorId(space);
211 if (vendor_id > 0) {
212 def = LibDHCP::getVendorOptionDef(universe, vendor_id, code);
213 }
214 }
215
216 // Still haven't found the definition, so look for custom
217 // definition in the given set of configured definitions
218 if (!def) {
219 def = cfg_def->get(space, code);
220 }
221
222 // Finish with a last resort option definition.
223 if (!def) {
224 def = LibDHCP::getLastResortOptionDef(space, code);
225 }
226
227 std::string& formatted_value = opt_desc.formatted_value_;
228 if (!def) {
229 if (!formatted_value.empty()) {
230 isc_throw(InvalidOperation, "option: " << space << "." << code
231 << " has a formatted value: '" << formatted_value
232 << "' but no option definition");
233 }
234
235 // If there's no definition and no formatted string, we'll
236 // settle for the generic option already in the descriptor.
237 // Indicate no-change by returning false.
238 return (false);
239 }
240
241 try {
242 // Definition found. Let's replace the generic option in
243 // the descriptor with one created based on definition's factory.
244 if (formatted_value.empty()) {
245 // No formatted value, use data stored in the generic option.
246 opt_desc.option_ = def->optionFactory(universe, code, opt_desc.option_->getData());
247 } else {
248 // Spit the value specified in comma separated values format.
249 std::vector<std::string> split_vec;
250 boost::split(split_vec, formatted_value, boost::is_any_of(","));
251 opt_desc.option_ = def->optionFactory(universe, code, split_vec);
252 }
253 } catch (const std::exception& ex) {
254 isc_throw(InvalidOperation, "could not create option: " << space << "." << code
255 << " from data specified, reason: " << ex.what());
256 }
257
258 // Indicate we replaced the definition.
259 return(true);
260}
261
262void
264 // Merge non-vendor options.
265 mergeInternal(options_, other.options_);
266 // Merge vendor options.
267 mergeInternal(vendor_options_, other.vendor_options_);
268}
269
270void
272 // Remove any existing data in the destination.
273 other.options_.clearItems();
274 other.vendor_options_.clearItems();
275 mergeTo(other);
276 other.encapsulated_ = isEncapsulated();
277}
278
279void
281 // Append sub-options to the top level "dhcp4" option space.
282 encapsulateInternal(DHCP4_OPTION_SPACE);
283 // Append sub-options to the top level "dhcp6" option space.
284 encapsulateInternal(DHCP6_OPTION_SPACE);
285 encapsulated_ = true;
286}
287
288void
289CfgOption::encapsulateInternal(const std::string& option_space) {
290 // Get all options for the particular option space.
291 OptionContainerPtr options = getAll(option_space);
292 // For each option in the option space we will append sub-options
293 // from the option spaces they encapsulate.
294 for (auto const& opt : *options) {
295 encapsulateInternal(opt.option_);
296 }
297}
298
299void
300CfgOption::encapsulateInternal(const OptionPtr& option) {
301 // Get encapsulated option space for the option.
302 const std::string& encap_space = option->getEncapsulatedSpace();
303 // Empty value means that no option space is encapsulated.
304 if (!encap_space.empty()) {
305 if (encap_space == DHCP4_OPTION_SPACE || encap_space == DHCP6_OPTION_SPACE) {
306 return;
307 }
308 // Retrieve all options from the encapsulated option space.
309 OptionContainerPtr encap_options = getAll(encap_space);
310 for (auto const& encap_opt : *encap_options) {
311 if (option.get() == encap_opt.option_.get()) {
312 // Avoid recursion by not adding options to themselves.
313 continue;
314 }
315
316 // Add sub-option if there isn't one added already.
317 if (!option->getOption(encap_opt.option_->getType())) {
318 option->addOption(encap_opt.option_);
319 }
320 encapsulateInternal(encap_opt.option_);
321 }
322 }
323}
324
325template <typename Selector>
326void
327CfgOption::mergeInternal(const OptionSpaceContainer<OptionContainer,
328 OptionDescriptor, Selector>& src_container,
329 OptionSpaceContainer<OptionContainer,
330 OptionDescriptor, Selector>& dest_container) const {
331 // Get all option spaces used in source container.
332 std::list<Selector> selectors = src_container.getOptionSpaceNames();
333
334 // For each space in the source container retrieve the actual options and
335 // match them with the options held in the destination container under
336 // the same space.
337 for (auto const& it : selectors) {
338 // Get all options in the destination container for the particular
339 // option space.
340 OptionContainerPtr dest_all = dest_container.getItems(it);
341 OptionContainerPtr src_all = src_container.getItems(it);
342 // For each option under this option space check if there is a
343 // corresponding option in the destination container. If not,
344 // add one.
345 for (auto const& src_opt : *src_all) {
346 const OptionContainerTypeIndex& idx = dest_all->get<1>();
347 const OptionContainerTypeRange& range =
348 idx.equal_range(src_opt.option_->getType());
349 // If there is no such option in the destination container,
350 // add one.
351 if (std::distance(range.first, range.second) == 0) {
352 dest_container.addItem(OptionDescriptor(src_opt), it);
353 }
354 }
355 }
356}
357
359CfgOption::getAll(const std::string& option_space) const {
360 return (options_.getItems(option_space));
361}
362
364CfgOption::getAll(const uint32_t vendor_id) const {
365 return (vendor_options_.getItems(vendor_id));
366}
367
369CfgOption::getAllCombined(const std::string& option_space) const {
370 auto vendor_id = LibDHCP::optionSpaceToVendorId(option_space);
371 if (vendor_id > 0) {
372 return (getAll(vendor_id));
373 }
374 return (getAll(option_space));
375}
376
377size_t
378CfgOption::del(const std::string& option_space, const uint16_t option_code) {
379 // Check for presence of options.
380 OptionContainerPtr options = getAll(option_space);
381 if (!options || options->empty()) {
382 // There are no options, so there is nothing to do.
383 return (0);
384 }
385
386 // If this is not top level option we may also need to delete the
387 // option instance from options encapsulating the particular option
388 // space.
389 if ((option_space != DHCP4_OPTION_SPACE) &&
390 (option_space != DHCP6_OPTION_SPACE)) {
391 // For each option space name iterate over the existing options.
392 auto option_space_names = getOptionSpaceNames();
393 for (auto const& option_space_from_list : option_space_names) {
394 // Get all options within the particular option space.
395 auto const& options_in_space = getAll(option_space_from_list);
396 for (auto const& option_it : *options_in_space) {
397
398 // Check if the option encapsulates our option space and
399 // it does, try to delete our option.
400 if (option_it.option_ &&
401 (option_it.option_->getEncapsulatedSpace() == option_space)) {
402 option_it.option_->delOption(option_code);
403 }
404 }
405 }
406 }
407
408 auto& idx = options->get<1>();
409 return (idx.erase(option_code));
410}
411
412size_t
413CfgOption::del(const uint32_t vendor_id, const uint16_t option_code) {
414 // Check for presence of options.
415 OptionContainerPtr vendor_options = getAll(vendor_id);
416 if (!vendor_options || vendor_options->empty()) {
417 // There are no options, so there is nothing to do.
418 return (0);
419 }
420
421 auto& idx = vendor_options->get<1>();
422 return (idx.erase(option_code));
423}
424
425size_t
426CfgOption::del(const uint64_t id) {
427 // Hierarchical nature of the options configuration requires that
428 // we go over all options and decapsulate them before removing
429 // any of them. Let's walk over the existing option spaces.
430 for (auto const& space_name : getOptionSpaceNames()) {
431 // Get all options for the option space.
432 auto const& options = getAll(space_name);
433 for (auto const& option_it : *options) {
434 if (!option_it.option_) {
435 continue;
436 }
437
438 // For each option within the option space we need to dereference
439 // any existing sub options.
440 auto sub_options = option_it.option_->getOptions();
441 for (auto const& sub : sub_options) {
442 // Dereference sub option.
443 option_it.option_->delOption(sub.second->getType());
444 }
445 }
446 }
447
448 // Now that we got rid of dependencies between the instances of the options
449 // we can delete all options having a specified id.
450 size_t num_deleted = options_.deleteItems(id) + vendor_options_.deleteItems(id);
451
452 // Let's encapsulate those options that remain in the configuration.
453 encapsulate();
454
455 // Return the number of deleted options.
456 return (num_deleted);
457}
458
461 return (toElementWithMetadata(false));
462}
463
466 return (toElementWithMetadata(false, cfg_option_def));
467}
468
470CfgOption::toElementWithMetadata(const bool include_metadata,
471 CfgOptionDefPtr cfg_option_def) const {
472 // option-data value is a list of maps
474 // Iterate first on options using space names
475 const std::list<std::string>& names = options_.getOptionSpaceNames();
476 for (auto const& name : names) {
477 OptionContainerPtr opts = getAll(name);
478 for (auto const& opt : *opts) {
479 // Get and fill the map for this option
481 // Set user context
482 opt.contextToElement(map);
483 // Set space from parent iterator
484 map->set("space", Element::create(name));
485 // Set the code
486 uint16_t code = opt.option_->getType();
487 map->set("code", Element::create(code));
488 // Set the name (always for standard options else when asked for)
490 if (cfg_option_def) {
491 def = cfg_option_def->get(name, code);
492 }
493 if (!def) {
494 def = LibDHCP::getOptionDef(name, code);
495 }
496 if (!def) {
497 def = LibDHCP::getRuntimeOptionDef(name, code);
498 }
499 if (!def) {
500 def = LibDHCP::getLastResortOptionDef(name, code);
501 }
502 if (def) {
503 map->set("name", Element::create(def->getName()));
504 }
505 // Set the data item
506 if (!opt.formatted_value_.empty()) {
507 map->set("csv-format", Element::create(true));
508 if (def && def->getType() == OPT_EMPTY_TYPE) {
509 map->set("data", Element::create(""));
510 } else {
511 map->set("data", Element::create(opt.formatted_value_));
512 }
513 } else {
514 std::vector<uint8_t> bin = opt.option_->toBinary();
515 if (!opt.cancelled_ || !bin.empty()) {
516 map->set("csv-format", Element::create(false));
517 if (def && def->getType() == OPT_EMPTY_TYPE) {
518 map->set("data", Element::create(""));
519 } else {
520 std::string repr = util::encode::encodeHex(bin);
521 map->set("data", Element::create(repr));
522 }
523 }
524 }
525 // Set the persistency flag
526 map->set("always-send", Element::create(opt.persistent_));
527 // Set the cancelled flag.
528 map->set("never-send", Element::create(opt.cancelled_));
529 // Include metadata if requested.
530 if (include_metadata) {
531 map->set("metadata", opt.getMetadata());
532 }
533
534 // Include client-classes if not empty.
535 if (!opt.client_classes_.empty()) {
536 map->set("client-classes", opt.client_classes_.toElement());
537 }
538
539 // Push on the list
540 result->add(map);
541 }
542 }
543 // Iterate first on vendor_options using vendor ids
544 const std::list<uint32_t>& ids = vendor_options_.getOptionSpaceNames();
545 for (auto const& id : ids) {
546 OptionContainerPtr opts = getAll(id);
547 for (auto const& opt : *opts) {
548 // Get and fill the map for this option
550 // Set user context
551 opt.contextToElement(map);
552 // Set space from parent iterator
553 std::ostringstream oss;
554 oss << "vendor-" << id;
555 map->set("space", Element::create(oss.str()));
556 // Set the code
557 uint16_t code = opt.option_->getType();
558 map->set("code", Element::create(code));
559 // Set the name
560 Option::Universe universe = opt.option_->getUniverse();
562 LibDHCP::getVendorOptionDef(universe, id, code);
563 if (!def) {
564 // vendor-XXX space is in oss
565 def = LibDHCP::getRuntimeOptionDef(oss.str(), code);
566 }
567 if (def) {
568 map->set("name", Element::create(def->getName()));
569 }
570 // Set the data item
571 if (!opt.formatted_value_.empty()) {
572 map->set("csv-format", Element::create(true));
573 if (def && def->getType() == OPT_EMPTY_TYPE) {
574 map->set("data", Element::create(""));
575 } else {
576 map->set("data", Element::create(opt.formatted_value_));
577 }
578 } else {
579 std::vector<uint8_t> bin = opt.option_->toBinary();
580 if (!opt.cancelled_ || !bin.empty()) {
581 map->set("csv-format", Element::create(false));
582 if (def && def->getType() == OPT_EMPTY_TYPE) {
583 map->set("data", Element::create(""));
584 } else {
585 std::string repr = util::encode::encodeHex(bin);
586 map->set("data", Element::create(repr));
587 }
588 }
589 }
590 // Set the persistency flag
591 map->set("always-send", Element::create(opt.persistent_));
592 // Set the cancellation flag
593 map->set("never-send", Element::create(opt.cancelled_));
594
595 // Include client-classes if not empty.
596 if (!opt.client_classes_.empty()) {
597 map->set("client-classes", opt.client_classes_.toElement());
598 }
599
600 // Push on the list
601 result->add(map);
602 }
603 }
604
605 return (result);
606}
607
608} // namespace dhcp
609} // namespace isc
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
A generic exception that is thrown if a function is called in a prohibited way.
static ElementPtr create(const Position &pos=ZERO_POSITION())
Definition data.cc:249
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
Definition data.cc:304
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Definition data.cc:299
Represents option data configuration for the DHCP server.
Definition cfg_option.h:372
bool isEncapsulated() const
Checks if options have been encapsulated.
Definition cfg_option.h:570
OptionContainerPtr getAllCombined(const std::string &option_space) const
Returns all non-vendor or vendor options for the specified option space.
void encapsulate()
Appends encapsulated options to top-level options.
void replace(const OptionDescriptor &desc, const std::string &option_space)
Replaces the instance of an option within this collection.
static bool createDescriptorOption(CfgOptionDefPtr cfg_def, const std::string &space, OptionDescriptor &opt_desc)
Creates an option descriptor's option based on a set of option defs.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
void createOptions(CfgOptionDefPtr cfg_def)
Re-create the option in each descriptor based on given definitions.
isc::data::ElementPtr toElementWithMetadata(const bool include_metadata, CfgOptionDefPtr cfg_option_def=CfgOptionDefPtr()) const
Unparse a configuration object with optionally including the metadata.
size_t del(const std::string &option_space, const uint16_t option_code)
Deletes option for the specified option space and option code.
std::list< std::string > getOptionSpaceNames() const
Returns a list of configured option space names.
Definition cfg_option.h:727
bool empty() const
Indicates the object is empty.
Definition cfg_option.cc:76
void mergeTo(CfgOption &other) const
Merges this configuration to another configuration.
void copyTo(CfgOption &other) const
Copies this configuration to another configuration.
CfgOption()
default constructor
Definition cfg_option.cc:71
std::list< std::string > getVendorIdsSpaceNames() const
Returns a list of option space names for configured vendor ids.
OptionContainerPtr getAll(const std::string &option_space) const
Returns all options for the specified option space.
void merge(CfgOptionDefPtr cfg_def, CfgOption &other)
Merges another option configuration into this one.
bool equals(const CfgOption &other) const
Check if configuration is equal to other configuration.
Definition cfg_option.cc:81
void add(const OptionPtr &option, const bool persistent, const bool cancelled, const std::string &option_space, const uint64_t id=0)
Adds instance of the option to the configuration.
Definition cfg_option.cc:87
std::list< uint32_t > getVendorIds() const
Returns a list of all configured vendor identifiers.
Definition cfg_option.h:732
Container for storing client class names.
Definition classify.h:109
void insert(const ClientClass &class_name)
Insert an element.
Definition classify.h:159
bool empty() const
Check if classes is empty.
Definition classify.h:169
bool intersects(const ClientClasses &cclasses) const
returns whether this container has at least one class in common with a given container.
Definition classify.cc:61
static OptionDefinitionPtr getOptionDef(const std::string &space, const uint16_t code)
Return the first option definition matching a particular option code.
Definition libdhcp++.cc:132
static OptionDefinitionPtr getVendorOptionDef(const Option::Universe u, const uint32_t vendor_id, const uint16_t code)
Returns vendor option definition for a given vendor-id and code.
Definition libdhcp++.cc:174
static uint32_t optionSpaceToVendorId(const std::string &option_space)
Converts option space name to vendor id.
static OptionDefinitionPtr getRuntimeOptionDef(const std::string &space, const uint16_t code)
Returns runtime (non-standard) option definition by space and option code.
Definition libdhcp++.cc:195
static OptionDefinitionPtr getLastResortOptionDef(const std::string &space, const uint16_t code)
Returns last resort option definition by space and option code.
Definition libdhcp++.cc:253
Option descriptor.
Definition cfg_option.h:48
OptionPtr option_
Option instance.
Definition cfg_option.h:51
void addClientClass(const std::string &class_name)
Adds new client class for which the option is allowed.
Definition cfg_option.cc:55
std::string space_name_
Option space name.
Definition cfg_option.h:91
bool equals(const OptionDescriptor &other) const
Checks if the one descriptor is equal to another.
Definition cfg_option.cc:46
bool allowedForClientClasses(const ClientClasses &cclasses) const
Validates an OptionDescriptor's client-classes against a list of classes.
Definition cfg_option.cc:63
bool cancelled_
Cancelled flag.
Definition cfg_option.h:65
std::string formatted_value_
Option value in textual (CSV) format.
Definition cfg_option.h:80
static OptionDescriptorPtr create(const OptionPtr &opt, bool persist, bool cancel, const std::string &formatted_value="", data::ConstElementPtr user_context=data::ConstElementPtr())
Factory function creating an instance of the OptionDescriptor.
Definition cfg_option.cc:27
ClientClasses client_classes_
Collection of classes for the which option is allowed.
Definition cfg_option.h:95
bool persistent_
Persistence flag.
Definition cfg_option.h:57
uint64_t deleteItems(const uint64_t id)
Remove all options or option definitions with a given database identifier.
void addItem(const ItemType &item, const Selector &option_space)
Adds a new item to the option_space.
bool empty() const
Indicates the container is empty.
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.
bool equals(const OptionSpaceContainer &other) const
Check if two containers are equal.
static bool validateName(const std::string &name)
Checks that the provided option space name is valid.
Universe
defines option universe DHCPv4 or DHCPv6
Definition option.h:90
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
std::string ClientClass
Defines a single class name.
Definition classify.h:43
std::pair< OptionContainerTypeIndex::const_iterator, OptionContainerTypeIndex::const_iterator > OptionContainerTypeRange
Pair of iterators to represent the range of options having the same option type value.
Definition cfg_option.h:330
OptionContainer::nth_index< 1 >::type OptionContainerTypeIndex
Type of the index #1 - option type.
Definition cfg_option.h:325
boost::shared_ptr< CfgOptionDef > CfgOptionDefPtr
Non-const pointer.
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
boost::shared_ptr< OptionDescriptor > OptionDescriptorPtr
A pointer to option descriptor.
Definition cfg_option.h:37
boost::shared_ptr< OptionContainer > OptionContainerPtr
Pointer to the OptionContainer object.
Definition cfg_option.h:323
boost::multi_index_container< OptionDescriptor, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_non_unique< KeyFromKeyExtractor< boost::multi_index::const_mem_fun< Option, uint16_t, &Option::getType >, boost::multi_index::member< OptionDescriptor, OptionPtr, &OptionDescriptor::option_ > > >, boost::multi_index::hashed_non_unique< boost::multi_index::member< OptionDescriptor, bool, &OptionDescriptor::persistent_ > >, boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< OptionIdIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, uint64_t, &data::BaseStampedElement::getId > >, boost::multi_index::hashed_non_unique< boost::multi_index::member< OptionDescriptor, bool, &OptionDescriptor::cancelled_ > > > > OptionContainer
Multi index container for DHCP option descriptors.
Definition cfg_option.h:320
boost::shared_ptr< Option > OptionPtr
Definition option.h:37
string encodeHex(const vector< uint8_t > &binary)
Encode binary data in the base16 format.
Definition encode.cc:361
string trim(const string &input)
Trim leading and trailing spaces.
Definition str.cc:32
Defines the logger used by the top-level component of kea-lfc.
#define DHCP4_OPTION_SPACE
global std option spaces
#define DHCP6_OPTION_SPACE