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