• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef DRM_ERROR_CODE_H
17 #define DRM_ERROR_CODE_H
18 #include <iostream>
19 
20 namespace OHOS {
21 namespace DrmStandard {
22 
23 enum DrmInnerErrCode : int32_t {
24     /**
25      * the operation completed successfully.
26      */
27     DRM_INNER_ERR_OK = 0,
28     /**
29      * DRM_INNER_ERR_BASE.
30      */
31     DRM_INNER_ERR_BASE = 24700800,
32     /**
33      * unknown error.
34      */
35     DRM_INNER_ERR_UNKNOWN = DRM_INNER_ERR_BASE + 1,
36     /**
37      * opertation not be permitted.
38      */
39     DRM_INNER_ERR_OPERATION_NOT_PERMITTED = DRM_INNER_ERR_BASE + 2,
40     /**
41      * Meet max MediaKeySystem num limit.
42      */
43     DRM_INNER_ERR_MAX_SYSTEM_NUM_REACHED = DRM_INNER_ERR_BASE + 3,
44     /**
45      * Meet max MediaKeySession num limit.
46      */
47     DRM_INNER_ERR_MAX_SESSION_NUM_REACHED = DRM_INNER_ERR_BASE + 4,
48     /**
49      * no memory.
50      */
51     DRM_INNER_ERR_NO_MEMORY = DRM_INNER_ERR_BASE + 5,
52     /**
53      * invalid argument.
54      */
55     DRM_INNER_ERR_INVALID_VAL = DRM_INNER_ERR_BASE + 6,
56     /**
57      * IO error.
58      */
59     DRM_INNER_ERR_IO = DRM_INNER_ERR_BASE + 7,
60     /**
61      * network timeout.
62      */
63     DRM_INNER_ERR_TIMEOUT = DRM_INNER_ERR_BASE + 8,
64     /**
65      * drm service died.
66      */
67     DRM_INNER_ERR_SERVICE_DIED = DRM_INNER_ERR_BASE + 9,
68     /**
69      * not support this operation in this state.
70      */
71     DRM_INNER_ERR_INVALID_STATE = DRM_INNER_ERR_BASE + 10,
72     /**
73      * mediakey system not supported.
74      */
75     DRM_INNER_ERR_UNSUPPORTED = DRM_INNER_ERR_BASE + 11,
76     /**
77      * invalid key session.
78      */
79     DRM_INNER_ERR_INVALID_KEY_SESSION = DRM_INNER_ERR_BASE + 12,
80     /**
81      * invalid media key system.
82      */
83     DRM_INNER_ERR_INVALID_MEDIA_KEY_SYSTEM = DRM_INNER_ERR_BASE + 13,
84     /**
85      * crypto error.
86      */
87     DRM_INNER_ERR_CRYPTO_ERROR = DRM_INNER_ERR_BASE + 14,
88     /**
89      * device not provisioned.
90      */
91     DRM_INNER_ERR_NOT_PROVISIONED = DRM_INNER_ERR_BASE + 15,
92     /**
93      * device time error.
94      */
95     DRM_INNER_ERR_DEVICE_TIME_ERROR = DRM_INNER_ERR_BASE + 16,
96     /**
97      * provisioning not allowed.
98      */
99     DRM_INNER_ERR_PROVISIONING_NOT_ALLOWED = DRM_INNER_ERR_BASE + 17,
100     /**
101      * not device cert when provisioning.
102      */
103     DRM_INNER_ERR_PROVISIONING_NO_DEVICE_CERT = DRM_INNER_ERR_BASE + 18,
104     /**
105      * server certificates are invalid when provisioning.
106      */
107     DRM_INNER_ERR_PROVISIONING_INVALID_SERVER_CERTIFICATES = DRM_INNER_ERR_BASE + 19,
108     /**
109      * server certificates are expired when provisioning.
110      */
111     DRM_INNER_ERR_PROVISIONING_SERVER_CERTIFICATES_EXPIRED = DRM_INNER_ERR_BASE + 20,
112     /**
113      * invalid message when provisioning.
114      */
115     DRM_INNER_ERR_PROVISIONING_INVALID_MESSAGE = DRM_INNER_ERR_BASE + 21,
116     /**
117      * drm certificates are invalid when provisioning.
118      */
119     DRM_INNER_ERR_PROVISIONING_INVALID_DRM_CERTIFICATES = DRM_INNER_ERR_BASE + 22,
120     /**
121      * time error when provisioning.
122      */
123     DRM_INNER_ERR_PROVISIONING_TIME_ERROR = DRM_INNER_ERR_BASE + 23,
124     /**
125      * storage read is failed when provisioning.
126      */
127     DRM_INNER_ERR_STORAGE_READ = DRM_INNER_ERR_BASE + 24,
128     /**
129      * storage write is failed when provisioning.
130      */
131     DRM_INNER_ERR_STORAGE_WRITE = DRM_INNER_ERR_BASE + 25,
132     /**
133      * not allowed to generate key request.
134      */
135     DRM_INNER_ERR_KEY_REQUEST_NOT_ALLOWED = DRM_INNER_ERR_BASE + 26,
136     /**
137      * invalid media key type when generating key request.
138      */
139     DRM_INNER_ERR_KEY_REQUEST_INVALID_MEDIA_KEY_TYPE = DRM_INNER_ERR_BASE + 27,
140     /**
141      * invalid mime type when generating key request.
142      */
143     DRM_INNER_ERR_KEY_REQUEST_INVALID_MIMETYPE = DRM_INNER_ERR_BASE + 28,
144     /**
145      * invalid initdata when generating key request.
146      */
147     DRM_INNER_ERR_KEY_REQUEST_INVALID_INITDATA = DRM_INNER_ERR_BASE + 29,
148     /**
149      * invalid drm certificates when generating key request.
150      */
151     DRM_INNER_ERR_KEY_REQUEST_INVALID_DRM_CERTIFICATES = DRM_INNER_ERR_BASE + 30,
152     /**
153      * drm certificates are expired when generating key request.
154      */
155     DRM_INNER_ERR_KEY_REQUEST_DRM_CERTIFICATES_EXPIRED = DRM_INNER_ERR_BASE + 31,
156     /**
157      * drm certificates are revoked when generating key request.
158      */
159     DRM_INNER_ERR_KEY_REQUEST_DRM_CERTIFICATES_REVOKED = DRM_INNER_ERR_BASE + 32,
160     /**
161      * invalid message when processing key response.
162      */
163     DRM_INNER_ERR_KEY_RESPONSE_INVALID_MESSAGE = DRM_INNER_ERR_BASE + 33,
164     /**
165      * invalid server certificates when processing key response.
166      */
167     DRM_INNER_ERR_KEY_RESPONSE_INVALID_SERVER_CERTIFICATES = DRM_INNER_ERR_BASE + 34,
168     /**
169      * server certificates expired when processing key response.
170      */
171     DRM_INNER_ERR_KEY_RESPONSE_SERVER_CERTIFICATES_EXPIRED = DRM_INNER_ERR_BASE + 35,
172     /**
173      * time error when processing key response.
174      */
175     DRM_INNER_ERR_KEY_RESPONSE_TIME_ERROR = DRM_INNER_ERR_BASE + 36,
176     /**
177      * server denied when processing key response.
178      */
179     DRM_INNER_ERR_KEY_RESPONSE_DENIED = DRM_INNER_ERR_BASE + 37,
180     /**
181      * invalid media key id when restoring offline mediakeys.
182      */
183     DRM_INNER_ERR_KEY_RESTORE_INVALID_MEDIA_KEY_ID = DRM_INNER_ERR_BASE + 38,
184     /**
185      * algorithm not support when decrypting media samples.
186      */
187     DRM_INNER_ERR_DECRYPT_ALGORITHM_NOT_SUPPORT = DRM_INNER_ERR_BASE + 39,
188     /**
189      * no license when decrypting media samples.
190      */
191     DRM_INNER_ERR_DECRYPT_NO_LICENSE = DRM_INNER_ERR_BASE + 40,
192     /**
193      * no key when decrypting media samples.
194      */
195     DRM_INNER_ERR_DECRYPT_NO_KEY = DRM_INNER_ERR_BASE + 41,
196     /**
197      * invalid iv when decrypting media samples.
198      */
199     DRM_INNER_ERR_DECRYPT_INVALID_IV = DRM_INNER_ERR_BASE + 42,
200     /**
201      * invalid subsamples when decrypting media samples.
202      */
203     DRM_INNER_ERR_DECRYPT_INVALID_SUBSAMPLES = DRM_INNER_ERR_BASE + 43,
204     /**
205      * invalid pattern when decrypting media samples.
206      */
207     DRM_INNER_ERR_DECRYPT_INVALID_PATTERN = DRM_INNER_ERR_BASE + 44,
208     /**
209      * invalid input buffer when decrypting media samples.
210      */
211     DRM_INNER_ERR_DECRYPT_INVALID_INPUT_BUFFER = DRM_INNER_ERR_BASE + 45,
212     /**
213      * invalid input buffer len when decrypting media samples.
214      */
215     DRM_INNER_ERR_DECRYPT_INVALID_INPUT_BUFFER_LEN = DRM_INNER_ERR_BASE + 46,
216     /**
217      * invalid output buffer when decrypting media samples.
218      */
219     DRM_INNER_ERR_DECRYPT_INVALID_OUTPUT_BUFFER = DRM_INNER_ERR_BASE + 47,
220     /**
221      * invalid output buffer len when decrypting media samples.
222      */
223     DRM_INNER_ERR_DECRYPT_INVALID_OUTPUT_BUFFER_LEN = DRM_INNER_ERR_BASE + 48,
224     /**
225      * secure not support when decrypting media samples.
226      */
227     DRM_INNER_ERR_DECRYPT_SECURE_NOT_SUPPORT = DRM_INNER_ERR_BASE + 49,
228     /**
229      * output protection not allowed when do policy control.
230      */
231     DRM_INNER_ERR_POLICY_OUTPUT_PROTECTION_NOT_ALLOWED = DRM_INNER_ERR_BASE + 50,
232     /**
233      * content protection level not allowed when do policy control.
234      */
235     DRM_INNER_ERR_POLICY_CONTENT_PROTECTION_LEVEL_NOT_ALLOWED = DRM_INNER_ERR_BASE + 51,
236     /**
237      * rental not allowed when do policy control.
238      */
239     DRM_INNER_ERR_POLICY_RENTAL_NOT_ALLOWED = DRM_INNER_ERR_BASE + 52,
240     /**
241      * invalid renew parameter when do policy control.
242      */
243     DRM_INNER_ERR_POLICY_INVALID_RENEW_PARAMETER = DRM_INNER_ERR_BASE + 53,
244     /**
245      * license need when do policy control.
246      */
247     DRM_INNER_ERR_POLICY_LICENSE_NEED = DRM_INNER_ERR_BASE + 54,
248     /**
249      * memory error.
250      */
251     DRM_INNER_ERR_MEMORY_ERROR = DRM_INNER_ERR_BASE + 55,
252     /**
253      * tamper found.
254      */
255     DRM_INNER_ERR_TAMPER_FOUND = DRM_INNER_ERR_BASE + 56,
256     /**
257      * drm service fatal error.
258      */
259     DRM_INNER_ERR_SERVICE_FATAL_ERROR = DRM_INNER_ERR_BASE + 57,
260     /**
261      * calling plugin error.
262      */
263     DRM_INNER_ERR_PLUGIN_ERROR = DRM_INNER_ERR_BASE + 58,
264 };
265 } // namespace DrmStandard
266 } // namespace OHOS
267 #endif // DRM_ERROR_CODE_H