line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, Afilias Trademark extension (for .INFO .MOBI .IN) |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2010,2013 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::Afilias::Trademark; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
1046
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
421
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#################################################################################################### |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub register_commands |
25
|
|
|
|
|
|
|
{ |
26
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
27
|
0
|
|
|
|
|
|
my %tmp=( |
28
|
|
|
|
|
|
|
create => [ \&create, undef ], |
29
|
|
|
|
|
|
|
## update |
30
|
|
|
|
|
|
|
info => [ undef, \&info_parse ] |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return { 'domain' => \%tmp }; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
## Namespace should be set in calling superclass, as it differs in each TLD ! |
37
|
|
|
|
|
|
|
## |
38
|
|
|
|
|
|
|
## INFO requires: name, country, number, date |
39
|
|
|
|
|
|
|
## MOBI requires: name, country, number, regDate, appDate |
40
|
|
|
|
|
|
|
## IN requires: name, country, number, date, ownerCountry |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#################################################################################################### |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub create |
45
|
|
|
|
|
|
|
{ |
46
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
47
|
|
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
|
return unless Net::DRI::Util::has_key($rd,'trademark'); |
49
|
0
|
|
|
|
|
|
my $rt=$rd->{trademark}; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my @t; |
52
|
0
|
|
|
|
|
|
foreach my $k (qw/name country number/) |
53
|
|
|
|
|
|
|
{ |
54
|
0
|
0
|
0
|
|
|
|
next unless exists $rt->{$k} && length $rt->{$k}; |
55
|
0
|
|
|
|
|
|
push @t,['trademark:'.$k,$rt->{$k}]; |
56
|
|
|
|
|
|
|
} |
57
|
0
|
|
|
|
|
|
foreach my $k (qw/date regDate appDate/) |
58
|
|
|
|
|
|
|
{ |
59
|
0
|
0
|
|
|
|
|
next unless exists $rt->{$k}; |
60
|
0
|
|
|
|
|
|
Net::DRI::Util::check_isa($rt->{$k},'DateTime'); |
61
|
0
|
|
|
|
|
|
push @t,['trademark:'.$k,$rt->{$k}->set_time_zone('UTC')->ymd()]; |
62
|
|
|
|
|
|
|
} |
63
|
0
|
|
|
|
|
|
foreach my $k (qw/ownerCountry/) |
64
|
|
|
|
|
|
|
{ |
65
|
0
|
0
|
0
|
|
|
|
next unless exists $rt->{$k} && length $rt->{$k}; |
66
|
0
|
|
|
|
|
|
push @t,['trademark:'.$k,$rt->{$k}]; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
70
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('trademark:create',sprintf('xmlns:trademark="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('trademark'))); |
71
|
0
|
|
|
|
|
|
$mes->command_extension($eid,\@t); |
72
|
0
|
|
|
|
|
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub info_parse |
76
|
|
|
|
|
|
|
{ |
77
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
78
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
79
|
0
|
|
|
|
|
|
my $infdata=$mes->get_extension('trademark','infData'); |
80
|
0
|
0
|
|
|
|
|
return unless defined $infdata; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my %t; |
83
|
0
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($infdata)) |
84
|
|
|
|
|
|
|
{ |
85
|
0
|
|
|
|
|
|
my ($n,$c)=@$el; |
86
|
0
|
0
|
|
|
|
|
if ($n=~m/^(?:name|country|number|ownerCountry)$/) |
|
|
0
|
|
|
|
|
|
87
|
|
|
|
|
|
|
{ |
88
|
0
|
|
|
|
|
|
$t{$n}=$c->textContent(); |
89
|
|
|
|
|
|
|
} elsif ($n=~m/^(?:date|appDate|regDate)$/) |
90
|
|
|
|
|
|
|
{ |
91
|
0
|
|
|
|
|
|
$t{$n}=$po->parse_iso8601($c->textContent()); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
$rinfo->{$otype}->{$oname}->{trademark}=\%t; |
96
|
0
|
|
|
|
|
|
return; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
#################################################################################################### |
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |