line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::RR::TKEY; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
5
|
|
|
|
|
|
|
our $VERSION = (qw$Id: TKEY.pm 1908 2023-03-15 07:28:50Z willem $)[2]; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use base qw(Net::DNS::RR); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
142
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Net::DNS::RR::TKEY - DNS TKEY resource record |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
8
|
use integer; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
37
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
72
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
6
|
use Net::DNS::Parameters qw(:class :type); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
176
|
|
21
|
1
|
|
|
1
|
|
7
|
use Net::DNS::DomainName; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
5
|
use constant ANY => classbyname qw(ANY); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
24
|
1
|
|
|
1
|
|
7
|
use constant TKEY => typebyname qw(TKEY); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _decode_rdata { ## decode rdata from wire-format octet string |
28
|
3
|
|
|
3
|
|
7
|
my ( $self, $data, $offset ) = @_; |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
|
|
4
|
my $limit = $offset + $self->{rdlength}; |
31
|
|
|
|
|
|
|
|
32
|
3
|
|
|
|
|
10
|
( $self->{algorithm}, $offset ) = Net::DNS::DomainName->decode( $data, $offset ); |
33
|
|
|
|
|
|
|
|
34
|
3
|
|
|
|
|
11
|
@{$self}{qw(inception expiration mode error)} = unpack "\@$offset N2n2", $$data; |
|
3
|
|
|
|
|
10
|
|
35
|
3
|
|
|
|
|
6
|
$offset += 12; |
36
|
|
|
|
|
|
|
|
37
|
3
|
|
|
|
|
6
|
my $key_size = unpack "\@$offset n", $$data; |
38
|
3
|
|
|
|
|
7
|
$self->{key} = substr $$data, $offset + 2, $key_size; |
39
|
3
|
|
|
|
|
5
|
$offset += $key_size + 2; |
40
|
|
|
|
|
|
|
|
41
|
3
|
|
|
|
|
7
|
my $other_size = unpack "\@$offset n", $$data; |
42
|
3
|
|
|
|
|
6
|
$self->{other} = substr $$data, $offset + 2, $other_size; |
43
|
3
|
|
|
|
|
5
|
$offset += $other_size + 2; |
44
|
|
|
|
|
|
|
|
45
|
3
|
100
|
|
|
|
233
|
croak('corrupt TKEY data') unless $offset == $limit; # more or less FUBAR |
46
|
2
|
|
|
|
|
5
|
return; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub _encode_rdata { ## encode rdata as wire-format octet string |
51
|
11
|
|
|
11
|
|
17
|
my $self = shift; |
52
|
|
|
|
|
|
|
|
53
|
11
|
100
|
|
|
|
39
|
return '' unless defined $self->{algorithm}; |
54
|
9
|
|
|
|
|
23
|
my $rdata = $self->{algorithm}->encode; |
55
|
|
|
|
|
|
|
|
56
|
9
|
|
|
|
|
21
|
$rdata .= pack 'N2n2', $self->inception, $self->expiration, $self->mode, $self->error; |
57
|
|
|
|
|
|
|
|
58
|
9
|
|
|
|
|
22
|
my $key = $self->key; # RFC2930(2.7) |
59
|
9
|
|
|
|
|
28
|
$rdata .= pack 'na*', length $key, $key; |
60
|
|
|
|
|
|
|
|
61
|
9
|
|
|
|
|
17
|
my $other = $self->other; # RFC2930(2.8) |
62
|
9
|
|
|
|
|
20
|
$rdata .= pack 'na*', length $other, $other; |
63
|
9
|
|
|
|
|
32
|
return $rdata; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub class { ## override RR method |
68
|
2
|
|
|
2
|
1
|
25
|
return 'ANY'; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub encode { ## override RR method |
72
|
6
|
|
|
6
|
1
|
642
|
my $self = shift; |
73
|
|
|
|
|
|
|
|
74
|
6
|
|
|
|
|
17
|
my $owner = $self->{owner}->encode(); |
75
|
6
|
|
100
|
|
|
13
|
my $rdata = eval { $self->_encode_rdata() } || ''; |
76
|
6
|
|
|
|
|
38
|
return pack 'a* n2 N n a*', $owner, TKEY, ANY, 0, length $rdata, $rdata; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub algorithm { |
81
|
3
|
|
|
3
|
1
|
12
|
my ( $self, @value ) = @_; |
82
|
3
|
|
|
|
|
5
|
for (@value) { $self->{algorithm} = Net::DNS::DomainName->new($_) } |
|
1
|
|
|
|
|
7
|
|
83
|
3
|
100
|
|
|
|
20
|
return $self->{algorithm} ? $self->{algorithm}->name : undef; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub inception { |
88
|
12
|
|
|
12
|
1
|
1062
|
my ( $self, @value ) = @_; |
89
|
12
|
|
|
|
|
24
|
for (@value) { $self->{inception} = 0 + $_ } |
|
1
|
|
|
|
|
3
|
|
90
|
12
|
|
100
|
|
|
41
|
return $self->{inception} || 0; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub expiration { |
95
|
12
|
|
|
12
|
1
|
1138
|
my ( $self, @value ) = @_; |
96
|
12
|
|
|
|
|
21
|
for (@value) { $self->{expiration} = 0 + $_ } |
|
1
|
|
|
|
|
24
|
|
97
|
12
|
|
100
|
|
|
44
|
return $self->{expiration} || 0; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub mode { |
102
|
12
|
|
|
12
|
1
|
1058
|
my ( $self, @value ) = @_; |
103
|
12
|
|
|
|
|
21
|
for (@value) { $self->{mode} = 0 + $_ } |
|
1
|
|
|
|
|
3
|
|
104
|
12
|
|
100
|
|
|
38
|
return $self->{mode} || 0; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub error { |
109
|
12
|
|
|
12
|
1
|
1056
|
my ( $self, @value ) = @_; |
110
|
12
|
|
|
|
|
20
|
for (@value) { $self->{error} = 0 + $_ } |
|
1
|
|
|
|
|
2
|
|
111
|
12
|
|
100
|
|
|
45
|
return $self->{error} || 0; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub key { |
116
|
12
|
|
|
12
|
1
|
1039
|
my ( $self, @value ) = @_; |
117
|
12
|
|
|
|
|
19
|
for (@value) { $self->{key} = $_ } |
|
1
|
|
|
|
|
2
|
|
118
|
12
|
|
100
|
|
|
77
|
return $self->{key} || ""; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub other { |
123
|
14
|
|
|
14
|
1
|
1036
|
my ( $self, @value ) = @_; |
124
|
14
|
|
|
|
|
25
|
for (@value) { $self->{other} = $_ } |
|
1
|
|
|
|
|
2
|
|
125
|
14
|
|
100
|
|
|
49
|
return $self->{other} || ""; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
2
|
|
|
2
|
0
|
631
|
sub other_data { return &other; } # uncoverable pod |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |
133
|
|
|
|
|
|
|
__END__ |