line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: SRV.pm 49 2009-05-31 13:15:34Z VinsWorldcom $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::DNS::RR::SRV; |
5
|
6
|
|
|
6
|
|
31
|
use strict; use warnings; |
|
6
|
|
|
6
|
|
12
|
|
|
6
|
|
|
|
|
125
|
|
|
6
|
|
|
|
|
26
|
|
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
132
|
|
6
|
|
|
|
|
|
|
|
7
|
6
|
|
|
6
|
|
25
|
use Net::Frame::Layer qw(:consts :subs); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
1066
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @AS = qw( |
11
|
|
|
|
|
|
|
priority |
12
|
|
|
|
|
|
|
weight |
13
|
|
|
|
|
|
|
port |
14
|
|
|
|
|
|
|
target |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
17
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
18
|
|
|
|
|
|
|
|
19
|
6
|
|
|
6
|
|
39
|
use Net::Frame::Layer::DNS qw(:subs); |
|
6
|
|
|
|
|
24
|
|
|
6
|
|
|
|
|
1909
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
|
|
|
|
|
|
shift->SUPER::new( |
23
|
1
|
|
|
1
|
1
|
167
|
priority => 1, |
24
|
|
|
|
|
|
|
weight => 0, |
25
|
|
|
|
|
|
|
port => 53, |
26
|
|
|
|
|
|
|
target => 'localhost', |
27
|
|
|
|
|
|
|
@_, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub getLength { |
32
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
33
|
0
|
|
|
|
|
0
|
return length($self->target) + 6; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub pack { |
37
|
2
|
|
|
2
|
1
|
113
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
|
|
7
|
my $name = dnsAton($self->target); |
40
|
|
|
|
|
|
|
|
41
|
2
|
50
|
|
|
|
7
|
$self->raw($self->SUPER::pack('nnn H*', |
42
|
|
|
|
|
|
|
$self->priority, $self->weight, $self->port, $name |
43
|
|
|
|
|
|
|
)) or return; |
44
|
|
|
|
|
|
|
|
45
|
2
|
|
|
|
|
93
|
return $self->raw; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub unpack { |
49
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
0
|
my ($priority, $weight, $port, $target) = |
52
|
|
|
|
|
|
|
$self->SUPER::unpack('nnn a*', $self->raw) |
53
|
|
|
|
|
|
|
or return; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
0
|
my ($name, $ptr) = dnsNtoa($target); |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
0
|
$self->priority($priority); |
58
|
0
|
|
|
|
|
0
|
$self->weight($weight); |
59
|
0
|
|
|
|
|
0
|
$self->port($port); |
60
|
0
|
|
|
|
|
0
|
$self->target($name); |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
0
|
$self->payload(substr $self->raw, $ptr+6); |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
0
|
return $self; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub encapsulate { |
68
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
69
|
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
0
|
return $self->nextLayer if $self->nextLayer; |
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
0
|
if ($self->payload) { |
73
|
0
|
|
|
|
|
0
|
return 'DNS::RR'; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
0
|
NF_LAYER_NONE; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub print { |
80
|
2
|
|
|
2
|
1
|
237
|
my $self = shift; |
81
|
|
|
|
|
|
|
|
82
|
2
|
|
|
|
|
12
|
my $l = $self->layer; |
83
|
2
|
|
|
|
|
27
|
my $buf = sprintf |
84
|
|
|
|
|
|
|
"$l: priority:%d weight:%d port:%d\n". |
85
|
|
|
|
|
|
|
"$l: target:%s", |
86
|
|
|
|
|
|
|
$self->priority, $self->weight, $self->port, |
87
|
|
|
|
|
|
|
$self->target; |
88
|
|
|
|
|
|
|
|
89
|
2
|
|
|
|
|
209
|
return $buf; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__END__ |