« DRI/Protocol/EPP/Extensions/AT/Domain.pm
↑ Summary
DRI/Protocol/EPP/Extensions/VeriSign/PollLowBalance.pm »
| 1 | ## Domain Registry Interface, Afilias IPR extension (for .ME and .ASIA) | ||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2010,2013,2019 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::Afilias::IPR; | ||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||
| 22 | #################################################################################################### | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | sub register_commands | ||||||||||||||||||||||||||||
| 25 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 26 | 0 | my ($class,$version)=@_; | |||||||||||||||||||||||||||
| 27 | 0 | my %tmp=( | |||||||||||||||||||||||||||
| 28 | create => [ \&create, undef ], | ||||||||||||||||||||||||||||
| 29 | update => [ \&update, undef ], | ||||||||||||||||||||||||||||
| 30 | info => [ undef, \&info_parse ], | ||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | return { 'domain' => \%tmp }; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | ## Namespace should be set in calling superclass, as it differs in .ASIA & .ME | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | #################################################################################################### | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | sub build_ipr | ||||||||||||||||||||||||||||
| 41 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
build_ipr: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 42 | 0 | my ($ipr)=@_; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | my @iprdata; | |||||||||||||||||||||||||||
| 45 | 0 | foreach my $k (qw/name ccLocality number/) | |||||||||||||||||||||||||||
| 46 | { | ||||||||||||||||||||||||||||
| 47 | 0 | ▶ | my $kk=($k eq 'ccLocality') ? 'cc' : $k; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | next unless exists $ipr->{$kk} && length $ipr->{$kk}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $ipr->{$kk} and length $ipr->{$kk}
MC/DC0%0/2
exists $ipr->{$kk} and length $ipr->{$kk}
exists $ipr->{$kk}
length $ipr->{$kk}
Truth table0%0/3
A and B
A= exists $ipr->{$kk}B= length $ipr->{$kk}
| |||||||||||||||||||||||||||||
| 49 | 0 | push @iprdata,['ipr:'.$k,$ipr->{$kk}]; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | 0 | foreach my $k (qw/appDate regDate/) | |||||||||||||||||||||||||||
| 52 | { | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | next unless exists $ipr->{$k}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 0 | Net::DRI::Util::check_isa($ipr->{$k},'DateTime'); | |||||||||||||||||||||||||||
| 55 | 0 | push @iprdata,['ipr:'.$k,$ipr->{$k}->set_time_zone('UTC')->ymd()]; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | 0 | foreach my $k (qw/class entitlement form type preVerified/) | |||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||
| 59 | 0 | ▶ | next unless exists $ipr->{$k} && length $ipr->{$k}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $ipr->{$k} and length $ipr->{$k}
MC/DC0%0/2
exists $ipr->{$k} and length $ipr->{$k}
exists $ipr->{$k}
length $ipr->{$k}
Truth table0%0/3
A and B
A= exists $ipr->{$k}B= length $ipr->{$k}
| |||||||||||||||||||||||||||||
| 60 | 0 | push @iprdata,['ipr:'.$k,$ipr->{$k}]; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | return @iprdata; | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | sub create | ||||||||||||||||||||||||||||
| 67 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
create: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 68 | 0 | my ($epp,$domain,$rd)=@_; | |||||||||||||||||||||||||||
| 69 | 0 | ▶ | return unless Net::DRI::Util::has_key($rd,'ipr'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 0 | my @n=build_ipr($rd->{ipr}); | |||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | $epp->message()->command_extension('ipr', ['create', @n]); | |||||||||||||||||||||||||||
| 73 | 0 | return; | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | # ipr-1.1 adds ability to change or remove (but not add?) | ||||||||||||||||||||||||||||
| 77 | sub update | ||||||||||||||||||||||||||||
| 78 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
update: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 79 | 0 | my ($epp,$domain,$todo)=@_; | |||||||||||||||||||||||||||
| 80 | 0 | my $todel=$todo->del('ipr'); | |||||||||||||||||||||||||||
| 81 | 0 | my $tochg=$todo->set('ipr'); | |||||||||||||||||||||||||||
| 82 | 0 | my @def=grep { defined } ($todel,$tochg); | |||||||||||||||||||||||||||
| 83 | 0 | ▶ | return unless @def; ## no updates asked | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 0 | my @n; | |||||||||||||||||||||||||||
| 86 | 0 | ▶ | push @n,['ipr:rem',build_ipr($todel)] if defined $todel; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 87 | 0 | ▶ | push @n,['ipr:chg',build_ipr($tochg)] if defined $tochg; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | 0 | $epp->message()->command_extension('ipr', ['update', @n]); | |||||||||||||||||||||||||||
| 89 | 0 | return; | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | sub info_parse | ||||||||||||||||||||||||||||
| 93 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
info_parse: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 94 | 0 | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | |||||||||||||||||||||||||||
| 95 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 96 | 0 | my $infdata=$mes->get_extension('ipr','infData'); | |||||||||||||||||||||||||||
| 97 | 0 | ▶ | return unless defined $infdata; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 0 | my %ipr; | |||||||||||||||||||||||||||
| 100 | 0 | foreach my $el (Net::DRI::Util::xml_list_children($infdata)) | |||||||||||||||||||||||||||
| 101 | { | ||||||||||||||||||||||||||||
| 102 | 0 | my ($n,$c)=@$el; | |||||||||||||||||||||||||||
| 103 | 0 | ▶ | if ($n=~m/^(?:name|number|class|entitlement|form|preVerified|type)$/) | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 104 | { | ||||||||||||||||||||||||||||
| 105 | 0 | $ipr{$n}=$c->textContent(); | |||||||||||||||||||||||||||
| 106 | } elsif ($n eq 'ccLocality') | ||||||||||||||||||||||||||||
| 107 | { | ||||||||||||||||||||||||||||
| 108 | 0 | $ipr{cc}=$c->textContent(); | |||||||||||||||||||||||||||
| 109 | } elsif ($n=~m/^(?:appDate|regDate)$/) | ||||||||||||||||||||||||||||
| 110 | { | ||||||||||||||||||||||||||||
| 111 | 0 | $ipr{$n}=$po->parse_iso8601($c->textContent()); | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 0 | $rinfo->{$otype}->{$oname}->{ipr}=\%ipr; | |||||||||||||||||||||||||||
| 116 | 0 | return; | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | #################################################################################################### | ||||||||||||||||||||||||||||
| 120 | 1 | 1; | |||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | __END__ | ||||||||||||||||||||||||||||