From f5f56e1a1c4d9e9496fcb9d81131066a964ccd23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 14:15:43 +0200 Subject: Adding upstream version 2.4.1. Signed-off-by: Daniel Baumann --- src/lib/dhcpsrv/cfg_consistency.cc | 60 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/lib/dhcpsrv/cfg_consistency.cc (limited to 'src/lib/dhcpsrv/cfg_consistency.cc') diff --git a/src/lib/dhcpsrv/cfg_consistency.cc b/src/lib/dhcpsrv/cfg_consistency.cc new file mode 100644 index 0000000..3756d1e --- /dev/null +++ b/src/lib/dhcpsrv/cfg_consistency.cc @@ -0,0 +1,60 @@ +// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include + +#include +#include + +using namespace isc::data; + +namespace isc { +namespace dhcp { + +isc::data::ElementPtr CfgConsistency::toElement() const { + ElementPtr m(new MapElement()); + ElementPtr l(new StringElement(sanityCheckToText(getLeaseSanityCheck()))); + m->set("lease-checks", l); + ElementPtr x(new StringElement(sanityCheckToText(getExtendedInfoSanityCheck()))); + m->set("extended-info-checks", x); + + return (m); +} + +std::string CfgConsistency::sanityCheckToText(LeaseSanity check_type) { + switch (check_type) { + case LEASE_CHECK_NONE: + return ("none"); + case LEASE_CHECK_WARN: + return ("warn"); + case LEASE_CHECK_FIX: + return ("fix"); + case LEASE_CHECK_FIX_DEL: + return ("fix-del"); + case LEASE_CHECK_DEL: + return ("del"); + default: + return ("unknown"); + } +} + +std::string CfgConsistency::sanityCheckToText(ExtendedInfoSanity check_type) { + switch (check_type) { + case EXTENDED_INFO_CHECK_NONE: + return ("none"); + case EXTENDED_INFO_CHECK_FIX: + return ("fix"); + case EXTENDED_INFO_CHECK_STRICT: + return ("strict"); + case EXTENDED_INFO_CHECK_PEDANTIC: + return ("pedantic"); + default: + return ("unknown"); + } +} + +} +} -- cgit v1.2.3