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