erldns_handler behaviour (erldns v8.0.0-rc2)

View Source

The module that handles the resolution of a single DNS question.

The meat of the resolution occurs in erldns_resolver:resolve/3

Configuration

{erldns, [
    {handlers, [
        {my_custom_handler_module, [?DNS_TYPE_A, ?DNS_TYPE_AAAA], 3}
    ]},
]}

The minimum supported version is 2.

Version 2's handler signature is

handle(dns:message(), dns:labels(), dns:type(), [dns:rr()]) -> [dns:rr()]

Version 3's handler signature is

handle(dns:dname(), dns:type(), [dns:rr()], dns:message()) -> [dns:rr()].

Summary

Callbacks

Filter the given record set, returning replacement records.

Filter out records not related to the given handler

Map handler's record types to NSEC bit types.

Functions

Filter records through registered handlers.

Call all registered handlers.

Get all registered handlers along with the DNS types they handle and associated versions

Register a record handler with the default version of 1

Register a record handler with version

Start the handler registry process

Types

handler()

-type handler() :: {module(), [dns:type()]}.

state()

-opaque state()

versioned_handler()

-type versioned_handler() ::
          {fun((dns:message(), dns:labels(), dns:type(), [dns:rr()]) -> [dns:rr()]),
           fun(([dns:rr()]) -> [dns:rr()]),
           fun((dns:type(), dns:type()) -> [dns:type()]),
           module(),
           [dns:type()],
           integer()}.

Callbacks

filter/1

-callback filter([dns:rr()]) -> [dns:rr()].

Filter the given record set, returning replacement records.

handle/4

-callback handle(dns:message(), dns:labels(), dns:type(), [dns:rr()]) -> [dns:rr()].

Filter out records not related to the given handler

nsec_rr_type_mapper/2

-callback nsec_rr_type_mapper(dns:type(), dns:type()) -> [dns:type()].

Map handler's record types to NSEC bit types.

Functions

call_filters(Records)

-spec call_filters([dns:rr()]) -> [dns:rr()].

Filter records through registered handlers.

call_handlers(Message, QLabels, QType, Records)

-spec call_handlers(dns:message(), dns:labels(), dns:type(), [dns:rr()]) -> [dns:rr()].

Call all registered handlers.

call_map_nsec_rr_types(Types)

-spec call_map_nsec_rr_types([dns:type()]) -> [dns:type()].

call_map_nsec_rr_types(QType, Types)

-spec call_map_nsec_rr_types(dns:type(), [dns:type()]) -> [dns:type()].

get_versioned_handlers()

-spec get_versioned_handlers() -> [versioned_handler()].

Get all registered handlers along with the DNS types they handle and associated versions

register_handler(RecordTypes, Module)

-spec register_handler([dns:type()], module()) -> ok.

Register a record handler with the default version of 1

register_handler(RecordTypes, Module, Version)

-spec register_handler([dns:type()], module(), integer()) -> ok.

Register a record handler with version

start_link()

-spec start_link() -> gen_server:start_ret().

Start the handler registry process