Coverage Report

Created: 2026-06-30 07:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/kea/src/lib/dhcpsrv/cfg_rsoo.cc
Line
Count
Source
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
13
using namespace isc::data;
14
15
namespace isc {
16
namespace dhcp {
17
18
CfgRSOO::CfgRSOO()
19
115k
    : rsoo_options_() {
20
115k
    rsoo_options_.insert(D6O_ERP_LOCAL_DOMAIN_NAME);
21
115k
}
22
23
void
24
0
CfgRSOO::clear() {
25
0
    rsoo_options_.clear();
26
0
}
27
28
bool
29
0
CfgRSOO::enabled(const uint16_t code) const {
30
0
    return (rsoo_options_.find(code) != rsoo_options_.end());
31
0
}
32
33
void
34
0
CfgRSOO::enable(const uint16_t code) {
35
0
    if (rsoo_options_.find(code) == rsoo_options_.end()) {
36
        // If there's no such code added yet, let's add it
37
0
        rsoo_options_.insert(code);
38
0
    }
39
0
}
40
41
ElementPtr
42
0
CfgRSOO::toElement() const {
43
0
    ElementPtr result = Element::createList();
44
    // We can use LibDHCP::getOptionDef(DHCP6_OPTION_SPACE, *opt) too...
45
0
    for (auto const& opt : rsoo_options_) {
46
0
        const std::string& code = boost::lexical_cast<std::string>(opt);
47
0
        result->add(Element::create(code));
48
0
    }
49
0
    return (result);
50
0
}
51
52
}
53
}