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