« DRI/Protocol/EPP/Extensions/AFNIC/Notifications.pm
↑ Summary
DRI/Protocol/EPP/Extensions/AERO/Contact.pm »
| 1 | ## Domain Registry Interface, VeriSign EPP WhoWas Extension | ||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2010,2012,2013,2016,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::WhoWas; | ||||||||||||||||||||||||||||
| 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 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 27 | 0 | my ($class,$version)=@_; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | return { 'domain' => { 'whowas' => [ \&whowas_info, \&whowas_parse ] } }; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | sub setup | ||||||||||||||||||||||||||||
| 33 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 34 | 0 | my ($class,$po,$version)=@_; | |||||||||||||||||||||||||||
| 35 | 0 | $po->ns({ 'whowas' => 'http://www.verisign.com/epp/whowas-1.0' }); | |||||||||||||||||||||||||||
| 36 | 0 | return; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | #################################################################################################### | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | sub whowas_info | ||||||||||||||||||||||||||||
| 42 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
whowas_info: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 43 | 0 | my ($epp,$domain,$rd)=@_; | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | Net::DRI::Exception->die(1,'protocol/EPP',2,'Domain name needed') unless defined $domain && length $domain; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $domain and length $domain
MC/DC0%0/2
defined $domain and length $domain
defined $domain
length $domain
Truth table0%0/3
A and B
A= defined $domainB= length $domain
| |||||||||||||||||||||||||||||
| 46 | 0 | my $isroid=0; | |||||||||||||||||||||||||||
| 47 | 0 | ▶ | if (index($domain,'.') > -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | { | ||||||||||||||||||||||||||||
| 49 | 0 | ▶ | Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid domain name: '.$domain) unless Net::DRI::Util::is_hostname($domain); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | } else | ||||||||||||||||||||||||||||
| 51 | { | ||||||||||||||||||||||||||||
| 52 | 0 | ▶ | Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid ROID value: '.$domain) unless Net::DRI::Util::is_roid($domain); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | 0 | $isroid=1; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||
| 56 | 0 | $mes->command(['info','whowas:info', $mes->nsattrs('whowas')]); | |||||||||||||||||||||||||||
| 57 | 0 | ▶ | $mes->command_body([['whowas:type','domain'],[$isroid ? 'whowas:roid' : 'whowas:name',$domain]]); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | 0 | return; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | sub whowas_parse | ||||||||||||||||||||||||||||
| 62 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
whowas_parse: not called CC=12 SCAR=50.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 63 | 0 | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | |||||||||||||||||||||||||||
| 64 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 65 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 0 | my $infdata=$mes->get_response('whowas','infData'); | |||||||||||||||||||||||||||
| 67 | 0 | ▶ | return unless defined $infdata; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 0 | my %r=(action => 'whowas', name => undef, type => undef, history => []); | |||||||||||||||||||||||||||
| 70 | 0 | foreach my $el (Net::DRI::Util::xml_list_children($infdata)) | |||||||||||||||||||||||||||
| 71 | { | ||||||||||||||||||||||||||||
| 72 | 0 | my ($name,$c)=@$el; | |||||||||||||||||||||||||||
| 73 | 0 | ▶ | if ($name eq 'type') | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 74 | { | ||||||||||||||||||||||||||||
| 75 | 0 | $r{type}=$c->textContent(); | |||||||||||||||||||||||||||
| 76 | } elsif ($name eq 'name') | ||||||||||||||||||||||||||||
| 77 | { | ||||||||||||||||||||||||||||
| 78 | 0 | $r{name}=$c->textContent(); | |||||||||||||||||||||||||||
| 79 | } elsif ($name eq 'history') | ||||||||||||||||||||||||||||
| 80 | { | ||||||||||||||||||||||||||||
| 81 | 0 | foreach my $subel (Net::DRI::Util::xml_list_children($c)) | |||||||||||||||||||||||||||
| 82 | { | ||||||||||||||||||||||||||||
| 83 | 0 | my ($subname,$subnode)=@$subel; | |||||||||||||||||||||||||||
| 84 | 0 | ▶ | next unless $subname eq 'rec'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 85 | 0 | my %rec; | |||||||||||||||||||||||||||
| 86 | 0 | foreach my $rec (Net::DRI::Util::xml_list_children($subnode)) | |||||||||||||||||||||||||||
| 87 | { | ||||||||||||||||||||||||||||
| 88 | 0 | my ($recname,$recnode)=@$rec; | |||||||||||||||||||||||||||
| 89 | 0 | ▶ | if ($recname=~m/^(?:name|newName|roid|op|clID|clName)$/) | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 90 | { | ||||||||||||||||||||||||||||
| 91 | 0 | $rec{$recname}=$recnode->textContent(); | |||||||||||||||||||||||||||
| 92 | } elsif ($recname eq 'date') | ||||||||||||||||||||||||||||
| 93 | { | ||||||||||||||||||||||||||||
| 94 | 0 | $rec{$recname}=$po->parse_iso8601($recnode->textContent()); | |||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | 0 | push @{$r{history}},\%rec; | |||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 0 | my $name=$r{name}; | |||||||||||||||||||||||||||
| 103 | 0 | delete $r{name}; | |||||||||||||||||||||||||||
| 104 | 0 | $rinfo->{$otype}->{$name}=\%r; | |||||||||||||||||||||||||||
| 105 | 0 | return; | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | ######################################################################################################### | ||||||||||||||||||||||||||||
| 109 | 1 | 1; | |||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | __END__ | ||||||||||||||||||||||||||||