| 1 | # | ||||||||||
| 2 | # $Id: LinkStateAck.pm 73 2015-01-14 06:42:49Z gomor $ | ||||||||||
| 3 | # | ||||||||||
| 4 | package Net::Frame::Layer::OSPF::LinkStateAck; | ||||||||||
| 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 @AA = qw( | |||||||||
| 11 | lsaList | ||||||||||
| 12 | ); | ||||||||||
| 13 | 15 | __PACKAGE__->cgBuildIndices; | |||||||||
| 14 | 15 | __PACKAGE__->cgBuildAccessorsArray(\@AA); | |||||||||
| 15 | |||||||||||
| 16 | 15 | ▶ | use Net::Frame::Layer::OSPF qw(:consts); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 15 | require Net::Frame::Layer::OSPF::Lsa; | |||||||||
| 18 | |||||||||||
| 19 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 20 | shift->SUPER::new( | ||||||||||
| 21 | 1 | lsaList => [], | |||||||||
| 22 | @_, | ||||||||||
| 23 | ); | ||||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 1 | ▶ | sub pack { | ||||||||
|
Subroutine
pack: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||
| 27 | 1 | my $self = shift; | |||||||||
| 28 | |||||||||||
| 29 | 1 | my $raw = ''; | |||||||||
| 30 | 1 | for ($self->lsaList) { | |||||||||
| 31 | 0 | ▶ | $raw .= $_->pack or return undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 1 | $self->raw($raw); | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 1 | ▶ | sub unpack { | ||||||||
|
Subroutine
unpack: called CC=2 SCAR=8.0
Pod
documented
| |||||||||||
| 38 | 1 | my $self = shift; | |||||||||
| 39 | |||||||||||
| 40 | 1 | my $payload = $self->raw; | |||||||||
| 41 | |||||||||||
| 42 | 1 | my @lsaList = (); | |||||||||
| 43 | 1 | ▶ | while ($payload) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 0 | my $lsa = Net::Frame::Layer::OSPF::Lsa->new(raw => $payload, full => 0); | |||||||||
| 45 | 0 | $lsa->unpack; | |||||||||
| 46 | 0 | push @lsaList, $lsa; | |||||||||
| 47 | 0 | $payload = $lsa->payload; | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 1 | $self->lsaList(\@lsaList); | |||||||||
| 51 | 1 | $self->payload($payload); | |||||||||
| 52 | |||||||||||
| 53 | 1 | $self; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub print { | ||||||||
|
Subroutine
print: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 57 | 0 | my $self = shift; | |||||||||
| 58 | |||||||||||
| 59 | 0 | my $buf = ''; | |||||||||
| 60 | 0 | my $first = 1; | |||||||||
| 61 | 0 | for ($self->lsaList) { | |||||||||
| 62 | 0 | ▶ | $buf .= "\n" unless $first; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | 0 | $first = 0; | |||||||||
| 64 | 0 | $buf .= $_->print; | |||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | 0 | $buf; | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 15 | 1; | |||||||||
| 71 | |||||||||||
| 72 | __END__ | ||||||||||