line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package XML::SRS::Types; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1363
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
5
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
182
|
use Moose::Util::TypeConstraints; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use PRANG::XMLSchema::Types; |
10
|
|
|
|
|
|
|
use Regexp::Common qw(net); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $PKG = "XML::SRS"; |
13
|
|
|
|
|
|
|
subtype "${PKG}::Number" |
14
|
|
|
|
|
|
|
=> as "PRANG::XMLSchema::nonNegativeInteger"; |
15
|
|
|
|
|
|
|
subtype "${PKG}::RegistrarId" |
16
|
|
|
|
|
|
|
=> as "PRANG::XMLSchema::positiveInteger"; |
17
|
|
|
|
|
|
|
subtype "${PKG}::Term" |
18
|
|
|
|
|
|
|
=> as "PRANG::XMLSchema::positiveInteger"; |
19
|
|
|
|
|
|
|
subtype "${PKG}::token_OTHERS" |
20
|
|
|
|
|
|
|
=> as "Str", |
21
|
|
|
|
|
|
|
=> where { $_ eq "OTHERS" }; |
22
|
|
|
|
|
|
|
subtype "${PKG}::RegistrarIdOrOTHERS" |
23
|
|
|
|
|
|
|
=> as "${PKG}::RegistrarId|${PKG}::token_OTHERS"; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
subtype "${PKG}::Dollars" |
26
|
|
|
|
|
|
|
=> as "PRANG::XMLSchema::decimal" |
27
|
|
|
|
|
|
|
=> where { |
28
|
|
|
|
|
|
|
($_ - sprintf("%.2f",$_)) < 0.0000001; |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
subtype "${PKG}::UID" |
31
|
|
|
|
|
|
|
=> as "Str"; # XXX - any other constraints on ActionIDs? |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# a non-IDN domain name |
34
|
|
|
|
|
|
|
our $RR_re = qr/[a-zA-Z0-9](:?[a-zA-Z0-9\-]*[a-zA-Z0-9])?/; |
35
|
|
|
|
|
|
|
our $DNS_name_re = qr/(?:$RR_re\.)+$RR_re/; |
36
|
|
|
|
|
|
|
subtype "${PKG}::DomainName" |
37
|
|
|
|
|
|
|
=> as "Str" |
38
|
|
|
|
|
|
|
=> where { |
39
|
|
|
|
|
|
|
m{\A$DNS_name_re\Z}; |
40
|
|
|
|
|
|
|
}; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
subtype "${PKG}::UDAI" |
43
|
|
|
|
|
|
|
=> as "Str" |
44
|
|
|
|
|
|
|
=> where { |
45
|
|
|
|
|
|
|
$_ =~ m{ \A [abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ23456789]{8} \z }xms; |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
subtype "${PKG}::HandleId" |
49
|
|
|
|
|
|
|
=> as "PRANG::XMLSchema::token" |
50
|
|
|
|
|
|
|
=> where { |
51
|
|
|
|
|
|
|
# this is a subset of the EPP handle ID specification, |
52
|
|
|
|
|
|
|
# which allows for 3-16 characters. Here we just |
53
|
|
|
|
|
|
|
# restrict it to "word" characters, which still allows |
54
|
|
|
|
|
|
|
# a whole bunch of Unicode characters. And hyphens. |
55
|
|
|
|
|
|
|
m{\A[\p{IsWord}\- ]{3,16}\Z}; |
56
|
|
|
|
|
|
|
}; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
subtype "${PKG}::Email" |
59
|
|
|
|
|
|
|
=> as "Str" |
60
|
|
|
|
|
|
|
=> where { |
61
|
|
|
|
|
|
|
# kept as-is for historical reasons |
62
|
|
|
|
|
|
|
m{\A(?:[^@\s]+|".*")\@$DNS_name_re\Z}; |
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
subtype "${PKG}::IPv4" |
66
|
|
|
|
|
|
|
=> as "Str" |
67
|
|
|
|
|
|
|
=> where { |
68
|
|
|
|
|
|
|
$_ =~ m{ \A $RE{net}{IPv4} \z }xms; |
69
|
|
|
|
|
|
|
}; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# IPv6 : from Regexp::IPv6 |
72
|
|
|
|
|
|
|
# http://search.cpan.org/~salva/Regexp-IPv6-0.02/lib/Regexp/IPv6.pm |
73
|
|
|
|
|
|
|
# http://cpansearch.perl.org/src/SALVA/Regexp-IPv6-0.02/lib/Regexp/IPv6.pm |
74
|
|
|
|
|
|
|
my $IPv4 = "(?:(?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2}))"; |
75
|
|
|
|
|
|
|
my $G = "[\\da-f]{1,4}"; |
76
|
|
|
|
|
|
|
my @tail = ( ":", ":(?:$G)?", "(?:(?::$G){1,2}|:$IPv4?)", "(?::$G)?(?:(?::$G){1,2}|:$IPv4?)", "(?::$G){0,2}(?:(?::$G){1,2}|:$IPv4?)", "(?::$G){0,3}(?:(?::$G){1,2}|:$IPv4?)", "(?::$G){0,4}(?:(?::$G){1,2}|:$IPv4?)" ); |
77
|
|
|
|
|
|
|
my $IPv6_re = $G; |
78
|
|
|
|
|
|
|
$IPv6_re = "$G:(?:$IPv6_re|$_)" for @tail; |
79
|
|
|
|
|
|
|
$IPv6_re = qr/:(?::$G){0,5}(?:(?::$G){1,2}|:$IPv4)|$IPv6_re/i; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
subtype "${PKG}::IPv6" |
82
|
|
|
|
|
|
|
=> as "Str" |
83
|
|
|
|
|
|
|
=> where { |
84
|
|
|
|
|
|
|
$_ =~ m{ \A $IPv6_re \z }xms; |
85
|
|
|
|
|
|
|
}; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
our @Boolean = qw(0 1); |
88
|
|
|
|
|
|
|
subtype "${PKG}::Boolean" |
89
|
|
|
|
|
|
|
=> as "Bool" |
90
|
|
|
|
|
|
|
=> where { |
91
|
|
|
|
|
|
|
$_ ~~ @Boolean; |
92
|
|
|
|
|
|
|
}; |
93
|
|
|
|
|
|
|
coerce "${PKG}::Boolean" |
94
|
|
|
|
|
|
|
=> from "Bool" |
95
|
|
|
|
|
|
|
=> via { $_ ? 1 : 0 }; |
96
|
|
|
|
|
|
|
coerce "${PKG}::Dollars" |
97
|
|
|
|
|
|
|
=> from "PRANG::XMLSchema::decimal" |
98
|
|
|
|
|
|
|
=> via { |
99
|
|
|
|
|
|
|
sprintf("%.2f",$_); |
100
|
|
|
|
|
|
|
}; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
our @AccountingAction = qw(Credit Debit); |
103
|
|
|
|
|
|
|
subtype "${PKG}::token_OTHERS" |
104
|
|
|
|
|
|
|
=> as "Str", |
105
|
|
|
|
|
|
|
=> where { $_ ~~ @AccountingAction }; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
enum "${PKG}::DomainWriteAction" => |
108
|
|
|
|
|
|
|
qw(DomainCreate DomainUpdate); |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
enum "${PKG}::DomainQueryAction" => |
111
|
|
|
|
|
|
|
qw(Whois DomainDetailsQry ActionDetailsQry UDAIValidQry); |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
enum "${PKG}::HandleWriteAction" => |
114
|
|
|
|
|
|
|
qw(HandleCreate HandleUpdate); |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
subtype "${PKG}::HandleQueryAction" |
117
|
|
|
|
|
|
|
=> as "Str", |
118
|
|
|
|
|
|
|
=> where { |
119
|
|
|
|
|
|
|
$_ eq qw(HandleDetailsQry); |
120
|
|
|
|
|
|
|
}; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
enum "${PKG}::RegistrarWriteAction" => |
123
|
|
|
|
|
|
|
qw(RegistrarCreate RegistrarUpdate AckMessage); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
enum "${PKG}::RegistrarQueryAction" => |
126
|
|
|
|
|
|
|
qw(RegistrarDetailsQry RegistrarAccountQry GetMessages); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
enum "${PKG}::RegistryAction" => |
129
|
|
|
|
|
|
|
qw(SysParamsUpdate SysParamsQry RunLogCreate RunLogQry |
130
|
|
|
|
|
|
|
ScheduleCreate ScheduleCancel ScheduleQry ScheduleUpdate |
131
|
|
|
|
|
|
|
BillingExtract SetBillingAmount BillingAmountQry |
132
|
|
|
|
|
|
|
DeferredIncomeSummaryQry DeferredIncomeDetailQry |
133
|
|
|
|
|
|
|
BilledUntilAdjustment BuildDnsZoneFiles GenerateDomainReport |
134
|
|
|
|
|
|
|
AdjustRegistrarAccount AccessControlListQry |
135
|
|
|
|
|
|
|
AccessControlListAdd AccessControlListRemove); |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
subtype "${PKG}::ActionName" => |
138
|
|
|
|
|
|
|
as join("|", map { "${PKG}::$_" } |
139
|
|
|
|
|
|
|
qw(DomainWriteAction DomainQueryAction |
140
|
|
|
|
|
|
|
HandleWriteAction HandleQueryAction |
141
|
|
|
|
|
|
|
RegistrarWriteAction RegistrarQueryAction |
142
|
|
|
|
|
|
|
RegistryAction)); |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
enum "${PKG}::ActionEtcExtra" => |
145
|
|
|
|
|
|
|
qw(UnknownTransaction DomainTransfer); |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
enum "${PKG}::RegDomainStatus" => |
148
|
|
|
|
|
|
|
qw(Active PendingRelease); |
149
|
|
|
|
|
|
|
enum "${PKG}::DomainStatus" => |
150
|
|
|
|
|
|
|
qw(Active PendingRelease Available); |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
subtype "${PKG}::ActionEtc" |
153
|
|
|
|
|
|
|
=> as "${PKG}::ActionName|${PKG}::ActionEtcExtra"; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
enum "${PKG}::RoleName" => |
156
|
|
|
|
|
|
|
qw( Registrar Registry Whois Query CreateDomain UpdateDomain |
157
|
|
|
|
|
|
|
TransferDomain CancelDomain UncancelDomain UpdateRegistrar |
158
|
|
|
|
|
|
|
Administer Supervisor Connect ReleaseDomain QueryACL |
159
|
|
|
|
|
|
|
UpdateACL ); |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
# Domain Statuses |
162
|
|
|
|
|
|
|
enum "${PKG}::RegDomainStatus" => |
163
|
|
|
|
|
|
|
qw(Active PendingRelease); |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
enum "${PKG}::DomainStatus" => |
166
|
|
|
|
|
|
|
qw(Active PendingRelease Available); |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
enum "${PKG}::BillStatus" => |
169
|
|
|
|
|
|
|
qw(PendingConfirmation Confirmed); |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
1; |