line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::RR::AAAA; |
2
|
|
|
|
|
|
|
|
3
|
21
|
|
|
21
|
|
155
|
use strict; |
|
21
|
|
|
|
|
67
|
|
|
21
|
|
|
|
|
638
|
|
4
|
21
|
|
|
21
|
|
115
|
use warnings; |
|
21
|
|
|
|
|
59
|
|
|
21
|
|
|
|
|
1048
|
|
5
|
|
|
|
|
|
|
our $VERSION = (qw$Id: AAAA.pm 1896 2023-01-30 12:59:25Z willem $)[2]; |
6
|
|
|
|
|
|
|
|
7
|
21
|
|
|
21
|
|
147
|
use base qw(Net::DNS::RR); |
|
21
|
|
|
|
|
50
|
|
|
21
|
|
|
|
|
1749
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Net::DNS::RR::AAAA - DNS AAAA resource record |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
21
|
|
|
21
|
|
141
|
use integer; |
|
21
|
|
|
|
|
54
|
|
|
21
|
|
|
|
|
130
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _decode_rdata { ## decode rdata from wire-format octet string |
20
|
387
|
|
|
387
|
|
931
|
my ( $self, $data, $offset ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
387
|
|
|
|
|
1487
|
$self->{address} = unpack "\@$offset a16", $$data; |
23
|
387
|
|
|
|
|
947
|
return; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _encode_rdata { ## encode rdata as wire-format octet string |
28
|
238
|
|
|
238
|
|
345
|
my $self = shift; |
29
|
|
|
|
|
|
|
|
30
|
238
|
|
|
|
|
589
|
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
|
|
200
|
my ( $self, @argument ) = @_; |
43
|
|
|
|
|
|
|
|
44
|
67
|
|
|
|
|
246
|
$self->address(@argument); |
45
|
67
|
|
|
|
|
137
|
return; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub address_long { |
50
|
277
|
|
|
277
|
1
|
721
|
my $addr = pack 'a*@16', grep {defined} shift->{address}; |
|
277
|
|
|
|
|
1100
|
|
51
|
277
|
|
|
|
|
2176
|
return sprintf '%x:%x:%x:%x:%x:%x:%x:%x', unpack 'n8', $addr; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub address_short { |
56
|
57
|
|
|
57
|
1
|
224
|
my $addr = pack 'a*@16', grep {defined} shift->{address}; |
|
57
|
|
|
|
|
205
|
|
57
|
57
|
|
|
|
|
339
|
local $_ = sprintf ':%x:%x:%x:%x:%x:%x:%x:%x:', unpack 'n8', $addr; |
58
|
57
|
|
|
|
|
387
|
s/(:0[:0]+:)(?!.+:0\1)/::/; # squash longest zero sequence |
59
|
57
|
100
|
|
|
|
227
|
s/^:// unless /^::/; # prune LH : |
60
|
57
|
100
|
|
|
|
213
|
s/:$// unless /::$/; # prune RH : |
61
|
57
|
|
|
|
|
281
|
return $_; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub address { |
66
|
447
|
|
|
447
|
1
|
895
|
my ( $self, $addr ) = @_; |
67
|
|
|
|
|
|
|
|
68
|
447
|
100
|
|
|
|
1084
|
return address_long($self) unless defined $addr; |
69
|
|
|
|
|
|
|
|
70
|
225
|
|
|
|
|
829
|
my @parse = split /:/, "0$addr"; |
71
|
|
|
|
|
|
|
|
72
|
225
|
100
|
|
|
|
738
|
if ( (@parse)[$#parse] =~ /\./ ) { # embedded IPv4 |
73
|
4
|
|
|
|
|
13
|
my @ip4 = split /\./, pop(@parse); |
74
|
4
|
|
|
|
|
8
|
my $rhs = pop(@ip4); |
75
|
4
|
100
|
|
|
|
9
|
my @ip6 = map { /./ ? hex($_) : (0) x ( 7 - @parse ) } @parse; |
|
12
|
|
|
|
|
45
|
|
76
|
4
|
|
|
|
|
36
|
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
|
|
|
|
450
|
my @expand = map { /./ ? hex($_) : (0) x ( 9 - @parse ) } @parse; |
|
1339
|
|
|
|
|
3597
|
|
81
|
221
|
|
|
|
|
1447
|
return $self->{address} = pack 'n8', @expand; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
__END__ |