| 1 | ## Domain Registry Interface, VeriSign EPP Client Object Attribute Extension | ||||||||||||||||||||||||||||
| 2 | ## From epp-client-object-attribute.pdf | ||||||||||||||||||||||||||||
| 3 | ## | ||||||||||||||||||||||||||||
| 4 | ## Copyright (c) 2011-2013,2016,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 5 | ## | ||||||||||||||||||||||||||||
| 6 | ## This file is part of Net::DRI | ||||||||||||||||||||||||||||
| 7 | ## | ||||||||||||||||||||||||||||
| 8 | ## Net::DRI is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 9 | ## it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 10 | ## the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 11 | ## (at your option) any later version. | ||||||||||||||||||||||||||||
| 12 | ## | ||||||||||||||||||||||||||||
| 13 | ## See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 14 | #################################################################################################### | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | package Net::DRI::Protocol::EPP::Extensions::VeriSign::ClientAttributes; | ||||||||||||||||||||||||||||
| 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::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | #################################################################################################### | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | sub register_commands | ||||||||||||||||||||||||||||
| 27 | { | ||||||||||||||||||||||||||||
| 28 | 0 | ▶ | my ($class,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | return { 'domain' => { 'info' => [ undef, \&info_parse ], | |||||||||||||||||||||||||||
| 31 | 'create' => [ \&create, undef ], | ||||||||||||||||||||||||||||
| 32 | 'update' => [ \&update, undef ], | ||||||||||||||||||||||||||||
| 33 | } }; | ||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | sub setup | ||||||||||||||||||||||||||||
| 37 | { | ||||||||||||||||||||||||||||
| 38 | 0 | ▶ | my ($class,$po,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 39 | 0 | $po->ns({ 'coa' => 'urn:ietf:params:xml:ns:coa-1.0' }); | |||||||||||||||||||||||||||
| 40 | 0 | return; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 0 | ▶ | sub capabilities_add { return ('domain_update','client_attributes',['add','del']); } | ||||||||||||||||||||||||||
|
Subroutine
capabilities_add: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | #################################################################################################### | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | sub info_parse | ||||||||||||||||||||||||||||
| 48 | { | ||||||||||||||||||||||||||||
| 49 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
info_parse: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 50 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 51 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 0 | my $infdata=$mes->get_extension('coa','infData'); | |||||||||||||||||||||||||||
| 54 | 0 | ▶ | return unless defined $infdata; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | my %coa; | |||||||||||||||||||||||||||
| 57 | 0 | my $ns=$mes->ns('coa'); | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 0 | foreach my $el (Net::DRI::Util::xml_list_children($infdata)) | |||||||||||||||||||||||||||
| 60 | { | ||||||||||||||||||||||||||||
| 61 | 0 | my ($name,$node)=@$el; | |||||||||||||||||||||||||||
| 62 | 0 | ▶ | next unless $name eq 'attr'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 63 | 0 | $coa{Net::DRI::Util::xml_child_content($node,$ns,'key')}=Net::DRI::Util::xml_child_content($node,$ns,'value'); | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | $rinfo->{domain}->{$oname}->{'client_attributes'}=\%coa; | |||||||||||||||||||||||||||
| 67 | 0 | return; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | sub add_coa | ||||||||||||||||||||||||||||
| 71 | { | ||||||||||||||||||||||||||||
| 72 | 0 | ▶ | my ($name,$coa)=@_; | ||||||||||||||||||||||||||
|
Subroutine
add_coa: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 0 | my @d; | |||||||||||||||||||||||||||
| 75 | 0 | ▶ | while(my ($k,$v)=each(%$coa)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 76 | { | ||||||||||||||||||||||||||||
| 77 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('Key parameter must be XML token of 50 characters or less, not: '.$k) unless Net::DRI::Util::xml_is_token($k,1,50); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | 0 | ▶ | if ($name eq 'rem') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | { | ||||||||||||||||||||||||||||
| 80 | 0 | push @d,['coa:key',$k]; | |||||||||||||||||||||||||||
| 81 | 0 | next; | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('Value parameter must be XML token of 1000 characters or less, not: '.$v) unless Net::DRI::Util::xml_is_token($v,1,1000); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | 0 | push @d,['coa:attr',['coa:key',$k],['coa:value',$v]]; | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 0 | return @d; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | sub create | ||||||||||||||||||||||||||||
| 91 | { | ||||||||||||||||||||||||||||
| 92 | 0 | ▶ | my ($epp,$domain,$rd)=@_; | ||||||||||||||||||||||||||
|
Subroutine
create: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 0 | ▶ | return unless Net::DRI::Util::has_key($rd,'client_attributes'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | my $rcoa=$rd->{client_attributes}; | |||||||||||||||||||||||||||
| 97 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('client_attributes must be a hash ref') unless ref $rcoa eq 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||
| 100 | 0 | my $eid=$mes->command_extension_register('coa', 'create'); | |||||||||||||||||||||||||||
| 101 | 0 | $mes->command_extension($eid,add_coa('create',$rcoa)); | |||||||||||||||||||||||||||
| 102 | 0 | return; | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | sub update | ||||||||||||||||||||||||||||
| 106 | { | ||||||||||||||||||||||||||||
| 107 | 0 | ▶ | my ($epp,$domain,$todo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
update: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 0 | my $rem=$todo->del('client_attributes'); | |||||||||||||||||||||||||||
| 110 | 0 | my $put=$todo->add('client_attributes'); | |||||||||||||||||||||||||||
| 111 | 0 | ▶ | return unless defined $rem || defined $put; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $rem or defined $put
MC/DC0%0/2
defined $rem or defined $put
defined $rem
defined $put
Truth table0%0/3
A or B
A= defined $remB= defined $put
| |||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 0 | my @d; | |||||||||||||||||||||||||||
| 114 | 0 | ▶ | if (defined $rem) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 115 | { | ||||||||||||||||||||||||||||
| 116 | 0 | ▶ | $rem={ $rem => undef } if ! ref $rem; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | 0 | ▶ | $rem={ map { $_ => undef } @$rem } if ref $rem eq 'ARRAY'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 118 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('client_attributes to delete must be a hash ref') unless ref $rem eq 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 119 | 0 | push @d,['coa:rem',add_coa('rem',$rem)]; | |||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | 0 | ▶ | if (defined $put) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | { | ||||||||||||||||||||||||||||
| 123 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('client_attributes to add must be a hash ref') unless ref $put eq 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 124 | 0 | push @d,['coa:put',add_coa('put',$put)]; | |||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||
| 128 | 0 | my $eid=$mes->command_extension_register('coa', 'update'); | |||||||||||||||||||||||||||
| 129 | 0 | $mes->command_extension($eid,@d); | |||||||||||||||||||||||||||
| 130 | 0 | return; | |||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | ######################################################################################################### | ||||||||||||||||||||||||||||
| 134 | 1 | 1; | |||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | __END__ | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | =pod | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | =head1 NAME | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | Net::DRI::Protocol::EPP::Extensions::VeriSign::ClientAttributes - VeriSign EPP Client Object Attribute Extension for Net::DRI | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | $dri=Net::DRI->new(); | ||||||||||||||||||||||||||||
| 147 | $dri->add_current_registry('VeriSign::COM_NET',{client_id=>'XXXXXX'); | ||||||||||||||||||||||||||||
| 148 | $dri->add_current_profile(...); | ||||||||||||||||||||||||||||
| 149 | $rc=$dri->domain_info('whatever.com'); | ||||||||||||||||||||||||||||
| 150 | $rh=$rc->get_data('client_attributes'); | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | This extension is loaded by default during add_profile. | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | Please see the README file for details. | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | Copyright (c) 2011-2013,2016,2018 Patrick Mevzek <netdri@dotandco.com>. | ||||||||||||||||||||||||||||
| 177 | All rights reserved. | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 180 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 181 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 182 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | =cut | ||||||||||||||||||||||||||||