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