Kea: cfg_consistency.cc Source File

| Kea 2.2.0

cfg_consistency.cc
Go to the documentation of this file.
1// Copyright (C) 2018-2020 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 <dhcpsrv/cfg_consistency.h>
10#include <cc/data.h>
11
12using namespace isc::data;
13
14namespace isc {
15namespace dhcp {
16
17 isc::data::ElementPtr CfgConsistency::toElement() const {
18 ElementPtr m(new MapElement());
19 ElementPtr l(new StringElement(sanityCheckToText(getLeaseSanityCheck())));
20 m->set("lease-checks", l);
21
22 return (m);
23}
24
25std::string CfgConsistency::sanityCheckToText(LeaseSanity check_type) {
26 switch (check_type) {
27 case LEASE_CHECK_NONE:
28 return ("none");
29 case LEASE_CHECK_WARN:
30 return ("warn");
31 case LEASE_CHECK_FIX:
32 return ("fix");
33 case LEASE_CHECK_FIX_DEL:
34 return ("fix-del");
35 case LEASE_CHECK_DEL:
36 return ("del");
37 default:
38 return ("unknown");
39 }
40}
41
42};
43};
44
45
cfg_consistency.h
isc::data::MapElement
Definition: data.h:701
isc::data::StringElement
Definition: data.h:642
isc::dhcp::CfgConsistency::toElement
virtual isc::data::ElementPtr toElement() const
Returns JSON representation.
Definition: cfg_consistency.cc:17
isc::dhcp::CfgConsistency::LeaseSanity
LeaseSanity
Values for subnet-id sanity checks done for leases.
Definition: cfg_consistency.h:24
isc::dhcp::CfgConsistency::LEASE_CHECK_FIX
@ LEASE_CHECK_FIX
Definition: cfg_consistency.h:27
isc::dhcp::CfgConsistency::LEASE_CHECK_DEL
@ LEASE_CHECK_DEL
Definition: cfg_consistency.h:32
isc::dhcp::CfgConsistency::LEASE_CHECK_FIX_DEL
@ LEASE_CHECK_FIX_DEL
Definition: cfg_consistency.h:30
isc::dhcp::CfgConsistency::LEASE_CHECK_WARN
@ LEASE_CHECK_WARN
Definition: cfg_consistency.h:26
isc::dhcp::CfgConsistency::LEASE_CHECK_NONE
@ LEASE_CHECK_NONE
Definition: cfg_consistency.h:25
isc::dhcp::CfgConsistency::getLeaseSanityCheck
LeaseSanity getLeaseSanityCheck() const
Returns specific sanity checks mode for leases.
Definition: cfg_consistency.h:56
isc::dhcp::CfgConsistency::sanityCheckToText
static std::string sanityCheckToText(LeaseSanity check_type)
Converts sanity check value to printable text.
Definition: cfg_consistency.cc:25
data.h
isc::data
Definition: base_stamped_element.cc:12
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition: data.h:24
isc
Defines the logger used by the top-level component of kea-lfc.
Definition: agent_parser.cc:143