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