Kea 1.5.0
zone_checker.h
Go to the documentation of this file.
1// Copyright (C) 2012-2015 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 <boost/function.hpp>
13
14#include <string>
15
16namespace isc {
17namespace dns {
18
23public:
27 typedef boost::function<void(const std::string& reason)> IssueCallback;
28
43 ZoneCheckerCallbacks(const IssueCallback& error_callback,
44 const IssueCallback& warn_callback) :
45 error_callback_(error_callback), warn_callback_(warn_callback)
46 {}
47
54 void error(const std::string& reason) const {
55 if (!error_callback_.empty()) {
56 error_callback_(reason);
57 }
58 }
59
66 void warn(const std::string& reason) const {
67 if (!warn_callback_.empty())
68 warn_callback_(reason);
69 }
70
71private:
72 IssueCallback error_callback_;
73 IssueCallback warn_callback_;
74};
75
143bool
144checkZone(const Name& zone_name, const RRClass& zone_class,
145 const RRsetCollectionBase& zone_rrsets,
146 const ZoneCheckerCallbacks& callbacks);
147
148} // namespace dns
149} // namespace isc
150#endif // ZONE_CHECKER_H
151
152// Local Variables:
153// mode: c++
154// End:
Set of callbacks used in zone checks.
Definition: zone_checker.h:22
boost::function< void(const std::string &reason)> IssueCallback
Functor type of the callback on some issue (error or warning).
Definition: zone_checker.h:27
void error(const std::string &reason) const
Call the callback for a critical error.
Definition: zone_checker.h:54
ZoneCheckerCallbacks(const IssueCallback &error_callback, const IssueCallback &warn_callback)
Constructor.
Definition: zone_checker.h:43
void warn(const std::string &reason) const
Call the callback for a non critical issue.
Definition: zone_checker.h:66
Forward declarations for definitions of libdns++.
bool checkZone(const Name &zone_name, const RRClass &zone_class, const RRsetCollectionBase &zone_rrsets, const ZoneCheckerCallbacks &callbacks)
Perform basic integrity checks on zone RRsets.
Defines the logger used by the top-level component of kea-dhcp-ddns.