line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Echo.pm 53 2012-01-31 20:27:06Z gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::ICMPv4::Echo; |
5
|
3
|
|
|
3
|
|
6963
|
use strict; use warnings; |
|
3
|
|
|
3
|
|
6
|
|
|
3
|
|
|
|
|
108
|
|
|
3
|
|
|
|
|
17
|
|
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
98
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
885
|
use Net::Frame::Layer qw(:consts :subs); |
|
3
|
|
|
|
|
132938
|
|
|
3
|
|
|
|
|
1884
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @AS = qw( |
11
|
|
|
|
|
|
|
identifier |
12
|
|
|
|
|
|
|
sequenceNumber |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
15
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
|
|
|
|
|
|
shift->SUPER::new( |
19
|
1
|
|
|
1
|
1
|
20
|
identifier => getRandom16bitsInt(), |
20
|
|
|
|
|
|
|
sequenceNumber => getRandom16bitsInt(), |
21
|
|
|
|
|
|
|
@_, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
0
|
1
|
0
|
sub getLength { 4 } |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub pack { |
28
|
1
|
|
|
1
|
1
|
302
|
my $self = shift; |
29
|
|
|
|
|
|
|
|
30
|
1
|
50
|
|
|
|
4
|
$self->raw($self->SUPER::pack('nn', |
31
|
|
|
|
|
|
|
$self->identifier, $self->sequenceNumber, |
32
|
|
|
|
|
|
|
)) or return; |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
69
|
return $self->raw; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub unpack { |
38
|
1
|
|
|
1
|
1
|
12
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
1
|
50
|
|
|
|
4
|
my ($identifier, $sequenceNumber, $payload) = |
41
|
|
|
|
|
|
|
$self->SUPER::unpack('nn a*', $self->raw) |
42
|
|
|
|
|
|
|
or return; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
30
|
$self->identifier($identifier); |
45
|
1
|
|
|
|
|
10
|
$self->sequenceNumber($sequenceNumber); |
46
|
1
|
|
|
|
|
14
|
$self->payload($payload); |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
9
|
return $self; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub print { |
52
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
8
|
my $l = $self->layer; |
55
|
1
|
|
|
|
|
16
|
sprintf "$l: identifier:%d sequenceNumber:%d", |
56
|
|
|
|
|
|
|
$self->identifier, $self->sequenceNumber; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |