blob: 3756d1e5f2eb349413764ccf2e008f6f2f4599d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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 <config.h>
#include <dhcpsrv/cfg_consistency.h>
#include <cc/data.h>
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");
}
}
}
}
|