line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, RRI Registry messages commands (DENIC-11) |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2008,2012 Tonnerre Lombard . 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::RRI::RegistryMessage; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
717
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
19
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
5
|
use DateTime::Format::ISO8601 (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
5
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
780
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=pod |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Net::DRI::Protocol::RRI::RegistryMessage - RRI Registry messages commands (DENIC-11) for Net::DRI |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 DESCRIPTION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Please see the README file for details. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 SUPPORT |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
For now, support questions should be sent to: |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Etonnerre.lombard@sygroup.chE |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Please also see the SUPPORT file in the distribution. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SEE ALSO |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Ehttp://oss.bsdprojects.net/project/netdri/E |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 AUTHOR |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Tonnerre Lombard, Etonnerre.lombard@sygroup.chE |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 COPYRIGHT |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Copyright (c) 2008,2013 Tonnerre Lombard . |
54
|
|
|
|
|
|
|
All rights reserved. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
57
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
58
|
|
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or |
59
|
|
|
|
|
|
|
(at your option) any later version. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
See the LICENSE file that comes with this distribution for more details. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#################################################################################################### |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub register_commands |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
70
|
0
|
|
|
|
|
|
my %tmp=( |
71
|
|
|
|
|
|
|
retrieve => [ \&pollreq, \&parse_poll ], |
72
|
|
|
|
|
|
|
delete => [ \&pollack ], |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
return { 'message' => \%tmp }; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub pollack |
79
|
|
|
|
|
|
|
{ |
80
|
0
|
|
|
0
|
0
|
|
my ($rri, $msgid) = @_; |
81
|
0
|
|
|
|
|
|
my $mes = $rri->message(); |
82
|
0
|
|
|
|
|
|
$mes->command(['msg', 'delete', $mes->ns->{msg}->[0], {msgid => $msgid}]); |
83
|
0
|
|
|
|
|
|
return; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub pollreq |
87
|
|
|
|
|
|
|
{ |
88
|
0
|
|
|
0
|
0
|
|
my ($rri,$msgid)=@_; |
89
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('In RRI, you can not specify the message id you want to retrieve') if defined($msgid); |
90
|
0
|
|
|
|
|
|
my $mes = $rri->message(); |
91
|
0
|
|
|
|
|
|
$mes->command(['msg', 'queue-read', $mes->ns->{msg}->[0]]); |
92
|
0
|
|
|
|
|
|
$mes->cltrid(undef); |
93
|
0
|
|
|
|
|
|
return; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
## We take into account all parse functions, to be able to parse any result |
97
|
|
|
|
|
|
|
sub parse_poll |
98
|
|
|
|
|
|
|
{ |
99
|
0
|
|
|
0
|
0
|
|
my ($po, $otype, $oaction, $oname, $rinfo) = @_; |
100
|
0
|
|
|
|
|
|
my $mes = $po->message(); |
101
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
102
|
0
|
|
|
|
|
|
my $msgdata = $mes->get_content('message', $mes->ns('msg')); |
103
|
0
|
0
|
|
|
|
|
return unless ($msgdata); |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
my $msgid = $msgdata->getAttribute('msgid'); |
106
|
0
|
0
|
0
|
|
|
|
return unless (defined($msgid) && $msgid); |
107
|
0
|
|
|
|
|
|
$rinfo->{message}->{session}->{last_id}=$msgid; ## needed here and not lower below, in case of pure text registry message |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
my $rd = {}; |
110
|
0
|
|
|
|
|
|
$rd->{id} = $msgid; |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
$rd->{lang} = 'en'; |
113
|
0
|
|
|
|
|
|
$rd->{qdate} = DateTime::Format::ISO8601->new()->parse_datetime($msgdata->getAttribute('msgtime')); |
114
|
0
|
|
|
|
|
|
$rd->{objtype} = 'domain'; |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
my $el = $msgdata;#->getFirstChild(); |
117
|
0
|
|
|
|
|
|
my $action = undef; |
118
|
0
|
|
|
|
|
|
my @actions = ( 'authInfo2Notify', 'authInfo2Delete', 'authInfoExpire', 'chprovAuthInfo', 'expire', 'expireWarning', 'domainDelete' ); |
119
|
0
|
|
|
|
|
|
foreach (@actions) { |
120
|
0
|
0
|
|
|
|
|
next unless ($el->getElementsByTagNameNS($mes->ns('msg'), $_)); |
121
|
0
|
|
|
|
|
|
$action = $rd->{action} = $_; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# domain and clID |
125
|
0
|
|
|
|
|
|
my @doms = $el->getElementsByTagNameNS($mes->ns('msg'), 'domain'); |
126
|
0
|
|
|
|
|
|
my @news = $el->getElementsByTagNameNS($mes->ns('msg'), 'new'); |
127
|
0
|
|
|
|
|
|
my @olds = $el->getElementsByTagNameNS($mes->ns('msg'), 'old'); |
128
|
0
|
|
|
|
|
|
my $dom = $doms[0]; |
129
|
0
|
|
|
|
|
|
my $new; |
130
|
0
|
0
|
|
|
|
|
$new = $news[0]->getFirstChild()->getData() if (@news); |
131
|
0
|
0
|
|
|
|
|
$rd->{clID} = $new if (length($new)); |
132
|
0
|
|
|
|
|
|
my $old; |
133
|
0
|
0
|
|
|
|
|
$old = $olds[0]->getFirstChild()->getData() if (@olds); |
134
|
0
|
0
|
|
|
|
|
$rd->{oldID} = $old if (length($old)); # should this be acID ? its already left the account |
135
|
0
|
|
|
|
|
|
my $dn; |
136
|
0
|
0
|
|
|
|
|
if ($dom) |
137
|
|
|
|
|
|
|
{ |
138
|
0
|
|
|
|
|
|
my @hndls = $dom->getElementsByTagNameNS($mes->ns('msg'), 'handle'); |
139
|
0
|
|
|
|
|
|
my @exps = $dom->getElementsByTagNameNS($mes->ns('msg'), 'expire'); |
140
|
0
|
|
|
|
|
|
my $hndl = $hndls[0]; |
141
|
|
|
|
|
|
|
|
142
|
0
|
0
|
|
|
|
|
$dn = $rd->{object_id} = $hndl->getFirstChild()->getData() if (@hndls); |
143
|
0
|
0
|
|
|
|
|
$rd->{exDate} = DateTime::Format::ISO8601->new()->parse_datetime($exps[0]->getFirstChild()->getData()) if (@exps); |
144
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
my @authexps = $el->getElementsByTagNameNS($mes->ns('msg'), 'authinfoexpire'); |
146
|
0
|
0
|
|
|
|
|
$rd->{authInfoExpire} = DateTime::Format::ISO8601->new()->parse_datetime($authexps[0]->getFirstChild()->getData()) if (@authexps); |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
0
|
0
|
|
|
|
|
$rd->{content} = $dn . ' change of provider to ' . $new if ($action eq 'chprovAuthInfo'); |
150
|
0
|
0
|
|
|
|
|
$rd->{content} = $dn . ' will expire on ' . $rd->{exDate}->ymd . ' at ' . $rd->{exDate}->hms if ($action eq 'expireWarning'); |
151
|
0
|
0
|
|
|
|
|
$rd->{content} = $dn . ' expired on ' . $rd->{exDate}->ymd . ' at ' . $rd->{exDate}->hms if ($action eq 'expire'); |
152
|
0
|
0
|
|
|
|
|
$rd->{content} = $dn . ' deleted by DENIC legal department on ' . $rd->{exDate}->ymd . ' at ' . $rd->{exDate}->hms if ($action eq 'domainDelete'); |
153
|
0
|
0
|
|
|
|
|
$rd->{content} = $dn . ' authinfo expired on '. $rd->{authInfoExpire}->ymd if ($action eq 'authInfoExpire'); |
154
|
0
|
0
|
|
|
|
|
$rd->{content} = $dn . ' authinfo2 created' if ($action eq 'authInfo2Notify'); |
155
|
0
|
0
|
|
|
|
|
$rd->{content} = $dn . ' authinfo2 deleted' if ($action eq 'authInfo2Delete'); |
156
|
0
|
0
|
|
|
|
|
$rd->{content} = $dn . ' ' . $action unless (defined $rd->{content}); |
157
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
|
$rinfo->{message}->{$msgid} = $rd; |
159
|
0
|
|
|
|
|
|
return; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
#################################################################################################### |
163
|
|
|
|
|
|
|
1; |