| Kea 3.0.2-git

cfg_consistency.cc
Go to the documentation of this file.
1// Copyright (C) 2018-2022 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
12 using namespace isc::data;
13
14 namespace isc {
15 namespace 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 ElementPtr x(new StringElement(sanityCheckToText(getExtendedInfoSanityCheck())));
22 m->set("extended-info-checks", x);
23
24 return (m);
25}
26
27std::string CfgConsistency::sanityCheckToText(LeaseSanity check_type) {
28 switch (check_type) {
29 case LEASE_CHECK_NONE:
30 return ("none");
31 case LEASE_CHECK_WARN:
32 return ("warn");
33 case LEASE_CHECK_FIX:
34 return ("fix");
35 case LEASE_CHECK_FIX_DEL:
36 return ("fix-del");
37 case LEASE_CHECK_DEL:
38 return ("del");
39 default:
40 return ("unknown");
41 }
42}
43
44std::string CfgConsistency::sanityCheckToText(ExtendedInfoSanity check_type) {
45 switch (check_type) {
46 case EXTENDED_INFO_CHECK_NONE:
47 return ("none");
48 case EXTENDED_INFO_CHECK_FIX:
49 return ("fix");
50 case EXTENDED_INFO_CHECK_STRICT:
51 return ("strict");
52 case EXTENDED_INFO_CHECK_PEDANTIC:
53 return ("pedantic");
54 default:
55 return ("unknown");
56 }
57}
58
59}
60}
cfg_consistency.h
isc::data::MapElement
Definition data.h:768
isc::data::StringElement
Definition data.h:709
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::getExtendedInfoSanityCheck
ExtendedInfoSanity getExtendedInfoSanityCheck() const
Returns specific sanity checks mode for extended info.
Definition cfg_consistency.h:84
isc::dhcp::CfgConsistency::ExtendedInfoSanity
ExtendedInfoSanity
Values for extended info sanity checks done for leases.
Definition cfg_consistency.h:36
isc::dhcp::CfgConsistency::EXTENDED_INFO_CHECK_STRICT
@ EXTENDED_INFO_CHECK_STRICT
Definition cfg_consistency.h:39
isc::dhcp::CfgConsistency::EXTENDED_INFO_CHECK_PEDANTIC
@ EXTENDED_INFO_CHECK_PEDANTIC
Definition cfg_consistency.h:41
isc::dhcp::CfgConsistency::EXTENDED_INFO_CHECK_FIX
@ EXTENDED_INFO_CHECK_FIX
Definition cfg_consistency.h:38
isc::dhcp::CfgConsistency::EXTENDED_INFO_CHECK_NONE
@ EXTENDED_INFO_CHECK_NONE
Definition cfg_consistency.h:37
isc::dhcp::CfgConsistency::getLeaseSanityCheck
LeaseSanity getLeaseSanityCheck() const
Returns specific sanity checks mode for leases.
Definition cfg_consistency.h:65
isc::dhcp::CfgConsistency::sanityCheckToText
static std::string sanityCheckToText(LeaseSanity check_type)
Converts lease sanity check value to printable text.
Definition cfg_consistency.cc:27
data.h
isc::data
Definition base_stamped_element.cc:12
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
isc::dhcp
Definition dhcp4/client_handler.cc:20
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148