Kea 3.3.3
cfg_consistency.h
Go to the documentation of this file.
1// Copyright (C) 2018-2026 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#ifndef CFG_CONSISTENCY_H
8#define CFG_CONSISTENCY_H
9
10#include <cc/cfg_to_element.h>
11#include <cc/user_context.h>
12
13#include <cstdint>
14
15namespace isc {
16namespace dhcp {
17
18
22
23 public:
24
26 enum LeaseSanity : uint16_t {
27 LEASE_CHECK_NONE, // Skip sanity checks
28 LEASE_CHECK_WARN, // Print a warning if subnet-id is incorrect.
29 LEASE_CHECK_FIX, // If subnet-id is incorrect, try to fix it (try to pick
30 // appropriate subnet, but if it fails, keep the lease,
31 // despite its broken subnet-id.
32 LEASE_CHECK_FIX_DEL, // If subnet-id is incorrect, try to fix it (try to pick
33 // appropriate subnet. If it fails, delete broken lease.
34 LEASE_CHECK_DEL // Delete leases with invalid subnet-id.
35 };
36
38 enum ExtendedInfoSanity : uint16_t {
39 EXTENDED_INFO_CHECK_NONE, // Skip sanity checks.
40 EXTENDED_INFO_CHECK_FIX, // Fix extended info common inconsistencies.
41 EXTENDED_INFO_CHECK_STRICT, // Fix extended info inconsistencies which
42 // have an impact for Bulk Lease Query.
43 EXTENDED_INFO_CHECK_PEDANTIC // Fix all extended info inconsistencies.
44 };
45
48 : lease_sanity_check_(LEASE_CHECK_NONE),
49 extended_info_sanity_check_(EXTENDED_INFO_CHECK_FIX) {
50 }
51
55 virtual isc::data::ElementPtr toElement() const;
56
61 lease_sanity_check_ = l;
62 }
63
68 return (lease_sanity_check_);
69 }
70
74 static std::string sanityCheckToText(LeaseSanity check_type);
75
80 extended_info_sanity_check_ = l;
81 }
82
87 return (extended_info_sanity_check_);
88 }
89
93 static std::string sanityCheckToText(ExtendedInfoSanity check_type);
94
95 private:
96
98 LeaseSanity lease_sanity_check_;
99
101 ExtendedInfoSanity extended_info_sanity_check_;
102};
103
105typedef boost::shared_ptr<CfgConsistency> CfgConsistencyPtr;
106
108typedef boost::shared_ptr<const CfgConsistency> ConstCfgConsistencyPtr;
109
110} // namespace isc::dhcp
111} // namespace isc
112
113#endif /* CFG_CONSISTENCY_H */
ExtendedInfoSanity
Values for extended info sanity checks done for leases.
virtual isc::data::ElementPtr toElement() const
Returns JSON representation.
void setLeaseSanityCheck(LeaseSanity l)
Sets specific sanity checks mode for leases.
LeaseSanity
Values for subnet-id sanity checks done for leases.
ExtendedInfoSanity getExtendedInfoSanityCheck() const
Returns specific sanity checks mode for extended info.
LeaseSanity getLeaseSanityCheck() const
Returns specific sanity checks mode for leases.
void setExtendedInfoSanityCheck(ExtendedInfoSanity l)
Sets specific sanity checks mode for extended info.
static std::string sanityCheckToText(LeaseSanity check_type)
Converts lease sanity check value to printable text.
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
boost::shared_ptr< CfgConsistency > CfgConsistencyPtr
Type used to for pointing to CfgConsistency structure.
boost::shared_ptr< const CfgConsistency > ConstCfgConsistencyPtr
Type used to for pointing to const CfgConsistency structure.
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.
Base class for user context.