1## Domain Registry Interface, .LU policy from DocRegistrar-2.0.6.pdf
2##
3## Copyright (c) 2007,2008,2009 Patrick Mevzek <netdri@dotandco.com>. 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#
16####################################################################################################
17
18package Net::DRI::DRD::LU;
19
20use strict;
21use warnings;
22
23use base qw/Net::DRI::DRD/;
24
25use Net::DRI::Data::Contact::LU;
26
27our $VERSION=do { my @r=(q$Revision: 1.5 $=~/\d+/g); sprintf("%d".".%02d" x $#r, @r); };
28
29__PACKAGE__->make_exception_for_unavailable_operations(qw/domain_renew domain_transfer_accept domain_transfer_refuse contact_transfer contact_transfer_start contact_transfer_stop
30contact_transfer_query contact_transfer_accept contact_transfer_refuse/);
31
32=pod
33
34=head1 NAME
35
36Net::DRI::DRD::LU - .LU policies for Net::DRI
37
38=head1 DESCRIPTION
39
40Please see the README file for details.
41
42=head1 SUPPORT
43
44For now, support questions should be sent to:
45
46E<lt>netdri@dotandco.comE<gt>
47
48Please also see the SUPPORT file in the distribution.
49
50=head1 SEE ALSO
51
52E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
53
54=head1 AUTHOR
55
56Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
57
58=head1 COPYRIGHT
59
60Copyright (c) 2007,2008,2009 Patrick Mevzek <netdri@dotandco.com>.
61All rights reserved.
62
63This program is free software; you can redistribute it and/or modify
64it under the terms of the GNU General Public License as published by
65the Free Software Foundation; either version 2 of the License, or
66(at your option) any later version.
67
68See the LICENSE file that comes with this distribution for more details.
69
70=cut
71
72####################################################################################################
73
74sub new
75{
76 my $class=shift;
77 my $self=$class->SUPER::new(@_);
78 $self->{info}->{host_as_attr}=0;
79 $self->{info}->{contact_i18n}=1; ## LOC only
80 bless($self,$class);
81 return $self;
82}
83
84sub periods  { return; } ## registry does not expect any duration at all
85sub name     { return 'DNSLU'; }
86sub tlds     { return ('lu'); }
87sub object_types { return ('domain','contact','ns'); }
88sub profile_types { return qw/epp whois/; }
89
90sub transport_protocol_default
91{
92 my ($self,$type)=@_;
93
94 return ('Net::DRI::Transport::Socket',{},'Net::DRI::Protocol::EPP::Extensions::LU',{})              if $type eq 'epp';
95 return ('Net::DRI::Transport::Socket',{remote_host=>'whois.dns.lu'},'Net::DRI::Protocol::Whois',{}) if $type eq 'whois';
96 return;
97}
98
99sub set_factories
100{
101 my ($self,$po)=@_;
102 $po->factories('contact',sub { return Net::DRI::Data::Contact::LU->new(@_); });
103}
104
105####################################################################################################
106
107sub verify_name_domain
108{
109 my ($self,$ndr,$domain,$op)=@_;
110 return $self->_verify_name_rules($domain,$op,{check_name => 1,
111                                               my_tld => 1,
112                                               min_length => 3,
113                                               no_double_hyphen => 1,
114                                              });
115}
116
117sub domain_status_allows
118{
119 my ($self,$ndr,$domain,$what,$rd)=@_;
120
121 return 0 unless ($what=~m/^(?:delete|update|transfer|renew|trade|transfer-trade|transfer-restore)$/);
122 my $s=$self->domain_current_status($ndr,$domain,$rd);
123 return 0 unless (defined($s));
124
125 return !$s->is_pending() && $s->can_delete()   if ($what eq 'delete');
126 return !$s->is_pending() && $s->can_update()   if ($what eq 'update'); ## no pendingCreate pendingUpdate pendingDelete
127 return $s->can_transfer() if ($what eq 'transfer');
128 return 0                  if ($what eq 'renew');
129 return $s->has_not('serverTradeProhibited','pendingCreate','pendingDelete') if ($what eq 'trade');
130 return $s->has_not('serverTransferProhibited','serverTradeProhibited') if ($what eq 'transfer-trade');
131 return $s->has_not('serverTransferProhibited','serverRestoreProhibited') && $s->has_any('pendingDelete') if ($what eq 'transfer-restore');
132 return 0; ## failsafe
133}
134
135sub domain_restore
136{
137 my ($self,$ndr,$domain)=@_;
138 $self->enforce_domain_name_constraints($ndr,$domain,'restore');
139 return $ndr->process('domain','restore',[$domain]);
140}
141
142sub domain_trade_start
143{
144 my ($self,$ndr,$domain,$rd)=@_;
145 $self->enforce_domain_name_constraints($ndr,$domain,'trade');
146 return $ndr->process('domain','trade_request',[$domain,$rd]);
147}
148
149sub domain_trade_query
150{
151 my ($self,$ndr,$domain)=@_;
152 $self->enforce_domain_name_constraints($ndr,$domain,'trade');
153 return $ndr->process('domain','trade_query',[$domain]);
154}
155
156sub domain_trade_stop
157{
158 my ($self,$ndr,$domain)=@_;
159 $self->enforce_domain_name_constraints($ndr,$domain,'trade');
160 return $ndr->process('domain','trade_cancel',[$domain]);
161}
162
163sub domain_transfer_trade_start
164{
165 my ($self,$ndr,$domain,$rd)=@_;
166 $self->enforce_domain_name_constraints($ndr,$domain,'transfer_trade');
167 return $ndr->process('domain','transfer_trade_request',[$domain,$rd]);
168}
169
170sub domain_transfer_trade_query
171{
172 my ($self,$ndr,$domain)=@_;
173 $self->enforce_domain_name_constraints($ndr,$domain,'transfer_trade');
174 return $ndr->process('domain','transfer_trade_query',[$domain]);
175}
176
177sub domain_transfer_trade_stop
178{
179 my ($self,$ndr,$domain)=@_;
180 $self->enforce_domain_name_constraints($ndr,$domain,'transfer_trade');
181 return $ndr->process('domain','transfer_trade_cancel',[$domain]);
182}
183
184sub domain_transfer_restore_start
185{
186 my ($self,$ndr,$domain,$rd)=@_;
187 $self->enforce_domain_name_constraints($ndr,$domain,'transfer_restore');
188 return $ndr->process('domain','transfer_restore_request',[$domain,$rd]);
189}
190
191sub domain_transfer_restore_query
192{
193 my ($self,$ndr,$domain)=@_;
194 $self->enforce_domain_name_constraints($ndr,$domain,'transfer_restore');
195 return $ndr->process('domain','transfer_restore_query',[$domain]);
196}
197
198sub domain_transfer_restore_stop
199{
200 my ($self,$ndr,$domain)=@_;
201 $self->enforce_domain_name_constraints($ndr,$domain,'transfer_restore');
202 return $ndr->process('domain','transfer_restore_cancel',[$domain]);
203}
204
205####################################################################################################
2061;
207