line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::AppleConfigProfile::Payload::Types; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
14
|
use 5.14.4; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
46
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
101
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.00_001'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Exporter::Easy ( |
10
|
1
|
|
|
|
|
15
|
OK => [qw( |
11
|
|
|
|
|
|
|
$ProfileString $ProfileNumber $ProfileData $ProfileBool |
12
|
|
|
|
|
|
|
$ProfileReal $ProfileDate $ProfileDict $ProfileArray |
13
|
|
|
|
|
|
|
$ProfileNSDataBlob $ProfileUUID $ProfileIdentifier |
14
|
|
|
|
|
|
|
)], |
15
|
|
|
|
|
|
|
TAGS => [ |
16
|
|
|
|
|
|
|
'all' => [qw( |
17
|
|
|
|
|
|
|
$ProfileString $ProfileNumber $ProfileData $ProfileBool |
18
|
|
|
|
|
|
|
$ProfileReal $ProfileDate $ProfileDict $ProfileArray |
19
|
|
|
|
|
|
|
$ProfileNSDataBlob $ProfileUUID $ProfileIdentifier $ProfileClass |
20
|
|
|
|
|
|
|
)], |
21
|
|
|
|
|
|
|
], |
22
|
1
|
|
|
1
|
|
1124
|
); |
|
1
|
|
|
|
|
2051
|
|
23
|
1
|
|
|
1
|
|
421
|
use Readonly; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
281
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
XML::AppleConfigProfile::Payload::Types - Data types for payload keys. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Apple Configuration Profiles contain one or more I. Each payload |
33
|
|
|
|
|
|
|
contains a dictionary, which can be thought of like a Perl hash. Within a |
34
|
|
|
|
|
|
|
payload's dictionary, each key's value is restricted to a specific type. |
35
|
|
|
|
|
|
|
One key might require a number; a different key might require a string, or some |
36
|
|
|
|
|
|
|
binary data. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Provided in this module are a number of Readonly scalars that will be used |
39
|
|
|
|
|
|
|
(instead of strings) to identify the data types for configuration profile keys. |
40
|
|
|
|
|
|
|
The scalars are all OK for import into your local namespace, or you can simply |
41
|
|
|
|
|
|
|
import C<:all> to get all of them at once. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 TYPES |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Apple Configuration Profile payloads use the following types, |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 String (C<$ProfileString>) |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
A UTF-8 string. The client should simply provide a Perl string (NOT a binary |
50
|
|
|
|
|
|
|
string). Multi-line strings are allowed, although specific payload keys may |
51
|
|
|
|
|
|
|
not allow this. Empty strings are B allowed. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
B If your source data was not ASCII, and not UTF-8, then please make |
54
|
|
|
|
|
|
|
sure you have converted it before doing anything else! "converted it" normally |
55
|
|
|
|
|
|
|
means using the C module to convert from the original encoding. Your |
56
|
|
|
|
|
|
|
string will not be valid unless it can be encoded as UTF-8. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Readonly our $ProfileString => 1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 Number (C<$ProfileNumber>) |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
An Integer, positive, zero, or negative. The plist standard doesn't specify |
65
|
|
|
|
|
|
|
a range, but one may be imposed by specific keys. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Readonly our $ProfileNumber => 2; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 Real (C<$ProfileReal>) |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
A real number, positive, zero, or negative. The plist standard doesn't specify |
75
|
|
|
|
|
|
|
a range, but one may be imposed by specific keys. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Readonly our $ProfileReal => 5; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 Data (C<$ProfileData>) |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Binary data. Binary data may be provided by the client in multiple ways. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Clients can provide an open filehandle, or an open C object. |
87
|
|
|
|
|
|
|
C is used to make sure the handle/object is open. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
B When opening the file, please remember to use C before you |
90
|
|
|
|
|
|
|
do anything else with the file. Also, make sure the handle is open for reading! |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
The client may also provide a string. If a string is provided, then it must be |
93
|
|
|
|
|
|
|
a I, I string. In other words, C needs to |
94
|
|
|
|
|
|
|
return C; if it's returning C, then you probably need to use |
95
|
|
|
|
|
|
|
C (or maybe C) to get a binary string. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Readonly our $ProfileData => 3; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 Boolean (C<$ProfileBool>) |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Either True for False. When reading a boolean from a payload's contents, a 1 |
104
|
|
|
|
|
|
|
is used to represent true, and 0 is returned for false. When setting a boolean, |
105
|
|
|
|
|
|
|
the value provided is filtered using the code C<($value) ? 1 : 0>. As long as |
106
|
|
|
|
|
|
|
you aren't providing C as the input, your input will probably be |
107
|
|
|
|
|
|
|
accepted! |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Readonly our $ProfileBool => 4; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 Date (C<$ProfileDate>) |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
A date. This is stored internally as a C object, and when read a |
117
|
|
|
|
|
|
|
C object will be returned. When serialized into plist form, the |
118
|
|
|
|
|
|
|
time will be in UTC, but no other guarantees are made about the timezone when |
119
|
|
|
|
|
|
|
the object is stored internally, so if you read a Date, be sure to call |
120
|
|
|
|
|
|
|
C<< ->set_time_zone() >> before outputting it yourself. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
If a string is provided, L will be used to parse it. |
123
|
|
|
|
|
|
|
For best results, parse it yourself, and provide the resulting C |
124
|
|
|
|
|
|
|
object! |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Readonly our $ProfileDate => 5; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 Dictionary (C<$ProfileDict>) |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
A dictionary is the plist equivalent to a Perl hash, and that is what will be |
134
|
|
|
|
|
|
|
made available. The client should expect the hash to only accept certain types |
135
|
|
|
|
|
|
|
of C modules. For more information, see the |
136
|
|
|
|
|
|
|
documentation for the specific key. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Readonly our $ProfileDict => 10; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 Array (C<$ProfileArray>) |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
An array, similar to a Perl array. The client should expect the array to only |
145
|
|
|
|
|
|
|
accept certain data types. For more information, see the documentation for the |
146
|
|
|
|
|
|
|
specific key. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Readonly our $ProfileArray => 11; |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 NSData Blob |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
This is a weird type. The only place it appears in the I
|
156
|
|
|
|
|
|
|
Reference> (the edition dated 2014-03-20) is in the C key in the |
157
|
|
|
|
|
|
|
Exchange payload. I don't really understand this, though I'm guessing it's |
158
|
|
|
|
|
|
|
really a Data type, and the I is referring to the contents. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Until I get more information on what exactly this is, this type will likely go |
161
|
|
|
|
|
|
|
unimplemnented. Right now, the same checks are performed as for the |
162
|
|
|
|
|
|
|
C type. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Readonly our $ProfileNSDataBlob => 20; |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 CUSTOM TYPES |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
The following types are not actual profile key types, but they are being |
171
|
|
|
|
|
|
|
treated specially here. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head2 UUID (C<$ProfileUUID>) |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
I |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Although the plist format does not have a special type for UUIDs (a simple |
178
|
|
|
|
|
|
|
String is used), these modules designate a special type for UUIDs, as a |
179
|
|
|
|
|
|
|
convenience to the client: All payloads have a UUID as one of the required |
180
|
|
|
|
|
|
|
keys. If the client does not specify a UUID when creating a payload, then |
181
|
|
|
|
|
|
|
one will be lazily auto-generated. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
If you would like to set an explicit UUID, you may provide a C |
184
|
|
|
|
|
|
|
object, a C object, or a string that C can parse. When |
185
|
|
|
|
|
|
|
reading, a C object is returned, but that can be converted into a |
186
|
|
|
|
|
|
|
string very easily: |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
$uuid = "$uuid"; |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=cut |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Readonly our $ProfileUUID => 21; |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head2 Identifier (C<$ProfileIdentifier>) |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
This is another convenience type. All payloads require an identifier, |
197
|
|
|
|
|
|
|
which is a reverse-DNS-style (Java-style) string. If the client does not |
198
|
|
|
|
|
|
|
specify an identifier, then one will be lazily auto-generated. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
See RFC 1035 for the standard relating to host and domain names, but please note |
201
|
|
|
|
|
|
|
that spaces are I acceptable here, even though they may be in RFC 1035. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=cut |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Readonly our $ProfileIdentifier => 22; |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 (C<$ProfileClass>) |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
This profile type is used to indicate that the value is an instance of a class. |
211
|
|
|
|
|
|
|
The class is a sub-class of C, so the |
212
|
|
|
|
|
|
|
methods implemented in that class are all available. More information about |
213
|
|
|
|
|
|
|
what specific sub-class is used can be found in the documentation of the |
214
|
|
|
|
|
|
|
containing class. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=cut |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
Readonly our $ProfileClass => 24; |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head1 SEE ALSO |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
L, L, L, L, L, |
224
|
|
|
|
|
|
|
L, |
225
|
|
|
|
|
|
|
L |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
Refer to L for acknowledgements. |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=head1 AUTHOR |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
A. Karl Kornel, C<< >> |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
Copyright © 2014 A. Karl Kornel. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
240
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
241
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
See L for more information. |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=cut |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
1; |