line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, Afilias IPR extension (for .ME and .ASIA) |
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::Afilias::IPR; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
672
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
18
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
525
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#################################################################################################### |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub register_commands |
25
|
|
|
|
|
|
|
{ |
26
|
0
|
|
|
0
|
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
|
|
|
|
|
|
|
{ |
42
|
0
|
|
|
0
|
0
|
|
my ($ipr)=@_; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my @iprdata; |
45
|
0
|
|
|
|
|
|
foreach my $k (qw/name ccLocality number/) |
46
|
|
|
|
|
|
|
{ |
47
|
0
|
0
|
|
|
|
|
my $kk=($k eq 'ccLocality') ? 'cc' : $k; |
48
|
0
|
0
|
0
|
|
|
|
next unless exists $ipr->{$kk} && length $ipr->{$kk}; |
49
|
0
|
|
|
|
|
|
push @iprdata,['ipr:'.$k,$ipr->{$kk}]; |
50
|
|
|
|
|
|
|
} |
51
|
0
|
|
|
|
|
|
foreach my $k (qw/appDate regDate/) |
52
|
|
|
|
|
|
|
{ |
53
|
0
|
0
|
|
|
|
|
next unless exists $ipr->{$k}; |
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
|
0
|
0
|
|
|
|
next unless exists $ipr->{$k} && length $ipr->{$k}; |
60
|
0
|
|
|
|
|
|
push @iprdata,['ipr:'.$k,$ipr->{$k}]; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return @iprdata; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub create |
67
|
|
|
|
|
|
|
{ |
68
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
69
|
0
|
0
|
|
|
|
|
return unless Net::DRI::Util::has_key($rd,'ipr'); |
70
|
0
|
|
|
|
|
|
my @n=build_ipr($rd->{ipr}); |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
73
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('ipr','create'); |
74
|
0
|
|
|
|
|
|
$mes->command_extension($eid,\@n); |
75
|
0
|
|
|
|
|
|
return; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# ipr-1.1 adds ability to change or remove (but not add?) |
79
|
|
|
|
|
|
|
sub update |
80
|
|
|
|
|
|
|
{ |
81
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$todo)=@_; |
82
|
0
|
|
|
|
|
|
my $todel=$todo->del('ipr'); |
83
|
0
|
|
|
|
|
|
my $tochg=$todo->set('ipr'); |
84
|
0
|
|
|
|
|
|
my @def=grep { defined } ($todel,$tochg); |
|
0
|
|
|
|
|
|
|
85
|
0
|
0
|
|
|
|
|
return unless @def; ## no updates asked |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
88
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('ipr','update'); |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
my @n; |
91
|
0
|
0
|
|
|
|
|
push @n,['ipr:rem',build_ipr($todel)] if defined $todel; |
92
|
0
|
0
|
|
|
|
|
push @n,['ipr:chg',build_ipr($tochg)] if defined $tochg; |
93
|
0
|
|
|
|
|
|
$mes->command_extension($eid,\@n); |
94
|
0
|
|
|
|
|
|
return; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub info_parse |
98
|
|
|
|
|
|
|
{ |
99
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
100
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
101
|
0
|
|
|
|
|
|
my $infdata=$mes->get_extension('ipr','infData'); |
102
|
0
|
0
|
|
|
|
|
return unless defined $infdata; |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
my %ipr; |
105
|
0
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($infdata)) |
106
|
|
|
|
|
|
|
{ |
107
|
0
|
|
|
|
|
|
my ($n,$c)=@$el; |
108
|
0
|
0
|
|
|
|
|
if ($n=~m/^(?:name|number|class|entitlement|form|preVerified|type)$/) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
109
|
|
|
|
|
|
|
{ |
110
|
0
|
|
|
|
|
|
$ipr{$n}=$c->textContent(); |
111
|
|
|
|
|
|
|
} elsif ($n eq 'ccLocality') |
112
|
|
|
|
|
|
|
{ |
113
|
0
|
|
|
|
|
|
$ipr{cc}=$c->textContent(); |
114
|
|
|
|
|
|
|
} elsif ($n=~m/^(?:appDate|regDate)$/) |
115
|
|
|
|
|
|
|
{ |
116
|
0
|
|
|
|
|
|
$ipr{$n}=$po->parse_iso8601($c->textContent()); |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
$rinfo->{$otype}->{$oname}->{ipr}=\%ipr; |
121
|
0
|
|
|
|
|
|
return; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
#################################################################################################### |
125
|
|
|
|
|
|
|
1; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
__END__ |