Kea  2.3.5-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 
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 
27 std::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 
44 std::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 }
boost::shared_ptr< Element > ElementPtr
Definition: data.h:24
LeaseSanity
Values for subnet-id sanity checks done for leases.
Defines the logger used by the top-level component of kea-lfc.
ExtendedInfoSanity
Values for extended info sanity checks done for leases.