line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, CIRA EPP Contact commands |
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::Contact; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
963
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
21
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
573
|
|
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
|
|
|
|
|
|
|
update => [ \&update ], |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return { 'contact' => \%tmp }; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub build_command_extension |
38
|
|
|
|
|
|
|
{ |
39
|
0
|
|
|
0
|
0
|
|
my ($mes,$epp,$tag)=@_; |
40
|
0
|
|
|
|
|
|
return $mes->command_extension_register($tag,sprintf('xmlns:cira="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('cira'))); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#################################################################################################### |
44
|
|
|
|
|
|
|
########### Query commands |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub info_parse |
47
|
|
|
|
|
|
|
{ |
48
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
49
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
50
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $infdata=$mes->get_extension('cira','ciraInfo'); |
53
|
0
|
0
|
|
|
|
|
return unless defined $infdata; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my %ag; |
56
|
0
|
|
|
|
|
|
my $contact=$rinfo->{contact}->{$oname}->{self}; |
57
|
0
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($infdata)) |
58
|
|
|
|
|
|
|
{ |
59
|
0
|
|
|
|
|
|
my ($name,$c)=@$el; |
60
|
0
|
0
|
|
|
|
|
if ($name eq 'language') |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
61
|
|
|
|
|
|
|
{ |
62
|
0
|
|
|
|
|
|
$contact->lang($c->textContent()); |
63
|
|
|
|
|
|
|
} elsif ($name eq 'cprCategory') |
64
|
|
|
|
|
|
|
{ |
65
|
0
|
|
|
|
|
|
$contact->legal_form($c->textContent()); |
66
|
|
|
|
|
|
|
} elsif ($name eq 'individual') |
67
|
|
|
|
|
|
|
{ |
68
|
0
|
0
|
|
|
|
|
$contact->is_individual($c->textContent() eq 'Y' ? 1 : 0); |
69
|
|
|
|
|
|
|
} elsif ($name eq 'ciraAgreementVersion') |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
|
|
|
|
|
$ag{version}=$c->textContent(); |
72
|
0
|
|
|
|
|
|
$ag{signed}=1; |
73
|
|
|
|
|
|
|
} elsif ($name eq 'agreementTimestamp') |
74
|
|
|
|
|
|
|
{ |
75
|
0
|
|
|
|
|
|
$ag{timestamp}=$po->parse_iso8601($c->textContent()); |
76
|
0
|
|
|
|
|
|
$ag{signed}=1; |
77
|
|
|
|
|
|
|
} elsif ($name eq 'originatingIpAddress') |
78
|
|
|
|
|
|
|
{ |
79
|
0
|
|
|
|
|
|
$contact->ip_address($c->textContent()); |
80
|
|
|
|
|
|
|
} elsif ($name eq 'whoisDisplaySetting') |
81
|
|
|
|
|
|
|
{ |
82
|
0
|
|
|
|
|
|
$contact->whois_display($c->textContent()); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
0
|
0
|
|
|
|
|
$contact->agreement(\%ag) if keys %ag; |
86
|
0
|
|
|
|
|
|
return; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
#################################################################################################### |
90
|
|
|
|
|
|
|
########### Transform commands |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub create |
93
|
|
|
|
|
|
|
{ |
94
|
0
|
|
|
0
|
0
|
|
my ($epp,$contact)=@_; |
95
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
## $contact->validate() has been called |
98
|
0
|
|
|
|
|
|
my @n; |
99
|
0
|
|
|
|
|
|
push @n,['cira:language',$contact->lang()]; |
100
|
0
|
0
|
|
|
|
|
push @n,['cira:originatingIpAddress',$contact->ip_address()] if defined $contact->ip_address(); |
101
|
0
|
0
|
|
|
|
|
push @n,['cira:cprCategory',$contact->legal_form()] if defined $contact->legal_form(); |
102
|
0
|
|
|
|
|
|
my $ra=$contact->agreement(); |
103
|
0
|
0
|
|
|
|
|
if (defined $ra) |
104
|
|
|
|
|
|
|
{ |
105
|
0
|
|
|
|
|
|
push @n,['cira:ciraAgreementVersion',$ra->{version}]; |
106
|
0
|
0
|
|
|
|
|
push @n,['cira:agreementValue',$ra->{signed} ? 'Y' : 'N']; |
107
|
|
|
|
|
|
|
} |
108
|
0
|
0
|
|
|
|
|
push @n,['cira:createdByResellerId',$contact->reseller_id()] if defined $contact->reseller_id(); |
109
|
0
|
0
|
|
|
|
|
push @n,['cira:whoisDisplaySetting',$contact->whois_display()] if defined $contact->whois_display(); |
110
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
my $eid=build_command_extension($mes,$epp,'cira:ciraCreate'); |
112
|
0
|
|
|
|
|
|
$mes->command_extension($eid,[@n]); |
113
|
0
|
|
|
|
|
|
return; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub update |
117
|
|
|
|
|
|
|
{ |
118
|
0
|
|
|
0
|
0
|
|
my ($epp,$contact,$todo)=@_; |
119
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
my $newc=$todo->set('info'); |
122
|
0
|
0
|
|
|
|
|
return unless defined $newc; |
123
|
|
|
|
|
|
|
|
124
|
0
|
0
|
|
|
|
|
Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid contact '.$newc) unless Net::DRI::Util::isa_contact($newc,'Net::DRI::Data::Contact::CIRA'); |
125
|
0
|
|
|
|
|
|
$newc->validate(1); ## will trigger an Exception if needed |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
my @n; |
128
|
0
|
0
|
|
|
|
|
push @n,['cira:cprCategory',$newc->legal_form()] if defined $newc->legal_form(); |
129
|
0
|
0
|
|
|
|
|
push @n,['cira:language',$newc->lang()] if defined $newc->lang(); |
130
|
0
|
0
|
|
|
|
|
push @n,['cira:whoisDisplaySetting',$newc->whois_display()] if defined $newc->whois_display(); |
131
|
|
|
|
|
|
|
|
132
|
0
|
0
|
|
|
|
|
return unless @n; |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
my $eid=build_command_extension($mes,$epp,'cira:ciraUpdate'); |
135
|
0
|
|
|
|
|
|
$mes->command_extension($eid,['cira:ciraChg',@n]); |
136
|
0
|
|
|
|
|
|
return; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
#################################################################################################### |
140
|
|
|
|
|
|
|
1; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
__END__ |