line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Farly::IPv4::ICMPType;
|
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
19250
|
use 5.008008;
|
|
17
|
|
|
|
|
50
|
|
|
17
|
|
|
|
|
787
|
|
4
|
17
|
|
|
17
|
|
89
|
use strict;
|
|
17
|
|
|
|
|
26
|
|
|
17
|
|
|
|
|
563
|
|
5
|
17
|
|
|
17
|
|
87
|
use warnings;
|
|
17
|
|
|
|
|
26
|
|
|
17
|
|
|
|
|
565
|
|
6
|
17
|
|
|
17
|
|
112
|
use Carp;
|
|
17
|
|
|
|
|
28
|
|
|
17
|
|
|
|
|
9129
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.26';
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new {
|
11
|
92
|
|
|
92
|
1
|
189
|
my ( $class, $type ) = @_;
|
12
|
|
|
|
|
|
|
|
13
|
92
|
50
|
|
|
|
260
|
confess "type number required" unless ( defined $type );
|
14
|
|
|
|
|
|
|
|
15
|
92
|
|
|
|
|
254
|
$type =~ s/\s+//g;
|
16
|
|
|
|
|
|
|
|
17
|
92
|
50
|
66
|
|
|
703
|
confess "$type is not a number"
|
18
|
|
|
|
|
|
|
unless ( $type =~ /^\d+$/ || $type =~ /^-1$/ );
|
19
|
|
|
|
|
|
|
|
20
|
92
|
50
|
33
|
|
|
498
|
confess "invalid type $type"
|
21
|
|
|
|
|
|
|
unless ( ( $type >= -1 && $type <= 255 ) );
|
22
|
|
|
|
|
|
|
|
23
|
92
|
|
|
|
|
434
|
return bless( \$type, $class );
|
24
|
|
|
|
|
|
|
}
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub type {
|
27
|
63
|
|
|
63
|
1
|
69
|
return ${ $_[0] };
|
|
63
|
|
|
|
|
1420
|
|
28
|
|
|
|
|
|
|
}
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub as_string {
|
31
|
21
|
|
|
21
|
1
|
40
|
return ${ $_[0] };
|
|
21
|
|
|
|
|
115
|
|
32
|
|
|
|
|
|
|
}
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub equals {
|
35
|
22
|
|
|
22
|
1
|
37
|
my ( $self, $other ) = @_;
|
36
|
|
|
|
|
|
|
|
37
|
22
|
100
|
|
|
|
124
|
if ( $other->isa('Farly::IPv4::ICMPType') ) {
|
38
|
|
|
|
|
|
|
|
39
|
14
|
|
|
|
|
34
|
return $self->type() == $other->type();
|
40
|
|
|
|
|
|
|
}
|
41
|
|
|
|
|
|
|
}
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub contains {
|
44
|
15
|
|
|
15
|
1
|
27
|
my ( $self, $other ) = @_;
|
45
|
|
|
|
|
|
|
|
46
|
15
|
50
|
|
|
|
75
|
if ( $other->isa('Farly::IPv4::ICMPType') ) {
|
47
|
|
|
|
|
|
|
|
48
|
15
|
100
|
|
|
|
35
|
if ( $self->type() == -1 ) {
|
49
|
3
|
|
|
|
|
17
|
return 1;
|
50
|
|
|
|
|
|
|
}
|
51
|
|
|
|
|
|
|
|
52
|
12
|
|
|
|
|
36
|
return $self->equals($other);
|
53
|
|
|
|
|
|
|
}
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub intersects {
|
57
|
3
|
|
|
3
|
1
|
6
|
my ( $self, $other ) = @_;
|
58
|
|
|
|
|
|
|
|
59
|
3
|
100
|
100
|
|
|
8
|
if ( $self->contains($other) || $other->contains($self) ) {
|
60
|
2
|
|
|
|
|
8
|
return 1;
|
61
|
|
|
|
|
|
|
}
|
62
|
|
|
|
|
|
|
}
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub compare {
|
65
|
10
|
|
|
10
|
0
|
22
|
my ( $self, $other ) = @_;
|
66
|
|
|
|
|
|
|
|
67
|
10
|
50
|
|
|
|
62
|
if ( $other->isa('Farly::IPv4::ICMPType') ) {
|
68
|
10
|
|
|
|
|
27
|
return $self->type() <=> $other->type();
|
69
|
|
|
|
|
|
|
}
|
70
|
|
|
|
|
|
|
}
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1;
|
73
|
|
|
|
|
|
|
__END__
|