line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::RR::RT; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
16
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
58
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
90
|
|
5
|
|
|
|
|
|
|
our $VERSION = (qw$Id: RT.pm 1898 2023-02-15 14:27:22Z willem $)[2]; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
20
|
use base qw(Net::DNS::RR); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
171
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Net::DNS::RR::RT - DNS RT resource record |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
13
|
use integer; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
9
|
|
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
|
82
|
use Net::DNS::DomainName; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
891
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _decode_rdata { ## decode rdata from wire-format octet string |
22
|
1
|
|
|
1
|
|
2
|
my ( $self, $data, $offset ) = @_; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
3
|
$self->{preference} = unpack( "\@$offset n", $$data ); |
25
|
1
|
|
|
|
|
7
|
$self->{intermediate} = Net::DNS::DomainName2535->decode( $data, $offset + 2 ); |
26
|
1
|
|
|
|
|
3
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _encode_rdata { ## encode rdata as wire-format octet string |
31
|
5
|
|
|
5
|
|
10
|
my ( $self, $offset, @opaque ) = @_; |
32
|
|
|
|
|
|
|
|
33
|
5
|
|
|
|
|
11
|
return pack 'n a*', $self->preference, $self->{intermediate}->encode( $offset + 2, @opaque ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _format_rdata { ## format rdata portion of RR string. |
38
|
2
|
|
|
2
|
|
15
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
6
|
return join ' ', $self->preference, $self->{intermediate}->string; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _parse_rdata { ## populate RR from rdata in argument list |
45
|
3
|
|
|
3
|
|
9
|
my ( $self, @argument ) = @_; |
46
|
|
|
|
|
|
|
|
47
|
3
|
|
|
|
|
8
|
for (qw(preference intermediate)) { $self->$_( shift @argument ) } |
|
6
|
|
|
|
|
16
|
|
48
|
3
|
|
|
|
|
7
|
return; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub preference { |
53
|
13
|
|
|
13
|
1
|
32
|
my ( $self, @value ) = @_; |
54
|
13
|
|
|
|
|
24
|
for (@value) { $self->{preference} = 0 + $_ } |
|
4
|
|
|
|
|
13
|
|
55
|
13
|
|
100
|
|
|
61
|
return $self->{preference} || 0; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub intermediate { |
60
|
6
|
|
|
6
|
1
|
826
|
my ( $self, @value ) = @_; |
61
|
6
|
|
|
|
|
12
|
for (@value) { $self->{intermediate} = Net::DNS::DomainName2535->new($_) } |
|
4
|
|
|
|
|
22
|
|
62
|
6
|
100
|
|
|
|
31
|
return $self->{intermediate} ? $self->{intermediate}->name : undef; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $function = sub { ## sort RRs in numerically ascending order. |
67
|
|
|
|
|
|
|
return $Net::DNS::a->{'preference'} <=> $Net::DNS::b->{'preference'}; |
68
|
|
|
|
|
|
|
}; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__PACKAGE__->set_rrsort_func( 'preference', $function ); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__PACKAGE__->set_rrsort_func( 'default_sort', $function ); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
__END__ |