| 1 | # | ||||||||||
| 2 | # $Id: NS.pm 49 2009-05-31 13:15:34Z VinsWorldcom $ | ||||||||||
| 3 | # | ||||||||||
| 4 | package Net::Frame::Layer::DNS::RR::NS; | ||||||||||
| 5 | 7 | ▶ | use strict; use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 7 | ▶ | use Net::Frame::Layer qw(:consts :subs); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 7 | our @ISA = qw(Net::Frame::Layer Exporter); | |||||||||
| 9 | |||||||||||
| 10 | 7 | our @AS = qw( | |||||||||
| 11 | nsdname | ||||||||||
| 12 | ); | ||||||||||
| 13 | 7 | __PACKAGE__->cgBuildIndices; | |||||||||
| 14 | 7 | __PACKAGE__->cgBuildAccessorsScalar(\@AS); | |||||||||
| 15 | |||||||||||
| 16 | 7 | ▶ | use Net::Frame::Layer::DNS qw(:subs); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 19 | shift->SUPER::new( | ||||||||||
| 20 | 1 | nsdname => 'localhost', | |||||||||
| 21 | @_, | ||||||||||
| 22 | ); | ||||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | sub getLength { | ||||||||
|
Subroutine
getLength: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 26 | 0 | my $self = shift; | |||||||||
| 27 | 0 | return length($self->nsdname) | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 2 | ▶ | sub pack { | ||||||||
|
Subroutine
pack: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 31 | 2 | my $self = shift; | |||||||||
| 32 | |||||||||||
| 33 | 2 | my $name = dnsAton($self->nsdname); | |||||||||
| 34 | |||||||||||
| 35 | 2 | ▶ | $self->raw($self->SUPER::pack('H*', | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | $name | ||||||||||
| 37 | )) or return; | ||||||||||
| 38 | |||||||||||
| 39 | 2 | return $self->raw; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 0 | ▶ | sub unpack { | ||||||||
|
Subroutine
unpack: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 43 | 0 | my $self = shift; | |||||||||
| 44 | |||||||||||
| 45 | 0 | my ($name, $ptr) = dnsNtoa($self->raw); | |||||||||
| 46 | |||||||||||
| 47 | 0 | $self->nsdname($name); | |||||||||
| 48 | |||||||||||
| 49 | 0 | $self->payload(substr $self->raw, $ptr); | |||||||||
| 50 | |||||||||||
| 51 | 0 | return $self; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 0 | ▶ | sub encapsulate { | ||||||||
|
Subroutine
encapsulate: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 55 | 0 | my $self = shift; | |||||||||
| 56 | |||||||||||
| 57 | 0 | ▶ | return $self->nextLayer if $self->nextLayer; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | |||||||||||
| 59 | 0 | ▶ | if ($self->payload) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 60 | 0 | return 'DNS::RR'; | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | 0 | NF_LAYER_NONE; | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | 2 | ▶ | sub print { | ||||||||
|
Subroutine
print: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 67 | 2 | my $self = shift; | |||||||||
| 68 | |||||||||||
| 69 | 2 | my $l = $self->layer; | |||||||||
| 70 | 2 | my $buf = sprintf | |||||||||
| 71 | "$l: nsdname:%s", | ||||||||||
| 72 | $self->nsdname; | ||||||||||
| 73 | |||||||||||
| 74 | 2 | return $buf; | |||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | 7 | 1; | |||||||||
| 78 | |||||||||||
| 79 | __END__ | ||||||||||