line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, ISPAPI (aka HEXONET) Key-Value EPP extensions |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2010,2013-2015 HEXONET GmbH, http://www.hexonet.net, |
4
|
|
|
|
|
|
|
## Jens Wagner |
5
|
|
|
|
|
|
|
## All rights reserved. |
6
|
|
|
|
|
|
|
## |
7
|
|
|
|
|
|
|
## This file is part of Net::DRI |
8
|
|
|
|
|
|
|
## |
9
|
|
|
|
|
|
|
## Net::DRI is free software; you can redistribute it and/or modify |
10
|
|
|
|
|
|
|
## it under the terms of the GNU General Public License as published by |
11
|
|
|
|
|
|
|
## the Free Software Foundation; either version 2 of the License, or |
12
|
|
|
|
|
|
|
## (at your option) any later version. |
13
|
|
|
|
|
|
|
## |
14
|
|
|
|
|
|
|
## See the LICENSE file that comes with this distribution for more details. |
15
|
|
|
|
|
|
|
#################################################################################################### |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
package Net::DRI::Protocol::EPP::Extensions::ISPAPI::KeyValue; |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
1012
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
48
|
|
20
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
6
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
777
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=pod |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Net::DRI::Protocol::EPP::Extensions::ISPAPI::KeyValue - EPP extension for Net::DRI |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Please see the README file for details. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SUPPORT |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
For now, support questions should be sent to: |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Esupport@hexonet.netE |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Please also see the SUPPORT file in the distribution. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SEE ALSO |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Ehttp://www.dotandco.com/services/software/Net-DRI/E |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 AUTHOR |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Alexander Biehl, Eabiehl@hexonet.netE |
49
|
|
|
|
|
|
|
Jens Wagner, Ejwagner@hexonet.netE |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 COPYRIGHT |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Copyright (c) 2010,2013-2015 HEXONET GmbH, Ehttp://www.hexonet.netE, |
54
|
|
|
|
|
|
|
Alexander Biehl , |
55
|
|
|
|
|
|
|
Jens Wagner |
56
|
|
|
|
|
|
|
All rights reserved. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
59
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
60
|
|
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or |
61
|
|
|
|
|
|
|
(at your option) any later version. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
See the LICENSE file that comes with this distribution for more details. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
#################################################################################################### |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub register_commands |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
72
|
0
|
|
|
|
|
|
my %tmp=( |
73
|
|
|
|
|
|
|
check => [ \&create_keyvalue, \&parse_keyvalue ], |
74
|
|
|
|
|
|
|
info => [ \&create_keyvalue, \&parse_keyvalue ], |
75
|
|
|
|
|
|
|
create => [ \&create_keyvalue, \&parse_keyvalue ], |
76
|
|
|
|
|
|
|
update => [ \&create_keyvalue_update, \&parse_keyvalue ], |
77
|
|
|
|
|
|
|
transfer_request => [ \&create_keyvalue, \&parse_keyvalue ], |
78
|
|
|
|
|
|
|
); |
79
|
0
|
|
|
|
|
|
my %api=( |
80
|
|
|
|
|
|
|
call => [ \&create_keyvalue_extension, \&parse_keyvalue ], |
81
|
|
|
|
|
|
|
); |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
my %account=( |
84
|
|
|
|
|
|
|
list_domains => [\&list_domains, \&list_domains_parse ], |
85
|
|
|
|
|
|
|
); |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
return { 'domain' => \%tmp, 'contact' => \%tmp, 'ns' => \%tmp, 'account' => \%account, 'api' => \%api }; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
our @NS = ('http://schema.ispapi.net/epp/xml/keyvalue-1.0', 'http://schema.ispapi.net/epp/xml/keyvalue-1.0 keyvalue-1.0.xsd'); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
#################################################################################################### |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
############ Transform commands |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub create_keyvalue_extension |
98
|
|
|
|
|
|
|
{ |
99
|
0
|
|
|
0
|
0
|
|
my ($epp,$hash)=@_; |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('keyvalue:extension','xmlns:keyvalue="'.$NS[0].'" xsi:schemaLocation="'.$NS[1].'"', 'keyvalue'); |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
my @kv = (); |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
foreach my $key ( sort { $a cmp $b } keys %{$hash} ) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
my $value = $hash->{$key}; |
109
|
0
|
0
|
|
|
|
|
if ( defined $value ) { |
110
|
0
|
|
|
|
|
|
push @kv, ['keyvalue:kv', { key => $key, value => $value }]; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
else { |
113
|
0
|
|
|
|
|
|
push @kv, ['keyvalue:kv', { key => $key }]; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
} |
116
|
0
|
0
|
|
|
|
|
return unless @kv; |
117
|
0
|
|
|
|
|
|
$mes->command_extension($eid,\@kv); |
118
|
0
|
|
|
|
|
|
return; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub create_keyvalue |
123
|
|
|
|
|
|
|
{ |
124
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
125
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
126
|
|
|
|
|
|
|
|
127
|
0
|
0
|
|
|
|
|
return unless Net::DRI::Util::has_key($rd,'keyvalue'); |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
return create_keyvalue_extension($epp, $rd->{keyvalue}); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub create_keyvalue_update |
134
|
|
|
|
|
|
|
{ |
135
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$todo) = @_; |
136
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
137
|
|
|
|
|
|
|
|
138
|
0
|
0
|
|
|
|
|
return unless $todo->set('keyvalue'); |
139
|
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
return create_keyvalue_extension($epp, $todo->set('keyvalue')); |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub parse_keyvalue |
145
|
|
|
|
|
|
|
{ |
146
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
147
|
0
|
|
|
|
|
|
my $mes = $po->message(); |
148
|
0
|
|
|
|
|
|
my $extension = $mes->get_extension($NS[0],'extension'); |
149
|
0
|
0
|
|
|
|
|
return unless (defined($extension)); |
150
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
my $keyvalue = {}; |
152
|
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
|
foreach my $kv ( $extension->getChildrenByTagNameNS($NS[0], 'kv') ) { |
154
|
0
|
|
|
|
|
|
$keyvalue->{$kv->getAttribute('key')} = $kv->getAttribute('value'); |
155
|
|
|
|
|
|
|
} |
156
|
0
|
|
|
|
|
|
$rinfo->{$otype}{$oname}{keyvalue} = $keyvalue; |
157
|
0
|
|
|
|
|
|
return; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub list_domains |
162
|
|
|
|
|
|
|
{ |
163
|
0
|
|
|
0
|
0
|
|
my ($epp, $hash)=@_; |
164
|
0
|
0
|
|
|
|
|
$hash = {} if !defined $hash; |
165
|
0
|
0
|
|
|
|
|
$hash->{COMMAND} = 'QueryDomainList' if !exists $hash->{COMMAND}; |
166
|
0
|
0
|
|
|
|
|
$hash->{USERDEPTH} = 'SELF' if !exists $hash->{USERDEPTH}; |
167
|
0
|
0
|
|
|
|
|
$hash->{ORDERBY} = 'DOMAIN' if !exists $hash->{DOMAIN}; |
168
|
0
|
0
|
|
|
|
|
$hash->{LIMIT} = '10000' if !exists $hash->{LIMIT}; |
169
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
|
return create_keyvalue_extension( $epp, $hash ); |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub list_domains_parse |
175
|
|
|
|
|
|
|
{ |
176
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
177
|
|
|
|
|
|
|
|
178
|
0
|
|
|
|
|
|
parse_keyvalue($po,'account','list','domains',$rinfo); |
179
|
|
|
|
|
|
|
|
180
|
0
|
0
|
|
|
|
|
if ( exists $rinfo->{account}{domains}{keyvalue} ) { |
181
|
0
|
|
|
|
|
|
my @domains = (); |
182
|
0
|
|
|
|
|
|
my $hash = $rinfo->{account}{domains}{keyvalue}; |
183
|
|
|
|
|
|
|
|
184
|
0
|
0
|
|
|
|
|
if ( exists $hash->{DOMAIN} ) { |
185
|
0
|
|
|
|
|
|
push @domains, $hash->{DOMAIN}; |
186
|
0
|
|
|
|
|
|
my $i; |
187
|
0
|
|
|
|
|
|
for ( $i = 1; exists $hash->{"DOMAIN$i"}; $i++ ) { |
188
|
0
|
|
|
|
|
|
push @domains, $hash->{"DOMAIN$i"}; |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
|
192
|
0
|
|
|
|
|
|
delete $rinfo->{account}{domains}{keyvalue}; |
193
|
|
|
|
|
|
|
|
194
|
0
|
|
|
|
|
|
$rinfo->{account}->{domains}->{action} = 'list'; |
195
|
0
|
|
|
|
|
|
$rinfo->{account}->{domains}->{list} = \@domains; |
196
|
|
|
|
|
|
|
} |
197
|
0
|
|
|
|
|
|
return; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
#################################################################################################### |
201
|
|
|
|
|
|
|
1; |