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