line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::RR::SRV; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
60
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
103
|
|
5
|
|
|
|
|
|
|
our $VERSION = (qw$Id: SRV.pm 1898 2023-02-15 14:27:22Z willem $)[2]; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
12
|
use base qw(Net::DNS::RR); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
192
|
|
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
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
|
82
|
use Net::DNS::DomainName; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1248
|
|
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
|
|
|
|
|
8
|
$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
|
|
102
|
my ( $self, $offset, @opaque ) = @_; |
33
|
|
|
|
|
|
|
|
34
|
61
|
|
|
|
|
90
|
my $target = $self->{target}; |
35
|
61
|
|
|
|
|
97
|
my @nums = ( $self->priority, $self->weight, $self->port ); |
36
|
61
|
|
|
|
|
135
|
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
|
|
|
|
|
3
|
my $target = $self->{target}; |
44
|
2
|
|
|
|
|
3
|
my @rdata = ( $self->priority, $self->weight, $self->port, $target->string ); |
45
|
2
|
|
|
|
|
18
|
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
|
|
|
|
|
81
|
$self->$attr( shift @argument ); |
54
|
|
|
|
|
|
|
} |
55
|
9
|
|
|
|
|
25
|
return; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub priority { |
60
|
75
|
|
|
75
|
1
|
120
|
my ( $self, @value ) = @_; |
61
|
75
|
|
|
|
|
126
|
for (@value) { $self->{priority} = 0 + $_ } |
|
10
|
|
|
|
|
24
|
|
62
|
75
|
|
100
|
|
|
216
|
return $self->{priority} || 0; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub weight { |
67
|
75
|
|
|
75
|
1
|
937
|
my ( $self, @value ) = @_; |
68
|
75
|
|
|
|
|
114
|
for (@value) { $self->{weight} = 0 + $_ } |
|
10
|
|
|
|
|
18
|
|
69
|
75
|
|
100
|
|
|
196
|
return $self->{weight} || 0; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub port { |
74
|
75
|
|
|
75
|
1
|
908
|
my ( $self, @value ) = @_; |
75
|
75
|
|
|
|
|
96
|
for (@value) { $self->{port} = 0 + $_ } |
|
10
|
|
|
|
|
25
|
|
76
|
75
|
|
100
|
|
|
172
|
return $self->{port} || 0; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub target { |
81
|
12
|
|
|
12
|
1
|
807
|
my ( $self, @value ) = @_; |
82
|
12
|
|
|
|
|
21
|
for (@value) { $self->{target} = Net::DNS::DomainName2535->new($_) } |
|
10
|
|
|
|
|
39
|
|
83
|
12
|
100
|
|
|
|
52
|
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__ |