line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, SIDN EPP Contact commands |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2009,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::SIDN::Contact; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
655
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
18
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
13
|
|
21
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
396
|
|
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:sidn="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('sidn'))); |
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('sidn','ext'); |
53
|
0
|
0
|
|
|
|
|
return unless defined $infdata; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $ns=$mes->ns('sidn'); |
56
|
0
|
|
|
|
|
|
$infdata=Net::DRI::Util::xml_traverse($infdata,$ns,'infData','contact'); |
57
|
0
|
0
|
|
|
|
|
return unless defined $infdata; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $contact=$rinfo->{contact}->{$oname}->{self}; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($infdata)) |
62
|
|
|
|
|
|
|
{ |
63
|
0
|
|
|
|
|
|
my ($name,$c)=@$el; |
64
|
0
|
0
|
|
|
|
|
if ($name eq 'legalForm') |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
65
|
|
|
|
|
|
|
{ |
66
|
0
|
|
|
|
|
|
$contact->legal_form($c->textContent()); |
67
|
|
|
|
|
|
|
} elsif ($name eq 'legalFormRegNo') |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
|
|
|
|
|
$contact->legal_id($c->textContent()); |
70
|
|
|
|
|
|
|
} elsif ($name eq 'limited') |
71
|
|
|
|
|
|
|
{ |
72
|
0
|
|
|
|
|
|
$contact->limited(Net::DRI::Util::xml_parse_boolean($c->textContent())); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
0
|
|
|
|
|
|
return; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
########### Transform commands |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub create |
81
|
|
|
|
|
|
|
{ |
82
|
0
|
|
|
0
|
0
|
|
my ($epp,$contact)=@_; |
83
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
## $contact->validate() has been called |
86
|
0
|
|
|
|
|
|
my @n; |
87
|
0
|
|
|
|
|
|
push @n,['sidn:legalForm',$contact->legal_form()]; |
88
|
0
|
0
|
|
|
|
|
push @n,['sidn:legalFormRegNo',$contact->legal_id()] if $contact->legal_id(); |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
my $eid=build_command_extension($mes,$epp,'sidn:ext'); |
91
|
0
|
|
|
|
|
|
$mes->command_extension($eid,['sidn:create',['sidn:contact',@n]]); |
92
|
0
|
|
|
|
|
|
return; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub update |
96
|
|
|
|
|
|
|
{ |
97
|
0
|
|
|
0
|
0
|
|
my ($epp,$contact,$todo)=@_; |
98
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
my $newc=$todo->set('info'); |
101
|
0
|
0
|
|
|
|
|
return unless defined $newc; |
102
|
|
|
|
|
|
|
|
103
|
0
|
0
|
|
|
|
|
Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid contact '.$newc) unless Net::DRI::Util::isa_contact($newc,'Net::DRI::Data::Contact::SIDN'); |
104
|
0
|
|
|
|
|
|
$newc->validate(1); ## will trigger an Exception if needed |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
my @n; |
107
|
0
|
0
|
|
|
|
|
push @n,['sidn:legalForm',$newc->legal_form()] if $newc->legal_form(); |
108
|
0
|
0
|
|
|
|
|
push @n,['sidn:legalFormRegNo',$newc->legal_id()] if $newc->legal_id(); |
109
|
|
|
|
|
|
|
|
110
|
0
|
0
|
|
|
|
|
return unless @n; |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
my $eid=build_command_extension($mes,$epp,'sidn:ext'); |
113
|
0
|
|
|
|
|
|
$mes->command_extension($eid,['sidn:update',['sidn:contact',@n]]); |
114
|
0
|
|
|
|
|
|
return; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
#################################################################################################### |
118
|
|
|
|
|
|
|
1; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
__END__ |