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