line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::RR::PX; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
15
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
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
|
|
|
|
|
100
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Net::DNS::RR::PX - DNS PX resource record |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
7
|
use integer; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
35
|
use Net::DNS::DomainName; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
630
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _decode_rdata { ## decode rdata from wire-format octet string |
22
|
1
|
|
|
1
|
|
3
|
my ( $self, $data, $offset ) = @_; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
4
|
$self->{preference} = unpack( "\@$offset n", $$data ); |
25
|
1
|
|
|
|
|
6
|
( $self->{map822}, $offset ) = Net::DNS::DomainName2535->decode( $data, $offset + 2 ); |
26
|
1
|
|
|
|
|
4
|
( $self->{mapx400}, $offset ) = Net::DNS::DomainName2535->decode( $data, $offset ); |
27
|
1
|
|
|
|
|
2
|
return; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _encode_rdata { ## encode rdata as wire-format octet string |
32
|
5
|
|
|
5
|
|
12
|
my ( $self, $offset, @opaque ) = @_; |
33
|
|
|
|
|
|
|
|
34
|
5
|
|
|
|
|
7
|
my $mapx400 = $self->{mapx400}; |
35
|
5
|
|
|
|
|
11
|
my $rdata = pack( 'n', $self->{preference} ); |
36
|
5
|
|
|
|
|
16
|
$rdata .= $self->{map822}->encode( $offset + 2, @opaque ); |
37
|
5
|
|
|
|
|
15
|
$rdata .= $mapx400->encode( $offset + length($rdata), @opaque ); |
38
|
5
|
|
|
|
|
20
|
return $rdata; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _format_rdata { ## format rdata portion of RR string. |
43
|
2
|
|
|
2
|
|
4
|
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
|
|
|
|
|
2
|
for (qw(preference map822 mapx400)) { $self->$_( shift @argument ) } |
|
3
|
|
|
|
|
8
|
|
54
|
1
|
|
|
|
|
3
|
return; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub preference { |
59
|
6
|
|
|
6
|
1
|
17
|
my ( $self, @value ) = @_; |
60
|
6
|
|
|
|
|
12
|
for (@value) { $self->{preference} = 0 + $_ } |
|
2
|
|
|
|
|
10
|
|
61
|
6
|
|
100
|
|
|
34
|
return $self->{preference} || 0; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub map822 { |
66
|
4
|
|
|
4
|
1
|
1065
|
my ( $self, @value ) = @_; |
67
|
4
|
|
|
|
|
6
|
for (@value) { $self->{map822} = Net::DNS::DomainName2535->new($_) } |
|
2
|
|
|
|
|
7
|
|
68
|
4
|
100
|
|
|
|
16
|
return $self->{map822} ? $self->{map822}->name : undef; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub mapx400 { |
73
|
4
|
|
|
4
|
1
|
1031
|
my ( $self, @value ) = @_; |
74
|
4
|
|
|
|
|
8
|
for (@value) { $self->{mapx400} = Net::DNS::DomainName2535->new($_) } |
|
2
|
|
|
|
|
15
|
|
75
|
4
|
100
|
|
|
|
19
|
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__ |