| 1 | ## Domain Registry Interface, VeriSign Zone Management EPP extension | ||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2012,2015,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 4 | ## | ||||||||||||||||||||||||||||
| 5 | ## This file is part of Net::DRI | ||||||||||||||||||||||||||||
| 6 | ## | ||||||||||||||||||||||||||||
| 7 | ## Net::DRI is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 8 | ## it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 9 | ## the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 10 | ## (at your option) any later version. | ||||||||||||||||||||||||||||
| 11 | ## | ||||||||||||||||||||||||||||
| 12 | ## See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 13 | #################################################################################################### | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | package Net::DRI::Protocol::EPP::Extensions::VeriSign::ZoneManagement; | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use Net::DRI::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | #################################################################################################### | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | sub register_commands | ||||||||||||||||||||||||||||
| 26 | { | ||||||||||||||||||||||||||||
| 27 | 0 | ▶ | my ($class,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 28 | 0 | return { 'domain' => { create => [ \&domain_create_generate, undef ], | |||||||||||||||||||||||||||
| 29 | info => [ undef, \&domain_info_parse ], | ||||||||||||||||||||||||||||
| 30 | update => [ \&domain_update_generate, undef ] }, | ||||||||||||||||||||||||||||
| 31 | }; | ||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | sub setup | ||||||||||||||||||||||||||||
| 35 | { | ||||||||||||||||||||||||||||
| 36 | 0 | ▶ | my ($class,$po,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 37 | 0 | $po->ns({ 'zoneMgt' => 'http://www.verisign.com/epp/zoneMgt-1.0', | |||||||||||||||||||||||||||
| 38 | }); | ||||||||||||||||||||||||||||
| 39 | 0 | return; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | #################################################################################################### | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | sub _generate_rrecs | ||||||||||||||||||||||||||||
| 45 | { | ||||||||||||||||||||||||||||
| 46 | 0 | ▶ | my ($rr)=@_; | ||||||||||||||||||||||||||
|
Subroutine
_generate_rrecs: not called CC=12 SCAR=50.5
| |||||||||||||||||||||||||||||
| 47 | 0 | ▶ | my @d=ref $rr eq 'ARRAY' ? @$rr : ($rr); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('RRs must be array of ref hashes') if grep { ref $_ ne 'HASH' } @d; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 0 | my @r; | |||||||||||||||||||||||||||
| 51 | 0 | foreach my $r (@d) | |||||||||||||||||||||||||||
| 52 | { | ||||||||||||||||||||||||||||
| 53 | 0 | my @rr; | |||||||||||||||||||||||||||
| 54 | 0 | ▶ | Net::DRI::Exception::usererr_insufficient_parameters('In RR, "type" key must exist') unless Net::DRI::Util::has_key($r,'type'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('In RR, for key "type", value must be an XML token') unless Net::DRI::Util::xml_is_token($r->{type}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | 0 | push @rr,['zoneMgt:type',$r->{type}]; | |||||||||||||||||||||||||||
| 57 | 0 | ▶ | if (Net::DRI::Util::has_key($r,'class')) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||
| 59 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('In RR, for key "class", value must be an XML token, if provided') unless Net::DRI::Util::xml_is_token($r->{class}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 0 | push @rr,['zoneMgt:class',$r->{class}]; | |||||||||||||||||||||||||||
| 61 | } else | ||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||
| 63 | 0 | push @rr,['zoneMgt:class','IN']; | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | 0 | ▶ | if (Net::DRI::Util::has_key($r,'ttl')) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | { | ||||||||||||||||||||||||||||
| 67 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('In RR, for key "ttl", value must be an XML integeter, if provided') unless Net::DRI::Util::verify_int($r->{ttl}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | 0 | push @rr,['zoneMgt:ttl',$r->{ttl}]; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | 0 | ▶ | Net::DRI::Exception::usererr_insufficient_parameters('In RR, "rdata" key must exist') unless Net::DRI::Util::has_key($r,'rdata'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('In RR, for key "rdata", value must be an XML token') unless Net::DRI::Util::xml_is_token($r->{rdata}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | 0 | push @rr,['zoneMgt:rdata',$r->{rdata}]; | |||||||||||||||||||||||||||
| 73 | 0 | push @r,['zoneMgt:rrec',@rr]; | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | 0 | return @r; | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | sub domain_create_generate | ||||||||||||||||||||||||||||
| 79 | { | ||||||||||||||||||||||||||||
| 80 | 0 | ▶ | my ($epp,$domain,$rp)=@_; | ||||||||||||||||||||||||||
|
Subroutine
domain_create_generate: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 81 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 0 | ▶ | return unless Net::DRI::Util::has_key($rp,'zone'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 0 | my $eid=$mes->command_extension_register('zoneMgt','create'); | |||||||||||||||||||||||||||
| 86 | 0 | $mes->command_extension($eid,[_generate_rrecs($rp->{zone})]); | |||||||||||||||||||||||||||
| 87 | 0 | return; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | sub domain_info_parse | ||||||||||||||||||||||||||||
| 91 | { | ||||||||||||||||||||||||||||
| 92 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
domain_info_parse: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 93 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 94 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | my $data=$mes->get_response('zoneMgt','infData'); | |||||||||||||||||||||||||||
| 97 | 0 | ▶ | return unless defined $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 0 | my @r; | |||||||||||||||||||||||||||
| 100 | 0 | foreach my $el (Net::DRI::Util::xml_list_children($data)) | |||||||||||||||||||||||||||
| 101 | { | ||||||||||||||||||||||||||||
| 102 | 0 | my ($name,$c)=@$el; | |||||||||||||||||||||||||||
| 103 | 0 | my %r; | |||||||||||||||||||||||||||
| 104 | 0 | ▶ | if ($name eq 'rrec') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | { | ||||||||||||||||||||||||||||
| 106 | 0 | foreach my $subel (Net::DRI::Util::xml_list_children($c)) | |||||||||||||||||||||||||||
| 107 | { | ||||||||||||||||||||||||||||
| 108 | 0 | my ($subname,$subc)=@$subel; | |||||||||||||||||||||||||||
| 109 | 0 | ▶ | if ($subname=~m/^(type|class|ttl|rdata)$/) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | { | ||||||||||||||||||||||||||||
| 111 | 0 | $r{$1}=$subc->textContent(); | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | 0 | push @r,\%r; | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 0 | $rinfo->{domain}->{$oname}->{zone}=\@r; | |||||||||||||||||||||||||||
| 119 | 0 | return; | |||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | sub domain_update_generate | ||||||||||||||||||||||||||||
| 123 | { | ||||||||||||||||||||||||||||
| 124 | 0 | ▶ | my ($epp,$domain,$todo,$rp)=@_; | ||||||||||||||||||||||||||
|
Subroutine
domain_update_generate: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 0 | ▶ | if (grep { ! /^(?:add|del)$/ } $todo->types('zone')) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | { | ||||||||||||||||||||||||||||
| 128 | 0 | Net::DRI::Exception->die(0,'protocol/EPP',11,'Only zone add/del available for domain'); | |||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 0 | my $zadd=$todo->add('zone'); | |||||||||||||||||||||||||||
| 132 | 0 | my $zdel=$todo->del('zone'); | |||||||||||||||||||||||||||
| 133 | 0 | ▶ | return unless $zadd || $zdel; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$zadd or $zdel
MC/DC0%0/2
$zadd or $zdel
$zadd
$zdel
Truth table0%0/3
A or B
A= $zaddB= $zdel
| |||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 0 | my @n; | |||||||||||||||||||||||||||
| 136 | 0 | ▶ | push @n,['zoneMgt:add',_generate_rrecs($zadd)] if $zadd; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | 0 | ▶ | push @n,['zoneMgt:rem',_generate_rrecs($zdel)] if $zdel; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||
| 140 | 0 | my $eid=$mes->command_extension_register('zoneMgt','update'); | |||||||||||||||||||||||||||
| 141 | 0 | $mes->command_extension($eid,\@n); | |||||||||||||||||||||||||||
| 142 | 0 | return; | |||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | #################################################################################################### | ||||||||||||||||||||||||||||
| 146 | 1 | 1; | |||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | __END__ | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | =pod | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | =head1 NAME | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | Net::DRI::Protocol::EPP::Extensions::VeriSign::ZoneManagement - VeriSign Zone Management EPP for Net::DRI | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | Please see the README file for details. | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | Copyright (c) 2012,2015,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 179 | All rights reserved. | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 182 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 183 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 184 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | =cut | ||||||||||||||||||||||||||||