| 1 | package Net::DRI::Protocol::OpenSRS::XCP::Host; | ||||||||||||||||||||||||||||
| 2 | #=============================================================================== | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | # FILE: Host.pm | ||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||
| 6 | # DESCRIPTION: | ||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||
| 8 | # FILES: --- | ||||||||||||||||||||||||||||
| 9 | # BUGS: --- | ||||||||||||||||||||||||||||
| 10 | # NOTES: --- | ||||||||||||||||||||||||||||
| 11 | # AUTHOR: Dmitry Belyavsky (BelDmit), <beldmit@tcinet.ru> | ||||||||||||||||||||||||||||
| 12 | # COMPANY: tcinet.ru | ||||||||||||||||||||||||||||
| 13 | # VERSION: 1.0 | ||||||||||||||||||||||||||||
| 14 | # CREATED: 04/27/2012 04:10:40 PM MSK | ||||||||||||||||||||||||||||
| 15 | # REVISION: --- | ||||||||||||||||||||||||||||
| 16 | #=============================================================================== | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Net::DRI::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | sub register_commands | ||||||||||||||||||||||||||||
| 25 | { | ||||||||||||||||||||||||||||
| 26 | 0 | ▶ | my ($class,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 27 | 0 | my %tmp=( | |||||||||||||||||||||||||||
| 28 | # info => [\&info, \&info_parse ], | ||||||||||||||||||||||||||||
| 29 | # create => [ \&create, \&create_parse ], | ||||||||||||||||||||||||||||
| 30 | # delete => [ \&delete, ], | ||||||||||||||||||||||||||||
| 31 | # update => [\&update, undef], | ||||||||||||||||||||||||||||
| 32 | # | ||||||||||||||||||||||||||||
| 33 | registry_add => [\®istry_add, ], | ||||||||||||||||||||||||||||
| 34 | registry_check => [\®istry_check, \®istry_check_parse], | ||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | return { 'nameserver' => \%tmp }; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | #################################################################################################### | ||||||||||||||||||||||||||||
| 41 | ########### Query commands | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | sub registry_check | ||||||||||||||||||||||||||||
| 44 | { | ||||||||||||||||||||||||||||
| 45 | 0 | ▶ | my ($xcp, $hostname, $registry) = @_; | ||||||||||||||||||||||||||
|
Subroutine
registry_check: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 46 | 0 | my $msg=$xcp->message(); | |||||||||||||||||||||||||||
| 47 | 0 | my %r = (action => 'registry_check_nameserver', object => 'nameserver'); | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | $msg->command(\%r); | |||||||||||||||||||||||||||
| 50 | 0 | ▶ | Net::DRI::Exception::usererr_insufficient_parameters('Missing or bad registry') unless ($registry && $registry =~ /^\./); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$registry and $registry =~ /^\./
MC/DC0%0/2
$registry and $registry =~ /^\./
$registry
$registry =~ /^\./
Truth table0%0/3
A and B
A= $registryB= $registry =~ /^\./
| |||||||||||||||||||||||||||||
| 51 | 0 | my $attr = {fqdn => $hostname, tld => $registry}; | |||||||||||||||||||||||||||
| 52 | 0 | $msg->command_attributes($attr); | |||||||||||||||||||||||||||
| 53 | 0 | return; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | sub registry_check_parse | ||||||||||||||||||||||||||||
| 57 | { | ||||||||||||||||||||||||||||
| 58 | 0 | ▶ | my ($xcp,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
registry_check_parse: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 59 | 0 | my $mes=$xcp->message(); | |||||||||||||||||||||||||||
| 60 | 0 | ▶ | return if($mes->response_code() >= 400); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 0 | $rinfo->{nameserver}->{$oname}->{action}='registry_check_nameserver'; | |||||||||||||||||||||||||||
| 63 | 0 | my $ra=$mes->response_attributes(); | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | $rinfo->{nameserver}->{$oname}->{exists} = $ra->{is_success} ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 0 | return; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | ############ Transform commands | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | sub registry_add | ||||||||||||||||||||||||||||
| 72 | { | ||||||||||||||||||||||||||||
| 73 | 0 | ▶ | my ($xcp, $hostname, $rd) = @_; | ||||||||||||||||||||||||||
|
Subroutine
registry_add: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 74 | 0 | my $msg=$xcp->message(); | |||||||||||||||||||||||||||
| 75 | 0 | my %r = (action => 'registry_add_ns', object => 'nameserver'); | |||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 0 | $msg->command(\%r); | |||||||||||||||||||||||||||
| 78 | 0 | ▶ | Net::DRI::Exception::usererr_insufficient_parameters('Missing or bad registry') unless ($rd->{tld} && $rd->{tld} =~ /^\./); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rd->{"tld"} and $rd->{"tld"} =~ /^\./
MC/DC0%0/2
$rd->{"tld"} and $rd->{"tld"} =~ /^\./
$rd->{"tld"}
$rd->{"tld"} =~ /^\./
Truth table0%0/3
A and B
A= $rd->{"tld"}B= $rd->{"tld"} =~ /^\./
| |||||||||||||||||||||||||||||
| 79 | 0 | ▶ | my $attr = {fqdn => $hostname, tld => $rd->{tld}, all => $rd->{all} || 0}; | ||||||||||||||||||||||||||
|
Condition0%0/2
$rd->{'all'} || 0
MC/DC0%0/1
$rd->{'all'} || 0
$rd->{'all'}
Truth table0%0/2
A
A= $rd->{'all'}
| |||||||||||||||||||||||||||||
| 80 | 0 | $msg->command_attributes($attr); | |||||||||||||||||||||||||||
| 81 | 0 | return; | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 1 | 1; | |||||||||||||||||||||||||||