line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, Reseller Extension Mapping for EPP |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2015,2016 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
|
|
901
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
18
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
21
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
592
|
|
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-03'; } |
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
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($data)) |
58
|
|
|
|
|
|
|
{ |
59
|
0
|
|
|
|
|
|
my ($name,$node)=@$el; |
60
|
0
|
0
|
|
|
|
|
if ($name eq 'id') |
61
|
|
|
|
|
|
|
{ |
62
|
0
|
|
|
|
|
|
$rinfo->{$otype}->{$oname}->{reseller}=$node->textContent(); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
return; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub _add_id |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
|
|
0
|
|
|
my ($id)=@_; |
72
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('Invalid syntax for reseller id: '.$id) unless Net::DRI::Util::xml_is_token($id,3,16); |
73
|
0
|
|
|
|
|
|
return (['resellerext:id',$id]); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub create_build |
77
|
|
|
|
|
|
|
{ |
78
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
79
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
80
|
|
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
|
return unless Net::DRI::Util::has_key($rd,'reseller'); |
82
|
0
|
|
|
|
|
|
my @d=_add_id($rd->{reseller}); |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('resellerext','create'); |
85
|
0
|
|
|
|
|
|
$mes->command_extension($eid,\@d); |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
return; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub update_build |
91
|
|
|
|
|
|
|
{ |
92
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$todo,$rp)=@_; |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
my $add=$todo->add('reseller'); |
95
|
0
|
|
|
|
|
|
my $del=$todo->del('reseller'); |
96
|
0
|
|
|
|
|
|
my $set=$todo->set('reseller'); |
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
0
|
|
|
|
return unless defined $add || defined $del || defined $set; |
|
|
|
0
|
|
|
|
|
99
|
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
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
my @n; |
102
|
0
|
0
|
|
|
|
|
push @n,['resellerext:add',_add_id($add)] if defined $add; |
103
|
0
|
0
|
|
|
|
|
push @n,['resellerext:rem',_add_id($del)] if defined $del; |
104
|
0
|
0
|
|
|
|
|
push @n,['resellerext:chg',_add_id($set)] if defined $set; |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
107
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('resellerext','update'); |
108
|
0
|
|
|
|
|
|
$mes->command_extension($eid,\@n); |
109
|
0
|
|
|
|
|
|
return; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
#################################################################################################### |
114
|
|
|
|
|
|
|
1; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
__END__ |