line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, CIRA EPP Domain extensions |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2010,2013 Patrick Mevzek . 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::CIRA::Domain; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
679
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
18
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
6
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
13
|
|
21
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
697
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#################################################################################################### |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub register_commands |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
28
|
0
|
|
|
|
|
|
my %tmp=( |
29
|
|
|
|
|
|
|
info => [ undef, \&info_parse], |
30
|
|
|
|
|
|
|
create => [ \&create, undef ], |
31
|
|
|
|
|
|
|
transfer_request => [ \&transfer_request, undef ], |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return { 'domain' => \%tmp }; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#################################################################################################### |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub build_command_extension |
40
|
|
|
|
|
|
|
{ |
41
|
0
|
|
|
0
|
0
|
|
my ($mes,$epp,$tag)=@_; |
42
|
0
|
|
|
|
|
|
return $mes->command_extension_register($tag,sprintf('xmlns:cira="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('cira'))); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub info_parse |
46
|
|
|
|
|
|
|
{ |
47
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
48
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
49
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $infdata=$mes->get_extension('cira','ciraInfo'); |
52
|
0
|
0
|
|
|
|
|
return unless defined $infdata; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($infdata)) |
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
|
|
|
my ($name,$c)=@$el; |
57
|
0
|
0
|
|
|
|
|
if ($name eq 'domainStageOfLife') |
|
|
0
|
|
|
|
|
|
58
|
|
|
|
|
|
|
{ |
59
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$oname}->{stage_of_life}=$c->textContent(); |
60
|
|
|
|
|
|
|
} elsif ($name eq 'domainStageOfLifeEnd') |
61
|
|
|
|
|
|
|
{ |
62
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$oname}->{stage_of_life_end}=$po->parse_iso8601($c->textContent()); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
0
|
|
|
|
|
|
return; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub create |
69
|
|
|
|
|
|
|
{ |
70
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
71
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('contacts are mandatory in .CA for domain_create') unless Net::DRI::Util::has_contact($rd); |
72
|
0
|
|
|
|
|
|
my $cs=$rd->{contact}; |
73
|
0
|
|
|
|
|
|
my @c=$cs->get('registrant'); |
74
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('one registrant is mandatory in .CA for domain_create') unless (@c==1 && Net::DRI::Util::isa_contact($c[0],'Net::DRI::Data::Contact::CIRA') && length $c[0]->srid() && $c[0]->validate(1)); |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
75
|
0
|
|
|
|
|
|
@c=$cs->get('admin'); |
76
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('one admin contact is mandatory in .CA for domain_create') unless (@c==1 && Net::DRI::Util::isa_contact($c[0],'Net::DRI::Data::Contact::CIRA') && length $c[0]->srid() && $c[0]->validate(1)); |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
77
|
0
|
|
|
|
|
|
@c=$cs->get('tech'); |
78
|
0
|
0
|
|
|
|
|
return unless @c; |
79
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('only up to 3 tech contacts are possible in .CA for domain_create') if (scalar(@c)!=scalar(grep { Net::DRI::Util::isa_contact($_,'Net::DRI::Data::Contact::CIRA') && length $_->srid() && $_->validate(1) } @c) || @c>3); |
|
0
|
0
|
0
|
|
|
|
|
80
|
0
|
|
|
|
|
|
return; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub transfer_request |
84
|
|
|
|
|
|
|
{ |
85
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
86
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
87
|
0
|
0
|
|
|
|
|
return unless Net::DRI::Util::has_contact($rd); |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
my @n; |
90
|
0
|
|
|
|
|
|
my $cs=$rd->{contact}; |
91
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('Both registrant and admin contacts are required for .CA domain name transfer if contacts are provided') unless ($cs->has_type('registrant') && $cs->has_type('admin')); |
92
|
0
|
|
|
|
|
|
my @c=$cs->get('registrant'); |
93
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('only one registrant is mandatory in .CA for domain_transfer_start if contacts are provided') unless (@c==1 && Net::DRI::Util::isa_contact($c[0],'Net::DRI::Data::Contact::CIRA') && length $c[0]->srid() && $c[0]->validate(1)); |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
94
|
0
|
|
|
|
|
|
push @n,['cira:registrant',$c[0]->srid()]; |
95
|
0
|
|
|
|
|
|
@c=$cs->get('admin'); |
96
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('only one admin contact is mandatory in .CA for domain_transfer_start if contacts are provided') unless (@c==1 && Net::DRI::Util::isa_contact($c[0],'Net::DRI::Data::Contact::CIRA') && length $c[0]->srid() && $c[0]->validate(1)); |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
97
|
0
|
|
|
|
|
|
push @n,['cira:contact',{type=>'admin'},$c[0]->srid()]; |
98
|
0
|
|
|
|
|
|
@c=$cs->get('tech'); |
99
|
0
|
0
|
|
|
|
|
if (@c) |
100
|
|
|
|
|
|
|
{ |
101
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('only up to 3 tech contacts are possible in .CA for domain_transfer_start') if (scalar(@c)!=scalar(grep { Net::DRI::Util::isa_contact($_,'Net::DRI::Data::Contact::CIRA') && length $_->srid() && $_->validate(1) } @c) || @c>3); |
|
0
|
0
|
0
|
|
|
|
|
102
|
0
|
|
|
|
|
|
push @n,map { ['cira:contact',{type=>'tech'},$_->srid()] } @c; |
|
0
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
my $eid=build_command_extension($mes,$epp,'cira:ciraTransfer'); |
106
|
0
|
|
|
|
|
|
$mes->command_extension($eid,['cira:ciraChg',@n]); |
107
|
0
|
|
|
|
|
|
return; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
#################################################################################################### |
111
|
|
|
|
|
|
|
1; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
__END__ |