| 1 | ## Domain Registry Interface, EPP AusRegistry IDN Extension | ||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2013,2018-2019 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::AusRegistry::IDN; | ||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use Net::DRI::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | #################################################################################################### | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | sub register_commands | ||||||||||||||||||||||||||||
| 26 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 27 | 0 | my ($class,$version)=@_; | |||||||||||||||||||||||||||
| 28 | 0 | my %tmp=( | |||||||||||||||||||||||||||
| 29 | info => [ undef , \&info_parse ], | ||||||||||||||||||||||||||||
| 30 | create => [ \&create_build, \&create_parse ], | ||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | return { 'domain' => \%tmp }; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | sub setup | ||||||||||||||||||||||||||||
| 37 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 38 | 0 | my ($class,$po,$version)=@_; | |||||||||||||||||||||||||||
| 39 | 0 | $po->ns({ 'idn' => 'urn:X-ar:params:xml:ns:idnadomain-1.0' }); | |||||||||||||||||||||||||||
| 40 | 0 | return; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | #################################################################################################### | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | sub parse_idn | ||||||||||||||||||||||||||||
| 46 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
parse_idn: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 47 | 0 | my ($rh,$data)=@_; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | my %idn; | |||||||||||||||||||||||||||
| 50 | 0 | foreach my $el (Net::DRI::Util::xml_list_children($data)) | |||||||||||||||||||||||||||
| 51 | { | ||||||||||||||||||||||||||||
| 52 | 0 | my ($name,$node)=@$el; | |||||||||||||||||||||||||||
| 53 | 0 | ▶ | if ($name eq 'userForm') | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 54 | { | ||||||||||||||||||||||||||||
| 55 | 0 | $idn{user_form}=$node->textContent(); | |||||||||||||||||||||||||||
| 56 | 0 | $idn{language}=$node->getAttribute('language'); | |||||||||||||||||||||||||||
| 57 | } elsif ($name eq 'canonicalForm') | ||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||
| 59 | 0 | $idn{canonical_form}=$node->textContent(); | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | $rh->{idn}=\%idn; | |||||||||||||||||||||||||||
| 64 | 0 | $rh->{language}=$idn{language}; ## compatibility mode with other IDN extensions | |||||||||||||||||||||||||||
| 65 | 0 | return; | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | ## <extension> | ||||||||||||||||||||||||||||
| 69 | ## <infData xmlns="urn:X-ar:params:xml:ns:idnadomain-1.0"> | ||||||||||||||||||||||||||||
| 70 | ## <userForm language="gr">ως.example</userForm> | ||||||||||||||||||||||||||||
| 71 | ## <canonicalForm>ως.example</canonicalForm> | ||||||||||||||||||||||||||||
| 72 | ## </infData> | ||||||||||||||||||||||||||||
| 73 | ## </extension> | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | sub info_parse | ||||||||||||||||||||||||||||
| 76 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
info_parse: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 77 | 0 | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | |||||||||||||||||||||||||||
| 78 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 79 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 0 | my $data=$mes->get_extension('idn','infData'); | |||||||||||||||||||||||||||
| 82 | 0 | ▶ | return unless defined $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 0 | parse_idn($rinfo->{domain}->{$oname},$data); | |||||||||||||||||||||||||||
| 85 | 0 | return; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | ## (In documentation, XML exemple is wrong, text is OK) | ||||||||||||||||||||||||||||
| 89 | ## | ||||||||||||||||||||||||||||
| 90 | ## <extension> | ||||||||||||||||||||||||||||
| 91 | ## <create xmlns="urn:X-ar:params:xml:ns:idnadomain-1.0"> | ||||||||||||||||||||||||||||
| 92 | ## <userForm language="gr">ως.example</userForm> | ||||||||||||||||||||||||||||
| 93 | ## </create> | ||||||||||||||||||||||||||||
| 94 | ## </extension> | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | sub create_build | ||||||||||||||||||||||||||||
| 97 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
create_build: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 98 | 0 | my ($epp,$domain,$rd)=@_; | |||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 0 | ▶ | return unless Net::DRI::Util::has_key($rd,'idn'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters(q{Value for "idn" key must be a ref hash, not: }.$rd->{idn}) unless $rd->{idn} eq 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | 0 | ▶ | Net::DRI::Exception::usererr_insufficient_parameters(q{IDN ref hash must have a language key}) unless exists $rd->{idn}->{language} && defined $rd->{idn}->{language}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $rd->{"idn"}{"language"} and defined $rd->{"idn"}{"language"}
MC/DC0%0/2
exists $rd->{"idn"}{"language"} and defined $rd->{"idn"}{"language"}
exists $rd->{"idn"}{"language"}
defined $rd->{"idn"}{"language"}
Truth table0%0/3
A and B
A= exists $rd->{"idn"}{"language"}B= defined $rd->{"idn"}{"language"}
| |||||||||||||||||||||||||||||
| 104 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters(q{IDN language tag value must be of type XML schema language}) unless Net::DRI::Util::xml_is_language($rd->{idn}->{language}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | 0 | ▶ | Net::DRI::Exception::usererr_insufficient_parameters(q{IDN ref hash must have a user_form key}) unless exists $rd->{idn}->{user_form} && defined $rd->{idn}->{user_form}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $rd->{"idn"}{"user_form"} and defined $rd->{"idn"}{"user_form"}
MC/DC0%0/2
exists $rd->{"idn"}{"user_form"} and defined $rd->{"idn"}{"user_form"}
exists $rd->{"idn"}{"user_form"}
defined $rd->{"idn"}{"user_form"}
Truth table0%0/3
A and B
A= exists $rd->{"idn"}{"user_form"}B= defined $rd->{"idn"}{"user_form"}
| |||||||||||||||||||||||||||||
| 106 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters(q{IDN user_form value must be of type XML token from 1 to 255 characters}) unless Net::DRI::Util::xml_is_token($rd->{idn}->{user_form},1,255); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||
| 109 | 0 | $mes->command_extension('idn', ['create', ['userForm', {language => $rd->{idn}->{language}}, $rd->{idn}->{user_form}]]); | |||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | return; | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | ## <extension> | ||||||||||||||||||||||||||||
| 115 | ## <creData xmlns="urn:X-ar:params:xml:ns:idnadomain-1.0"> | ||||||||||||||||||||||||||||
| 116 | ## <userForm language="gr">ως.example</userForm> | ||||||||||||||||||||||||||||
| 117 | ## <canonicalForm>ως.example</canonicalForm> | ||||||||||||||||||||||||||||
| 118 | ## </creData> | ||||||||||||||||||||||||||||
| 119 | ## </extension> | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | sub create_parse | ||||||||||||||||||||||||||||
| 122 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
create_parse: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 123 | 0 | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | |||||||||||||||||||||||||||
| 124 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 125 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 0 | my $data=$mes->get_extension('idn','creData'); | |||||||||||||||||||||||||||
| 128 | 0 | ▶ | return unless defined $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 0 | parse_idn($rinfo->{domain}->{$oname},$data); | |||||||||||||||||||||||||||
| 131 | 0 | return; | |||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | #################################################################################################### | ||||||||||||||||||||||||||||
| 136 | 1 | 1; | |||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | __END__ | ||||||||||||||||||||||||||||