line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Emit.pm,v 1.2 2007/03/15 18:23:11 gomor Exp $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::LLTD::Emit; |
5
|
9
|
|
|
9
|
|
48
|
use strict; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
311
|
|
6
|
9
|
|
|
9
|
|
45
|
use warnings; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
260
|
|
7
|
|
|
|
|
|
|
|
8
|
9
|
|
|
9
|
|
44
|
use Net::Frame::Layer qw(:consts); |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
1868
|
|
9
|
|
|
|
|
|
|
require Exporter; |
10
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @AS = qw( |
13
|
|
|
|
|
|
|
numDescs |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
our @AA = qw( |
16
|
|
|
|
|
|
|
emiteeDescList |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
19
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
20
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsArray (\@AA); |
21
|
|
|
|
|
|
|
|
22
|
9
|
|
|
9
|
|
5828
|
use Net::Frame::Layer::LLTD::EmiteeDesc; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
6013
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new { |
25
|
|
|
|
|
|
|
shift->SUPER::new( |
26
|
1
|
|
|
1
|
1
|
33
|
numDescs => 0, |
27
|
|
|
|
|
|
|
emiteeDescList => [], |
28
|
|
|
|
|
|
|
@_, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub getEmiteeDescLength { |
33
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
34
|
0
|
|
|
|
|
0
|
my $len = 0; |
35
|
0
|
|
|
|
|
0
|
for ($self->emiteeDescList) { |
36
|
0
|
|
|
|
|
0
|
$len += $_->getLength; |
37
|
|
|
|
|
|
|
} |
38
|
0
|
|
|
|
|
0
|
$len; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub getLength { |
42
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
43
|
0
|
|
|
|
|
0
|
my $len = 2; |
44
|
0
|
0
|
|
|
|
0
|
$len += $self->getEmiteeDescLength if $self->emiteeDescList; |
45
|
0
|
|
|
|
|
0
|
$len; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub pack { |
49
|
1
|
|
|
1
|
1
|
272
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
1
|
50
|
|
|
|
6
|
$self->raw( |
52
|
|
|
|
|
|
|
$self->SUPER::pack('n', |
53
|
|
|
|
|
|
|
$self->numDescs, |
54
|
|
|
|
|
|
|
) |
55
|
|
|
|
|
|
|
) or return undef; |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
76
|
$self->raw; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub unpack { |
61
|
1
|
|
|
1
|
1
|
17
|
my $self = shift; |
62
|
|
|
|
|
|
|
|
63
|
1
|
50
|
|
|
|
4
|
my ($numDescs, $payload) = |
64
|
|
|
|
|
|
|
$self->SUPER::unpack('n a*', $self->raw) |
65
|
|
|
|
|
|
|
or return undef; |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
33
|
$self->numDescs($numDescs); |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
10
|
my @emiteeDescList = (); |
70
|
1
|
50
|
33
|
|
|
4
|
if ($self->numDescs && $self->numDescs > 0) { |
71
|
0
|
|
|
|
|
0
|
for (1..$self->numDescs) { |
72
|
0
|
|
|
|
|
0
|
my $emitee = Net::Frame::Layer::LLTD::EmiteeDesc->new(raw => $payload); |
73
|
0
|
|
|
|
|
0
|
$emitee->unpack; |
74
|
0
|
|
|
|
|
0
|
push @emiteeDescList, $emitee; |
75
|
0
|
|
|
|
|
0
|
$payload = $emitee->payload; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
1
|
|
|
|
|
18
|
$self->emiteeDescList(\@emiteeDescList); |
80
|
1
|
|
|
|
|
24
|
$self->payload($payload); |
81
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
15
|
$self; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
0
|
1
|
|
sub encapsulate { shift->nextLayer } |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub print { |
88
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
my $l = $self->layer; |
91
|
0
|
|
|
|
|
|
my $buf = sprintf "$l: numDescs:%d", $self->numDescs; |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
for ($self->emiteeDescList) { |
94
|
0
|
|
|
|
|
|
$buf .= "\n".$_->print; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
$buf; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |