line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: VoipVlanReply.pm 1640 2013-03-28 17:58:27Z VinsWorldcom $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::CDP::VoipVlanReply; |
5
|
19
|
|
|
19
|
|
15378
|
use strict; use warnings; |
|
19
|
|
|
19
|
|
36
|
|
|
19
|
|
|
|
|
599
|
|
|
19
|
|
|
|
|
95
|
|
|
19
|
|
|
|
|
34
|
|
|
19
|
|
|
|
|
541
|
|
6
|
|
|
|
|
|
|
|
7
|
19
|
|
|
19
|
|
988
|
use Net::Frame::Layer qw(:consts :subs); |
|
19
|
|
|
|
|
116550
|
|
|
19
|
|
|
|
|
4727
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @AS = qw( |
11
|
|
|
|
|
|
|
type |
12
|
|
|
|
|
|
|
length |
13
|
|
|
|
|
|
|
data |
14
|
|
|
|
|
|
|
voipVlan |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
17
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#no strict 'vars'; |
20
|
|
|
|
|
|
|
|
21
|
19
|
|
|
19
|
|
906
|
use Net::Frame::Layer::CDP::Constants qw(:consts); |
|
19
|
|
|
|
|
37
|
|
|
19
|
|
|
|
|
20933
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
|
|
|
|
|
|
shift->SUPER::new( |
25
|
2
|
|
|
2
|
1
|
267
|
type => NF_CDP_TYPE_VOIP_VLAN_REPLY, |
26
|
|
|
|
|
|
|
length => 5, |
27
|
|
|
|
|
|
|
data => 1, |
28
|
|
|
|
|
|
|
voipVlan => '', |
29
|
|
|
|
|
|
|
@_, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub getLength { |
34
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
0
|
my $length = 4; |
37
|
0
|
0
|
0
|
|
|
0
|
if (defined($self->data) && ($self->data ne '')) { |
38
|
0
|
|
|
|
|
0
|
$length += 1; |
39
|
|
|
|
|
|
|
} |
40
|
0
|
0
|
0
|
|
|
0
|
if (defined($self->voipVlan) && ($self->voipVlan ne '')) { |
41
|
0
|
|
|
|
|
0
|
$length += 2; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
0
|
return $length; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub pack { |
48
|
1
|
|
|
1
|
1
|
580
|
my $self = shift; |
49
|
|
|
|
|
|
|
|
50
|
1
|
50
|
|
|
|
6
|
my $raw = $self->SUPER::pack('nn', |
51
|
|
|
|
|
|
|
$self->type, |
52
|
|
|
|
|
|
|
$self->length, |
53
|
|
|
|
|
|
|
) or return; |
54
|
|
|
|
|
|
|
|
55
|
1
|
50
|
33
|
|
|
102
|
if (defined($self->data) && ($self->data ne '')) { |
56
|
1
|
50
|
|
|
|
36
|
$raw .= $self->SUPER::pack('C', |
57
|
|
|
|
|
|
|
$self->data |
58
|
|
|
|
|
|
|
) or return; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
1
|
50
|
33
|
|
|
27
|
if (defined($self->voipVlan) && ($self->voipVlan ne '')) { |
62
|
0
|
0
|
|
|
|
0
|
$raw .= $self->SUPER::pack('n', |
63
|
|
|
|
|
|
|
$self->voipVlan |
64
|
|
|
|
|
|
|
) or return; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
99
|
return $self->raw($raw); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub unpack { |
71
|
1
|
|
|
1
|
1
|
17
|
my $self = shift; |
72
|
|
|
|
|
|
|
|
73
|
1
|
50
|
|
|
|
5
|
my ($type, $length, $payload) = |
74
|
|
|
|
|
|
|
$self->SUPER::unpack('nn a*', $self->raw) |
75
|
|
|
|
|
|
|
or return; |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
82
|
$self->type($type); |
78
|
1
|
|
|
|
|
14
|
$self->length($length); |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
10
|
my $data; |
81
|
1
|
50
|
|
|
|
5
|
if ($length >= 5) { |
82
|
1
|
50
|
|
|
|
6
|
($data, $payload) = |
83
|
|
|
|
|
|
|
$self->SUPER::unpack('C a*', $payload) |
84
|
|
|
|
|
|
|
or return; |
85
|
1
|
|
|
|
|
61
|
$self->data($data); |
86
|
1
|
|
|
|
|
12
|
my $voipVlan; |
87
|
1
|
50
|
|
|
|
4
|
if ($length >= 7) { |
88
|
0
|
0
|
|
|
|
0
|
($voipVlan, $payload) = |
89
|
|
|
|
|
|
|
$self->SUPER::unpack('n a*', $payload) |
90
|
|
|
|
|
|
|
or return; |
91
|
0
|
|
|
|
|
0
|
$self->voipVlan($voipVlan); |
92
|
|
|
|
|
|
|
} else { |
93
|
1
|
|
|
|
|
4
|
$self->voipVlan(''); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} else { |
96
|
0
|
|
|
|
|
0
|
$self->data(''); |
97
|
0
|
|
|
|
|
0
|
$self->voipVlan(''); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
1
|
|
|
|
|
20
|
$self->payload($payload); |
101
|
|
|
|
|
|
|
|
102
|
1
|
|
|
|
|
12
|
return $self; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub computeLengths { |
106
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
0
|
my $length = 4; |
109
|
0
|
0
|
0
|
|
|
0
|
if (defined($self->data) && ($self->data ne '')) { |
110
|
0
|
|
|
|
|
0
|
$length += 1; |
111
|
|
|
|
|
|
|
} |
112
|
0
|
0
|
0
|
|
|
0
|
if (defined($self->voipVlan) && ($self->voipVlan ne '')) { |
113
|
0
|
|
|
|
|
0
|
$length += 2; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
0
|
$self->length($length); |
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
0
|
return 1; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub print { |
122
|
3
|
|
|
3
|
1
|
15
|
my $self = shift; |
123
|
|
|
|
|
|
|
|
124
|
3
|
|
|
|
|
14
|
my $l = $self->layer; |
125
|
3
|
|
|
|
|
51
|
my $buf = sprintf |
126
|
|
|
|
|
|
|
"$l: type:0x%04x length:%d data:%s voipVlan:%s", |
127
|
|
|
|
|
|
|
$self->type, $self->length, $self->data, $self->voipVlan; |
128
|
|
|
|
|
|
|
|
129
|
3
|
|
|
|
|
2015
|
return $buf; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
__END__ |