NAME

Zonemaster::Zone - Object representing a DNS zone

SYNOPSIS

my $zone = Zonemaster::Zone->new({ name => 'nic.se' });
my $packet = $zone->parent->query_one($zone->name, 'NS');

DESCRIPTION

Objects of this class represent zones in DNS. As far as possible, test implementations should access information about zones via these objects. Doing so will provide lazy-loading of the information, well-defined methods in which the information is fetched, logging and the ability to do things like testing zones that have not yet been delegated.

ATTRIBUTES

name

A Zonemaster::DNSName object representing the name of the zone.

parent

A Zonemaster::Zone object for this domain's parent domain. As a special case, the root zone is considered to be its own parent (so look for that if you recurse up the tree).

ns_names

A reference to an array of Zonemaster::DNSName objects, holding the names of the nameservers for the domain, as returned by the first responding nameserver in the glue list.

ns

A reference to an array of Zonemaster::Nameserver objects for the domain, built by taking the list returned from ns_names() and looking up addresses for the names. One element will be added to this list for each unique name/IP pair. Names for which no addresses could be found will not be in this list. The list is lazy-loading, so take care to only look at as many entries as you really need. There are zones with more than 20 nameserver, and looking up the addresses of them all can take som considerable time.

glue_names

A reference to a an array of Zonemaster::DNSName objects, holding the names of this zones nameservers as listed at the first responding nameserver of the parent zone.

glue

A reference to an array of Zonemaster::Nameserver objects for the domain, built by taking the list returned from glue_names() and looking up addresses for the names. One element will be added to this list for each unique name/IP pair. Names for which no addresses could be found will not be in this list. The list is lazy-loading, so take care to only look at as many entries as you really need.

glue_addresses

A list of Net::LDNS::RR::A and Net::LDNS::RR::AAAA records returned in the Additional section of an NS query to the first listed nameserver for the parent domain.

METHODS

query_one($name[, $type[, $flags]])

Sends (or retrieves from cache) a query for the given name, type and flags sent to the first nameserver in the zone's ns list. If there is a response, it will be returned in a Zonemaster::Packet object. If the type arguments is not given, it defaults to 'A'. If the flags are not given, they default to class IN and dnssec, usevc and recurse according to configuration (which is by default off on all three).

query_persistent($name[, $type[, $flags]])

Identical to query_one, except that instead of returning the packet from the first server that returns one, it returns the first packet that actually contains a resource record matching the requested name and type.

query_auth($name[, $type[, $flags]])

Identical to query_one, except that instead of returning the packet from the first server that returns one, it returns the first packet that has the AA flag set.

query_all($name, $type, $flags)

Sends (or retrieves from cache) queries to all the nameservers listed in the zone's ns list, and returns a reference to an array with the responses. The responses can be either Zonemaster::Packet objects or undef values. The arguments are the same as for query_one.

is_in_zone($name)

Returns true if the given name is in the zone, false if not. If it could not be determined with a sufficient degree of certainty if the name is in the zone or not, undef is returned.