line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Capabilities.pm 1640 2013-03-28 17:58:27Z VinsWorldcom $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::CDP::Capabilities; |
5
|
19
|
|
|
19
|
|
7281
|
use strict; use warnings; |
|
19
|
|
|
19
|
|
35
|
|
|
19
|
|
|
|
|
553
|
|
|
19
|
|
|
|
|
96
|
|
|
19
|
|
|
|
|
27
|
|
|
19
|
|
|
|
|
668
|
|
6
|
|
|
|
|
|
|
|
7
|
19
|
|
|
19
|
|
888
|
use Net::Frame::Layer qw(:consts :subs); |
|
19
|
|
|
|
|
76645
|
|
|
19
|
|
|
|
|
3824
|
|
8
|
19
|
|
|
19
|
|
127
|
use Exporter; |
|
19
|
|
|
|
|
31
|
|
|
19
|
|
|
|
|
2101
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer Exporter); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
12
|
|
|
|
|
|
|
consts => [qw( |
13
|
|
|
|
|
|
|
NF_CDP_TYPE_CAPABILITIES_ROUTER |
14
|
|
|
|
|
|
|
NF_CDP_TYPE_CAPABILITIES_TRANSBRIDGE |
15
|
|
|
|
|
|
|
NF_CDP_TYPE_CAPABILITIES_SRCRTBRIDGE |
16
|
|
|
|
|
|
|
NF_CDP_TYPE_CAPABILITIES_SWITCH |
17
|
|
|
|
|
|
|
NF_CDP_TYPE_CAPABILITIES_HOST |
18
|
|
|
|
|
|
|
NF_CDP_TYPE_CAPABILITIES_IGMP |
19
|
|
|
|
|
|
|
NF_CDP_TYPE_CAPABILITIES_REPEATER |
20
|
|
|
|
|
|
|
)], |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
23
|
|
|
|
|
|
|
@{$EXPORT_TAGS{consts}}, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
19
|
|
|
19
|
|
95
|
use constant NF_CDP_TYPE_CAPABILITIES_ROUTER => 1; |
|
19
|
|
|
|
|
32
|
|
|
19
|
|
|
|
|
1163
|
|
27
|
19
|
|
|
19
|
|
89
|
use constant NF_CDP_TYPE_CAPABILITIES_TRANSBRIDGE => 2; |
|
19
|
|
|
|
|
38
|
|
|
19
|
|
|
|
|
922
|
|
28
|
19
|
|
|
19
|
|
90
|
use constant NF_CDP_TYPE_CAPABILITIES_SRCRTBRIDGE => 4; |
|
19
|
|
|
|
|
33
|
|
|
19
|
|
|
|
|
773
|
|
29
|
19
|
|
|
19
|
|
82
|
use constant NF_CDP_TYPE_CAPABILITIES_SWITCH => 8; |
|
19
|
|
|
|
|
42
|
|
|
19
|
|
|
|
|
845
|
|
30
|
19
|
|
|
19
|
|
84
|
use constant NF_CDP_TYPE_CAPABILITIES_HOST => 16; |
|
19
|
|
|
|
|
30
|
|
|
19
|
|
|
|
|
788
|
|
31
|
19
|
|
|
19
|
|
109
|
use constant NF_CDP_TYPE_CAPABILITIES_IGMP => 32; |
|
19
|
|
|
|
|
32
|
|
|
19
|
|
|
|
|
781
|
|
32
|
19
|
|
|
19
|
|
86
|
use constant NF_CDP_TYPE_CAPABILITIES_REPEATER => 64; |
|
19
|
|
|
|
|
29
|
|
|
19
|
|
|
|
|
1433
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
our @AS = qw( |
35
|
|
|
|
|
|
|
type |
36
|
|
|
|
|
|
|
length |
37
|
|
|
|
|
|
|
capabilities |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
40
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#no strict 'vars'; |
43
|
|
|
|
|
|
|
|
44
|
19
|
|
|
19
|
|
2269
|
use Net::Frame::Layer::CDP::Constants qw(:consts); |
|
19
|
|
|
|
|
33
|
|
|
19
|
|
|
|
|
10098
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub new { |
47
|
|
|
|
|
|
|
shift->SUPER::new( |
48
|
2
|
|
|
2
|
1
|
240
|
type => NF_CDP_TYPE_CAPABILITIES, |
49
|
|
|
|
|
|
|
length => 8, |
50
|
|
|
|
|
|
|
capabilities => 0x00000000, |
51
|
|
|
|
|
|
|
@_, |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
1
|
0
|
sub getLength { 8 } |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub pack { |
58
|
1
|
|
|
1
|
1
|
318
|
my $self = shift; |
59
|
|
|
|
|
|
|
|
60
|
1
|
50
|
|
|
|
6
|
my $raw = $self->SUPER::pack('nnN', |
61
|
|
|
|
|
|
|
$self->type, |
62
|
|
|
|
|
|
|
$self->length, |
63
|
|
|
|
|
|
|
$self->capabilities, |
64
|
|
|
|
|
|
|
) or return; |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
73
|
return $self->raw($raw); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub unpack { |
70
|
1
|
|
|
1
|
1
|
15
|
my $self = shift; |
71
|
|
|
|
|
|
|
|
72
|
1
|
50
|
|
|
|
4
|
my ($type, $length, $capabilities, $payload) = |
73
|
|
|
|
|
|
|
$self->SUPER::unpack('nnN a*', $self->raw) |
74
|
|
|
|
|
|
|
or return; |
75
|
|
|
|
|
|
|
|
76
|
1
|
|
|
|
|
33
|
$self->type($type); |
77
|
1
|
|
|
|
|
12
|
$self->length($length); |
78
|
1
|
|
|
|
|
12
|
$self->capabilities($capabilities); |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
16
|
$self->payload($payload); |
81
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
14
|
return $self; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub computeLengths { |
86
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
0
|
$self->length(8); |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
0
|
return 1; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub print { |
94
|
3
|
|
|
3
|
1
|
12
|
my $self = shift; |
95
|
|
|
|
|
|
|
|
96
|
3
|
|
|
|
|
15
|
my $l = $self->layer; |
97
|
3
|
|
|
|
|
40
|
my $buf = sprintf |
98
|
|
|
|
|
|
|
"$l: type:0x%04x length:%d capabilities:0x%08x", |
99
|
|
|
|
|
|
|
$self->type, $self->length, $self->capabilities; |
100
|
|
|
|
|
|
|
|
101
|
3
|
|
|
|
|
509
|
return $buf; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
__END__ |