line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: SOA.pm 49 2009-05-31 13:15:34Z VinsWorldcom $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::DNS::RR::SOA; |
5
|
6
|
|
|
6
|
|
29
|
use strict; use warnings; |
|
6
|
|
|
6
|
|
9
|
|
|
6
|
|
|
|
|
158
|
|
|
6
|
|
|
|
|
27
|
|
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
143
|
|
6
|
|
|
|
|
|
|
|
7
|
6
|
|
|
6
|
|
25
|
use Net::Frame::Layer qw(:consts :subs); |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
1371
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @AS = qw( |
11
|
|
|
|
|
|
|
mname |
12
|
|
|
|
|
|
|
rname |
13
|
|
|
|
|
|
|
serial |
14
|
|
|
|
|
|
|
refresh |
15
|
|
|
|
|
|
|
retry |
16
|
|
|
|
|
|
|
expire |
17
|
|
|
|
|
|
|
minimum |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
20
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
21
|
|
|
|
|
|
|
|
22
|
6
|
|
|
6
|
|
37
|
use Net::Frame::Layer::DNS qw(:subs); |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
3775
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new { |
25
|
|
|
|
|
|
|
shift->SUPER::new( |
26
|
1
|
|
|
1
|
1
|
216
|
mname => 'localhost', |
27
|
|
|
|
|
|
|
rname => 'administrator.localhost', |
28
|
|
|
|
|
|
|
serial => 0, |
29
|
|
|
|
|
|
|
refresh => 0, |
30
|
|
|
|
|
|
|
retry => 0, |
31
|
|
|
|
|
|
|
expire => 0, |
32
|
|
|
|
|
|
|
minimum => 0, |
33
|
|
|
|
|
|
|
@_, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub getLength { |
38
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
0
|
my $mnamelen = 1; |
41
|
0
|
|
|
|
|
0
|
my $rnamelen = 1; |
42
|
0
|
0
|
|
|
|
0
|
if (length($self->mname) > 0) { |
43
|
0
|
|
|
|
|
0
|
$mnamelen = length($self->mname) + 2 |
44
|
|
|
|
|
|
|
} |
45
|
0
|
0
|
|
|
|
0
|
if (length($self->rname) > 0) { |
46
|
0
|
|
|
|
|
0
|
$rnamelen = length($self->rname) + 2 |
47
|
|
|
|
|
|
|
} |
48
|
0
|
|
|
|
|
0
|
return $mnamelen + $rnamelen + 20 # 4 bytes x 5 values (serial, refresh ...) |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub pack { |
52
|
2
|
|
|
2
|
1
|
194
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
8
|
my $mname = Net::Frame::Layer::DNS::dnsAton($self->mname); |
55
|
2
|
|
|
|
|
8
|
my $rname = Net::Frame::Layer::DNS::dnsAton($self->rname); |
56
|
|
|
|
|
|
|
|
57
|
2
|
50
|
|
|
|
8
|
$self->raw($self->SUPER::pack('H*H*NNNNN', |
58
|
|
|
|
|
|
|
$mname, |
59
|
|
|
|
|
|
|
$rname, |
60
|
|
|
|
|
|
|
$self->serial, |
61
|
|
|
|
|
|
|
$self->refresh, |
62
|
|
|
|
|
|
|
$self->retry, |
63
|
|
|
|
|
|
|
$self->expire, |
64
|
|
|
|
|
|
|
$self->minimum |
65
|
|
|
|
|
|
|
)) or return; |
66
|
|
|
|
|
|
|
|
67
|
2
|
|
|
|
|
150
|
return $self->raw; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub unpack { |
71
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
0
|
my ($mname, $ptr) = dnsNtoa($self->raw); |
74
|
0
|
|
|
|
|
0
|
my ($rname, $ptr1) = dnsNtoa(substr $self->raw, $ptr); |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
0
|
$self->mname($mname); |
77
|
0
|
|
|
|
|
0
|
$self->rname($rname); |
78
|
|
|
|
|
|
|
|
79
|
0
|
0
|
|
|
|
0
|
my ($serial, $refresh, $retry, $expire, $minimum, $payload) = |
80
|
|
|
|
|
|
|
$self->SUPER::unpack('NNNNN a*', (substr $self->raw, $ptr+$ptr1)) |
81
|
|
|
|
|
|
|
or return; |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
0
|
$self->serial($serial); |
84
|
0
|
|
|
|
|
0
|
$self->refresh($refresh); |
85
|
0
|
|
|
|
|
0
|
$self->retry($retry); |
86
|
0
|
|
|
|
|
0
|
$self->expire($expire); |
87
|
0
|
|
|
|
|
0
|
$self->minimum($minimum); |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
0
|
$self->payload($payload); |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
0
|
return $self; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub encapsulate { |
95
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
96
|
|
|
|
|
|
|
|
97
|
0
|
0
|
|
|
|
0
|
return $self->nextLayer if $self->nextLayer; |
98
|
|
|
|
|
|
|
|
99
|
0
|
0
|
|
|
|
0
|
if ($self->payload) { |
100
|
0
|
|
|
|
|
0
|
return 'DNS::RR'; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
0
|
NF_LAYER_NONE; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub print { |
107
|
2
|
|
|
2
|
1
|
283
|
my $self = shift; |
108
|
|
|
|
|
|
|
|
109
|
2
|
|
|
|
|
10
|
my $l = $self->layer; |
110
|
2
|
|
|
|
|
28
|
my $buf = sprintf |
111
|
|
|
|
|
|
|
"$l: mname:%s rname:%s\n". |
112
|
|
|
|
|
|
|
"$l: serial:%d refresh:%d retry:%d\n". |
113
|
|
|
|
|
|
|
"$l: expire:%d minimum:%d", |
114
|
|
|
|
|
|
|
$self->mname, $self->rname, |
115
|
|
|
|
|
|
|
$self->serial, $self->refresh, $self->retry, |
116
|
|
|
|
|
|
|
$self->expire, $self->minimum; |
117
|
|
|
|
|
|
|
|
118
|
2
|
|
|
|
|
388
|
return $buf; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
__END__ |