Kea 2.7.5
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.
 

Public Member Functions

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

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

◆ IssueCallback

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

◆ MasterLoaderCallbacks()

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.

Member Function Documentation

◆ error()

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 93 of file master_loader_callbacks.h.

◆ warning()

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 109 of file master_loader_callbacks.h.


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