NAME

Zonemaster::Engine::Util - utility functions for other Zonemaster modules

SYNOPSIS

use Zonemaster::Engine::Util;
info(TAG => { some => 'argument'});
my $ns = ns($name, $address);
my $name = name('whatever.example.org');

EXPORTED FUNCTIONS

info($tag, $href)

Creates and returns a Zonemaster::Engine::Logger::Entry object. The object is also added to the global logger object's list of entries.

ns($name, $address)

Creates and returns a nameserver object with the given name and address.

name($string_name_or_zone)

Creates and returns a Zonemaster::Engine::DNSName object for the given argument.

zone($name)

Returns a Zonemaster::Engine::Zone object for the given name.

parse_hints($string)

Parses a string in the root hints format into the format expected by Zonemaster::Engine::Resolver->add_fake_addresses().

Returns a hashref with domain names as keys and arrayrefs to IP addresses as values.

Throws an exception if the inputs is not valid root hints text.

A root hints file is a valid RFC 1035 zone file of the same type IANA publishes to be used as hint file for name servers https://www.internic.net/domain/named.root.

In addition to being valid zone file the following restrictions are imposed on the root hints format:

  • The file must not contain any $TTL, $ORIGIN, $INCLUDE or $GENERATE directives.

  • The class field of all records must be "IN" or absent. If class is absent, IN is assumed.

  • The TTL field may be absent or present. The TTL value is ignored.

  • The RR type of all DNS records must be NS, A or AAAA.

  • The file must contain at least one NS record.

  • The owner name of all NS records must be ..

  • For every NS record there must be at least one address record (A or AAAA) whose owner name is identical to the domain name in the RDATA of the NS record.

  • All address records (A or AAAA) must have an owner name that is identical to the domain name in the RDATA of some NS record in the zone.

serial_gt($serial_a, $serial_b) Checks if serial_a is greater than serial_b, according to serial number arithmetic as defined in RFC1982, section 3.2.

Return a boolean.

scramble_case

This routine provides a special effect: sCraMBliNg tHe CaSe

should_run_test

Check if a test is blacklisted and should run or not.

ipversion_ok

Check if IP version operations are permitted. Tests are done against Zonemaster::Engine::Profile->effective content.

test_levels

WIP, here to please Pod::Coverage.