line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::RR::MX; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
45
|
use strict; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
205
|
|
4
|
6
|
|
|
6
|
|
31
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
360
|
|
5
|
|
|
|
|
|
|
our $VERSION = (qw$Id: MX.pm 1896 2023-01-30 12:59:25Z willem $)[2]; |
6
|
|
|
|
|
|
|
|
7
|
6
|
|
|
6
|
|
42
|
use base qw(Net::DNS::RR); |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
660
|
|
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
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
64
|
|
17
|
|
|
|
|
|
|
|
18
|
6
|
|
|
6
|
|
340
|
use Net::DNS::DomainName; |
|
6
|
|
|
|
|
24
|
|
|
6
|
|
|
|
|
3784
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _decode_rdata { ## decode rdata from wire-format octet string |
22
|
31
|
|
|
31
|
|
142
|
my ( $self, @argument ) = @_; |
23
|
31
|
|
|
|
|
94
|
my ( $data, $offset, @opaque ) = @argument; |
24
|
|
|
|
|
|
|
|
25
|
31
|
|
|
|
|
129
|
$self->{preference} = unpack( "\@$offset n", $$data ); |
26
|
31
|
|
|
|
|
138
|
$self->{exchange} = Net::DNS::DomainName1035->decode( $data, $offset + 2, @opaque ); |
27
|
31
|
|
|
|
|
107
|
return; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _encode_rdata { ## encode rdata as wire-format octet string |
32
|
5
|
|
|
5
|
|
11
|
my ( $self, @argument ) = @_; |
33
|
5
|
|
|
|
|
46
|
my ( $offset, @opaque ) = @argument; |
34
|
|
|
|
|
|
|
|
35
|
5
|
|
|
|
|
9
|
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
|
|
3
|
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
|
|
19
|
my ( $self, @argument ) = @_; |
50
|
|
|
|
|
|
|
|
51
|
5
|
|
|
|
|
12
|
for (qw(preference exchange)) { $self->$_( shift @argument ) } |
|
10
|
|
|
|
|
26
|
|
52
|
5
|
|
|
|
|
10
|
return; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _defaults { ## specify RR attribute default values |
57
|
6
|
|
|
6
|
|
14
|
my $self = shift; |
58
|
|
|
|
|
|
|
|
59
|
6
|
|
|
|
|
24
|
$self->preference(10); |
60
|
6
|
|
|
|
|
15
|
return; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub preference { |
65
|
29
|
|
|
29
|
1
|
79
|
my ( $self, @value ) = @_; |
66
|
29
|
|
|
|
|
69
|
for (@value) { $self->{preference} = 0 + $_ } |
|
13
|
|
|
|
|
72
|
|
67
|
29
|
|
100
|
|
|
147
|
return $self->{preference} || 0; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub exchange { |
72
|
10
|
|
|
10
|
1
|
531
|
my ( $self, @value ) = @_; |
73
|
10
|
|
|
|
|
21
|
for (@value) { $self->{exchange} = Net::DNS::DomainName1035->new($_) } |
|
7
|
|
|
|
|
21
|
|
74
|
10
|
100
|
|
|
|
49
|
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__ |