line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OMA::Download::DRM::REL::XML; |
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
3
|
|
|
|
|
|
|
BEGIN { |
4
|
1
|
|
|
1
|
|
799
|
use MIME::Base64; |
|
1
|
|
|
|
|
687
|
|
|
1
|
|
|
|
|
6613
|
|
5
|
1
|
|
|
1
|
|
623
|
use OMA::Download::DRM::REL; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
6
|
1
|
|
|
1
|
|
445
|
push @OMA::Download::DRM::REL::XML::ISA, 'OMA::Download::DRM::REL'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
OMA::Download::DRM::REL::XML - XML representation of the OMA DRM REL 1.0 |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
XML representation of the Open Mobile Alliance Digital Rights Management Rights Expression Language 1.0 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use OMA::Download::DRM::REL::XML; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $rel=OMA::Download::DRM::REL::XML->new(%args); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 PROPERTIES |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 mime |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Returns the XML rights object MIME type |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
print $rel->mime; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
1
|
|
|
1
|
1
|
4
|
sub mime { 'application/vnd.oma.drm.rights+xml' } |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 extension |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Returns the XML rights object extension |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
print $rel->extension; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
0
|
|
|
0
|
1
|
0
|
sub extension { '.dr' } |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
### Class init ----------------------------------------------------------------- |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 METHODS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 packit |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Packs data using XML format |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
print $rel->packit; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
sub packit { |
59
|
1
|
|
|
1
|
1
|
2
|
my ($self)=@_; |
60
|
1
|
|
|
|
|
2
|
my $res=''; |
61
|
1
|
|
|
|
|
2
|
$res.=''."\n"; # WBXML Version Number (1.3) |
62
|
1
|
|
|
|
|
3
|
$res.=''."\n"; # Public Identifier (~//OMA//DTD REL 1.0//EN) |
63
|
1
|
|
|
|
|
10
|
return $res.''."\n".$self->_packin."\n".''; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
#--- Support routines ---------------------------------------------------------- |
67
|
|
|
|
|
|
|
sub _init { |
68
|
1
|
|
|
1
|
|
2
|
my ($self)=@_; |
69
|
1
|
|
|
|
|
150
|
$self->{'element_tokens'} = { |
70
|
|
|
|
|
|
|
'rights' => 'o-ex:rights', |
71
|
|
|
|
|
|
|
'context' => 'o-ex:context', |
72
|
|
|
|
|
|
|
'version' => 'o-dd:version', |
73
|
|
|
|
|
|
|
'uid' => 'o-dd:uid', |
74
|
|
|
|
|
|
|
'agreement' => 'o-ex:agreement', |
75
|
|
|
|
|
|
|
'asset' => 'o-ex:asset', |
76
|
|
|
|
|
|
|
'KeyInfo' => 'ds:KeyInfo', |
77
|
|
|
|
|
|
|
'KeyValue' => 'ds:KeyValue', |
78
|
|
|
|
|
|
|
'permission' => 'o-ex:permission', |
79
|
|
|
|
|
|
|
'play' => 'o-dd:play', |
80
|
|
|
|
|
|
|
'display' => 'o-dd:display', |
81
|
|
|
|
|
|
|
'execute' => 'o-dd:execute', |
82
|
|
|
|
|
|
|
'print' => 'o-dd:print', |
83
|
|
|
|
|
|
|
'constraint' => 'o-ex:constraint', |
84
|
|
|
|
|
|
|
'count' => 'o-dd:count', |
85
|
|
|
|
|
|
|
'datetime' => 'o-dd:datetime', |
86
|
|
|
|
|
|
|
'start' => 'o-dd:start', |
87
|
|
|
|
|
|
|
'end' => 'o-dd:end', |
88
|
|
|
|
|
|
|
'interval' => 'o-dd:interval' |
89
|
|
|
|
|
|
|
}; |
90
|
1
|
50
|
|
|
|
12
|
if ($self->{key}) { |
91
|
0
|
|
|
|
|
0
|
$self->{key}=encode_base64($self->{key}); $self->{key}=~s/[\r\n]//g; |
|
0
|
|
|
|
|
0
|
|
92
|
|
|
|
|
|
|
} |
93
|
1
|
|
|
|
|
3
|
return 1; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
sub _in_element { |
96
|
9
|
|
|
9
|
|
82
|
my ($self, $element, $content, $is_root)=@_; |
97
|
9
|
50
|
|
|
|
21
|
die "Unknown element token $element" unless $self->{element_tokens}{$element}; |
98
|
9
|
|
|
|
|
19
|
my $res='<'.$self->{element_tokens}{$element}; |
99
|
9
|
100
|
|
|
|
14
|
if ($content) { |
100
|
7
|
|
|
|
|
22
|
$res.='>'.$content.''.$self->{element_tokens}{$element}.'>' |
101
|
|
|
|
|
|
|
} else { |
102
|
2
|
|
|
|
|
4
|
$res.='/>' |
103
|
|
|
|
|
|
|
} |
104
|
9
|
|
|
|
|
22
|
return $res; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
sub _in_string { |
107
|
3
|
|
|
3
|
|
10
|
return $_[1]; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
sub _in_opaque { |
110
|
0
|
|
|
0
|
|
|
return $_[1]; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
__END__ |