line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Allocation Token Mapping for EPP (draft-gould-allocation-token-01) |
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::AllocationToken; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
830
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
19
|
1
|
|
|
1
|
|
7
|
use feature 'state'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
84
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
14
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
22
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
390
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#################################################################################################### |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub register_commands |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
state $rd={ 'domain' => { check => [ \&command, undef ], |
31
|
|
|
|
|
|
|
check_multi => [ \&command, undef ], |
32
|
|
|
|
|
|
|
info => [ \&command, \&info_parse ], |
33
|
|
|
|
|
|
|
create => [ \&command, undef ], |
34
|
|
|
|
|
|
|
transfer_request => [ \&command, undef ], |
35
|
|
|
|
|
|
|
update => [ \&command, undef ], |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return $rd; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub setup |
43
|
|
|
|
|
|
|
{ |
44
|
0
|
|
|
0
|
0
|
|
my ($class,$po,$version)=@_; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
state $ns = { 'allocationToken' => [ 'urn:ietf:params:xml:ns:allocationToken-1.0','allocationToken-1.0.xsd' ] }; |
47
|
0
|
|
|
|
|
|
$po->ns($ns); |
48
|
0
|
|
|
|
|
|
return; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
0
|
0
|
|
sub implements { return 'https://tools.ietf.org/html/draft-gould-allocation-token-02'; } |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
#################################################################################################### |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub command |
56
|
|
|
|
|
|
|
{ |
57
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,@rd)=@_; |
58
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
59
|
0
|
|
|
|
|
|
my $operation=$mes->operation()->[1]; |
60
|
0
|
0
|
|
|
|
|
my $rd=$rd[$operation eq 'update' ? 1 : 0]; |
61
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
return unless Net::DRI::Util::has_key($rd,'allocation_token'); |
63
|
0
|
|
|
|
|
|
my $token=$rd->{allocation_token}; |
64
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('Invalid syntax for allocation token: '.$token) unless Net::DRI::Util::xml_is_token($token); |
65
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
if ($operation eq 'info') |
67
|
|
|
|
|
|
|
{ |
68
|
0
|
0
|
|
|
|
|
return unless $rd->{allocation_token}; ## any true value will be enough for us here |
69
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('allocationToken','info'); |
70
|
|
|
|
|
|
|
} else |
71
|
|
|
|
|
|
|
{ |
72
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('allocationToken','allocationToken'); |
73
|
0
|
|
|
|
|
|
$mes->command_extension($eid,$token); |
74
|
|
|
|
|
|
|
} |
75
|
0
|
|
|
|
|
|
return; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub info_parse |
79
|
|
|
|
|
|
|
{ |
80
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
81
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
82
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
my $data=$mes->get_extension('allocationToken','allocationToken'); |
85
|
0
|
0
|
|
|
|
|
return unless defined $data; |
86
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$oname}->{allocation_token}=$data->textContent(); |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
return; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
#################################################################################################### |
92
|
|
|
|
|
|
|
1; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__END__ |