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