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