line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::RR::RT; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
159
|
|
5
|
|
|
|
|
|
|
our $VERSION = (qw$Id: RT.pm 1898 2023-02-15 14:27:22Z willem $)[2]; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
12
|
use base qw(Net::DNS::RR); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
177
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Net::DNS::RR::RT - DNS RT resource record |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
12
|
use integer; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
21
|
|
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
|
75
|
use Net::DNS::DomainName; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
890
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _decode_rdata { ## decode rdata from wire-format octet string |
22
|
1
|
|
|
1
|
|
2
|
my ( $self, $data, $offset ) = @_; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
4
|
$self->{preference} = unpack( "\@$offset n", $$data ); |
25
|
1
|
|
|
|
|
6
|
$self->{intermediate} = Net::DNS::DomainName2535->decode( $data, $offset + 2 ); |
26
|
1
|
|
|
|
|
4
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _encode_rdata { ## encode rdata as wire-format octet string |
31
|
5
|
|
|
5
|
|
12
|
my ( $self, $offset, @opaque ) = @_; |
32
|
|
|
|
|
|
|
|
33
|
5
|
|
|
|
|
10
|
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
|
|
3
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
13
|
return join ' ', $self->preference, $self->{intermediate}->string; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _parse_rdata { ## populate RR from rdata in argument list |
45
|
3
|
|
|
3
|
|
8
|
my ( $self, @argument ) = @_; |
46
|
|
|
|
|
|
|
|
47
|
3
|
|
|
|
|
7
|
for (qw(preference intermediate)) { $self->$_( shift @argument ) } |
|
6
|
|
|
|
|
19
|
|
48
|
3
|
|
|
|
|
9
|
return; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub preference { |
53
|
13
|
|
|
13
|
1
|
32
|
my ( $self, @value ) = @_; |
54
|
13
|
|
|
|
|
25
|
for (@value) { $self->{preference} = 0 + $_ } |
|
4
|
|
|
|
|
13
|
|
55
|
13
|
|
100
|
|
|
64
|
return $self->{preference} || 0; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub intermediate { |
60
|
6
|
|
|
6
|
1
|
823
|
my ( $self, @value ) = @_; |
61
|
6
|
|
|
|
|
12
|
for (@value) { $self->{intermediate} = Net::DNS::DomainName2535->new($_) } |
|
4
|
|
|
|
|
21
|
|
62
|
6
|
100
|
|
|
|
29
|
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__ |