Kea 2.7.5
cfg_rsoo.cc
Go to the documentation of this file.
1// Copyright (C) 2015-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/dhcp6.h>
10#include <dhcpsrv/cfg_rsoo.h>
11#include <boost/lexical_cast.hpp>
12
13using namespace isc::data;
14
15namespace isc {
16namespace dhcp {
17
19 : rsoo_options_() {
20 rsoo_options_.insert(D6O_ERP_LOCAL_DOMAIN_NAME);
21}
22
23void
25 rsoo_options_.clear();
26}
27
28bool
29CfgRSOO::enabled(const uint16_t code) const {
30 return (rsoo_options_.find(code) != rsoo_options_.end());
31}
32
33void
34CfgRSOO::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 (auto const& opt : rsoo_options_) {
46 const std::string& code = boost::lexical_cast<std::string>(opt);
47 result->add(Element::create(code));
48 }
49 return (result);
50}
51
52}
53}
static ElementPtr create(const Position &pos=ZERO_POSITION())
Definition data.cc:249
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Definition data.cc:299
void clear()
Removes designation of all options as RSOO_enabled.
Definition cfg_rsoo.cc:24
void enable(const uint16_t code)
Marks specified option code as RSOO-enabled.
Definition cfg_rsoo.cc:34
bool enabled(const uint16_t code) const
Returns whether specific option code is RSOO-enabled.
Definition cfg_rsoo.cc:29
CfgRSOO()
Constructor.
Definition cfg_rsoo.cc:18
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition cfg_rsoo.cc:42
@ D6O_ERP_LOCAL_DOMAIN_NAME
Definition dhcp6.h:85
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
Defines the logger used by the top-level component of kea-lfc.