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