1## Domain Registry Interface, .NO Result extension 2## 3## Copyright (c) 2008 UNINETT Norid AS, E<lt>http://www.norid.noE<gt>, 4## Trond Haugen E<lt>info@norid.noE<gt> 5## All rights reserved. 6## 7## This file is part of Net::DRI 8## 9## Net::DRI is free software; you can redistribute it and/or modify 10## it under the terms of the GNU General Public License as published by 11## the Free Software Foundation; either version 2 of the License, or 12## (at your option) any later version. 13## 14## See the LICENSE file that comes with this distribution for more details. 15# 16# 17# 18#################################################################################################### 19 20package Net::DRI::Protocol::EPP::Extensions::NO::Result; 21 22use strict; 23 24our $VERSION = do { my @r = ( q$Revision: 1.3 $ =~ /\d+/gxm ); sprintf( "%d" . ".%02d" x $#r, @r ); }; 25 26=pod 27 28=head1 NAME 29 30Net::DRI::Protocol::EPP::Extensions::NO::Result - .NO Result Condition EPP Mapping for Net::DRI 31 32=head1 DESCRIPTION 33 34Please see the README file for details. 35 36=head1 SUPPORT 37 38For now, support questions should be sent to: 39 40E<lt>netdri@dotandco.comE<gt> 41 42Please also see the SUPPORT file in the distribution. 43 44=head1 SEE ALSO 45 46E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> 47 48=head1 AUTHOR 49 50Trond Haugen, E<lt>info@norid.noE<gt> 51 52=head1 COPYRIGHT 53 54Copyright (c) 2008 UNINETT Norid AS, E<lt>http://www.norid.noE<gt>, 55Trond Haugen, E<lt>info@norid.noE<gt> 56All rights reserved. 57 58This program is free software; you can redistribute it and/or modify 59it under the terms of the GNU General Public License as published by 60the Free Software Foundation; either version 2 of the License, or 61(at your option) any later version. 62 63See the LICENSE file that comes with this distribution for more details. 64 65=cut 66 67#################################################################################################### 68 69sub register_commands { 70 my ( $class, $version ) = @_; 71 my %tmp = ( 72 73 # hmmm, would like to parse our login response extensions as well, 74 # but that doesn't work .. 75 #login => [ undef, \&condition_parse ], 76 check => [ undef, \&condition_parse ], 77 info => [ undef, \&condition_parse ], 78 create => [ undef, \&condition_parse ], 79 delete => [ undef, \&condition_parse ], 80 transfer_request => [ undef, \&condition_parse ], 81 transfer_query => [ undef, \&condition_parse ], 82 transfer_cancel => [ undef, \&condition_parse ], 83 transfer_execute => [ undef, \&condition_parse ], 84 update => [ undef, \&condition_parse ], 85 renew => [ undef, \&condition_parse ], 86 withdraw => [ undef, \&condition_parse ], 87 nocommand => [ undef, \&condition_parse ], 88 ); 89 90 return { 91 'domain' => \%tmp, 92 'contact' => \%tmp, 93 'host' => \%tmp 94 }; 95} 96 97sub condition_parse { 98 my ( $po, $otype, $oaction, $oname, $rinfo ) = @_; 99 my $mes = $po->message(); 100 101 my $condata = $mes->get_extension( 'no_result', 'conditions' ); 102 return unless $condata; 103 104 parse( $mes, $otype, $oname, $rinfo, $condata ); 105 return 1; 106} 107 108sub parse { 109 my ( $mes, $otype, $oname, $rinfo, $node ) = @_; 110 my $NS = $mes->ns('no_result'); 111 my @conditions; 112 113 foreach my $el ( $node->getElementsByTagNameNS( $NS, 'condition' ) ) { 114 my %con; 115 my $c = $el->getFirstChild(); 116 117 $con{code} = $el->getAttribute('code') if $el->getAttribute('code'); 118 $con{severity} = $el->getAttribute('severity') 119 if $el->getAttribute('severity'); 120 121 while ($c) { 122 my $name = $c->localname() || $c->nodeName(); 123 next unless $name; 124 if ( $name =~ m/^(msg|details)$/mx ) { 125 $con{$1} = $c->getFirstChild()->getData(); 126 } elsif ( $name =~ m/^attributes$/mx ) { 127 foreach my $attr ( $c->getChildrenByTagNameNS( $NS, 'attr' ) ) 128 { 129 my $attrname = $attr->getAttribute('name'); 130 $con{ "attr " . $attrname } 131 = $attr->getFirstChild()->getData(); 132 } 133 } 134 $c = $c->getNextSibling(); 135 } 136 push @conditions, \%con; 137 } 138 139 # Extension results can be returned in all 3 object types 140 $rinfo->{$otype}->{$oname}->{conditions} = \@conditions; 141 142 return; 143} 144############################################################################## 1451; 146