| 1 | # | ||||||||||
| 2 | # $Id: Lls.pm 73 2015-01-14 06:42:49Z gomor $ | ||||||||||
| 3 | # | ||||||||||
| 4 | package Net::Frame::Layer::OSPF::Lls; | ||||||||||
| 5 | 15 | ▶ | use strict; use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 15 | ▶ | use Net::Frame::Layer qw(:consts :subs); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 15 | our @ISA = qw(Net::Frame::Layer); | |||||||||
| 9 | |||||||||||
| 10 | 15 | our @AS = qw( | |||||||||
| 11 | checksum | ||||||||||
| 12 | dataLength | ||||||||||
| 13 | rawTlv | ||||||||||
| 14 | ); | ||||||||||
| 15 | 15 | our @AA = qw( | |||||||||
| 16 | tlvList | ||||||||||
| 17 | ); | ||||||||||
| 18 | 15 | __PACKAGE__->cgBuildIndices; | |||||||||
| 19 | 15 | __PACKAGE__->cgBuildAccessorsScalar(\@AS); | |||||||||
| 20 | 15 | __PACKAGE__->cgBuildAccessorsScalar(\@AA); | |||||||||
| 21 | |||||||||||
| 22 | 15 | ▶ | use Net::Frame::Layer::OSPF qw(:consts); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 25 | shift->SUPER::new( | ||||||||||
| 26 | 1 | checksum => 0, | |||||||||
| 27 | dataLength => 0, | ||||||||||
| 28 | tlvList => [], | ||||||||||
| 29 | @_, | ||||||||||
| 30 | ); | ||||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 0 | ▶ | sub getLength { | ||||||||
|
Subroutine
getLength: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 34 | #my $self = shift; | ||||||||||
| 35 | #my $len = 4; | ||||||||||
| 36 | #if ($self->rawTlv) { | ||||||||||
| 37 | #$len += length($self->rawTlv); | ||||||||||
| 38 | #} | ||||||||||
| 39 | #print "TLV LEN: $len\n"; | ||||||||||
| 40 | #$len; | ||||||||||
| 41 | 0 | 0; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 1 | ▶ | sub pack { | ||||||||
|
Subroutine
pack: called CC=4 SCAR=17.1
Pod
documented
| |||||||||||
| 45 | 1 | my $self = shift; | |||||||||
| 46 | |||||||||||
| 47 | 1 | ▶ | my $raw = $self->SUPER::pack('nn', $self->checksum, $self->dataLength) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | or return undef; | ||||||||||
| 49 | |||||||||||
| 50 | 1 | ▶ | if ($self->rawTlv) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | 0 | ▶ | $raw .= $self->SUPER::pack('a*', $self->rawTlv) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | or return undef; | ||||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 1 | $self->raw($raw); | |||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | 1 | ▶ | sub unpack { | ||||||||
|
Subroutine
unpack: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 59 | 1 | my $self = shift; | |||||||||
| 60 | |||||||||||
| 61 | 1 | ▶ | my ($checksum, $dataLength, $payload) = | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | $self->SUPER::unpack('nn a*', $self->raw) | ||||||||||
| 63 | or return undef; | ||||||||||
| 64 | |||||||||||
| 65 | 1 | $self->checksum($checksum); | |||||||||
| 66 | 1 | $self->dataLength($dataLength); | |||||||||
| 67 | |||||||||||
| 68 | # XXX: handle TLV | ||||||||||
| 69 | 1 | $self->rawTlv($payload); | |||||||||
| 70 | |||||||||||
| 71 | #$self->payload($payload); | ||||||||||
| 72 | |||||||||||
| 73 | 1 | $self; | |||||||||
| 74 | } | ||||||||||
| 75 | |||||||||||
| 76 | 0 | ▶ | sub print { | ||||||||
|
Subroutine
print: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 77 | 0 | my $self = shift; | |||||||||
| 78 | |||||||||||
| 79 | 0 | my $l = $self->layer; | |||||||||
| 80 | 0 | sprintf | |||||||||
| 81 | "$l: checksum:0x%04x dataLength:%d\n". | ||||||||||
| 82 | "$l: rawTlv:%s", | ||||||||||
| 83 | $self->checksum, | ||||||||||
| 84 | $self->dataLength, | ||||||||||
| 85 | CORE::unpack('H*', $self->rawTlv), | ||||||||||
| 86 | ; | ||||||||||
| 87 | } | ||||||||||
| 88 | |||||||||||
| 89 | 15 | 1; | |||||||||
| 90 | |||||||||||
| 91 | __END__ | ||||||||||