line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, Neulevel EPP WhoisType (for .TEL and possibly others) |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2013 Patrick Mevzek . All rights reserved. |
4
|
|
|
|
|
|
|
## (c) 2013 Michael Holloway . All rights reserved. |
5
|
|
|
|
|
|
|
## |
6
|
|
|
|
|
|
|
## This file is part of Net::DRI |
7
|
|
|
|
|
|
|
## |
8
|
|
|
|
|
|
|
## Net::DRI is free software; you can redistribute it and/or modify |
9
|
|
|
|
|
|
|
## it under the terms of the GNU General Public License as published by |
10
|
|
|
|
|
|
|
## the Free Software Foundation; either version 2 of the License, or |
11
|
|
|
|
|
|
|
## (at your option) any later version. |
12
|
|
|
|
|
|
|
## |
13
|
|
|
|
|
|
|
## See the LICENSE file that comes with this distribution for more details. |
14
|
|
|
|
|
|
|
#################################################################################################### |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
package Net::DRI::Protocol::EPP::Extensions::NeuLevel::WhoisType; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
687
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
19
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
14
|
|
22
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
520
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#################################################################################################### |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub register_commands |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
29
|
0
|
|
|
|
|
|
my %tmp=( |
30
|
|
|
|
|
|
|
create => [ \&create, undef ], |
31
|
|
|
|
|
|
|
update => [ \&update, undef ], |
32
|
|
|
|
|
|
|
info => [ undef, \&info_parse ], |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return { 'domain' => \%tmp }; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#################################################################################################### |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub add_whoistype |
41
|
|
|
|
|
|
|
{ |
42
|
0
|
|
|
0
|
0
|
|
my $rd = shift; |
43
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('whois_type type value must be defined') unless Net::DRI::Util::has_key($rd,'type'); |
44
|
0
|
|
|
|
|
|
my $wt = uc $rd->{'type'}; |
45
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('whois_type type value must be either Legal or Natural') unless $wt =~ m/^(?:LEGAL|NATURAL)$/; |
46
|
0
|
0
|
0
|
|
|
|
my $pub = (defined $rd->{'publish'} && (lc($rd->{'publish'}) =~ m/(true|yes|1|y)/ ))?'Y':'N'; |
47
|
0
|
0
|
|
|
|
|
return "WhoisType=$wt" . (($wt eq 'LEGAL')?'': " Publish=$pub"); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub create |
51
|
|
|
|
|
|
|
{ |
52
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
53
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('whois_type is required for domain creates') unless Net::DRI::Util::has_key($rd,'whois_type'); |
54
|
0
|
|
|
|
|
|
my $unspec = add_whoistype($rd->{'whois_type'}); |
55
|
0
|
0
|
|
|
|
|
return unless defined $unspec; |
56
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
57
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('neulevel','extension'); |
58
|
0
|
|
|
|
|
|
$mes->command_extension($eid,['neulevel:unspec', $unspec]); |
59
|
0
|
|
|
|
|
|
return; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub update |
63
|
|
|
|
|
|
|
{ |
64
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$todo)=@_; |
65
|
0
|
|
|
|
|
|
my $tochg=$todo->set('whois_type'); |
66
|
0
|
0
|
|
|
|
|
return unless defined $tochg; |
67
|
0
|
|
|
|
|
|
my $unspec = add_whoistype($tochg); |
68
|
0
|
0
|
|
|
|
|
return unless defined $unspec; |
69
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
70
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('neulevel','extension'); |
71
|
0
|
|
|
|
|
|
$mes->command_extension($eid,['neulevel:unspec', $unspec]); |
72
|
0
|
|
|
|
|
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub info_parse |
76
|
|
|
|
|
|
|
{ |
77
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
78
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
79
|
0
|
|
|
|
|
|
my $infdata=$mes->get_extension('neulevel','extension'); |
80
|
0
|
0
|
|
|
|
|
return unless defined $infdata; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my %t; |
83
|
|
|
|
|
|
|
my $unspec; |
84
|
0
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($infdata)) |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
|
|
|
my ($n,$c)=@$el; |
87
|
0
|
0
|
|
|
|
|
next unless $n eq 'unspec'; |
88
|
0
|
|
|
|
|
|
foreach my $kv (split(/ /,$c->textContent())) |
89
|
|
|
|
|
|
|
{ |
90
|
0
|
|
|
|
|
|
my ($k,$v) = split(/=/,$kv); |
91
|
0
|
0
|
|
|
|
|
$rinfo->{$otype}->{$oname}->{whois_type}->{type}=$v if $k eq 'WhoisType'; |
92
|
0
|
0
|
|
|
|
|
$rinfo->{$otype}->{$oname}->{whois_type}->{publish}=$v if $k eq 'Publish'; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
return; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
#################################################################################################### |
100
|
|
|
|
|
|
|
1; |