| 1 | # | ||||||||||||||
| 2 | # Contributed by Vince http://www.vinsworld.com/ | ||||||||||||||
| 3 | # | ||||||||||||||
| 4 | # $Id: DestUnreach.pm,v bc01789674fd 2019/05/23 05:51:45 gomor $ | ||||||||||||||
| 5 | # | ||||||||||||||
| 6 | package Net::Frame::Layer::ICMPv6::DestUnreach; | ||||||||||||||
| 7 | 2 | ▶ | use strict; use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | |||||||||||||||
| 9 | 2 | ▶ | use Net::Frame::Layer qw(:consts); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 10 | 2 | our @ISA = qw(Net::Frame::Layer); | |||||||||||||
| 11 | |||||||||||||||
| 12 | 2 | our @AS = qw( | |||||||||||||
| 13 | unused | ||||||||||||||
| 14 | ); | ||||||||||||||
| 15 | 2 | __PACKAGE__->cgBuildIndices; | |||||||||||||
| 16 | 2 | __PACKAGE__->cgBuildAccessorsScalar(\@AS); | |||||||||||||
| 17 | |||||||||||||||
| 18 | 1 | ▶ | sub new { | ||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||
| 19 | 1 | my $self = shift->SUPER::new( | |||||||||||||
| 20 | unused => 0, | ||||||||||||||
| 21 | @_, | ||||||||||||||
| 22 | ); | ||||||||||||||
| 23 | |||||||||||||||
| 24 | 1 | return $self; | |||||||||||||
| 25 | } | ||||||||||||||
| 26 | |||||||||||||||
| 27 | 0 | ▶ | sub getLength { 4 } | ||||||||||||
|
Subroutine
getLength: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 28 | |||||||||||||||
| 29 | 1 | ▶ | sub pack { | ||||||||||||
|
Subroutine
pack: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||
| 30 | 1 | my $self = shift; | |||||||||||||
| 31 | |||||||||||||||
| 32 | 1 | ▶ | $self->raw($self->SUPER::pack('N', $self->unused)) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 33 | or return; | ||||||||||||||
| 34 | |||||||||||||||
| 35 | 1 | return $self->raw; | |||||||||||||
| 36 | } | ||||||||||||||
| 37 | |||||||||||||||
| 38 | 1 | ▶ | sub unpack { | ||||||||||||
|
Subroutine
unpack: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||
| 39 | 1 | my $self = shift; | |||||||||||||
| 40 | |||||||||||||||
| 41 | 1 | ▶ | my ($unused, $payload) = $self->SUPER::unpack('N a*', $self->raw) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 42 | or return undef; | ||||||||||||||
| 43 | |||||||||||||||
| 44 | 1 | $self->unused($unused); | |||||||||||||
| 45 | 1 | $self->payload($payload); | |||||||||||||
| 46 | |||||||||||||||
| 47 | 1 | return $self; | |||||||||||||
| 48 | } | ||||||||||||||
| 49 | |||||||||||||||
| 50 | 0 | ▶ | sub encapsulate { | ||||||||||||
|
Subroutine
encapsulate: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||
| 51 | 0 | my $self = shift; | |||||||||||||
| 52 | |||||||||||||||
| 53 | 0 | ▶ | return $self->nextLayer if $self->nextLayer; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 54 | |||||||||||||||
| 55 | 0 | ▶ | if ($self->payload) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 56 | 0 | my $pLen = length($self->payload); | |||||||||||||
| 57 | 0 | ▶ | if ($pLen < 40) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 58 | 0 | $self->payload($self->payload.("\x00" x (40 - $pLen))); | |||||||||||||
| 59 | } elsif ($pLen > 1240) { | ||||||||||||||
| 60 | 0 | $self->payload(substr $self->payload, 0, 1240); | |||||||||||||
| 61 | } | ||||||||||||||
| 62 | 0 | return 'IPv6'; | |||||||||||||
| 63 | } | ||||||||||||||
| 64 | |||||||||||||||
| 65 | 0 | return NF_LAYER_NONE; | |||||||||||||
| 66 | } | ||||||||||||||
| 67 | |||||||||||||||
| 68 | 0 | ▶ | sub print { | ||||||||||||
|
Subroutine
print: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 69 | 0 | my $self = shift; | |||||||||||||
| 70 | |||||||||||||||
| 71 | 0 | my $l = $self->layer; | |||||||||||||
| 72 | 0 | return sprintf "$l: unused:%d", $self->unused; | |||||||||||||
| 73 | } | ||||||||||||||
| 74 | |||||||||||||||
| 75 | 2 | 1; | |||||||||||||
| 76 | |||||||||||||||
| 77 | __END__ | ||||||||||||||