| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::DNS::RR::SRV; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
14
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
59
|
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
92
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = (qw$Id: SRV.pm 1898 2023-02-15 14:27:22Z willem $)[2]; |
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
14
|
use base qw(Net::DNS::RR); |
|
|
2
|
|
|
|
|
9
|
|
|
|
2
|
|
|
|
|
189
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Net::DNS::RR::SRV - DNS SRV resource record |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
|
15
|
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
14
|
use integer; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
9
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
|
75
|
use Net::DNS::DomainName; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
1228
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _decode_rdata { ## decode rdata from wire-format octet string |
|
22
|
1
|
|
|
1
|
|
3
|
my ( $self, $data, $offset ) = @_; |
|
23
|
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
3
|
@{$self}{qw(priority weight port)} = unpack( "\@$offset n3", $$data ); |
|
|
1
|
|
|
|
|
3
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
7
|
$self->{target} = Net::DNS::DomainName2535->decode( $data, $offset + 6 ); |
|
27
|
1
|
|
|
|
|
3
|
return; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _encode_rdata { ## encode rdata as wire-format octet string |
|
32
|
61
|
|
|
61
|
|
97
|
my ( $self, $offset, @opaque ) = @_; |
|
33
|
|
|
|
|
|
|
|
|
34
|
61
|
|
|
|
|
94
|
my $target = $self->{target}; |
|
35
|
61
|
|
|
|
|
89
|
my @nums = ( $self->priority, $self->weight, $self->port ); |
|
36
|
61
|
|
|
|
|
128
|
return pack 'n3 a*', @nums, $target->encode( $offset + 6, @opaque ); |
|
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, $self->port, $target->string ); |
|
45
|
2
|
|
|
|
|
7
|
return @rdata; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _parse_rdata { ## populate RR from rdata in argument list |
|
50
|
9
|
|
|
9
|
|
25
|
my ( $self, @argument ) = @_; |
|
51
|
|
|
|
|
|
|
|
|
52
|
9
|
|
|
|
|
18
|
foreach my $attr (qw(priority weight port target)) { |
|
53
|
36
|
|
|
|
|
82
|
$self->$attr( shift @argument ); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
9
|
|
|
|
|
23
|
return; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub priority { |
|
60
|
75
|
|
|
75
|
1
|
120
|
my ( $self, @value ) = @_; |
|
61
|
75
|
|
|
|
|
121
|
for (@value) { $self->{priority} = 0 + $_ } |
|
|
10
|
|
|
|
|
23
|
|
|
62
|
75
|
|
100
|
|
|
213
|
return $self->{priority} || 0; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub weight { |
|
67
|
75
|
|
|
75
|
1
|
889
|
my ( $self, @value ) = @_; |
|
68
|
75
|
|
|
|
|
105
|
for (@value) { $self->{weight} = 0 + $_ } |
|
|
10
|
|
|
|
|
21
|
|
|
69
|
75
|
|
100
|
|
|
189
|
return $self->{weight} || 0; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub port { |
|
74
|
75
|
|
|
75
|
1
|
854
|
my ( $self, @value ) = @_; |
|
75
|
75
|
|
|
|
|
108
|
for (@value) { $self->{port} = 0 + $_ } |
|
|
10
|
|
|
|
|
23
|
|
|
76
|
75
|
|
100
|
|
|
161
|
return $self->{port} || 0; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub target { |
|
81
|
12
|
|
|
12
|
1
|
746
|
my ( $self, @value ) = @_; |
|
82
|
12
|
|
|
|
|
24
|
for (@value) { $self->{target} = Net::DNS::DomainName2535->new($_) } |
|
|
10
|
|
|
|
|
36
|
|
|
83
|
12
|
100
|
|
|
|
47
|
return $self->{target} ? $self->{target}->name : undef; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# order RRs by numerically increasing priority, decreasing weight |
|
88
|
|
|
|
|
|
|
my $function = sub { |
|
89
|
|
|
|
|
|
|
my ( $a, $b ) = ( $Net::DNS::a, $Net::DNS::b ); |
|
90
|
|
|
|
|
|
|
return $a->{priority} <=> $b->{priority} |
|
91
|
|
|
|
|
|
|
|| $b->{weight} <=> $a->{weight}; |
|
92
|
|
|
|
|
|
|
}; |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__PACKAGE__->set_rrsort_func( 'priority', $function ); |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__PACKAGE__->set_rrsort_func( 'default_sort', $function ); |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
|
100
|
|
|
|
|
|
|
__END__ |