line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::RR::AAAA; |
2
|
|
|
|
|
|
|
|
3
|
21
|
|
|
21
|
|
159
|
use strict; |
|
21
|
|
|
|
|
51
|
|
|
21
|
|
|
|
|
635
|
|
4
|
21
|
|
|
21
|
|
107
|
use warnings; |
|
21
|
|
|
|
|
59
|
|
|
21
|
|
|
|
|
1060
|
|
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
|
|
|
|
|
40
|
|
|
21
|
|
|
|
|
1609
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Net::DNS::RR::AAAA - DNS AAAA resource record |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
21
|
|
|
21
|
|
134
|
use integer; |
|
21
|
|
|
|
|
46
|
|
|
21
|
|
|
|
|
116
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _decode_rdata { ## decode rdata from wire-format octet string |
20
|
396
|
|
|
396
|
|
810
|
my ( $self, $data, $offset ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
396
|
|
|
|
|
1381
|
$self->{address} = unpack "\@$offset a16", $$data; |
23
|
396
|
|
|
|
|
874
|
return; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _encode_rdata { ## encode rdata as wire-format octet string |
28
|
238
|
|
|
238
|
|
335
|
my $self = shift; |
29
|
|
|
|
|
|
|
|
30
|
238
|
|
|
|
|
583
|
return pack 'a16', $self->{address}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _format_rdata { ## format rdata portion of RR string. |
35
|
2
|
|
|
2
|
|
2
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
5
|
return $self->address_short; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _parse_rdata { ## populate RR from rdata in argument list |
42
|
67
|
|
|
67
|
|
177
|
my ( $self, @argument ) = @_; |
43
|
|
|
|
|
|
|
|
44
|
67
|
|
|
|
|
228
|
$self->address(@argument); |
45
|
67
|
|
|
|
|
133
|
return; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub address_long { |
50
|
282
|
|
|
282
|
1
|
647
|
my $addr = pack 'a*@16', grep {defined} shift->{address}; |
|
282
|
|
|
|
|
1061
|
|
51
|
282
|
|
|
|
|
2067
|
return sprintf '%x:%x:%x:%x:%x:%x:%x:%x', unpack 'n8', $addr; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub address_short { |
56
|
57
|
|
|
57
|
1
|
198
|
my $addr = pack 'a*@16', grep {defined} shift->{address}; |
|
57
|
|
|
|
|
207
|
|
57
|
57
|
|
|
|
|
337
|
local $_ = sprintf ':%x:%x:%x:%x:%x:%x:%x:%x:', unpack 'n8', $addr; |
58
|
57
|
|
|
|
|
385
|
s/(:0[:0]+:)(?!.+:0\1)/::/; # squash longest zero sequence |
59
|
57
|
100
|
|
|
|
229
|
s/^:// unless /^::/; # prune LH : |
60
|
57
|
100
|
|
|
|
208
|
s/:$// unless /::$/; # prune RH : |
61
|
57
|
|
|
|
|
235
|
return $_; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub address { |
66
|
452
|
|
|
452
|
1
|
965
|
my ( $self, $addr ) = @_; |
67
|
|
|
|
|
|
|
|
68
|
452
|
100
|
|
|
|
1041
|
return address_long($self) unless defined $addr; |
69
|
|
|
|
|
|
|
|
70
|
225
|
|
|
|
|
852
|
my @parse = split /:/, "0$addr"; |
71
|
|
|
|
|
|
|
|
72
|
225
|
100
|
|
|
|
701
|
if ( (@parse)[$#parse] =~ /\./ ) { # embedded IPv4 |
73
|
4
|
|
|
|
|
12
|
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
|
|
|
|
|
51
|
|
76
|
4
|
|
|
|
|
42
|
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
|
|
|
|
415
|
my @expand = map { /./ ? hex($_) : (0) x ( 9 - @parse ) } @parse; |
|
1339
|
|
|
|
|
3468
|
|
81
|
221
|
|
|
|
|
1377
|
return $self->{address} = pack 'n8', @expand; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
__END__ |