line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: PPPLCP.pm 5 2015-01-14 06:47:16Z gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::PPPLCP; |
5
|
2
|
|
|
2
|
|
14515
|
use strict; use warnings; |
|
2
|
|
|
2
|
|
5
|
|
|
2
|
|
|
|
|
89
|
|
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
113
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.01'; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
1382
|
use Net::Frame::Layer qw(:consts); |
|
2
|
|
|
|
|
129939
|
|
|
2
|
|
|
|
|
462
|
|
10
|
2
|
|
|
2
|
|
21
|
use Exporter; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
263
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
14
|
|
|
|
|
|
|
consts => [qw( |
15
|
|
|
|
|
|
|
NF_PPPLCP_HDR_LEN |
16
|
|
|
|
|
|
|
NF_PPPLCP_CODE_ECHO_REQUEST |
17
|
|
|
|
|
|
|
NF_PPPLCP_CODE_ECHO_REPLY |
18
|
|
|
|
|
|
|
)], |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
21
|
|
|
|
|
|
|
@{$EXPORT_TAGS{consts}}, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
2
|
|
|
2
|
|
13
|
use constant NF_PPPLCP_HDR_LEN => 8; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
136
|
|
25
|
2
|
|
|
2
|
|
11
|
use constant NF_PPPLCP_CODE_ECHO_REQUEST => 0x09; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
95
|
|
26
|
2
|
|
|
2
|
|
11
|
use constant NF_PPPLCP_CODE_ECHO_REPLY => 0x0a; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
750
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
our @AS = qw( |
29
|
|
|
|
|
|
|
code |
30
|
|
|
|
|
|
|
identifier |
31
|
|
|
|
|
|
|
length |
32
|
|
|
|
|
|
|
magicNumber |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
35
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub new { |
38
|
|
|
|
|
|
|
shift->SUPER::new( |
39
|
1
|
|
|
1
|
1
|
21
|
code => NF_PPPLCP_CODE_ECHO_REQUEST, |
40
|
|
|
|
|
|
|
identifier => 1, |
41
|
|
|
|
|
|
|
length => NF_PPPLCP_HDR_LEN, |
42
|
|
|
|
|
|
|
magicNumber => 0xffffffff, |
43
|
|
|
|
|
|
|
@_, |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
1
|
0
|
sub getLength { shift->length } |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
0
|
1
|
0
|
sub getPayloadLength { shift->getLength - NF_PPPLCP_HDR_LEN } |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub pack { |
52
|
1
|
|
|
1
|
1
|
210
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
1
|
50
|
|
|
|
5
|
$self->raw($self->SUPER::pack('CCnN', |
55
|
|
|
|
|
|
|
$self->code, |
56
|
|
|
|
|
|
|
$self->identifier, |
57
|
|
|
|
|
|
|
$self->length, |
58
|
|
|
|
|
|
|
$self->magicNumber, |
59
|
|
|
|
|
|
|
)) or return undef; |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
68
|
$self->raw; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub unpack { |
65
|
1
|
|
|
1
|
1
|
10
|
my $self = shift; |
66
|
|
|
|
|
|
|
|
67
|
1
|
50
|
|
|
|
3
|
my ($code, $identifier, $length, $magicNumber, $payload) = |
68
|
|
|
|
|
|
|
$self->SUPER::unpack('CCnN a*', $self->raw) |
69
|
|
|
|
|
|
|
or return undef; |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
|
|
27
|
$self->code($code); |
72
|
1
|
|
|
|
|
7
|
$self->identifier($identifier); |
73
|
1
|
|
|
|
|
8
|
$self->length($length); |
74
|
1
|
|
|
|
|
6
|
$self->magicNumber($magicNumber); |
75
|
|
|
|
|
|
|
|
76
|
1
|
|
|
|
|
10
|
$self->payload($payload); |
77
|
|
|
|
|
|
|
|
78
|
1
|
|
|
|
|
6
|
$self; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
0
|
1
|
|
sub encapsulate { shift->nextLayer } |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub print { |
84
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $l = $self->layer; |
87
|
0
|
|
|
|
|
|
sprintf "$l: code:0x%02x identifier:0x%02x length:%d magicNumber:0x%04x", |
88
|
|
|
|
|
|
|
$self->code, |
89
|
|
|
|
|
|
|
$self->identifier, |
90
|
|
|
|
|
|
|
$self->length, |
91
|
|
|
|
|
|
|
$self->magicNumber, |
92
|
|
|
|
|
|
|
; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |