line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: Link.pm,v 1.1 2007/03/08 16:32:02 gomor Exp $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::Frame::Layer::OSPF::Lsa::Router::Link; |
5
|
2
|
|
|
2
|
|
6
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
56
|
|
6
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
40
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
5
|
use Net::Frame::Layer qw(:consts :subs); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
309
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Net::Frame::Layer); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @AS = qw( |
12
|
|
|
|
|
|
|
linkId |
13
|
|
|
|
|
|
|
linkData |
14
|
|
|
|
|
|
|
type |
15
|
|
|
|
|
|
|
nTos |
16
|
|
|
|
|
|
|
metric |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
19
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
2
|
|
8
|
use Net::Frame::Layer::OSPF qw(:consts); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
716
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
|
|
|
|
|
|
shift->SUPER::new( |
25
|
0
|
|
|
0
|
1
|
|
linkId => '0.0.0.0', |
26
|
|
|
|
|
|
|
linkData => '0.0.0.0', |
27
|
|
|
|
|
|
|
type => 0, |
28
|
|
|
|
|
|
|
nTos => 0, |
29
|
|
|
|
|
|
|
metric => 0, |
30
|
|
|
|
|
|
|
@_, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
0
|
1
|
|
sub getLength { 12 } |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub pack { |
37
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
|
$self->raw($self->SUPER::pack('a4a4CCn', |
40
|
|
|
|
|
|
|
inetAton($self->linkId), inetAton($self->linkData), $self->type, |
41
|
|
|
|
|
|
|
$self->nTos, $self->metric, |
42
|
|
|
|
|
|
|
)) or return undef; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
$self->raw; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub unpack { |
48
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
my ($linkId, $linkData, $type, $nTos, $metric, $payload) |
51
|
|
|
|
|
|
|
= $self->SUPER::unpack('a4a4CCn a*', $self->raw) |
52
|
|
|
|
|
|
|
or return undef; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
$self->linkId(inetNtoa($linkId)); |
55
|
0
|
|
|
|
|
|
$self->linkData(inetNtoa($linkData)); |
56
|
0
|
|
|
|
|
|
$self->type($type); |
57
|
0
|
|
|
|
|
|
$self->nTos($nTos); |
58
|
0
|
|
|
|
|
|
$self->metric($metric); |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
$self->payload($payload); |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
$self; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub print { |
66
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my $l = $self->layer; |
69
|
0
|
|
|
|
|
|
sprintf |
70
|
|
|
|
|
|
|
"$l: linkId:%s linkData:%s type:0x%02x nTos:%d metric:%d", |
71
|
|
|
|
|
|
|
$self->linkId, |
72
|
|
|
|
|
|
|
$self->linkData, |
73
|
|
|
|
|
|
|
$self->type, |
74
|
|
|
|
|
|
|
$self->nTos, |
75
|
|
|
|
|
|
|
$self->metric, |
76
|
|
|
|
|
|
|
; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |