BIND 10 trac2376-callbacks, updated. 94b80d73b69ecbd781d449798a8e993bcd2f098a [2376] Implement the createCallbacks function
BIND 10 source code commits
bind10-changes at lists.isc.org
Sat Nov 17 12:56:27 UTC 2012
The branch, trac2376-callbacks has been updated
via 94b80d73b69ecbd781d449798a8e993bcd2f098a (commit)
from 715fbf7729c4ac3edd50182978e3341e94a585ff (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 94b80d73b69ecbd781d449798a8e993bcd2f098a
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Sat Nov 17 13:56:06 2012 +0100
[2376] Implement the createCallbacks function
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/datasrc_messages.mes | 12 ++++++++
src/lib/datasrc/loader_callbacks.cc | 50 ++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/datasrc_messages.mes b/src/lib/datasrc/datasrc_messages.mes
index 94b4d42..cf086bf 100644
--- a/src/lib/datasrc/datasrc_messages.mes
+++ b/src/lib/datasrc/datasrc_messages.mes
@@ -305,6 +305,18 @@ Therefore, the zone will not be available for this process. If this is
a problem, you should move the zone to some database backend (sqlite3, for
example) and use it from there.
+% DATASRC_LOAD_CONTEXT_ERROR %1:%2: Zone '%3/%4' contains error: %5
+There's an error in the given master file. The zone won't be loaded for
+this reason. Parsing might follow, so you might get further errors and
+warnings to fix everything at once. But in case the error is serious enough,
+the parser might just give up or get confused and generate false errors
+afterwards.
+
+% DATASRC_LOAD_CONTEXT_WARN %1:%2: Zone '%3/%4' has a potential problem: %5
+There's something suspicious in the master file. This is a warning only.
+It may be a problem or it may be harmless, but it should be checked.
+This problem does not stop the zone from being loaded.
+
% DATASRC_MASTERLOAD_ERROR %1
An error was found in the zone data for a MasterFiles zone. The zone
is not loaded. The specific error is shown in the message, and should
diff --git a/src/lib/datasrc/loader_callbacks.cc b/src/lib/datasrc/loader_callbacks.cc
index abf02e8..856efdf 100644
--- a/src/lib/datasrc/loader_callbacks.cc
+++ b/src/lib/datasrc/loader_callbacks.cc
@@ -13,10 +13,60 @@
// PERFORMANCE OF THIS SOFTWARE.
#include <datasrc/loader_callbacks.h>
+#include <datasrc/zone.h>
+#include <datasrc/logger.h>
+
+#include <dns/name.h>
+#include <dns/rrclass.h>
+#include <dns/rrset.h>
+
+#include <string>
+#include <boost/bind.hpp>
namespace isc {
namespace datasrc {
+namespace {
+
+void
+logError(const dns::Name& name, const dns::RRClass& rrclass, bool* ok,
+ const std::string& source, size_t line, const std::string& reason)
+{
+ LOG_ERROR(logger, DATASRC_LOAD_CONTEXT_ERROR).arg(source).arg(line).
+ arg(name).arg(rrclass).arg(reason);
+ if (ok != NULL) {
+ *ok = false;
+ }
+}
+
+void
+logWarning(const dns::Name& name, const dns::RRClass& rrclass,
+ const std::string& source, size_t line, const std::string& reason)
+{
+ LOG_WARN(logger, DATASRC_LOAD_CONTEXT_WARN).arg(source).arg(line).
+ arg(name).arg(rrclass).arg(reason);
+}
+
+}
+
+isc::dns::LoaderCallbacks
+createCallbacks(ZoneUpdater& updater, const dns::Name& name,
+ const dns::RRClass& rrclass, bool* ok)
+{
+ return (isc::dns::LoaderCallbacks(boost::bind(&logError, name, rrclass, ok,
+ _1, _2, _3),
+ boost::bind(&logWarning, name, rrclass,
+ _1, _2, _3),
+ boost::bind(&ZoneUpdater::addRRset,
+ &updater,
+ // The callback provides a
+ // shared pointer, we need
+ // the object. This bind
+ // unpacks the object.
+ boost::bind(&dns::RRsetPtr::
+ operator*,
+ _1))));
+}
}
}
More information about the bind10-changes
mailing list