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