| 1 | package Net::DNS::RR::SSHFP; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | our $VERSION = (qw$Id: SSHFP.pm 2003 2025-01-21 12:06:06Z willem $)[2]; | |||||||||||
| 6 | |||||||||||||
| 7 | 1 | ▶ | use base qw(Net::DNS::RR); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | |||||||||||||
| 10 | =head1 NAME | ||||||||||||
| 11 | |||||||||||||
| 12 | Net::DNS::RR::SSHFP - DNS SSHFP resource record | ||||||||||||
| 13 | |||||||||||||
| 14 | =cut | ||||||||||||
| 15 | |||||||||||||
| 16 | 1 | ▶ | use integer; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | |||||||||||||
| 18 | 1 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | |||||||||||||
| 20 | 1 | ▶ | use constant BABBLE => defined eval { require Digest::BubbleBabble }; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 21 | |||||||||||||
| 22 | |||||||||||||
| 23 | 1 | ▶ | sub _decode_rdata { ## decode rdata from wire-format octet string | ||||||||||
|
Subroutine
_decode_rdata: called CC=1 SCAR=0.0
| |||||||||||||
| 24 | 1 | my ( $self, $data, $offset ) = @_; | |||||||||||
| 25 | |||||||||||||
| 26 | 1 | my $size = $self->{rdlength} - 2; | |||||||||||
| 27 | 1 | @{$self}{qw(algorithm fptype fpbin)} = unpack "\@$offset C2 a$size", $$data; | |||||||||||
| 28 | 1 | return; | |||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | |||||||||||||
| 32 | 5 | ▶ | sub _encode_rdata { ## encode rdata as wire-format octet string | ||||||||||
|
Subroutine
_encode_rdata: called CC=1 SCAR=0.0
| |||||||||||||
| 33 | 5 | my $self = shift; | |||||||||||
| 34 | |||||||||||||
| 35 | 5 | return pack 'C2 a*', @{$self}{qw(algorithm fptype fpbin)}; | |||||||||||
| 36 | } | ||||||||||||
| 37 | |||||||||||||
| 38 | |||||||||||||
| 39 | 3 | ▶ | sub _format_rdata { ## format rdata portion of RR string. | ||||||||||
|
Subroutine
_format_rdata: called CC=1 SCAR=0.0
| |||||||||||||
| 40 | 3 | my $self = shift; | |||||||||||
| 41 | |||||||||||||
| 42 | 3 | $self->_annotation( $self->babble ) if BABBLE; | |||||||||||
| 43 | 3 | my @fprint = split /(\S{64})/, $self->fp; | |||||||||||
| 44 | 3 | my @rdata = ( $self->algorithm, $self->fptype, @fprint ); | |||||||||||
| 45 | 3 | return @rdata; | |||||||||||
| 46 | } | ||||||||||||
| 47 | |||||||||||||
| 48 | |||||||||||||
| 49 | 2 | ▶ | sub _parse_rdata { ## populate RR from rdata in argument list | ||||||||||
|
Subroutine
_parse_rdata: called CC=2 SCAR=6.9
| |||||||||||||
| 50 | 2 | my ( $self, @argument ) = @_; | |||||||||||
| 51 | |||||||||||||
| 52 | 2 | for (qw(algorithm fptype)) { $self->$_( shift @argument ) } | |||||||||||
| 53 | 2 | $self->fp(@argument); | |||||||||||
| 54 | 2 | return; | |||||||||||
| 55 | } | ||||||||||||
| 56 | |||||||||||||
| 57 | |||||||||||||
| 58 | 8 | ▶ | sub algorithm { | ||||||||||
|
Subroutine
algorithm: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 59 | 8 | my ( $self, @value ) = @_; | |||||||||||
| 60 | 8 | for (@value) { $self->{algorithm} = 0 + $_ } | |||||||||||
| 61 | 8 | ▶ | return $self->{algorithm} || 0; | ||||||||||
|
Condition100%2/2
$self->{'algorithm'} || 0
MC/DC100%1/1
$self->{'algorithm'} || 0
$self->{'algorithm'}
Truth table100%2/2
A
A= $self->{'algorithm'}
| |||||||||||||
| 62 | } | ||||||||||||
| 63 | |||||||||||||
| 64 | |||||||||||||
| 65 | 8 | ▶ | sub fptype { | ||||||||||
|
Subroutine
fptype: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 66 | 8 | my ( $self, @value ) = @_; | |||||||||||
| 67 | 8 | for (@value) { $self->{fptype} = 0 + $_ } | |||||||||||
| 68 | 8 | ▶ | return $self->{fptype} || 0; | ||||||||||
|
Condition100%2/2
$self->{'fptype'} || 0
MC/DC100%1/1
$self->{'fptype'} || 0
$self->{'fptype'}
Truth table100%2/2
A
A= $self->{'fptype'}
| |||||||||||||
| 69 | } | ||||||||||||
| 70 | |||||||||||||
| 71 | |||||||||||||
| 72 | 11 | ▶ | sub fp { | ||||||||||
|
Subroutine
fp: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 73 | 11 | my ( $self, @value ) = @_; | |||||||||||
| 74 | 11 | ▶ | return unpack "H*", $self->fpbin() unless scalar @value; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 75 | 4 | ▶ | my @hex = map { /^"*([\dA-Fa-f]*)"*$/ || croak("corrupt hex"); $1 } @value; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 76 | 3 | return $self->fpbin( pack "H*", join "", @hex ); | |||||||||||
| 77 | } | ||||||||||||
| 78 | |||||||||||||
| 79 | |||||||||||||
| 80 | 17 | ▶ | sub fpbin { | ||||||||||
|
Subroutine
fpbin: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 81 | 17 | my ( $self, @value ) = @_; | |||||||||||
| 82 | 17 | for (@value) { $self->{fpbin} = $_ } | |||||||||||
| 83 | 17 | ▶ | return $self->{fpbin} || ""; | ||||||||||
|
Condition100%2/2
$self->{'fpbin'} || ''
MC/DC100%1/1
$self->{'fpbin'} || ''
$self->{'fpbin'}
Truth table100%2/2
A
A= $self->{'fpbin'}
| |||||||||||||
| 84 | } | ||||||||||||
| 85 | |||||||||||||
| 86 | |||||||||||||
| 87 | 5 | ▶ | sub babble { | ||||||||||
|
Subroutine
babble: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 88 | 5 | return BABBLE ? Digest::BubbleBabble::bubblebabble( Digest => shift->fpbin ) : ''; | |||||||||||
| 89 | } | ||||||||||||
| 90 | |||||||||||||
| 91 | |||||||||||||
| 92 | 2 | ▶ | sub fingerprint { return &fp; } ## historical | ||||||||||
|
Subroutine
fingerprint: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 93 | |||||||||||||
| 94 | |||||||||||||
| 95 | 1 | 1; | |||||||||||
| 96 | __END__ | ||||||||||||