| 1 | # | ||||||||||
| 2 | # $Id: HINFO.pm 49 2009-05-31 13:15:34Z VinsWorldcom $ | ||||||||||
| 3 | # | ||||||||||
| 4 | package Net::Frame::Layer::DNS::RR::HINFO; | ||||||||||
| 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 | cpu | ||||||||||
| 12 | os | ||||||||||
| 13 | ); | ||||||||||
| 14 | 7 | __PACKAGE__->cgBuildIndices; | |||||||||
| 15 | 7 | __PACKAGE__->cgBuildAccessorsScalar(\@AS); | |||||||||
| 16 | |||||||||||
| 17 | 7 | ▶ | use Net::Frame::Layer::DNS qw(:subs); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | |||||||||||
| 19 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 20 | shift->SUPER::new( | ||||||||||
| 21 | 1 | cpu => 'PC', | |||||||||
| 22 | os => 'Windows', | ||||||||||
| 23 | @_, | ||||||||||
| 24 | ); | ||||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | sub getLength { | ||||||||
|
Subroutine
getLength: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 28 | 0 | my $self = shift; | |||||||||
| 29 | 0 | return length($self->cpu) + length($self->os) | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 2 | ▶ | sub pack { | ||||||||
|
Subroutine
pack: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 33 | 2 | my $self = shift; | |||||||||
| 34 | |||||||||||
| 35 | 2 | my $cpu = CORE::pack('C a*', | |||||||||
| 36 | length($self->cpu), $self->cpu | ||||||||||
| 37 | ); | ||||||||||
| 38 | 2 | my $os = CORE::pack('C a*', | |||||||||
| 39 | length($self->os), $self->os | ||||||||||
| 40 | ); | ||||||||||
| 41 | |||||||||||
| 42 | 2 | $self->raw($cpu . $os); | |||||||||
| 43 | |||||||||||
| 44 | 2 | return $self->raw; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 0 | ▶ | sub unpack { | ||||||||
|
Subroutine
unpack: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||
| 48 | 0 | my $self = shift; | |||||||||
| 49 | |||||||||||
| 50 | 0 | ▶ | my ($cpulen) = | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | $self->SUPER::unpack('C', $self->raw) | ||||||||||
| 52 | or return; | ||||||||||
| 53 | |||||||||||
| 54 | 0 | ▶ | my ($cpudata) = | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | $self->SUPER::unpack('a*', substr $self->raw, 1, $cpulen) | ||||||||||
| 56 | or return; | ||||||||||
| 57 | |||||||||||
| 58 | 0 | ▶ | my ($oslen) = | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | $self->SUPER::unpack('C', substr $self->raw, 1+$cpulen) | ||||||||||
| 60 | or return; | ||||||||||
| 61 | |||||||||||
| 62 | 0 | ▶ | my ($osdata) = | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | $self->SUPER::unpack('a*', substr $self->raw, 2+$cpulen, $oslen) | ||||||||||
| 64 | or return; | ||||||||||
| 65 | |||||||||||
| 66 | 0 | $self->cpu($cpudata); | |||||||||
| 67 | 0 | $self->os($osdata); | |||||||||
| 68 | |||||||||||
| 69 | 0 | $self->payload(substr $self->raw, 2+$cpulen+$oslen); | |||||||||
| 70 | |||||||||||
| 71 | 0 | return $self; | |||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | 0 | ▶ | sub encapsulate { | ||||||||
|
Subroutine
encapsulate: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 75 | 0 | my $self = shift; | |||||||||
| 76 | |||||||||||
| 77 | 0 | ▶ | return $self->nextLayer if $self->nextLayer; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 78 | |||||||||||
| 79 | 0 | ▶ | if ($self->payload) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 80 | 0 | return 'DNS::RR'; | |||||||||
| 81 | } | ||||||||||
| 82 | |||||||||||
| 83 | 0 | NF_LAYER_NONE; | |||||||||
| 84 | } | ||||||||||
| 85 | |||||||||||
| 86 | 2 | ▶ | sub print { | ||||||||
|
Subroutine
print: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 87 | 2 | my $self = shift; | |||||||||
| 88 | |||||||||||
| 89 | 2 | my $l = $self->layer; | |||||||||
| 90 | 2 | my $buf = sprintf | |||||||||
| 91 | "$l: cpu:%s os:%s", | ||||||||||
| 92 | $self->cpu, $self->os; | ||||||||||
| 93 | |||||||||||
| 94 | 2 | return $buf; | |||||||||
| 95 | } | ||||||||||
| 96 | |||||||||||
| 97 | 7 | 1; | |||||||||
| 98 | |||||||||||
| 99 | __END__ | ||||||||||