21 #include <boost/scoped_ptr.hpp>
34 namespace ph = std::placeholders;
46 const NameComparisonResult cmp_result =
47 rrset->getName().compare(*origin);
50 isc_throw(MasterLoadError,
"Out-of-zone data for " << *origin
51 <<
"/" << rrset->getClass() <<
": " << rrset->getName());
55 isc_throw(MasterLoadError,
"SOA not at top of zone: "
62 template <
typename InputType>
64 loadHelper(InputType input,
const Name& origin,
67 RRCollator rr_collator(std::bind(callbackWrapper, ph::_1, callback,
69 MasterLoader loader(input, origin, zone_class,
71 rr_collator.getCallback());
74 }
catch (
const MasterLoaderError& ex) {
85 if ((filename == NULL) || (*filename ==
'\0')) {
89 loadHelper<const char*>(filename, origin, zone_class, callback);
96 loadHelper<istream&>(input, origin, zone_class, callback);
The Name class encapsulates DNS names.
static const RRType & SOA()
static MasterLoaderCallbacks getNullCallbacks()
Return a callbacks instance with null callbacks.
An exception that is thrown if an error occurs while loading a master zone data.
The RRClass class encapsulates DNS resource record classes.
std::function< void(RRsetPtr)> MasterLoadCallback
The type of the callback parameter of masterLoad().
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Defines the logger used by the top-level component of kea-dhcp-ddns.
boost::shared_ptr< AbstractRRset > RRsetPtr
A pointer-like type pointing to an RRset object.
void masterLoad(const char *const filename, const Name &origin, const RRClass &zone_class, MasterLoadCallback callback)
Master zone file loader from a file.