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