line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: LOOP.pm,v 1.1 2007/03/31 10:34:41 gomor Exp $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::LOOP; |
5
|
2
|
|
|
2
|
|
19042
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
123
|
|
6
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
2117
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.00'; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
3269
|
use Net::Frame::Layer qw(:consts); |
|
2
|
|
|
|
|
240024
|
|
|
2
|
|
|
|
|
700
|
|
11
|
|
|
|
|
|
|
require Exporter; |
12
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
15
|
|
|
|
|
|
|
consts => [qw( |
16
|
|
|
|
|
|
|
NF_LOOP_HDR_LEN |
17
|
|
|
|
|
|
|
NF_LOOP_FUNCTION_REPLY |
18
|
|
|
|
|
|
|
)], |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
21
|
|
|
|
|
|
|
@{$EXPORT_TAGS{consts}}, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
2
|
|
|
2
|
|
22
|
use constant NF_LOOP_HDR_LEN => 6; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
106
|
|
25
|
2
|
|
|
2
|
|
9
|
use constant NF_LOOP_FUNCTION_REPLY => 0x0100; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
702
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our @AS = qw( |
28
|
|
|
|
|
|
|
skipCount |
29
|
|
|
|
|
|
|
function |
30
|
|
|
|
|
|
|
receiptNumber |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
33
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new { |
36
|
|
|
|
|
|
|
shift->SUPER::new( |
37
|
1
|
|
|
1
|
1
|
24
|
skipCount => 0, |
38
|
|
|
|
|
|
|
function => NF_LOOP_FUNCTION_REPLY, |
39
|
|
|
|
|
|
|
receiptNumber => 0, |
40
|
|
|
|
|
|
|
@_, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
1
|
0
|
sub getLength { NF_LOOP_HDR_LEN } |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub pack { |
47
|
1
|
|
|
1
|
1
|
236
|
my $self = shift; |
48
|
|
|
|
|
|
|
|
49
|
1
|
50
|
|
|
|
5
|
$self->raw($self->SUPER::pack('nnn', |
50
|
|
|
|
|
|
|
$self->skipCount, |
51
|
|
|
|
|
|
|
$self->function, |
52
|
|
|
|
|
|
|
$self->receiptNumber, |
53
|
|
|
|
|
|
|
)) or return undef; |
54
|
|
|
|
|
|
|
|
55
|
1
|
|
|
|
|
75
|
$self->raw; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub unpack { |
59
|
1
|
|
|
1
|
1
|
12
|
my $self = shift; |
60
|
|
|
|
|
|
|
|
61
|
1
|
50
|
|
|
|
4
|
my ($skipCount, $function, $receiptNumber, $payload) = |
62
|
|
|
|
|
|
|
$self->SUPER::unpack('nnn a*', $self->raw) |
63
|
|
|
|
|
|
|
or return undef; |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
28
|
$self->skipCount($skipCount); |
66
|
1
|
|
|
|
|
11
|
$self->function($function); |
67
|
1
|
|
|
|
|
10
|
$self->receiptNumber($receiptNumber); |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
13
|
$self->payload($payload); |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
|
|
9
|
$self; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
0
|
1
|
|
sub encapsulate { shift->nextLayer } |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub print { |
77
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my $l = $self->layer; |
80
|
0
|
|
|
|
|
|
sprintf "$l: skipCount:%d function:0x%04x receiptNumber:%d", |
81
|
|
|
|
|
|
|
$self->skipCount, |
82
|
|
|
|
|
|
|
$self->function, |
83
|
|
|
|
|
|
|
$self->receiptNumber, |
84
|
|
|
|
|
|
|
; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__END__ |