Kea  1.9.9-git
isc::dns::MasterLoaderCallbacks Class Reference

Set of issue callbacks for a loader. More...

#include <master_loader_callbacks.h>

Public Types

typedef std::function< void(const std::string &source_name, size_t source_line, const std::string &reason)> IssueCallback
 Type of one callback to report problems. More...
 

Public Member Functions

 MasterLoaderCallbacks (const IssueCallback &error, const IssueCallback &warning)
 Constructor. More...
 
void error (const std::string &source_name, size_t source_line, const std::string &reason) const
 Call callback for serious errors. More...
 
void warning (const std::string &source_name, size_t source_line, const std::string &reason) const
 Call callback for potential problems. More...
 

Static Public Member Functions

static MasterLoaderCallbacks getNullCallbacks ()
 Return a callbacks instance with null callbacks. More...
 

Detailed Description

Set of issue callbacks for a loader.

This holds a set of callbacks by which a loader (such as MasterLoader) can report loaded RRsets, errors and other unusual conditions.

All the callbacks must be set.

Definition at line 49 of file master_loader_callbacks.h.

Member Typedef Documentation

typedef std::function<void(const std::string& source_name, size_t source_line, const std::string& reason)> isc::dns::MasterLoaderCallbacks::IssueCallback

Type of one callback to report problems.

This is the type of one callback used to report an unusual condition or error.

Parameters
source_nameThe name of the source where the problem happened. This is usually a file name.
source_linePosition of the problem, counted in lines from the beginning of the source.
reasonHuman readable description of what happened.

Definition at line 63 of file master_loader_callbacks.h.

Constructor & Destructor Documentation

isc::dns::MasterLoaderCallbacks::MasterLoaderCallbacks ( const IssueCallback error,
const IssueCallback warning 
)
inline

Constructor.

Initializes the callbacks.

Parameters
errorThe error callback to use.
warningThe warning callback to use.
Exceptions
isc::InvalidParameterif any of the callbacks is empty.

Definition at line 72 of file master_loader_callbacks.h.

References isc_throw.

Referenced by getNullCallbacks().

Member Function Documentation

void isc::dns::MasterLoaderCallbacks::error ( const std::string &  source_name,
size_t  source_line,
const std::string &  reason 
) const
inline

Call callback for serious errors.

This is called whenever there's a serious problem which makes the data being loaded unusable. Further processing may or may not happen after this (for example to detect further errors), but the data should not be used.

It calls whatever was passed to the error parameter to the constructor.

If the caller of the loader wants to abort, it is possible to throw from the callback, which aborts the load.

Definition at line 94 of file master_loader_callbacks.h.

MasterLoaderCallbacks isc::dns::MasterLoaderCallbacks::getNullCallbacks ( )
static

Return a callbacks instance with null callbacks.

This is a convenience wrapper to generate a MasterLoaderCallbacks object with both callbacks being nothing. This will be useful for applications that only need to run MasterLoader and get the end result.

Exceptions
None

Definition at line 23 of file master_loader_callbacks.cc.

References MasterLoaderCallbacks().

+ Here is the call graph for this function:

void isc::dns::MasterLoaderCallbacks::warning ( const std::string &  source_name,
size_t  source_line,
const std::string &  reason 
) const
inline

Call callback for potential problems.

This is called whenever a minor problem is discovered. This might mean the data is completely OK, it just looks suspicious.

It calls whatever was passed to the warn parameter to the constructor.

The loading will continue after the callback. If the caller wants to abort (which is probably not a very good idea, since warnings may be false positives), it is possible to throw from inside the callback.

Definition at line 111 of file master_loader_callbacks.h.

Referenced by isc::dns::rdata::createRdata().


The documentation for this class was generated from the following files: