| 1 | # | ||||||||||
| 2 | # $Id: MLD.pm 49 2009-05-31 13:15:34Z VinsWorldcom $ | ||||||||||
| 3 | # | ||||||||||
| 4 | package Net::Frame::Layer::ICMPv6::MLD; | ||||||||||
| 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 | our $VERSION = '1.00'; | |||||||||
| 8 | |||||||||||
| 9 | 4 | ▶ | use Net::Frame::Layer qw(:consts :subs); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 4 | ▶ | use Exporter; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 4 | our @ISA = qw(Net::Frame::Layer Exporter); | |||||||||
| 12 | |||||||||||
| 13 | 4 | our %EXPORT_TAGS = ( | |||||||||
| 14 | consts => [qw( | ||||||||||
| 15 | NF_MLD_ALLMLDRTRS | ||||||||||
| 16 | NF_MLD_ALLMLDRTRS_MAC | ||||||||||
| 17 | NF_MLD_TYPE_QUERY | ||||||||||
| 18 | NF_MLD_TYPE_REPORTv1 | ||||||||||
| 19 | NF_MLD_TYPE_DONE | ||||||||||
| 20 | NF_MLD_TYPE_REPORTv2 | ||||||||||
| 21 | )], | ||||||||||
| 22 | ); | ||||||||||
| 23 | our @EXPORT_OK = ( | ||||||||||
| 24 | 4 | @{$EXPORT_TAGS{consts}}, | |||||||||
| 25 | ); | ||||||||||
| 26 | |||||||||||
| 27 | 4 | ▶ | use constant NF_MLD_ALLMLDRTRS => 'ff02::16'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 4 | ▶ | use constant NF_MLD_ALLMLDRTRS_MAC => '33:33:00:00:00:16'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | 4 | ▶ | use constant NF_MLD_TYPE_QUERY => 130; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | 4 | ▶ | use constant NF_MLD_TYPE_REPORTv1 => 131; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 31 | 4 | ▶ | use constant NF_MLD_TYPE_DONE => 132; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 32 | 4 | ▶ | use constant NF_MLD_TYPE_REPORTv2 => 143; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 33 | |||||||||||
| 34 | 4 | our @AS = qw( | |||||||||
| 35 | maxResp | ||||||||||
| 36 | reserved | ||||||||||
| 37 | groupAddress | ||||||||||
| 38 | ); | ||||||||||
| 39 | 4 | __PACKAGE__->cgBuildIndices; | |||||||||
| 40 | 4 | __PACKAGE__->cgBuildAccessorsScalar(\@AS); | |||||||||
| 41 | |||||||||||
| 42 | #no strict 'vars'; | ||||||||||
| 43 | 4 | ▶ | use Net::Frame::Layer::ICMPv6::MLD::Query; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 44 | 4 | ▶ | use Net::Frame::Layer::ICMPv6::MLD::Report; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 45 | 4 | ▶ | use Net::Frame::Layer::ICMPv6::MLD::Report::Record qw(:consts); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 46 | |||||||||||
| 47 | 2 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 48 | shift->SUPER::new( | ||||||||||
| 49 | 2 | maxResp => 0, | |||||||||
| 50 | reserved => 0, | ||||||||||
| 51 | groupAddress => '::', | ||||||||||
| 52 | @_, | ||||||||||
| 53 | ); | ||||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub getLength { 20 } | ||||||||
|
Subroutine
getLength: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 57 | |||||||||||
| 58 | 1 | ▶ | sub pack { | ||||||||
|
Subroutine
pack: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||
| 59 | 1 | my $self = shift; | |||||||||
| 60 | |||||||||||
| 61 | 1 | ▶ | my $raw = $self->SUPER::pack('nna*', | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | $self->maxResp, | ||||||||||
| 63 | $self->reserved, | ||||||||||
| 64 | inet6Aton($self->groupAddress) | ||||||||||
| 65 | ) or return; | ||||||||||
| 66 | |||||||||||
| 67 | 1 | return $self->raw($raw); | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 1 | ▶ | sub unpack { | ||||||||
|
Subroutine
unpack: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 71 | 1 | my $self = shift; | |||||||||
| 72 | |||||||||||
| 73 | 1 | ▶ | my ($maxResp, $reserved, $group, $payload) = | ||||||||
|
Branch: 1 branch
| |||||||||||
| 74 | $self->SUPER::unpack('nna16 a*', $self->raw) | ||||||||||
| 75 | or return; | ||||||||||
| 76 | |||||||||||
| 77 | 1 | $self->maxResp($maxResp); | |||||||||
| 78 | 1 | $self->reserved($reserved); | |||||||||
| 79 | 1 | $self->groupAddress(inet6Ntoa($group)); | |||||||||
| 80 | |||||||||||
| 81 | 1 | $self->payload($payload); | |||||||||
| 82 | |||||||||||
| 83 | 1 | return $self; | |||||||||
| 84 | } | ||||||||||
| 85 | |||||||||||
| 86 | 1 | ▶ | sub encapsulate { | ||||||||
|
Subroutine
encapsulate: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||
| 87 | 1 | my $self = shift; | |||||||||
| 88 | |||||||||||
| 89 | 1 | ▶ | return $self->nextLayer if $self->nextLayer; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 90 | |||||||||||
| 91 | 1 | ▶ | if ($self->payload) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 92 | 0 | return 'ICMPv6::MLD::Query'; | |||||||||
| 93 | } | ||||||||||
| 94 | |||||||||||
| 95 | 1 | NF_LAYER_NONE; | |||||||||
| 96 | } | ||||||||||
| 97 | |||||||||||
| 98 | 3 | ▶ | sub print { | ||||||||
|
Subroutine
print: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 99 | 3 | my $self = shift; | |||||||||
| 100 | |||||||||||
| 101 | 3 | my $l = $self->layer; | |||||||||
| 102 | 3 | my $buf .= sprintf | |||||||||
| 103 | "$l: maxResp:%d reserved:%d\n". | ||||||||||
| 104 | "$l: groupAddress:%s", | ||||||||||
| 105 | $self->maxResp, $self->reserved, | ||||||||||
| 106 | $self->groupAddress; | ||||||||||
| 107 | |||||||||||
| 108 | 3 | return $buf; | |||||||||
| 109 | } | ||||||||||
| 110 | |||||||||||
| 111 | 4 | 1; | |||||||||
| 112 | |||||||||||
| 113 | __END__ | ||||||||||