line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::RR::AAAA; |
2
|
|
|
|
|
|
|
|
3
|
21
|
|
|
21
|
|
166
|
use strict; |
|
21
|
|
|
|
|
60
|
|
|
21
|
|
|
|
|
681
|
|
4
|
21
|
|
|
21
|
|
110
|
use warnings; |
|
21
|
|
|
|
|
40
|
|
|
21
|
|
|
|
|
1006
|
|
5
|
|
|
|
|
|
|
our $VERSION = (qw$Id: AAAA.pm 1896 2023-01-30 12:59:25Z willem $)[2]; |
6
|
|
|
|
|
|
|
|
7
|
21
|
|
|
21
|
|
140
|
use base qw(Net::DNS::RR); |
|
21
|
|
|
|
|
70
|
|
|
21
|
|
|
|
|
1564
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Net::DNS::RR::AAAA - DNS AAAA resource record |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
21
|
|
|
21
|
|
147
|
use integer; |
|
21
|
|
|
|
|
40
|
|
|
21
|
|
|
|
|
121
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _decode_rdata { ## decode rdata from wire-format octet string |
20
|
386
|
|
|
386
|
|
883
|
my ( $self, $data, $offset ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
386
|
|
|
|
|
1538
|
$self->{address} = unpack "\@$offset a16", $$data; |
23
|
386
|
|
|
|
|
950
|
return; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _encode_rdata { ## encode rdata as wire-format octet string |
28
|
238
|
|
|
238
|
|
346
|
my $self = shift; |
29
|
|
|
|
|
|
|
|
30
|
238
|
|
|
|
|
605
|
return pack 'a16', $self->{address}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _format_rdata { ## format rdata portion of RR string. |
35
|
2
|
|
|
2
|
|
3
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
4
|
return $self->address_short; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _parse_rdata { ## populate RR from rdata in argument list |
42
|
67
|
|
|
67
|
|
191
|
my ( $self, @argument ) = @_; |
43
|
|
|
|
|
|
|
|
44
|
67
|
|
|
|
|
226
|
$self->address(@argument); |
45
|
67
|
|
|
|
|
139
|
return; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub address_long { |
50
|
283
|
|
|
283
|
1
|
661
|
my $addr = pack 'a*@16', grep {defined} shift->{address}; |
|
283
|
|
|
|
|
1135
|
|
51
|
283
|
|
|
|
|
2598
|
return sprintf '%x:%x:%x:%x:%x:%x:%x:%x', unpack 'n8', $addr; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub address_short { |
56
|
57
|
|
|
57
|
1
|
218
|
my $addr = pack 'a*@16', grep {defined} shift->{address}; |
|
57
|
|
|
|
|
219
|
|
57
|
57
|
|
|
|
|
348
|
local $_ = sprintf ':%x:%x:%x:%x:%x:%x:%x:%x:', unpack 'n8', $addr; |
58
|
57
|
|
|
|
|
389
|
s/(:0[:0]+:)(?!.+:0\1)/::/; # squash longest zero sequence |
59
|
57
|
100
|
|
|
|
239
|
s/^:// unless /^::/; # prune LH : |
60
|
57
|
100
|
|
|
|
203
|
s/:$// unless /::$/; # prune RH : |
61
|
57
|
|
|
|
|
257
|
return $_; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub address { |
66
|
453
|
|
|
453
|
1
|
900
|
my ( $self, $addr ) = @_; |
67
|
|
|
|
|
|
|
|
68
|
453
|
100
|
|
|
|
1052
|
return address_long($self) unless defined $addr; |
69
|
|
|
|
|
|
|
|
70
|
225
|
|
|
|
|
854
|
my @parse = split /:/, "0$addr"; |
71
|
|
|
|
|
|
|
|
72
|
225
|
100
|
|
|
|
779
|
if ( (@parse)[$#parse] =~ /\./ ) { # embedded IPv4 |
73
|
4
|
|
|
|
|
17
|
my @ip4 = split /\./, pop(@parse); |
74
|
4
|
|
|
|
|
10
|
my $rhs = pop(@ip4); |
75
|
4
|
100
|
|
|
|
10
|
my @ip6 = map { /./ ? hex($_) : (0) x ( 7 - @parse ) } @parse; |
|
12
|
|
|
|
|
50
|
|
76
|
4
|
|
|
|
|
41
|
return $self->{address} = pack 'n6 C4', @ip6, @ip4, (0) x ( 3 - @ip4 ), $rhs; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# Note: pack() masks overlarge values, mostly without warning. |
80
|
221
|
100
|
|
|
|
445
|
my @expand = map { /./ ? hex($_) : (0) x ( 9 - @parse ) } @parse; |
|
1339
|
|
|
|
|
3727
|
|
81
|
221
|
|
|
|
|
1398
|
return $self->{address} = pack 'n8', @expand; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
__END__ |