| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
## Domain Registry Interface, EPP IDN (draft-ietf-eppext-idnmap-02) |
|
2
|
|
|
|
|
|
|
## |
|
3
|
|
|
|
|
|
|
## Copyright (c) 2013,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::IDN; |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
687
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
18
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
20
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Util; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
18
|
|
|
21
|
1
|
|
|
1
|
|
5
|
use Net::DRI::Exception; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
366
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#################################################################################################### |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub register_commands |
|
26
|
|
|
|
|
|
|
{ |
|
27
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
|
28
|
0
|
|
|
|
|
|
my %tmp=( |
|
29
|
|
|
|
|
|
|
info => [ undef , \&info_parse ], |
|
30
|
|
|
|
|
|
|
create => [ \&create_build, undef ], |
|
31
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return { 'domain' => \%tmp }; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub setup |
|
37
|
|
|
|
|
|
|
{ |
|
38
|
0
|
|
|
0
|
0
|
|
my ($class,$po,$version)=@_; |
|
39
|
0
|
|
|
|
|
|
$po->ns({ 'idn' => [ 'urn:ietf:params:xml:ns:idn-1.0','idn-1.0.xsd' ], |
|
40
|
|
|
|
|
|
|
}); |
|
41
|
0
|
|
|
|
|
|
return; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
#################################################################################################### |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub info_parse |
|
47
|
|
|
|
|
|
|
{ |
|
48
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
|
49
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
|
50
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $data=$mes->get_extension('idn','data'); |
|
53
|
0
|
0
|
|
|
|
|
return unless defined $data; |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($data)) |
|
56
|
|
|
|
|
|
|
{ |
|
57
|
0
|
|
|
|
|
|
my ($name,$node)=@$el; |
|
58
|
0
|
0
|
|
|
|
|
if ($name eq 'table') |
|
|
|
0
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
{ |
|
60
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$oname}->{idn_table}=$node->textContent(); |
|
61
|
|
|
|
|
|
|
} elsif ($name eq 'uname') |
|
62
|
|
|
|
|
|
|
{ |
|
63
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$oname}->{uname}=$node->textContent(); ## domain name in unicode NFC form |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
return; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub create_build |
|
71
|
|
|
|
|
|
|
{ |
|
72
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
|
73
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
|
74
|
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
return unless $domain=~m/^xn--/; |
|
76
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('For IDNs, an idn_table must be provided') unless Net::DRI::Util::has_key($rd,'idn_table'); |
|
77
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('idn_table must be of type XML schema token with at least 1 character') unless Net::DRI::Util::xml_is_token($rd->{idn_table},1); |
|
78
|
0
|
|
|
|
|
|
my @d; |
|
79
|
0
|
|
|
|
|
|
push @d,['idn:table',$rd->{idn_table}]; |
|
80
|
0
|
0
|
|
|
|
|
if (Net::DRI::Util::has_key($rd,'uname')) |
|
81
|
|
|
|
|
|
|
{ |
|
82
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('uname must be of type XML schema token from 1 to 255 characters') unless Net::DRI::Util::xml_is_token($rd->{uname},1,255); |
|
83
|
0
|
|
|
|
|
|
push @d,['idn:uname',$rd->{uname}]; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('idn','data'); |
|
87
|
0
|
|
|
|
|
|
$mes->command_extension($eid,\@d); |
|
88
|
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
return; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
#################################################################################################### |
|
93
|
|
|
|
|
|
|
1; |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |