| 1 | ## Domain Registry Interface, Service Message Extension Mapping for EPP | ||||||||||||||||||
| 2 | ## | ||||||||||||||||||
| 3 | ## Copyright (c) 2015,2018 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 | package Net::DRI::Protocol::EPP::Extensions::ServiceMessage; | ||||||||||||||||||
| 16 | |||||||||||||||||||
| 17 | 1 | ▶ | use strict; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 18 | 1 | ▶ | use warnings; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 19 | 1 | ▶ | use feature 'state'; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 20 | |||||||||||||||||||
| 21 | 1 | ▶ | use Net::DRI::Util; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 22 | |||||||||||||||||||
| 23 | #################################################################################################### | ||||||||||||||||||
| 24 | |||||||||||||||||||
| 25 | sub register_commands | ||||||||||||||||||
| 26 | { | ||||||||||||||||||
| 27 | 0 | ▶ | my ($class,$version)=@_; | ||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||
| 28 | |||||||||||||||||||
| 29 | 0 | state $rops = { 'session' => { review_complete => [ undef, \&parse ] } }; | |||||||||||||||||
| 30 | |||||||||||||||||||
| 31 | 0 | return $rops; | |||||||||||||||||
| 32 | } | ||||||||||||||||||
| 33 | |||||||||||||||||||
| 34 | sub setup | ||||||||||||||||||
| 35 | { | ||||||||||||||||||
| 36 | 0 | ▶ | my ($class,$po,$version)=@_; | ||||||||||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||
| 37 | 0 | $po->ns({ 'servicemessage' => 'http://tld-box.at/xmlns/resdata-1.1' }); | |||||||||||||||||
| 38 | 0 | return; | |||||||||||||||||
| 39 | } | ||||||||||||||||||
| 40 | |||||||||||||||||||
| 41 | 0 | ▶ | sub implements { return 'https://tools.ietf.org/html/draft-mayrhofer-eppext-servicemessage-00'; } | ||||||||||||||||
|
Subroutine
implements: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||
| 42 | |||||||||||||||||||
| 43 | #################################################################################################### | ||||||||||||||||||
| 44 | |||||||||||||||||||
| 45 | sub parse | ||||||||||||||||||
| 46 | { | ||||||||||||||||||
| 47 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||
|
Subroutine
parse: not called CC=13 SCAR=52.0
Pod
undocumented
| |||||||||||||||||||
| 48 | 0 | my $mes=$po->message(); | |||||||||||||||||
| 49 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 50 | |||||||||||||||||||
| 51 | 0 | my $data=$mes->get_response('servicemessage','message'); | |||||||||||||||||
| 52 | 0 | ▶ | return unless defined $data; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 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 | ▶ | if ($name eq 'desc') | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 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 | ▶ | if ($subname eq 'entry') ## specification says there are key/value tuples | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 73 | { | ||||||||||||||||||
| 74 | 0 | my $key = $subnode->getAttribute('name'); | |||||||||||||||||
| 75 | 0 | my $value = $subnode->textContent(); | |||||||||||||||||
| 76 | 0 | ▶ | if (exists $entries{$key}) | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 77 | { | ||||||||||||||||||
| 78 | 0 | ▶ | $entries{$key}=[ $entries{$key} ] unless ref $entries{$key}; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 79 | 0 | push @{$entries{$key}},$value; | |||||||||||||||||
| 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 | 1; | |||||||||||||||||
| 106 | |||||||||||||||||||
| 107 | __END__ | ||||||||||||||||||
| 108 | |||||||||||||||||||
| 109 | =pod | ||||||||||||||||||
| 110 | |||||||||||||||||||
| 111 | =head1 NAME | ||||||||||||||||||
| 112 | |||||||||||||||||||
| 113 | Net::DRI::Protocol::EPP::Extensions::ServiceMessage - EPP Service Message Extension mapping (draft-mayrhofer-eppext-servicemessage-00) for Net::DRI | ||||||||||||||||||
| 114 | |||||||||||||||||||
| 115 | =head1 DESCRIPTION | ||||||||||||||||||
| 116 | |||||||||||||||||||
| 117 | Please see the README file for details. | ||||||||||||||||||
| 118 | |||||||||||||||||||
| 119 | =head1 SUPPORT | ||||||||||||||||||
| 120 | |||||||||||||||||||
| 121 | For now, support questions should be sent to: | ||||||||||||||||||
| 122 | |||||||||||||||||||
| 123 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||
| 124 | |||||||||||||||||||
| 125 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||
| 126 | |||||||||||||||||||
| 127 | =head1 SEE ALSO | ||||||||||||||||||
| 128 | |||||||||||||||||||
| 129 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||||||
| 130 | |||||||||||||||||||
| 131 | =head1 AUTHOR | ||||||||||||||||||
| 132 | |||||||||||||||||||
| 133 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||
| 134 | |||||||||||||||||||
| 135 | =head1 COPYRIGHT | ||||||||||||||||||
| 136 | |||||||||||||||||||
| 137 | Copyright (c) 2015,2018 Patrick Mevzek <netdri@dotandco.com>. | ||||||||||||||||||
| 138 | All rights reserved. | ||||||||||||||||||
| 139 | |||||||||||||||||||
| 140 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||
| 141 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||
| 142 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||
| 143 | (at your option) any later version. | ||||||||||||||||||
| 144 | |||||||||||||||||||
| 145 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||
| 146 | |||||||||||||||||||
| 147 | =cut | ||||||||||||||||||