| 1 | package Net::DNS::RR::DELEG; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 1 | our $VERSION = (qw$Id: DELEG.pm 2053 2026-07-07 10:18:23Z willem $)[2]; | |||||||||||||
| 6 | |||||||||||||||
| 7 | 1 | ▶ | use base qw(Net::DNS::RR); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | |||||||||||||||
| 9 | |||||||||||||||
| 10 | =head1 NAME | ||||||||||||||
| 11 | |||||||||||||||
| 12 | Net::DNS::RR::DELEG - DNS DELEG resource record | ||||||||||||||
| 13 | |||||||||||||||
| 14 | =cut | ||||||||||||||
| 15 | |||||||||||||||
| 16 | 1 | ▶ | use integer; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 17 | |||||||||||||||
| 18 | 1 | ▶ | use Net::DNS::RR::A; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 19 | 1 | ▶ | use Net::DNS::RR::AAAA; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 20 | 1 | ▶ | use Net::DNS::DomainName; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 21 | 1 | ▶ | use Net::DNS::Text; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 22 | |||||||||||||||
| 23 | 1 | my %keybycode = ( | |||||||||||||
| 24 | 0 => 'mandatory', | ||||||||||||||
| 25 | 1 => 'server-ipv4', | ||||||||||||||
| 26 | 2 => 'server-ipv6', | ||||||||||||||
| 27 | 3 => 'server-name', | ||||||||||||||
| 28 | 4 => 'include-delegparam', | ||||||||||||||
| 29 | ); | ||||||||||||||
| 30 | 1 | my %keybyname = reverse %keybycode; | |||||||||||||
| 31 | |||||||||||||||
| 32 | |||||||||||||||
| 33 | sub _decode_rdata { ## decode rdata from wire-format octet string | ||||||||||||||
| 34 | 2 | ▶ | my ( $self, $data, $offset ) = @_; | ||||||||||||
|
Subroutine
_decode_rdata: called CC=4 SCAR=13.9
| |||||||||||||||
| 35 | |||||||||||||||
| 36 | 2 | my $limit = $self->{rdlength}; | |||||||||||||
| 37 | 2 | my $rdata = $self->{rdata} = substr $$data, $offset, $limit; | |||||||||||||
| 38 | 2 | my $index = 0; | |||||||||||||
| 39 | |||||||||||||||
| 40 | 2 | my $params = $self->{parameters} = []; | |||||||||||||
| 41 | 2 | ▶ | while ( ( my $start = $index + 4 ) <= $limit ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 42 | 7 | my ( $key, $size ) = unpack( "\@$index n2", $rdata ); | |||||||||||||
| 43 | 7 | ▶ | last if ( $index = $start + $size ) > $limit; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 44 | 6 | push @$params, ( $key, substr $rdata, $start, $size ); | |||||||||||||
| 45 | } | ||||||||||||||
| 46 | 2 | ▶ | die $self->type . ': corrupt RDATA' unless $index == $limit; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 47 | 1 | return; | |||||||||||||
| 48 | } | ||||||||||||||
| 49 | |||||||||||||||
| 50 | |||||||||||||||
| 51 | sub _encode_rdata { ## encode rdata as wire-format octet string | ||||||||||||||
| 52 | 4 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
_encode_rdata: called CC=2 SCAR=6.9
| |||||||||||||||
| 53 | |||||||||||||||
| 54 | 4 | my @packed; | |||||||||||||
| 55 | 4 | my ($paramref) = grep {defined} $self->{parameters}, []; | |||||||||||||
| 56 | 4 | my @parameters = @$paramref; | |||||||||||||
| 57 | 4 | ▶ | while (@parameters) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 58 | 16 | my $key = shift @parameters; | |||||||||||||
| 59 | 16 | my $val = shift @parameters; | |||||||||||||
| 60 | 16 | push @packed, pack( 'n2a*', $key, length($val), $val ); | |||||||||||||
| 61 | } | ||||||||||||||
| 62 | 4 | return join '', @packed; | |||||||||||||
| 63 | } | ||||||||||||||
| 64 | |||||||||||||||
| 65 | |||||||||||||||
| 66 | sub _format_rdata { ## format rdata portion of RR string. | ||||||||||||||
| 67 | 2 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
_format_rdata: called CC=4 SCAR=13.9
| |||||||||||||||
| 68 | |||||||||||||||
| 69 | 2 | my @rdata; | |||||||||||||
| 70 | 2 | my ($paramref) = grep {defined} $self->{parameters}, []; | |||||||||||||
| 71 | 2 | my @parameters = @$paramref; | |||||||||||||
| 72 | 2 | ▶ | while (@parameters) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 73 | 6 | my $key = shift @parameters; | |||||||||||||
| 74 | 6 | my $val = shift @parameters; | |||||||||||||
| 75 | 6 | ▶ | if ( my $name = $keybycode{$key} ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 76 | 5 | my @val = grep {length} $self->$name; | |||||||||||||
| 77 | 5 | s/,/\\044/g foreach @val; # escape embedded commas | |||||||||||||
| 78 | 5 | my @rhs = grep {length} join ',', @val; | |||||||||||||
| 79 | 5 | push @rdata, join '=', $name, @rhs; | |||||||||||||
| 80 | } else { | ||||||||||||||
| 81 | 1 | my $txt = Net::DNS::Text->decode( \$val, 0, length $val ); | |||||||||||||
| 82 | 1 | push @rdata, join '=', "key$key", $txt->string; | |||||||||||||
| 83 | } | ||||||||||||||
| 84 | } | ||||||||||||||
| 85 | |||||||||||||||
| 86 | 2 | return @rdata; | |||||||||||||
| 87 | } | ||||||||||||||
| 88 | |||||||||||||||
| 89 | |||||||||||||||
| 90 | sub _parse_rdata { ## populate RR from rdata in argument list | ||||||||||||||
| 91 | 13 | ▶ | my ( $self, @argument ) = @_; | ||||||||||||
|
Subroutine
_parse_rdata: called CC=5 SCAR=16.1
| |||||||||||||||
| 92 | |||||||||||||||
| 93 | 13 | ▶ | while ( local $_ = shift @argument ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 94 | 16 | m/^([^=]+)(=?)(.*)$/; | |||||||||||||
| 95 | 16 | my $key = $1; | |||||||||||||
| 96 | 16 | ▶ | my $val = length($3) ? $3 : $2 ? shift @argument : ''; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 97 | 16 | ▶ | if (/^key\d+/) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 98 | 1 | $self->$key($val); | |||||||||||||
| 99 | } else { | ||||||||||||||
| 100 | 15 | local $_ = $val; | |||||||||||||
| 101 | 15 | s/^"([^"]*)"$/$1/s; # strip enclosing quotes | |||||||||||||
| 102 | 15 | s/\\,/\\044/g; # disguise escaped comma | |||||||||||||
| 103 | 15 | $self->$key( split /,/ ); | |||||||||||||
| 104 | } | ||||||||||||||
| 105 | } | ||||||||||||||
| 106 | 10 | return; | |||||||||||||
| 107 | } | ||||||||||||||
| 108 | |||||||||||||||
| 109 | |||||||||||||||
| 110 | sub _post_parse { ## parser post processing | ||||||||||||||
| 111 | 11 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
_post_parse: called CC=11 SCAR=24.0
| |||||||||||||||
| 112 | |||||||||||||||
| 113 | 11 | my ($paramref) = grep {defined} $self->{parameters}, []; | |||||||||||||
| 114 | 11 | my %parameter = @$paramref; | |||||||||||||
| 115 | |||||||||||||||
| 116 | 11 | ▶ | if ( defined $parameter{0} ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 117 | 3 | my %unique; | |||||||||||||
| 118 | 3 | foreach ( grep { !$unique{$_}++ } unpack 'n*', $parameter{0} ) { | |||||||||||||
| 119 | 4 | ▶ | die( $self->type . qq[: unexpected "key0" in mandatory list] ) if $unique{0}; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 120 | 3 | ▶ | die( $self->type . qq[: duplicate "key$_" in mandatory list] ) if --$unique{$_}; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 121 | 2 | ▶ | die( $self->type . qq[: mandatory "key$_" not present] ) unless defined $parameter{$_}; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 122 | } | ||||||||||||||
| 123 | } | ||||||||||||||
| 124 | |||||||||||||||
| 125 | 8 | foreach ( 3, 4 ) { | |||||||||||||
| 126 | 15 | ▶ | next unless defined $parameter{$_}; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 127 | 6 | ▶ | next if length( $parameter{$_} ) > 1; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 128 | 2 | die( $self->type . qq[: invalid $keybycode{$_}] ); | |||||||||||||
| 129 | } | ||||||||||||||
| 130 | |||||||||||||||
| 131 | 6 | ▶ | if ( defined $parameter{4} ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 132 | 2 | ▶ | die( $self->type . qq[: parameter conflicts with $keybycode{4}] ) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 133 | if scalar( keys %parameter ) > 1; | ||||||||||||||
| 134 | } | ||||||||||||||
| 135 | 5 | return; | |||||||||||||
| 136 | } | ||||||||||||||
| 137 | |||||||||||||||
| 138 | |||||||||||||||
| 139 | sub mandatory { ## mandatory=key1,server-name,... | ||||||||||||||
| 140 | 7 | ▶ | my ( $self, @value ) = @_; # uncoverable pod | ||||||||||||
|
Subroutine
mandatory: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||
| 141 | 7 | ▶ | my @list = map { $keybyname{lc $_} || $_ } @value; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 142 | 7 | ▶ | my @keys = map { /(\d+)$/ ? $1 : die( $self->type . qq[: unexpected "$_"] ) } @list; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 143 | 6 | ▶ | return $self->_parameter( 0, _integer16( sort { $a <=> $b } @keys ) ) if @keys; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 144 | 2 | my $packed = $self->_parameter(0); | |||||||||||||
| 145 | 2 | ▶ | return _list( defined($packed) ? map {"key$_"} unpack 'n*', $packed : return ); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 146 | } | ||||||||||||||
| 147 | |||||||||||||||
| 148 | sub server_ipv4 { ## server-ipv4=192.0.2.53 | ||||||||||||||
| 149 | 5 | ▶ | my ( $self, @value ) = @_; | ||||||||||||
|
Subroutine
server_ipv4: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||
| 150 | 5 | ▶ | return $self->_parameter( 1, _address4(@value) ) if @value; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 151 | 3 | ▶ | my $packed = $self->_parameter(1) || return; | ||||||||||||
|
Condition100%2/2
$self->_parameter(1) || (return)
MC/DC100%1/1
$self->_parameter(1) || (return)
$self->_parameter(1)
Truth table100%2/2
A
A= $self->_parameter(1)
| |||||||||||||||
| 152 | 2 | my @iplist = unpack 'a4' x ( length($packed) / 4 ), $packed; | |||||||||||||
| 153 | 2 | return _list( map { Net::DNS::RR::A::address( {address => $_} ) } @iplist ); | |||||||||||||
| 154 | } | ||||||||||||||
| 155 | |||||||||||||||
| 156 | sub server_ipv6 { ## server-ipv6=2001:DB8::53 | ||||||||||||||
| 157 | 5 | ▶ | my ( $self, @value ) = @_; | ||||||||||||
|
Subroutine
server_ipv6: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||
| 158 | 5 | ▶ | return $self->_parameter( 2, _address6(@value) ) if @value; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 159 | 3 | ▶ | my $packed = $self->_parameter(2) || return; | ||||||||||||
|
Condition100%2/2
$self->_parameter(2) || (return)
MC/DC100%1/1
$self->_parameter(2) || (return)
$self->_parameter(2)
Truth table100%2/2
A
A= $self->_parameter(2)
| |||||||||||||||
| 160 | 2 | my @iplist = unpack 'a16' x ( length($packed) / 16 ), $packed; | |||||||||||||
| 161 | 2 | return _list( map { Net::DNS::RR::AAAA::address_short( {address => $_} ) } @iplist ); | |||||||||||||
| 162 | } | ||||||||||||||
| 163 | |||||||||||||||
| 164 | sub server_name { ## server-name=nameserver.example | ||||||||||||||
| 165 | 9 | ▶ | my ( $self, @value ) = @_; | ||||||||||||
|
Subroutine
server_name: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||
| 166 | 9 | ▶ | return $self->_parameter( 3, _domain(@value) ) if @value; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 167 | 3 | ▶ | my $packed = $self->_parameter(3) || return; | ||||||||||||
|
Condition100%2/2
$self->_parameter(3) || (return)
MC/DC100%1/1
$self->_parameter(3) || (return)
$self->_parameter(3)
Truth table100%2/2
A
A= $self->_parameter(3)
| |||||||||||||||
| 168 | 2 | my $index = 0; | |||||||||||||
| 169 | 2 | ▶ | ( $value[++$#value], $index ) = Net::DNS::DomainName->decode( \$packed, $index ) while $index < length $packed; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 170 | 2 | return _list( map { $_->fqdn } @value ); | |||||||||||||
| 171 | } | ||||||||||||||
| 172 | |||||||||||||||
| 173 | sub include_delegparam { ## include-delegparam=provider.example | ||||||||||||||
| 174 | 7 | ▶ | my ( $self, @value ) = @_; | ||||||||||||
|
Subroutine
include_delegparam: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||
| 175 | 7 | ▶ | return $self->_parameter( 4, _domain(@value) ) if @value; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 176 | 3 | ▶ | my $packed = $self->_parameter(4) || return; | ||||||||||||
|
Condition100%2/2
$self->_parameter(4) || (return)
MC/DC100%1/1
$self->_parameter(4) || (return)
$self->_parameter(4)
Truth table100%2/2
A
A= $self->_parameter(4)
| |||||||||||||||
| 177 | 2 | my $index = 0; | |||||||||||||
| 178 | 2 | ▶ | ( $value[++$#value], $index ) = Net::DNS::DomainName->decode( \$packed, $index ) while $index < length $packed; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 179 | 2 | return _list( map { $_->fqdn } @value ); | |||||||||||||
| 180 | } | ||||||||||||||
| 181 | |||||||||||||||
| 182 | |||||||||||||||
| 183 | ######################################## | ||||||||||||||
| 184 | |||||||||||||||
| 185 | sub AUTOLOAD { ## Dynamic constructor/accessor methods | ||||||||||||||
| 186 | 12 | ▶ | my ( $self, @argument ) = @_; | ||||||||||||
|
Subroutine
AUTOLOAD: called CC=5 SCAR=16.1
| |||||||||||||||
| 187 | |||||||||||||||
| 188 | 12 | our $AUTOLOAD; | |||||||||||||
| 189 | 12 | my ($method) = reverse split /::/, $AUTOLOAD; | |||||||||||||
| 190 | 12 | my $canonical = lc($method); | |||||||||||||
| 191 | 12 | $canonical =~ s/-/_/g; | |||||||||||||
| 192 | 12 | ▶ | if ( $self->can($canonical) ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 193 | 1 | ▶ | no strict 'refs'; ## no critic ProhibitNoStrict | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 194 | 4 | ▶ | *{$AUTOLOAD} = sub { shift->$canonical(@_) }; | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 195 | 4 | return $self->$canonical(@argument); | |||||||||||||
| 196 | } | ||||||||||||||
| 197 | |||||||||||||||
| 198 | 8 | my $super = "SUPER::$method"; | |||||||||||||
| 199 | 8 | ▶ | return $self->$super(@argument) unless $method =~ /^key[0]*(\d+)$/i; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 200 | 7 | my $key = $1; | |||||||||||||
| 201 | 7 | ▶ | return $self->_parameter($key) unless @argument; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 202 | 3 | my $first = shift @argument; | |||||||||||||
| 203 | 3 | ▶ | my $value = defined $first ? Net::DNS::Text->new($first)->raw : $first; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 204 | 3 | return $self->_parameter( $key, $value, @argument ); | |||||||||||||
| 205 | } | ||||||||||||||
| 206 | |||||||||||||||
| 207 | |||||||||||||||
| 208 | sub _parameter { | ||||||||||||||
| 209 | 40 | ▶ | my ( $self, $key, @argument ) = @_; | ||||||||||||
|
Subroutine
_parameter: called CC=6 SCAR=17.9
| |||||||||||||||
| 210 | |||||||||||||||
| 211 | 40 | my ($paramref) = grep {defined} $self->{parameters}, []; | |||||||||||||
| 212 | 40 | my %parameter = @$paramref; | |||||||||||||
| 213 | |||||||||||||||
| 214 | 40 | ▶ | if ( scalar @argument ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 215 | 22 | my $arg = shift @argument; # key($value); | |||||||||||||
| 216 | 22 | ▶ | delete $parameter{$key} unless defined $arg; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 217 | 22 | ▶ | die( $self->type . qq[: duplicate parameter key$key] ) if defined $parameter{$key}; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 218 | 21 | ▶ | die( $self->type . qq[: unexpected key$key value] ) if scalar @argument; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 219 | 20 | delete $self->{rdata}; | |||||||||||||
| 220 | 20 | ▶ | $parameter{$key} = $arg if defined $arg; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 221 | 20 | $self->{parameters} = [map { ( $_, $parameter{$_} ) } sort { $a <=> $b } keys %parameter]; | |||||||||||||
| 222 | } | ||||||||||||||
| 223 | |||||||||||||||
| 224 | 38 | return $parameter{$key}; | |||||||||||||
| 225 | } | ||||||||||||||
| 226 | |||||||||||||||
| 227 | |||||||||||||||
| 228 | sub _concatenate { ## concatenate octet string(s) | ||||||||||||||
| 229 | 18 | ▶ | my @arg = @_; | ||||||||||||
|
Subroutine
_concatenate: called CC=2 SCAR=6.9
| |||||||||||||||
| 230 | 18 | ▶ | return scalar(@arg) > 1 ? join( '', @arg ) : @arg; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 231 | } | ||||||||||||||
| 232 | |||||||||||||||
| 233 | sub _list { ## context-dependent list or single value | ||||||||||||||
| 234 | 9 | ▶ | my @arg = @_; | ||||||||||||
|
Subroutine
_list: called CC=2 SCAR=6.9
| |||||||||||||||
| 235 | 9 | ▶ | return wantarray ? @arg : shift @arg; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 236 | } | ||||||||||||||
| 237 | |||||||||||||||
| 238 | sub _address4 { | ||||||||||||||
| 239 | 2 | ▶ | my @arg = @_; | ||||||||||||
|
Subroutine
_address4: called CC=1 SCAR=0.0
| |||||||||||||||
| 240 | 2 | return _concatenate( map { Net::DNS::RR::A::address( {}, $_ ) } @arg ); | |||||||||||||
| 241 | } | ||||||||||||||
| 242 | |||||||||||||||
| 243 | sub _address6 { | ||||||||||||||
| 244 | 2 | ▶ | my @arg = @_; | ||||||||||||
|
Subroutine
_address6: called CC=1 SCAR=0.0
| |||||||||||||||
| 245 | 2 | return _concatenate( map { Net::DNS::RR::AAAA::address( {}, $_ ) } @arg ); | |||||||||||||
| 246 | } | ||||||||||||||
| 247 | |||||||||||||||
| 248 | sub _domain { | ||||||||||||||
| 249 | 10 | ▶ | my @arg = @_; | ||||||||||||
|
Subroutine
_domain: called CC=1 SCAR=0.0
| |||||||||||||||
| 250 | 10 | return _concatenate( map { Net::DNS::DomainName->new($_)->encode() } @arg ); | |||||||||||||
| 251 | } | ||||||||||||||
| 252 | |||||||||||||||
| 253 | sub _integer16 { | ||||||||||||||
| 254 | 4 | ▶ | my @arg = @_; | ||||||||||||
|
Subroutine
_integer16: called CC=1 SCAR=0.0
| |||||||||||||||
| 255 | 4 | return _concatenate( map { pack( 'n', $_ ) } @arg ); | |||||||||||||
| 256 | } | ||||||||||||||
| 257 | |||||||||||||||
| 258 | |||||||||||||||
| 259 | sub generic { | ||||||||||||||
| 260 | 4 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
generic: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||
| 261 | 4 | my $size = 0; | |||||||||||||
| 262 | 4 | my @rdata; | |||||||||||||
| 263 | 4 | my ($paramref) = grep {defined} $self->{parameters}, []; | |||||||||||||
| 264 | 4 | my @parameters = @$paramref; | |||||||||||||
| 265 | 4 | ▶ | while (@parameters) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 266 | 18 | my $key = shift @parameters; | |||||||||||||
| 267 | 18 | my $val = shift @parameters; | |||||||||||||
| 268 | 18 | push @rdata, "\n", unpack 'H4H4', pack( 'n2', $key, length $val ); | |||||||||||||
| 269 | 18 | $size += 4 + length $val; | |||||||||||||
| 270 | 18 | push @rdata, split /(\S{32})/, unpack 'H*', $val; | |||||||||||||
| 271 | } | ||||||||||||||
| 272 | |||||||||||||||
| 273 | 4 | my @ttl = grep {defined} $self->{ttl}; | |||||||||||||
| 274 | 4 | ▶ | my @class = map { $_ ? "CLASS$_" : () } $self->{class}; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 275 | 4 | my @core = ( $self->{owner}->string, @ttl, @class, "TYPE$self->{type}" ); | |||||||||||||
| 276 | 4 | return join "\n\t", Net::DNS::RR::_wrap( "@core ( \\# $size", @rdata, ')' ); | |||||||||||||
| 277 | } | ||||||||||||||
| 278 | |||||||||||||||
| 279 | ######################################## | ||||||||||||||
| 280 | |||||||||||||||
| 281 | |||||||||||||||
| 282 | 1 | 1; | |||||||||||||
| 283 | __END__ | ||||||||||||||