| 1 | # | ||||||||||
| 2 | # $Id: TimeExceed.pm 56 2015-01-20 18:55:33Z gomor $ | ||||||||||
| 3 | # | ||||||||||
| 4 | package Net::Frame::Layer::ICMPv4::TimeExceed; | ||||||||||
| 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 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 17 | 1 | my $self = shift->SUPER::new( | |||||||||
| 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 | 1 | ▶ | sub pack { | ||||||||
|
Subroutine
pack: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||
| 28 | 1 | my $self = shift; | |||||||||
| 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 | 1 | ▶ | sub unpack { | ||||||||
|
Subroutine
unpack: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 37 | 1 | my $self = shift; | |||||||||
| 38 | |||||||||||
| 39 | 1 | ▶ | my ($unused, $payload) = $self->SUPER::unpack('N a*', $self->raw) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | or return; | ||||||||||
| 41 | |||||||||||
| 42 | 1 | $self->unused($unused); | |||||||||
| 43 | 1 | $self->payload($payload); | |||||||||
| 44 | |||||||||||
| 45 | 1 | return $self; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 1 | ▶ | sub encapsulate { | ||||||||
|
Subroutine
encapsulate: called CC=4 SCAR=19.4
Pod
documented
| |||||||||||
| 49 | 1 | my $self = shift; | |||||||||
| 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 | 1 | ▶ | sub print { | ||||||||
|
Subroutine
print: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 65 | 1 | my $self = shift; | |||||||||
| 66 | |||||||||||
| 67 | 1 | my $l = $self->layer; | |||||||||
| 68 | 1 | return sprintf "$l: unused:%d", $self->unused; | |||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | 4 | 1; | |||||||||
| 72 | |||||||||||
| 73 | __END__ | ||||||||||