| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
## Domain Registry Interface, EPP AusRegistry IDN Extension |
|
2
|
|
|
|
|
|
|
## |
|
3
|
|
|
|
|
|
|
## Copyright (c) 2013 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::AusRegistry::IDN; |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
927
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
27
|
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
22
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Util; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
16
|
|
|
21
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Exception; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
521
|
|
|
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, \&create_parse ], |
|
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:X-ar:params:xml:ns:idnadomain-1.0','idnadomain-1.0.xsd' ], |
|
40
|
|
|
|
|
|
|
}); |
|
41
|
0
|
|
|
|
|
|
return; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
#################################################################################################### |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub parse_idn |
|
47
|
|
|
|
|
|
|
{ |
|
48
|
0
|
|
|
0
|
0
|
|
my ($rh,$data)=@_; |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my %idn; |
|
51
|
0
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($data)) |
|
52
|
|
|
|
|
|
|
{ |
|
53
|
0
|
|
|
|
|
|
my ($name,$node)=@$el; |
|
54
|
0
|
0
|
|
|
|
|
if ($name eq 'userForm') |
|
|
|
0
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
{ |
|
56
|
0
|
|
|
|
|
|
$idn{user_form}=$node->textContent(); |
|
57
|
0
|
|
|
|
|
|
$idn{language}=$node->getAttribute('language'); |
|
58
|
|
|
|
|
|
|
} elsif ($name eq 'canonicalForm') |
|
59
|
|
|
|
|
|
|
{ |
|
60
|
0
|
|
|
|
|
|
$idn{canonical_form}=$node->textContent(); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
$rh->{idn}=\%idn; |
|
65
|
0
|
|
|
|
|
|
$rh->{language}=$idn{language}; ## compatibility mode with other IDN extensions |
|
66
|
0
|
|
|
|
|
|
return; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
## |
|
70
|
|
|
|
|
|
|
## |
|
71
|
|
|
|
|
|
|
## ως.example |
|
72
|
|
|
|
|
|
|
## ως.example |
|
73
|
|
|
|
|
|
|
## |
|
74
|
|
|
|
|
|
|
## |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub info_parse |
|
77
|
|
|
|
|
|
|
{ |
|
78
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
|
79
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
|
80
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
|
81
|
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my $data=$mes->get_extension('idn','infData'); |
|
83
|
0
|
0
|
|
|
|
|
return unless defined $data; |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
parse_idn($rinfo->{domain}->{$oname},$data); |
|
86
|
0
|
|
|
|
|
|
return; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
## (In documentation, XML exemple is wrong, text is OK) |
|
90
|
|
|
|
|
|
|
## |
|
91
|
|
|
|
|
|
|
## |
|
92
|
|
|
|
|
|
|
## |
|
93
|
|
|
|
|
|
|
## ως.example |
|
94
|
|
|
|
|
|
|
## |
|
95
|
|
|
|
|
|
|
## |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub create_build |
|
98
|
|
|
|
|
|
|
{ |
|
99
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
|
100
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
|
101
|
|
|
|
|
|
|
|
|
102
|
0
|
0
|
|
|
|
|
return unless Net::DRI::Util::has_key($rd,'idn'); |
|
103
|
|
|
|
|
|
|
|
|
104
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters(q{Value for "idn" key must be a ref hash, not: }.$rd->{idn}) unless $rd->{idn} eq 'HASH'; |
|
105
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters(q{IDN ref hash must have a language key}) unless exists $rd->{idn}->{language} && defined $rd->{idn}->{language}; |
|
106
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters(q{IDN language tag value must be of type XML schema language}) unless Net::DRI::Util::xml_is_language($rd->{idn}->{language}); |
|
107
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters(q{IDN ref hash must have a user_form key}) unless exists $rd->{idn}->{user_form} && defined $rd->{idn}->{user_form}; |
|
108
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters(q{IDN user_form value must be of type XML token from 1 to 255 characters}) unless Net::DRI::Util::xml_is_token($rd->{idn}->{user_form},1,255); |
|
109
|
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('idn','create'); |
|
111
|
0
|
|
|
|
|
|
$mes->command_extension($eid,['userForm',{language => $rd->{idn}->{language}},$rd->{idn}->{user_form}]); |
|
112
|
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
return; |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
## |
|
117
|
|
|
|
|
|
|
## |
|
118
|
|
|
|
|
|
|
## ως.example |
|
119
|
|
|
|
|
|
|
## ως.example |
|
120
|
|
|
|
|
|
|
## |
|
121
|
|
|
|
|
|
|
## |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub create_parse |
|
124
|
|
|
|
|
|
|
{ |
|
125
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
|
126
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
|
127
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
|
128
|
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
my $data=$mes->get_extension('idn','creData'); |
|
130
|
0
|
0
|
|
|
|
|
return unless defined $data; |
|
131
|
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
parse_idn($rinfo->{domain}->{$oname},$data); |
|
133
|
0
|
|
|
|
|
|
return; |
|
134
|
|
|
|
|
|
|
} |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
#################################################################################################### |
|
138
|
|
|
|
|
|
|
1; |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
__END__ |