line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, CIRA (.CA) Registry Driver |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2010-2011 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::DRD::CIRA; |
16
|
|
|
|
|
|
|
|
17
|
3
|
|
|
3
|
|
1696
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
90
|
|
18
|
3
|
|
|
3
|
|
11
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
128
|
|
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
3
|
|
12
|
use base qw/Net::DRI::DRD/; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
1144
|
|
21
|
3
|
|
|
3
|
|
21
|
use DateTime::Duration; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
47
|
|
22
|
3
|
|
|
3
|
|
10
|
use Net::DRI::Exception; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
54
|
|
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
3
|
|
11
|
use Net::DRI::Data::Raw; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
21
|
|
25
|
3
|
|
|
3
|
|
1619
|
use Net::DRI::Protocol::EPP::Message; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__PACKAGE__->make_exception_for_unavailable_operations(qw/domain_transfer_stop domain_transfer_query domain_transfer_accept domain_transfer_refuse/); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#################################################################################################### |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub new |
32
|
|
|
|
|
|
|
{ |
33
|
|
|
|
|
|
|
my $class=shift; |
34
|
|
|
|
|
|
|
my $self=$class->SUPER::new(@_); |
35
|
|
|
|
|
|
|
$self->{info}->{host_as_attr}=0; |
36
|
|
|
|
|
|
|
$self->{info}->{contact_i18n}=1; ## LOC only |
37
|
|
|
|
|
|
|
return $self; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub periods { return map { DateTime::Duration->new(years => $_) } (1..10); } |
41
|
|
|
|
|
|
|
sub name { return 'CIRA'; } |
42
|
|
|
|
|
|
|
sub tlds { return (qw/ca/); } |
43
|
|
|
|
|
|
|
sub object_types { return (qw/domain contact ns/); } |
44
|
|
|
|
|
|
|
sub profile_types { return qw/epp/; } |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub transport_protocol_default |
47
|
|
|
|
|
|
|
{ |
48
|
|
|
|
|
|
|
my ($self,$type)=@_; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
return ('Net::DRI::Transport::Socket',{},'Net::DRI::Protocol::EPP::Extensions::CIRA',{}) if $type eq 'epp'; |
51
|
|
|
|
|
|
|
return; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#################################################################################################### |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub verify_name_domain |
57
|
|
|
|
|
|
|
{ |
58
|
|
|
|
|
|
|
my ($self,$ndr,$domain,$op)=@_; |
59
|
|
|
|
|
|
|
return $self->_verify_name_rules($domain,$op,{check_name=>1,check_name_dots=>[1,2,3],my_tld_not_strict=>1}); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub agreement_get |
63
|
|
|
|
|
|
|
{ |
64
|
|
|
|
|
|
|
my ($self,$ndr,$language)=@_; |
65
|
|
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('CIRA agreement language must be "en" or "fr"') if (defined $language && $language!~m/^(?:fr|en)$/); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
## This is an hack until the registry fix their EPP extension. |
68
|
|
|
|
|
|
|
my $cmd='get CIRA latest agreement'.(defined $language && length $language ? $language : 'en').''; |
69
|
|
|
|
|
|
|
my $ans=$self->SUPER::raw_command($ndr,$cmd); |
70
|
|
|
|
|
|
|
my $dr=Net::DRI::Data::Raw->new_from_xmlstring($ans); |
71
|
|
|
|
|
|
|
my $mes=Net::DRI::Protocol::EPP::Message->new(); |
72
|
|
|
|
|
|
|
$mes->version('1.0'); |
73
|
|
|
|
|
|
|
$mes->ns({ _main => ['urn:ietf:params:xml:ns:epp-1.0','epp-1.0.xsd'], cira=>['urn:ietf:params:xml:ns:cira-1.0','cira-1.0.xsd']}); |
74
|
|
|
|
|
|
|
$mes->parse($dr,{}); |
75
|
|
|
|
|
|
|
my $rc=$mes->result_status(); |
76
|
|
|
|
|
|
|
if ($rc->is_success()) |
77
|
|
|
|
|
|
|
{ |
78
|
|
|
|
|
|
|
my ($lang,$version,$content)=($ans=~m!(\S+)(\S+)(.+)!); |
79
|
|
|
|
|
|
|
$rc->_set_data({'agreement'=>{'get'=>{lang=>$lang,version=>$version,content=>$content}}}); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
return $rc; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# This would be the correct way to do it, when possible with registry: |
84
|
|
|
|
|
|
|
# my $rc=$ndr->process('agreement','get',[$language]); |
85
|
|
|
|
|
|
|
# return $rc; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
#################################################################################################### |
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__END__ |