line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, Reseller Extension Mapping for EPP |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2015 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::ResellerInfo; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
1055
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
12
|
|
21
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
600
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#################################################################################################### |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub register_commands |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
28
|
0
|
|
|
|
|
|
my %dhc = ( info => [ undef, \&info_parse ], |
29
|
|
|
|
|
|
|
create => [ \&create_build, undef ], |
30
|
|
|
|
|
|
|
update => [ \&update_build, undef ] ); |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
return { 'domain' => \%dhc, 'host' => \%dhc, 'contact' => \%dhc }; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub setup |
36
|
|
|
|
|
|
|
{ |
37
|
0
|
|
|
0
|
0
|
|
my ($class,$po,$version)=@_; |
38
|
0
|
|
|
|
|
|
$po->ns({ 'resellerext' => [ 'urn:ietf:params:xml:ns:resellerext-1.0','resellerext-1.0.xsd' ] }); |
39
|
0
|
|
|
|
|
|
return; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
0
|
|
sub capabilities_add { return ('domain_update','reseller',[qw/add del set/]); } |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
0
|
|
sub implements { return 'https://tools.ietf.org/html/draft-zhou-eppext-reseller-00'; } |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
#################################################################################################### |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub info_parse |
49
|
|
|
|
|
|
|
{ |
50
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
51
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
52
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my $data=$mes->get_extension($mes->ns('resellerext'),'infData'); |
55
|
0
|
0
|
|
|
|
|
return unless defined $data; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
my %r; |
58
|
0
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($data)) |
59
|
|
|
|
|
|
|
{ |
60
|
0
|
|
|
|
|
|
my ($name,$node)=@$el; |
61
|
0
|
0
|
|
|
|
|
if ($name eq 'resID') |
|
|
0
|
|
|
|
|
|
62
|
|
|
|
|
|
|
{ |
63
|
0
|
|
|
|
|
|
$r{id}=$node->textContent(); |
64
|
|
|
|
|
|
|
} elsif ($name eq 'resName') |
65
|
|
|
|
|
|
|
{ |
66
|
0
|
|
|
|
|
|
$r{name}=$node->textContent(); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
$rinfo->{$otype}->{$oname}->{reseller}=\%r; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub _add_info |
76
|
|
|
|
|
|
|
{ |
77
|
0
|
|
|
0
|
|
|
my ($rd)=@_; |
78
|
0
|
|
|
|
|
|
my @r; |
79
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('Missing reseller id') unless Net::DRI::Util::has_key($rd,'id'); |
80
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('Invalid syntax for reseller id: '.$rd->{id}) unless Net::DRI::Util::xml_is_token($rd->{id},3,16); |
81
|
0
|
|
|
|
|
|
push @r,['resellerext:resID',$rd->{id}]; |
82
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
|
if (Net::DRI::Util::has_key($rd,'name')) |
84
|
|
|
|
|
|
|
{ |
85
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('Invalid syntax for reseller name: '.$rd->{name}) unless length $rd->{name}; |
86
|
0
|
|
|
|
|
|
push @r,['resellerext:resName',$rd->{name}]; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
return @r; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub create_build |
93
|
|
|
|
|
|
|
{ |
94
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
95
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
96
|
|
|
|
|
|
|
|
97
|
0
|
0
|
|
|
|
|
return unless Net::DRI::Util::has_key($rd,'reseller'); |
98
|
0
|
|
|
|
|
|
my @d=_add_info($rd->{reseller}); |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('resellerext','create'); |
101
|
0
|
|
|
|
|
|
$mes->command_extension($eid,\@d); |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
return; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub update_build |
107
|
|
|
|
|
|
|
{ |
108
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$todo,$rp)=@_; |
109
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
my $add=$todo->add('reseller'); |
111
|
0
|
|
|
|
|
|
my $del=$todo->del('reseller'); |
112
|
0
|
|
|
|
|
|
my $set=$todo->set('reseller'); |
113
|
|
|
|
|
|
|
|
114
|
0
|
0
|
0
|
|
|
|
return unless defined $add || defined $del || defined $set; |
|
|
|
0
|
|
|
|
|
115
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('Incompatible changeset for reseller: only add or del or set') if 1 < grep { defined } ($add,$del,$set); |
|
0
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
my @n; |
118
|
0
|
0
|
|
|
|
|
push @n,['resellerext:add',_add_info($add)] if defined $add; |
119
|
0
|
0
|
|
|
|
|
push @n,['resellerext:rem',_add_info($del)] if defined $del; |
120
|
0
|
0
|
|
|
|
|
push @n,['resellerext:chg',_add_info($set)] if defined $set; |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
123
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('resellerext','update'); |
124
|
0
|
|
|
|
|
|
$mes->command_extension($eid,\@n); |
125
|
0
|
|
|
|
|
|
return; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
#################################################################################################### |
130
|
|
|
|
|
|
|
1; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
__END__ |