Kea  2.3.5-git
zone_checker.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2020 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 ZONE_CHECKER_H
8 #define ZONE_CHECKER_H 1
9 
10 #include <dns/dns_fwd.h>
11 
12 #include <functional>
13 #include <string>
14 
15 namespace isc {
16 namespace dns {
17 
22 public:
26  typedef std::function<void(const std::string& reason)> IssueCallback;
27 
42  ZoneCheckerCallbacks(const IssueCallback& error_callback,
43  const IssueCallback& warn_callback) :
44  error_callback_(error_callback), warn_callback_(warn_callback)
45  {}
46 
53  void error(const std::string& reason) const {
54  if (error_callback_) {
55  error_callback_(reason);
56  }
57  }
58 
65  void warn(const std::string& reason) const {
66  if (warn_callback_)
67  warn_callback_(reason);
68  }
69 
70 private:
71  IssueCallback error_callback_;
72  IssueCallback warn_callback_;
73 };
74 
142 bool
143 checkZone(const Name& zone_name, const RRClass& zone_class,
144  const RRsetCollectionBase& zone_rrsets,
145  const ZoneCheckerCallbacks& callbacks);
146 
147 } // namespace dns
148 } // namespace isc
149 #endif // ZONE_CHECKER_H
150 
151 // Local Variables:
152 // mode: c++
153 // End:
The Name class encapsulates DNS names.
Definition: name.h:223
bool checkZone(const Name &zone_name, const RRClass &zone_class, const RRsetCollectionBase &zone_rrsets, const ZoneCheckerCallbacks &callbacks)
Perform basic integrity checks on zone RRsets.
void error(const std::string &reason) const
Call the callback for a critical error.
Definition: zone_checker.h:53
void warn(const std::string &reason) const
Call the callback for a non critical issue.
Definition: zone_checker.h:65
Set of callbacks used in zone checks.
Definition: zone_checker.h:21
The RRClass class encapsulates DNS resource record classes.
Definition: rrclass.h:98
std::function< void(const std::string &reason)> IssueCallback
Functor type of the callback on some issue (error or warning).
Definition: zone_checker.h:26
Defines the logger used by the top-level component of kea-lfc.
Forward declarations for definitions of libdns++.
ZoneCheckerCallbacks(const IssueCallback &error_callback, const IssueCallback &warn_callback)
Constructor.
Definition: zone_checker.h:42
Generic class to represent a set of RRsets.