line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, Service Message Extension Mapping for EPP |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2015 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::ServiceMessage; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
896
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
19
|
1
|
|
|
1
|
|
7
|
use feature 'state'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
60
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
581
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#################################################################################################### |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub register_commands |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
state $rops = { 'session' => { review_complete => [ undef, \&parse ] } }; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
return $rops; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub setup |
35
|
|
|
|
|
|
|
{ |
36
|
0
|
|
|
0
|
0
|
|
my ($class,$po,$version)=@_; |
37
|
0
|
|
|
|
|
|
$po->ns({ 'servicemessage' => [ 'http://tld-box.at/xmlns/resdata-1.1','resdata-1.1.xsd' ] }); |
38
|
0
|
|
|
|
|
|
return; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
0
|
0
|
|
sub implements { return 'https://tools.ietf.org/html/draft-mayrhofer-eppext-servicemessage-00'; } |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#################################################################################################### |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub parse |
46
|
|
|
|
|
|
|
{ |
47
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
48
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
49
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $data=$mes->get_response('servicemessage','message'); |
52
|
0
|
0
|
|
|
|
|
return unless defined $data; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my %r=(type => $data->getAttribute('type')); |
55
|
0
|
|
|
|
|
|
my $ns=$mes->ns('servicemessage'); |
56
|
0
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($data)) |
57
|
|
|
|
|
|
|
{ |
58
|
0
|
|
|
|
|
|
my ($name,$node)=@$el; |
59
|
0
|
0
|
|
|
|
|
if ($name eq 'desc') |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
60
|
|
|
|
|
|
|
{ |
61
|
0
|
|
|
|
|
|
$r{description}=$node->textContent(); |
62
|
|
|
|
|
|
|
} elsif ($name eq 'reftrID') |
63
|
|
|
|
|
|
|
{ |
64
|
0
|
|
|
|
|
|
$r{clTRID}=Net::DRI::Util::xml_traverse($node,$ns,qw/clTRID/); |
65
|
0
|
|
|
|
|
|
$r{svTRID}=Net::DRI::Util::xml_traverse($node,$ns,qw/svTRID/); |
66
|
|
|
|
|
|
|
} elsif ($name eq 'data') |
67
|
|
|
|
|
|
|
{ |
68
|
0
|
|
|
|
|
|
my %entries; |
69
|
0
|
|
|
|
|
|
foreach my $subel (Net::DRI::Util::xml_list_children($node)) |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
|
|
|
|
|
my ($subname,$subnode)=@$subel; |
72
|
0
|
0
|
|
|
|
|
if ($subname eq 'entry') ## specification says there are key/value tuples |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
73
|
|
|
|
|
|
|
{ |
74
|
0
|
|
|
|
|
|
my $key = $subnode->getAttribute('name'); |
75
|
0
|
|
|
|
|
|
my $value = $subnode->textContent(); |
76
|
0
|
0
|
|
|
|
|
if (exists $entries{$key}) |
77
|
|
|
|
|
|
|
{ |
78
|
0
|
0
|
|
|
|
|
$entries{$key}=[ $entries{$key} ] unless ref $entries{$key}; |
79
|
0
|
|
|
|
|
|
push @{$entries{$key}},$value; |
|
0
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
} else |
81
|
|
|
|
|
|
|
{ |
82
|
0
|
|
|
|
|
|
$entries{$key}=$value; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} elsif ($subname eq 'request') |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
|
|
|
$r{request}=$subnode->toString(0); ## TODO: do something better? |
87
|
|
|
|
|
|
|
} elsif ($subname eq 'response') |
88
|
|
|
|
|
|
|
{ |
89
|
0
|
|
|
|
|
|
$r{response}=$subnode->toString(0); ## TODO: do something better? |
90
|
|
|
|
|
|
|
} else # An OPTIONAL "any other" element from "any other" namespace |
91
|
|
|
|
|
|
|
{ |
92
|
0
|
|
|
|
|
|
$r{unspecified}=$subnode->toString(0); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
0
|
|
|
|
|
|
$r{entries}=\%entries; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
my $msgid=$mes->msg_id(); |
100
|
0
|
|
|
|
|
|
$rinfo->{message}->{$msgid}->{servicemessage}=\%r; |
101
|
0
|
|
|
|
|
|
return; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
#################################################################################################### |
105
|
|
|
|
|
|
|
1; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
__END__ |