Kea  2.3.5-git
cfg_rsoo.cc
Go to the documentation of this file.
1 // Copyright (C) 2015,2017 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/dhcp6.h>
10 #include <dhcpsrv/cfg_rsoo.h>
11 #include <boost/lexical_cast.hpp>
12 
13 using namespace isc::data;
14 
15 namespace isc {
16 namespace dhcp {
17 
18 CfgRSOO::CfgRSOO()
19  : rsoo_options_() {
20  rsoo_options_.insert(D6O_ERP_LOCAL_DOMAIN_NAME);
21 }
22 
23 void
25  rsoo_options_.clear();
26 }
27 
28 bool
29 CfgRSOO::enabled(const uint16_t code) const {
30  return (rsoo_options_.find(code) != rsoo_options_.end());
31 }
32 
33 void
34 CfgRSOO::enable(const uint16_t code) {
35  if (rsoo_options_.find(code) == rsoo_options_.end()) {
36  // If there's no such code added yet, let's add it
37  rsoo_options_.insert(code);
38  }
39 }
40 
44  // We can use LibDHCP::getOptionDef(DHCP6_OPTION_SPACE, *opt) too...
45  for (std::set<uint16_t>::const_iterator opt = rsoo_options_.cbegin();
46  opt != rsoo_options_.cend(); ++opt) {
47  const std::string& code = boost::lexical_cast<std::string>(*opt);
48  result->add(Element::create(code));
49  }
50  return (result);
51 }
52 
53 }
54 }
boost::shared_ptr< Element > ElementPtr
Definition: data.h:24
bool enabled(const uint16_t code) const
Returns whether specific option code is RSOO-enabled.
Definition: cfg_rsoo.cc:29
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Definition: data.cc:286
void enable(const uint16_t code)
Marks specified option code as RSOO-enabled.
Definition: cfg_rsoo.cc:34
Defines the logger used by the top-level component of kea-lfc.
static ElementPtr create(const Position &pos=ZERO_POSITION())
Definition: data.cc:241
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: cfg_rsoo.cc:42
void clear()
Removes designation of all options as RSOO_enabled.
Definition: cfg_rsoo.cc:24