Merged latest changes in Tizen 2.0
[framework/security/drm-client.git] / include / drm_client_types.h
1 /*\r
2  * drm-client\r
3  *\r
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
5  *\r
6  * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>\r
7  *                      Mahendra Kumar Prajapat <mahendra.p@samsung.com>\r
8  *                      Harsha Shekar <h.shekar@samsung.com>\r
9  *\r
10  *\r
11  * Licensed under the Apache License, Version 2.0 (the "License");\r
12  * you may not use this file except in compliance with the License.\r
13  * You may obtain a copy of the License at\r
14  *\r
15  * http://www.apache.org/licenses/LICENSE-2.0\r
16  *\r
17  * Unless required by applicable law or agreed to in writing, software\r
18  * distributed under the License is distributed on an "AS IS" BASIS,\r
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
20  * See the License for the specific language governing permissions and\r
21  * limitations under the License.\r
22  *\r
23  */\r
24 \r
25 /**\r
26  * @file                drm_client_types.h\r
27  * @brief       DRM Client API macros, structures & enum declaration file.\r
28  * @author      Mahendra Kumar Prajapat (mahendra.p@samsung.com)\r
29  * @author      Harsha Shekar (h.shekar@samsung.com)\r
30  * @version     0.1\r
31  * @history     0.1: First version of DRM Client API macros,\r
32  *                              structures & enum declarations.\r
33  */\r
34 \r
35 #ifndef __DRM_CLIENT_TYPES_H__\r
36 #define __DRM_CLIENT_TYPES_H__\r
37 \r
38 #ifdef __cplusplus\r
39 extern "C" {\r
40 #endif /*__cplusplus */\r
41 \r
42 #include <time.h>\r
43 \r
44 #include "tizen_error.h"\r
45 \r
46 \r
47 /******************************************************************/\r
48 \r
49 /*\r
50  * Maximum Length of Author field\r
51  */\r
52 #define DRM_MAX_LEN_AUTHOR              (64)\r
53 \r
54 /*\r
55  * Maximum Length of Copyright field\r
56  */\r
57 #define DRM_MAX_LEN_COPYRIGHT   (64)\r
58 \r
59 /*\r
60  * Maximum Length of Description field\r
61  */\r
62 #define DRM_MAX_LEN_DESCRIPTION (256)\r
63 \r
64 /*\r
65  * Maximum Length of Icon URI field\r
66  */\r
67 #define DRM_MAX_LEN_ICON_URI    (256)\r
68 \r
69 /*\r
70  * Maximum Length of Info URL field\r
71  */\r
72 #define DRM_MAX_LEN_INFO_URL    (256)\r
73 \r
74 /*\r
75  * Maximum Length of Content URL field\r
76  */\r
77 #define DRM_MAX_LEN_CONTENT_URL (512)\r
78 \r
79 /*\r
80  * Maximum Length of Rights URL field\r
81  */\r
82 #define DRM_MAX_LEN_RIGHTS_URL  (256)\r
83 \r
84 /*\r
85  * Maximum Length of Title field\r
86  */\r
87 #define DRM_MAX_LEN_TITLE               (256)\r
88 \r
89 /*\r
90  * Maximum Length of MIME (Content Type) field\r
91  */\r
92 #define DRM_MAX_LEN_MIME                (64)\r
93 \r
94 /*\r
95  * Maximum Length of Content ID field\r
96  */\r
97 #define DRM_MAX_LEN_CID                 (256)\r
98 \r
99 /*\r
100  * Maximum Length of Individual Identity field\r
101  */\r
102 #define DRM_MAX_LEN_INDIVIDUAL_IDENTITY (64)\r
103 \r
104 /*\r
105  * Maximum Length of System Identity field\r
106  */\r
107 #define DRM_MAX_LEN_SYSTEM_IDENTITY     (64)\r
108 \r
109 /*\r
110  * Maximum Length of original filename for PlayReady envelope\r
111  */\r
112 #define DRM_MAX_LEN_FILEPATH    (256)\r
113 \r
114 /**\r
115 * Maximum length of Transaction ID of the DCF\r
116 */\r
117 #define DRM_MAX_SIZE_TRANSACTION_ID             (17)\r
118 \r
119 /**\r
120 * Maximum length of DivX code (Registration / De-registration code )\r
121 */\r
122 #define DRM_MAX_SIZE_DIVX_CODE          (16)\r
123 \r
124 /**\r
125 * Maximum length of License Data\r
126 */\r
127 #define DRM_MAX_LEN_LICENSE_DATA        (3000)\r
128 \r
129 /**\r
130 * Maximum length of Initiator URL\r
131 */\r
132 #define DRM_MAX_LEN_INITIATOR_URL       (512)\r
133 \r
134 /**\r
135 * Maximum length of IP Address\r
136 */\r
137 #define DRM_MAX_LEN_IP_ADDR             (64)\r
138 \r
139 /*\r
140  * Max length of APP ID\r
141  */\r
142 #define DRM_MAX_LEN_APP_ID              (15)\r
143 \r
144 /*\r
145  * Max length of User ID\r
146  */\r
147 #define DRM_MAX_LEN_USER_GUID   (15)\r
148 \r
149 /*\r
150  * Max length of Device ID\r
151  */\r
152 #define DRM_MAX_LEN_DEVICE_ID   (15)\r
153 \r
154 /*\r
155  * Max length of Order ID\r
156  */\r
157 #define DRM_MAX_LEN_ORDER_ID    (23)\r
158 \r
159 /*\r
160  * Max length of Service ID\r
161  */\r
162 #define DRM_MAX_LEN_SERVICE_ID  (31)\r
163 \r
164 /*\r
165  * Max length of Account ID\r
166  */\r
167 #define DRM_MAX_LEN_ACCOUNT_ID  (31)\r
168 \r
169 /****************************************************************/\r
170 \r
171 /**\r
172  * @enum drm_result_e\r
173  * @brief DRM Return values.\r
174  */\r
175 typedef enum {\r
176         /**< Success */\r
177         DRM_RETURN_SUCCESS = 0,\r
178         /**< Invalid Argument */\r
179         DRM_RETURN_INVALID_ARG = TIZEN_ERROR_INVALID_PARAMETER,\r
180         /**< Insufficient Memory */\r
181         DRM_RETURN_INSUFFICIENT_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,\r
182         /**< Parsing Error */\r
183         DRM_RETURN_PARSING_ERROR = TIZEN_ERROR_DRM_CLASS | 0x01,\r
184         /**< DB Error */\r
185         DRM_RETURN_DB_ERROR = TIZEN_ERROR_DRM_CLASS | 0x02,\r
186         /**< File Error */\r
187         DRM_RETURN_FILE_ERROR = TIZEN_ERROR_DRM_CLASS | 0x03,\r
188         /**< Communication Error */\r
189         DRM_RETURN_COMMUNICATION_ERROR = TIZEN_ERROR_DRM_CLASS | 0x04,\r
190         /**< Internal Error */\r
191         DRM_RETURN_INTERNAL_ERROR = TIZEN_ERROR_UNKNOWN\r
192 } drm_result_e;\r
193 \r
194 /**\r
195  * @enum drm_bool_type_e\r
196  * @brief DRM Bool values.\r
197  */\r
198 typedef enum {\r
199         DRM_FALSE = 0,                       /**< false */\r
200         DRM_TRUE = 1,                        /**< true */\r
201         DRM_UNKNOWN = 0xFFFFFFFF             /**< error */\r
202 } drm_bool_type_e;\r
203 \r
204 /**\r
205  * @enum drm_file_type_e\r
206  * @brief DRM file types.\r
207  */\r
208 typedef enum {\r
209         DRM_TYPE_UNDEFINED,                             /**< For initialization purpose */\r
210         DRM_TYPE_OMA_V1,                                /**< OMA DRM v1 file */\r
211         DRM_TYPE_OMA_V2,                                /**< OMA DRM v2 file */\r
212         DRM_TYPE_PLAYREADY,                             /**< PlayReady file */\r
213         DRM_TYPE_PLAYREADY_ENVELOPE,    /**< PlayReady Envelope file */\r
214         DRM_TYPE_DIVX,                                  /**< DivX file */\r
215         DRM_TYPE_OMA_PD,                                /**< Progressive Download file */\r
216         DRM_TYPE_PIFF,                                  /**< PIFF file */\r
217         DRM_TYPE_SAPPS                                  /**< Samsung Apps */\r
218 } drm_file_type_e;\r
219 \r
220 /**\r
221  * @enum drm_permission_type_e\r
222  * @brief DRM Permission types.\r
223  */\r
224 typedef enum {\r
225         DRM_PERMISSION_TYPE_NONE,                               /**< For initialization purpose */\r
226         DRM_PERMISSION_TYPE_ANY,                                /**< Any permission */\r
227         DRM_PERMISSION_TYPE_PLAY,                               /**< Play Permission */\r
228         DRM_PERMISSION_TYPE_COLLABORATIVE_PLAY, /**< Collaborative Play\r
229                                                                                         (e.g gaming application) */\r
230 \r
231         DRM_PERMISSION_TYPE_DISPLAY,                    /**< Display Permission */\r
232         DRM_PERMISSION_TYPE_EXECUTE,                    /**< Execute Permission */\r
233         DRM_PERMISSION_TYPE_PRINT,                              /**< Print Permission */\r
234         DRM_PERMISSION_TYPE_EXPORT_COPY,                /**< Export-copy permission */\r
235         DRM_PERMISSION_TYPE_EXPORT_MOVE                 /**< Export-move permission */\r
236 } drm_permission_type_e;\r
237 \r
238 /**\r
239  * @enum drm_license_status_e\r
240  * @brief DRM License status.\r
241  */\r
242 typedef enum {\r
243         DRM_LICENSE_STATUS_UNDEFINED,   /**< For initialization purpose */\r
244         DRM_LICENSE_STATUS_VALID,               /**< Valid License */\r
245         DRM_LICENSE_STATUS_FUTURE_USE,  /**< License for future use */\r
246         DRM_LICENSE_STATUS_EXPIRED,             /**< Expired License */\r
247         DRM_LICENSE_STATUS_NO_LICENSE,  /**< No License */\r
248 } drm_license_status_e;\r
249 \r
250 /**\r
251  * @enum drm_action_type_e\r
252  * @brief DRM Action types.\r
253  */\r
254 typedef enum {\r
255         DRM_ACTION_UNDEFINED,           /**< for initialization purpose */\r
256         DRM_IS_FORWARDING_ALLOWED,      /**< if a file can be forwarded */\r
257         DRM_HAS_VALID_SETAS_STATUS,     /**< if a file can be SETAS */\r
258         DRM_IS_DEVICE_ACTIVATED,                /**< if a device is DIVX activated */\r
259         DRM_IS_VALID_SECURE_CLOCK       /**< if Secure Clock is set */\r
260 } drm_action_type_e;\r
261 \r
262 /**\r
263  * @enum drm_method_type_e\r
264  * @brief DRM method types.\r
265  */\r
266 typedef enum {\r
267         DRM_METHOD_TYPE_UNDEFINED,                      /**< For initialization purpose */\r
268         DRM_METHOD_TYPE_FORWARD_LOCK,           /**< OMA DRM forward lock */\r
269         DRM_METHOD_TYPE_COMBINED_DELIVERY,      /**< OMA DRM Combined Delivery */\r
270         DRM_METHOD_TYPE_SEPARATE_DELIVERY       /**< OMA DRM Separate Delivery\r
271                                                                                 & OMA DRM v2 */\r
272 }drm_method_type_e;\r
273 \r
274 /**\r
275  * @enum drm_rights_version_e\r
276  * @brief DRM Rights Version.\r
277  */\r
278 typedef enum {\r
279         DRM_OMA_DRMV1_RIGHTS,           /**< OMA DRM v1 */\r
280         DRM_OMA_DRMV2_RIGHTS,           /**< OMA DRM v2 */\r
281         DRM_UNDEFINED_RIGHTS = 3                /**< dummy */\r
282 } drm_rights_version_e;\r
283 \r
284 /**\r
285  * @enum drm_constraint_identity_type_e\r
286  * @brief DRM Constraint Identity type.\r
287  */\r
288 typedef enum {\r
289         DRM_CONSTRAINT_IDENTITY_TYPE_NONE,              /**< For initialization */\r
290         DRM_CONSTRAINT_IDENTITY_TYPE_IMEI,              /**< IMEI */\r
291         DRM_CONSTRAINT_IDENTITY_TYPE_IMSI,              /**< IMSI */\r
292         DRM_CONSTRAINT_IDENTITY_TYPE_MSISDN,    /**< MS-ISDN */\r
293         DRM_CONSTRAINT_IDENTITY_TYPE_WIM                /**< WIM\r
294                                                                                         (Wireless/WAP Identity Module ) */\r
295 } drm_constraint_identity_type_e;\r
296 \r
297 /**\r
298  * @enum drm_setas_category_e\r
299  * @brief DRM SETAS type.\r
300  */\r
301 typedef enum {\r
302         DRM_SETAS_NONE = -1,                    /**< No set as operation */\r
303         DRM_SETAS_WALLPAPER = 0,                /**< Set As Wallpaper */\r
304         DRM_SETAS_RINGTONE = 2,                 /**< Set As Ringtone */\r
305 } drm_setas_category_e;\r
306 \r
307 /**\r
308  * @enum drm_data_type_e\r
309  * @brief DRM Requested Data types.\r
310  */\r
311 typedef enum {\r
312         /* For initialization purpose */\r
313         DRM_DATA_TYPE_NONE = -1,\r
314 \r
315         /* Secure Clock Information */\r
316         DRM_DATA_TYPE_SECURE_CLOCK = 0,\r
317 \r
318         /* Transaction Tracking flag status information */\r
319         DRM_DATA_TYPE_TRANSACTION_TRACKING_FLAG,\r
320 \r
321         /* Transaction Tracking ID information */\r
322         DRM_DATA_TYPE_TRANSACTION_TRACKING_ID,\r
323 \r
324         /* DivX Registration Code information */\r
325         DRM_DATA_TYPE_DIVX_REGISTRATION_CODE,\r
326 \r
327         /* DivX De-registration Code information */\r
328         DRM_DATA_TYPE_DIVX_DEREGISTRATION_CODE,\r
329 } drm_data_type_e;\r
330 \r
331 /**\r
332  * @enum drm_request_type_e\r
333  * @brief DRM Request types.\r
334  */\r
335 typedef enum {\r
336         /* For initialization purpose */\r
337         DRM_REQUEST_TYPE_NONE = -1,\r
338 \r
339         /* Request to Register DRM file in DB */\r
340         DRM_REQUEST_TYPE_REGISTER_FILE = 0,\r
341 \r
342         /* Request to Un-register DRM file from DB */\r
343         DRM_REQUEST_TYPE_UNREGISTER_FILE,\r
344 \r
345         /* Request to Un-register All DRM files from DB */\r
346         DRM_REQUEST_TYPE_UNREGISTER_ALL_FILES,\r
347 \r
348         /* Request to Register / install License into DB */\r
349         DRM_REQUEST_TYPE_REGISTER_LICENSE,\r
350 \r
351         /* Request to start Initiator processing for PlayReady */\r
352         DRM_REQUEST_TYPE_SUBMIT_INITIATOR_URL,\r
353 \r
354         /* Submit Roap Message */\r
355         DRM_REQUEST_TYPE_SUBMIT_ROAP_MESSAGE,\r
356 \r
357         /* Submit Roap User Consent */\r
358         DRM_REQUEST_TYPE_SUBMIT_ROAP_USER_CONSENT,\r
359 \r
360         /* HTTP User Cancel */\r
361         DRM_REQUEST_TYPE_HTTP_USER_CANCEL,\r
362 \r
363         /* Register Copy File */\r
364         DRM_REQUEST_TYPE_REGISTER_COPY_FILE,\r
365 \r
366         /* Register Move File */\r
367         DRM_REQUEST_TYPE_REGISTER_MOVE_FILE,\r
368 \r
369         /* Insert External Memory */\r
370         DRM_REQUEST_TYPE_INSERT_EXT_MEMORY,\r
371 \r
372         /* Extract External Memory */\r
373         DRM_REQUEST_TYPE_EXTRACT_EXT_MEMORY,\r
374 \r
375         /* Register SetAs */\r
376         DRM_REQUEST_TYPE_REGISTER_SETAS,\r
377 \r
378         /* Unregister SetAs */\r
379         DRM_REQUEST_TYPE_UNREGISTER_SETAS\r
380 \r
381 } drm_request_type_e;\r
382 \r
383 /**\r
384  * @enum drm_roap_init_src_e\r
385  * @brief DRM ROAP initialization source.\r
386  */\r
387 typedef enum{\r
388         /**< dummy */\r
389    DRM_ROAP_INIT_FROM_UNKNOWN,\r
390 \r
391    /**< roap is initialized from browser*/\r
392    DRM_ROAP_INIT_FROM_BROWSER,\r
393 \r
394    /**< roap is initialized from DRM content */\r
395    DRM_ROAP_INIT_FROM_CONTENT,\r
396 \r
397    /**< roap is initialized from WAPPUSH */\r
398    DRM_ROAP_INIT_FROM_WAPPUSH\r
399 } drm_roap_init_src_e;\r
400 \r
401 /**\r
402  * @enum        drm_operation_type_e\r
403  * @brief       DRM operation type.\r
404  */\r
405 typedef enum {\r
406         /* License Acquisition Operation */\r
407         DRM_OPERATION_TYPE_LICENSE_ACQ,\r
408 \r
409         /* Join Domain Operation */\r
410         DRM_OPERATION_TYPE_JOIN_DOMAIN,\r
411 \r
412         /* Leave Domain Operation */\r
413         DRM_OPERATION_TYPE_LEAVE_DOMAIN,\r
414 \r
415         /* Metering Operation */\r
416         DRM_OPERATION_TYPE_METERING_INFO,\r
417 \r
418         /* Unknown Operation type */\r
419         DRM_OPERATION_TYPE_UNKNOWN\r
420 } drm_operation_type_e;\r
421 \r
422 /**\r
423  * @enum        drm_operation_status_e\r
424  * @brief       DRM operation status.\r
425  */\r
426 typedef enum {\r
427         /** DRM operation is started */\r
428         DRM_OPERATION_STATUS_STARTED,\r
429 \r
430         /** DRM operation is in Progress */\r
431         DRM_OPERATION_STATUS_INPROGRESS,\r
432 \r
433         /** DRM operation is Completed */\r
434         DRM_OPERATION_STATUS_COMPLETED,\r
435 \r
436         /** During DRM operation, additional operation is to be performed */\r
437         DRM_OPERATION_STATUS_ADDITIONAL_INFO,\r
438 \r
439         /** An error occurred with respect to DRM operation */\r
440         DRM_OPERATION_STATUS_ERROR\r
441 } drm_operation_status_e;\r
442 \r
443 /**\r
444  * @enum drm_web_server_result_code_e\r
445  * @brief DRM Return values.\r
446  */\r
447 typedef enum {\r
448         /** No server Error */\r
449         DRM_RESULT_CODE_NONE,\r
450 \r
451         /** Device Certificate is revoked.\r
452          * User shall be informed that their device needs to be updated.\r
453          */\r
454         DRM_RESULT_CODE_DEVCERT_REVOKED,\r
455 \r
456         /** Indicates a server problem.Device shall silently retry 3 times.\r
457          *  If failure persists, user shall be informed about a server failure\r
458          *  and to try again later\r
459          */\r
460         DRM_RESULT_CODE_INTERNAL_ERROR,\r
461 \r
462         /** Means an invalid protocol message.\r
463          * This shall never happen unless there's been a "man in the middle"\r
464          * attack. Device shall perform a retry.\r
465          */\r
466         DRM_RESULT_CODE_INVALID_MESSAGE,\r
467 \r
468         /** Means that the device limit has been reached for this domain and\r
469          * therefore the device cannot join this Domain.\r
470          * The application on the device shall provide the appropriate\r
471          * response to the end user.\r
472          */\r
473         DRM_RESULT_CODE_DEVICE_LIMIT_REACHED,\r
474 \r
475         /** Indicates that the device shall join a Domain and then\r
476          * retry license acquisition.\r
477          */\r
478         DRM_RESULT_CODE_DOMAIN_REQUIRED,\r
479 \r
480         /** Indicates that the device shall renew the Domain Certificate\r
481          * for this Domain. The device shall join Domain and then retry\r
482          * license acquisition.\r
483          */\r
484         DRM_RESULT_CODE_RENEW_DOMAIN,\r
485 \r
486         /** Device shall leave Domain */\r
487         DRM_RESULT_CODE_NOT_A_MEMBER,\r
488 \r
489         /** Means that device is not using correct protocol, most likely\r
490          * because server has been updated since device was manufactured.\r
491          * The device shall notify user to check for updates or fail gracefully.\r
492          */\r
493         DRM_RESULT_CODE_PROTOCOL_VERSION_MISMATCH,\r
494 \r
495         /** User shall always be authenticated before making license acquisitions.\r
496          *  If this error happens, device shall notify user to contact\r
497          *  customer service.\r
498          */\r
499         DRM_RESULT_CODE_UNKNOWN_ACCOUNTID,\r
500 \r
501         /** Device shall follow redirect. */\r
502         DRM_RESULT_CODE_PROTOCOL_REDIRECT,\r
503 \r
504         /** Service specific Server errors */\r
505         DRM_RESULT_CODE_SERVICE_SPECIFIC,\r
506 } drm_web_server_result_code_e;\r
507 \r
508 /**\r
509  * @enum drm_initiator_type\r
510  * @brief DRM Initiator type\r
511  */\r
512 typedef enum {\r
513         DRM_INITIATOR_TYPE_NONE = -1,\r
514         DRM_INITIATOR_TYPE_INITIATOR_URL = 0,\r
515         DRM_INITIATOR_TYPE_LICENSE_ACQ,\r
516         DRM_INITIATOR_TYPE_JOIN_DOMAIN,\r
517         DRM_INITIATOR_TYPE_LEAVE_DOMAIN\r
518 } drm_initiator_type;\r
519 \r
520 /**\r
521  * @enum drm_const_type_e\r
522  * @brief DRM constraint types\r
523  */\r
524 typedef enum {\r
525         DRM_CONSTRAINT_TYPE_RENTAL = 0,\r
526         DRM_CONSTRAINT_TYPE_RENTAL_UNLIMITED,\r
527         DRM_CONSTRAINT_TYPE_PURCHASE,\r
528         DRM_CONSTRAINT_TYPE_BASE,\r
529         DRM_CONSTRAINT_TYPE_EXPIRED,\r
530         DRM_CONSTRAINT_TYPE_NOT_AUTHORIZED,\r
531         DRM_CONSTRAINT_TYPE_INVALID_DRM_VERSION,\r
532         DRM_CONSTRAINT_TYPE_UNKNOWN_TYPE,\r
533         DRM_CONSTRAINT_TYPE_GENERAL_ERROR\r
534 } drm_const_type_e;\r
535 \r
536 /**\r
537  * @struct drm_content_info_s\r
538  * @brief DRM content info structure.\r
539  */\r
540 typedef struct {\r
541         /**< Author of original content */\r
542         char author[DRM_MAX_LEN_AUTHOR];\r
543 \r
544         /**< Copyright information */\r
545         char copyright[DRM_MAX_LEN_COPYRIGHT];\r
546 \r
547         /**< Content information */\r
548         char description[DRM_MAX_LEN_DESCRIPTION];\r
549 \r
550         char icon_uri[DRM_MAX_LEN_ICON_URI];                    /**< Icon URI */\r
551         char info_url[DRM_MAX_LEN_INFO_URL];                    /**< Information URL */\r
552         char content_url[DRM_MAX_LEN_CONTENT_URL];      /**< Content URL */\r
553         char rights_url[DRM_MAX_LEN_RIGHTS_URL];                /**< Rights URL */\r
554         char title[DRM_MAX_LEN_TITLE];                          /**< Content Title */\r
555 \r
556         /**< Original MIME type */\r
557         char mime_type[DRM_MAX_LEN_MIME];\r
558         char content_id[DRM_MAX_LEN_CID];                       /**< Content ID */\r
559 \r
560 } drm_content_info_s;\r
561 \r
562 /**\r
563  * @struct drm_file_oma_info_s\r
564  * @brief DRM (OMA)file info structure.\r
565  */\r
566 typedef struct {\r
567         drm_rights_version_e version;   /**< OMA DRM Rights Version */\r
568         drm_method_type_e method;               /**< OMA DRM Method type */\r
569 }drm_file_oma_info_s;\r
570 \r
571 /**\r
572  * @struct drm_file_pr_env_info_s\r
573  * @brief DRM (PlayReady Envelope)file info structure.\r
574  */\r
575 typedef struct {\r
576         /**< Original content file name inside Playready - Envelope Contents */\r
577         char org_file_name[DRM_MAX_LEN_FILEPATH];\r
578 \r
579         /**< Original content file size inside Playready - Envelope Contents */\r
580         unsigned int org_file_size;\r
581 }drm_file_pr_env_info_s;\r
582 \r
583 /**\r
584  * @struct drm_file_sapps_info_s\r
585  * @brief DRM (SAPPS)file info structure.\r
586  */\r
587 typedef struct {\r
588         char content_id[DRM_MAX_LEN_CID];                       /**< Content ID */\r
589         char rights_url[DRM_MAX_LEN_RIGHTS_URL];        /**< Rights URL */\r
590 } drm_file_sapps_info_s;\r
591 \r
592 /**\r
593  * @struct drm_file_info_s\r
594  * @brief DRM file info structure.\r
595  */\r
596 typedef struct {\r
597         drm_file_oma_info_s oma_info;           /**< OMA DRM file info */\r
598         drm_file_pr_env_info_s pr_env_info;     /**< PlayReady\r
599                                                                                                 Envelope file info */\r
600         drm_file_sapps_info_s sapps_info;       /**< SAPPS file info */\r
601 } drm_file_info_s;\r
602 \r
603 /**\r
604  * @struct drm_constraint_type_s\r
605  * @brief DRM Constraint type structure.\r
606  */\r
607 typedef struct {\r
608         int is_unlimited;                                 /**< Unlimited constraints */\r
609         int is_count;                                     /**< Count constraint present/not present */\r
610         int is_datetime;                                  /**< Datetime constraint present/not present */\r
611         int is_interval;                                  /**< Interval constraint present/not present */\r
612         int is_timedcount;                                /**< TimedCount constraint present/not present */\r
613         int is_accumulated;                               /**< Accumulated constraint present/not present */\r
614         int is_individual;                                /**< Individual constraint present/not present */\r
615         int is_system;                                    /**< System constraint present/not present */\r
616         drm_const_type_e constraint_type;         /**< Divx constraint types */\r
617 } drm_constraint_type_s;\r
618 \r
619 /**\r
620  * @struct drm_constraint_info_s\r
621  * @brief DRM Constraint info structure.\r
622  */\r
623 typedef struct {\r
624 \r
625         /**< Constraint type*/\r
626         drm_constraint_type_s const_type;\r
627 \r
628         /**< Original Count */\r
629         int original_count;\r
630 \r
631         /**< Remaining Count */\r
632         int remaining_count;\r
633 \r
634         /**< Start Time */\r
635         /*\r
636          * As per definition of struct tm:-\r
637          * int    tm_sec   seconds [0,61]\r
638          * int    tm_min   minutes [0,59]\r
639          * int    tm_hour  hour [0,23]\r
640          * int    tm_mday  day of month [1,31]\r
641          * int    tm_mon   month of year [0,11]\r
642          * int    tm_year  years since 1900\r
643          * int    tm_wday  day of week [0,6] (Sunday = 0)\r
644          * int    tm_yday  day of year [0,365]\r
645          * int    tm_isdst daylight savings flag\r
646          *\r
647          */\r
648 \r
649         /* if tm_year = 109 then it means actual year = 109 + 1900 = 2009\r
650          * if tm_mon = 0 then it means actual month = 0 + 1 = 1 = January\r
651          * if tm_mon = 1 then it means actual month = 1 + 1 = 2 = Feb\r
652          * Other parameters doesn't need any manipulation\r
653          * if tm_mday = 5 then it means day of the month = 5\r
654          */\r
655         struct tm start_time;\r
656 \r
657         /**< End time */\r
658         /*\r
659          * As per definition of struct tm:-\r
660          * int    tm_sec   seconds [0,61]\r
661          * int    tm_min   minutes [0,59]\r
662          * int    tm_hour  hour [0,23]\r
663          * int    tm_mday  day of month [1,31]\r
664          * int    tm_mon   month of year [0,11]\r
665          * int    tm_year  years since 1900\r
666          * int    tm_wday  day of week [0,6] (Sunday = 0)\r
667          * int    tm_yday  day of year [0,365]\r
668          * int    tm_isdst daylight savings flag\r
669          *\r
670          */\r
671 \r
672         /* if tm_year = 109 then it means actual year = 109 + 1900 = 2009\r
673          * if tm_mon = 0 then it means actual month = 0 + 1 = 1 = January\r
674          * if tm_mon = 1 then it means actual month = 1 + 1 = 2 = Feb\r
675          * Other parameters doesn't need any manipulation\r
676          * if tm_mday = 5 then it means day of the month = 5\r
677          */\r
678         struct tm end_time;\r
679 \r
680         /**< Interval Time */\r
681         /*\r
682          * In interval time calculation, no need to manipulate it.\r
683          * e.g if tm_year = 109 then it means actual year = 109.\r
684          * It means license constraint says that content can be consumed in 109 years.\r
685          *\r
686          * e.g:-\r
687          * tm_year = 1\r
688          * tm_mon = 0\r
689          * tm_mday = 0\r
690          * tm_hour = 1\r
691          * tm_min = 10\r
692          * tm_sec = 40\r
693          *\r
694          * It means content has validity for 1 year, 1 hour, 1 minute & 40 seconds.\r
695          */\r
696         struct tm interval_time;\r
697 \r
698         /**< Timed original count */\r
699         int timed_original_count;\r
700 \r
701         /**< Timed Remaining count */\r
702         int timed_remaining_count;\r
703 \r
704         /**< Timer attribute of Timed-count constraint */\r
705         int timed_count_timer;\r
706 \r
707         /**< Accumulated original time in seconds */\r
708         int accumulated_original_seconds;\r
709 \r
710         /**< Accumulated remaining time in seconds */\r
711         int accumulated_remaining_seconds;\r
712 \r
713         /**< individual identity type */\r
714         drm_constraint_identity_type_e individual_identity_type;\r
715 \r
716         /**< individual identity */\r
717         char individual_id[DRM_MAX_LEN_INDIVIDUAL_IDENTITY];\r
718 \r
719         /**< system identity type */\r
720         drm_constraint_identity_type_e system_identity_type;\r
721 \r
722         /**< system identity */\r
723         char system_id[DRM_MAX_LEN_SYSTEM_IDENTITY];\r
724 } drm_constraint_info_s;\r
725 \r
726 /**\r
727 * @struct drm_action_allowed_data_s\r
728 * @brief DRM Action Allowed structure.\r
729 */\r
730 typedef struct {\r
731         /**< File Path */\r
732         char file_path[DRM_MAX_LEN_FILEPATH];\r
733         /**< Additional input data */\r
734         int data;\r
735 }drm_action_allowed_data_s;\r
736 \r
737 /**\r
738 * @struct drm_secure_clock_data_s\r
739 * @brief DRM secure clock data structure.\r
740 */\r
741 typedef struct {\r
742         /** Flag to inform whether secure clock is SET or NOT SET\r
743          * is_secure_clock_set = 0 => Secure clock NOT SET.\r
744          * is_secure_clock_set = 1 => Secure clock is SET.\r
745          */\r
746         int is_secure_clock_set;\r
747 \r
748         /** Secure clock data */\r
749         struct tm secure_clock;\r
750 }drm_secure_clock_data_s;\r
751 \r
752 /**\r
753  * @struct drm_transaction_id_info_s\r
754  * @brief DRM Transaction tracking ID structure.\r
755  */\r
756 typedef struct {\r
757         /* transaction ID value*/\r
758         char tr_id[DRM_MAX_SIZE_TRANSACTION_ID];\r
759 \r
760         /*\r
761          * length of Transaction ID string.\r
762          * The value zero(0) indicates that transaction id is not available\r
763          */\r
764         unsigned int tr_id_len;\r
765 }drm_transaction_id_info_s;\r
766 \r
767 /**\r
768  * @struct drm_code_info_s\r
769  * @brief DRM DivX (Registration / De-registration)Code information structure.\r
770  */\r
771 typedef struct {\r
772         /** Code */\r
773         char code[DRM_MAX_SIZE_DIVX_CODE];\r
774 \r
775         /**\r
776          * length of Code.\r
777          * The value zero(0) indicates that Code is not available.\r
778          */\r
779         unsigned int code_len;\r
780 }drm_code_info_s;\r
781 \r
782 /**\r
783  * @struct drm_unregister_info_s\r
784  * @brief DRM Unregister Information structure.\r
785  */\r
786 typedef struct {\r
787         /** file path to be unregistered */\r
788         char file_path[DRM_MAX_LEN_FILEPATH];\r
789 \r
790         /*\r
791          * Flag to inform whether license also need to be removed\r
792          * remove_license = 0 => Do not remove License.\r
793          * remove_license = 1 => Remove License.\r
794          */\r
795         int remove_license;\r
796 }drm_unregister_info_s;\r
797 \r
798 /**\r
799  * @struct      drm_user_operation_info_s\r
800  * @brief       DRM operation information structure.\r
801  */\r
802 typedef struct {\r
803         /** Type of OPERATION */\r
804         drm_operation_type_e operation_type;\r
805 \r
806         /** Status of OPERATION */\r
807         drm_operation_status_e operation_status;\r
808 } drm_user_operation_info_s;\r
809 \r
810 /**\r
811  * Function pointer to handle DRM operation notifications\r
812  *\r
813  * @param[out]  operation_info  operation information .\r
814  * @param[out]  output_data             Output data specific to operation.\r
815  * @return              None\r
816  * @see\r
817  * @since       0.1\r
818  */\r
819 typedef void (*drm_operation_cb)(drm_user_operation_info_s *operation_info,\r
820                 void *output_data);\r
821 \r
822 /**\r
823  * @struct      drm_operation_cb_s\r
824  * @brief       DRM Operation callback structure.\r
825  * @remark      Currently one member but new callback can be added depending on\r
826  *                      requirements.\r
827  */\r
828 typedef struct {\r
829         /** Callback */\r
830         drm_operation_cb callback;\r
831 }drm_operation_cb_s;\r
832 \r
833 /**\r
834  * @struct drm_register_lic_info_s\r
835  * @brief DRM License register Information structure.\r
836  */\r
837 typedef struct {\r
838         /** Pointer to license buffer data */\r
839         unsigned char lic_data[DRM_MAX_LEN_LICENSE_DATA];\r
840 \r
841         /** license buffer data length */\r
842         unsigned int lic_data_len;\r
843 \r
844         /** license version (OMA DRM v1 or OMA DRM v2) */\r
845         drm_rights_version_e lic_version;\r
846 \r
847         /** Source of ROAP Initialization */\r
848         drm_roap_init_src_e roap_init_src;\r
849 \r
850         /** Callback for status update */\r
851         drm_operation_cb_s operation_callback;\r
852 }drm_register_lic_info_s;\r
853 \r
854 /**\r
855  * @struct drm_register_lic_resp_s\r
856  * @brief DRM License register Output parameter.\r
857  */\r
858 typedef struct {\r
859 \r
860         /** Content ID */\r
861         char cid[DRM_MAX_LEN_CID];\r
862 \r
863 }drm_register_lic_resp_s;\r
864 \r
865 /**\r
866  * @struct      drm_custom_data_info_s\r
867  * @brief       DRM Custom Data Information.\r
868  */\r
869 typedef struct {\r
870         char app_id[DRM_MAX_LEN_APP_ID + 1];                    /** App ID */\r
871         char user_guid[DRM_MAX_LEN_USER_GUID +1];       /** User GID */\r
872         char device_id[DRM_MAX_LEN_DEVICE_ID + 1];              /** Device ID */\r
873         char order_id[DRM_MAX_LEN_ORDER_ID + 1];                        /** Order ID */\r
874         char service_id[DRM_MAX_LEN_SERVICE_ID + 1];            /** Service ID */\r
875         char account_id[DRM_MAX_LEN_ACCOUNT_ID + 1];            /** Account ID */\r
876 } drm_custom_data_info_s;\r
877 \r
878 /**\r
879  * @struct drm_initiator_info_s\r
880  * @brief DRM License Initiator Information structure.\r
881  */\r
882 typedef struct {\r
883         /** Pointer to Initiator URL */\r
884         char initiator_url[DRM_MAX_LEN_INITIATOR_URL];\r
885 \r
886         /** Initiator URL length */\r
887         unsigned int initiator_url_len;\r
888 \r
889         /** Callback for status update */\r
890         drm_operation_cb_s operation_callback;\r
891 \r
892         /** Initiator Type */\r
893         drm_initiator_type init_type;\r
894 \r
895         /** Custom Data */\r
896         drm_custom_data_info_s custom_data;\r
897 }drm_initiator_info_s;\r
898 \r
899 /**\r
900  * @struct      drm_web_server_resp_data_s\r
901  * @brief       DRM Web Server Response Data After submitting Initiator URL Information.\r
902  */\r
903 typedef struct {\r
904     /** Content URL. Application can download content using this URL if available*/\r
905         char content_url[DRM_MAX_LEN_CONTENT_URL];\r
906 \r
907         /** Server Result Code */\r
908         drm_web_server_result_code_e result_code;\r
909 } drm_web_server_resp_data_s;\r
910 \r
911 /**\r
912  * Function pointer to handle DRM Roap Notifications\r
913  *\r
914  * @param[out]  cbParam                         Parameter\r
915  * @param[out]  appSessionData          Application Session Data\r
916  * @param[out]  agentSessionData        DRM Agent Session Data\r
917  * @return              None\r
918  * @see\r
919  * @since       0.1\r
920  */\r
921 typedef void (*drm_roap_service_cb) (void *cbParam,    /**<parameter */\r
922                                                void *appSessionData,   /**<application session data */\r
923                                                void *agentSessionData   /**<DRM agent session data */\r
924             );\r
925 \r
926 /**\r
927 * Type Definition Template\r
928 */\r
929 typedef drm_roap_service_cb drm_roap_notify_cb;\r
930 /**\r
931 * Type Definition Template\r
932 */\r
933 typedef drm_roap_service_cb drm_roap_consent_cb;\r
934 /**\r
935 * Type Definition Template\r
936 */\r
937 typedef drm_roap_service_cb drm_roap_result_cb;\r
938 \r
939 /**\r
940  * @struct      drm_roap_notification_cb_s\r
941  * @brief       DRM Roap Notification callback structure.\r
942  */\r
943 typedef struct {\r
944         drm_roap_notify_cb progressNotify;                                  /** Progress Notify */\r
945         drm_roap_consent_cb userConsent;                                    /** User Consent */\r
946         drm_roap_result_cb roapResult;                                  /** Roap Result */\r
947 } drm_roap_notification_cb_s;\r
948 \r
949 /**\r
950  * Function pointer to handle Start of Content download\r
951  *\r
952  * @param[out]  appSessionData  App Session Data.\r
953  * @return              int\r
954  * @see\r
955  * @since       0.1\r
956  */\r
957 typedef int (*drm_content_start_download_cb) (void *appSessionData);\r
958 \r
959 /**\r
960  * Function pointer to handle Progress of ODF download\r
961  *\r
962  * @param[out]  pData                   Data\r
963  * @param[out]  DataLen                 Data length\r
964  * @param[out]  appSessionData  App Session Data.\r
965  * @return              int\r
966  * @see\r
967  * @since       0.1\r
968  */\r
969 typedef int (*drm_content_progress_download_cb) (const void *pData,\r
970                                                     unsigned int DataLen,\r
971                                                     void *appSessionData);\r
972 \r
973 /**\r
974  * Function pointer to handle Start of ODF download\r
975  *\r
976  * @param[out]  appSessionData  App Session Data.\r
977  * @return              int\r
978  * @see\r
979  * @since       0.1\r
980  */\r
981 typedef int (*drm_content_finish_download_cb) (void *appSessionData);\r
982 \r
983 /**\r
984  * @struct      drm_roap_notification_cb_s\r
985  * @brief       DRM Roap Notification callback structure.\r
986  */\r
987 typedef struct {\r
988         drm_content_start_download_cb start_download_cb;                /** Start Download */\r
989         drm_content_progress_download_cb progress_download_cb;  /** Progress Download */\r
990         drm_content_finish_download_cb finish_download_cb;              /** Finish Download */\r
991 } drm_content_download_cb_s;\r
992 \r
993 /**\r
994  * @struct      drm_appsession_datatype_s\r
995  * @brief       DRM Application Session Datatype structure.\r
996  */\r
997 typedef struct {\r
998         int profileID;                                                                                  /** Profile ID */\r
999         int is_progressive_download;                                                    /** Is Progressive Download */\r
1000         char pProxyAddress[DRM_MAX_LEN_IP_ADDR];                                /** Proxy Address */\r
1001         drm_content_download_cb_s content_download_cb;                                  /** Content Download callback */\r
1002         unsigned int size_pData;                                                                /** Size of additional data */\r
1003         void *pData;                                                                                    /** Additional Data */\r
1004 } drm_appsession_datatype_s;\r
1005 \r
1006 /**\r
1007  * @struct      drm_submit_roap_message_info_s\r
1008  * @brief       DRM Submit Roap Message Info\r
1009  */\r
1010 typedef struct {\r
1011     unsigned char* buffer;                                              /** Buffer that contains Trigger of PDU data */\r
1012     unsigned int buff_size;                                             /** Buffer size */\r
1013     drm_roap_notification_cb_s roap_notify;             /** Roap Notification callback */\r
1014     drm_roap_init_src_e roap_initiator;                 /** Roap Initiator */\r
1015     drm_appsession_datatype_s app_session_data; /** App Session Data */\r
1016 } drm_submit_roap_message_info_s;\r
1017 \r
1018 /**\r
1019  * @struct      drm_submit_roap_user_content_info_s\r
1020  * @brief       DRM Submit Roap User Consent Info\r
1021  */\r
1022 typedef struct {\r
1023         drm_bool_type_e bConsent;                                       /** Result of User Consent */\r
1024 \r
1025         drm_bool_type_e bAddToTrustedWhiteList;         /** Result of User Consent */\r
1026 \r
1027         unsigned int size_agentdata;                            /** Size of Agent Data */\r
1028 \r
1029         /** Specifies the pointer points to a ROAP session information that is used by DRM.\r
1030          *  Must deliver agentData received through Callback completely intact\r
1031          */\r
1032         void *agentdata;\r
1033 } drm_submit_roap_user_consent_info_s;\r
1034 \r
1035 /**\r
1036  * @struct      drm_http_user_cancel_info_s\r
1037  * @brief       DRM HTTP User Cancel Info\r
1038  */\r
1039 typedef struct {\r
1040         unsigned int size_app_session_data;     /** Size of App Session Data */\r
1041         void *app_session_data;                         /** App Session Data */\r
1042 } drm_http_user_cancel_info_s;\r
1043 \r
1044 /**\r
1045  * @struct      drm_register_copy_file_info_s\r
1046  * @brief       DRM Register Copy file Info.\r
1047  */\r
1048 typedef struct {\r
1049         char src_file_path[DRM_MAX_LEN_FILEPATH];       /** Source File Path */\r
1050         char dest_file_path[DRM_MAX_LEN_FILEPATH];      /** Destination File Path */\r
1051 } drm_register_copy_file_info_s;\r
1052 \r
1053 /**\r
1054  * @struct      drm_register_move_file_info_s\r
1055  * @brief       DRM Register Move file Info.\r
1056  */\r
1057 typedef struct {\r
1058         char src_file_path[DRM_MAX_LEN_FILEPATH];       /** Source File Path */\r
1059         char dest_file_path[DRM_MAX_LEN_FILEPATH];      /** Destination File Path */\r
1060 } drm_register_move_file_info_s;\r
1061 \r
1062 /**\r
1063  * @struct      drm_register_setas_info_s\r
1064  * @brief       DRM Register SetAs Info.\r
1065  */\r
1066 typedef struct {\r
1067         char file_path[DRM_MAX_LEN_FILEPATH];   /** Source File Path */\r
1068         drm_setas_category_e setas_cat;                 /** SetAs Category */\r
1069 } drm_register_setas_info_s;\r
1070 \r
1071 /**\r
1072  * @struct      drm_register_setas_resp_data_s\r
1073  * @brief       DRM Stack Response Data containing the GMT expiry\r
1074  *              time corresponding to a given content\r
1075  */\r
1076 typedef struct {\r
1077         struct tm       time_expiry;                                            /** Expiry time*/\r
1078 } drm_register_setas_resp_data_s;\r
1079 /**\r
1080  * @struct      drm_unregister_setas_info_s\r
1081  * @brief       DRM Unregister SetAs Info.\r
1082  */\r
1083 typedef struct {\r
1084         char file_path[DRM_MAX_LEN_FILEPATH];   /** Source File Path */\r
1085         drm_setas_category_e setas_cat;                 /** SetAs Category */\r
1086 } drm_unregister_setas_info_s;\r
1087 \r
1088 #ifdef __cplusplus\r
1089 }\r
1090 #endif /* __cplusplus */\r
1091 \r
1092 #endif /*__DRM_CLIENT_TYPES_H__ */\r