Tizen 2.1 base
[platform/core/security/drm-client.git] / include / drm_client.h
1 /*
2  *  drm-client
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Hakjoo Ko <hakjoo.ko@samsung.com>
7  *                      Mahendra Kumar Prajapat <mahendra.p@samsung.com>
8  *                      Harsha Shekar <h.shekar@samsung.com>
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */
23
24 /**
25  * @file                drm_client.h
26  * @brief       DRM Client API declaration header file.
27  * @author      Mahendra Kumar Prajapat (mahendra.p@samsung.com)
28  * @author      Harsha Shekar (h.shekar@samsung.com)
29  * @version     0.1
30  * @history     0.1: DRM Client API Declarations
31  */
32
33 #ifndef __DRM_CLIENT_H__
34 #define __DRM_CLIENT_H__
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /*__cplusplus */
39
40 #include "drm_client_types.h"
41
42 /**
43  * @defgroup DRMCLIENT drm-client
44  * @{
45  */
46
47 /**
48  * @}
49  */
50
51 /**
52  * @addtogroup DRMCLIENT
53  * @{
54  */
55
56 /**
57  *  An application can check that a file is DRM file
58  *  (OMA DRM, PlayReady, DivX etc.)
59  *
60  * @param[in]   file_path               Specifies the pointer points a DRM file path.
61  * @param[out]  is_drm_file     DRM_TRUE if the input file is a DRM file
62  *                                                              else DRM_FALSE.
63  * @return              0 on success, else a negative error value
64  * @retval              DRM_RETURN_SUCCESS on success
65  * @retval              DRM_RETURN_INVALID_ARG if arguments are invalid
66  * @retval              DRM_RETURN_COMMUNICATION_ERROR if socket error
67  * @retval              DRM_RETURN_INTERNAL_ERROR if operation error
68  *
69  * @remarks
70  * @see
71  * @since       0.1
72  */
73 int drm_is_drm_file(const char *file_path, drm_bool_type_e *is_drm_file);
74
75 /**
76  *  An application can get DRM file type of the file that is
77  *  specified in file_path
78  *
79  * @param[in]   file_path       Specifies the pointer points a DRM file path.
80  * @param[out]  file_type       DRM file type.
81  * @return              0 on success, else a negative error value
82  * @retval              DRM_RETURN_SUCCESS on success
83  * @retval              DRM_RETURN_INVALID_ARG if arguments are invalid
84  * @remarks
85  * @see
86  * @since       0.1
87  */
88 int drm_get_file_type(const char *file_path, drm_file_type_e *file_type);
89
90 /**
91  * An application can check that a DRM file has valid license or not.
92  *
93  * @param[in]   file_path               DRM file path.
94  * @param[in]   perm_type               Enumeration type of permission.
95  * @param[out]  license_status  license status.
96  * @return              0 on success, else a negative error value
97  * @retval              DRM_RETURN_SUCCESS on success
98  * @retval              DRM_RETURN_INVALID_ARG if arguments are invalid
99  * @retval              DRM_RETURN_COMMUNICATION_ERROR if socket error
100  * @retval              DRM_RETURN_INTERNAL_ERROR if operation error
101  * @remarks
102  * @see
103  * @since       0.1
104  */
105 int drm_get_license_status(const char *file_path,
106                 drm_permission_type_e perm_type,
107                 drm_license_status_e *license_status);
108
109 /**
110  * An application can get DRM Content information for the file
111  * specified in file_path.
112  *
113  * @param[in]   file_path               DRM file path.
114  * @param[out]  content_info    Content information.
115  * @return              0 on success, else a negative error value
116  * @retval              DRM_RETURN_SUCCESS on success
117  * @retval              DRM_RETURN_INVALID_ARG if arguments are invalid
118  * @retval              DRM_RETURN_COMMUNICATION_ERROR if socket error
119  * @retval              DRM_RETURN_INTERNAL_ERROR if operation error
120  * @remarks
121  * @see
122  * @since       0.1
123  */
124 int drm_get_content_info(const char *file_path,
125                 drm_content_info_s *content_info);
126
127 /**
128  * An application can get file information of a DRM file.
129  *
130  * @param[in]   file_path               DRM file path.
131  * @param[out]  fileInfo                DRM file info.
132  * @return              0 on success, else a negative error value
133  * @retval              DRM_RETURN_SUCCESS on success
134  * @retval              DRM_RETURN_INVALID_ARG if arguments are invalid
135  * @retval              DRM_RETURN_COMMUNICATION_ERROR if socket error
136  * @retval              DRM_RETURN_INTERNAL_ERROR if operation error
137  * @remarks
138  * @see
139  * @since       0.1
140  */
141 int drm_get_file_info(const char *file_path, drm_file_info_s *file_info);
142
143 /**
144  * An application can get constraints associated with
145  * given permission & given file
146  *
147  * @param[in]   file_path                       DRM file path.
148  * @param[in]   perm_type                       Enumeration type of permission.
149  * @param[out]  constraint_info         Constraint info.
150  * @return              0 on success, else a negative error value
151  * @retval              DRM_RETURN_SUCCESS on success
152  * @retval              DRM_RETURN_INVALID_ARG if arguments are invalid
153  * @retval              DRM_RETURN_COMMUNICATION_ERROR if socket error
154  * @retval              DRM_RETURN_INTERNAL_ERROR if operation error
155  * @remarks
156  * @see
157  * @since       0.1
158  */
159 int drm_get_constraint_info(const char *file_path,
160                 drm_permission_type_e perm_type,
161                 drm_constraint_info_s *constraint_info);
162
163 /**
164  * An application can check the feasibility of actions to be
165  * performed based on the type of DRM file.
166  *
167  * @param[in]   action                          Action to be taken.
168  * @param[in]   action_data             Data needed to check action
169  *                                                                      allowed operation
170  * @param[out]  is_allowed                      DRM_TRUE if action is allowed
171  *                                                                      else DRM_FALSE
172  * @return              0 on success, else a negative error value
173  * @retval              DRM_RETURN_SUCCESS on success
174  * @retval              DRM_RETURN_INVALID_ARG if arguments are invalid
175  * @retval              DRM_RETURN_COMMUNICATION_ERROR if socket error
176  * @retval              DRM_RETURN_INTERNAL_ERROR if operation error
177  * @remarks
178  * @see
179  * @since       0.1
180  */
181 int drm_is_action_allowed(drm_action_type_e action,
182                 drm_action_allowed_data_s *action_data,
183                 drm_bool_type_e *is_allowed);
184
185
186 /**
187  * An application can get the requested data from DRM.
188  *
189  * @param[in]   data_type       Data types as per enum drm_data_type_e.
190  * @param[in]   input           Pointer to appropriate structure as per data_type.
191  * @param[out]  output          Output data. Pointer to appropriate structure as
192  *                                                      per data_type.
193  *
194  * @return              0 on success, else a negative error value
195  * @retval              DRM_RETURN_SUCCESS on success
196  * @retval              DRM_RETURN_INVALID_ARG if arguments are invalid
197  * @retval              DRM_RETURN_COMMUNICATION_ERROR if socket error
198  * @retval              DRM_RETURN_INTERNAL_ERROR if operation error
199  * @remarks             Please typecast to appropriate data structures
200  *                              as per data types.
201  *
202  *                              if data_type = DRM_DATA_TYPE_SECURE_CLOCK
203  *                              then input type: input = NULL
204  *                              and output type: output = pointer to struct
205  *                              drm_secure_clock_data_s
206  *
207  *                              if data_type = DRM_DATA_TYPE_TRANSACTION_TRACKING_FLAG
208  *                              then input type: input = NULL
209  *                              and output type: output = pointer to int
210  *
211  *                              if data_type = DRM_DATA_TYPE_TRANSACTION_TRACKING_ID
212  *                              then input type: input = pointer to file path (const char)
213  *                              and output type: output = pointer to struct
214  *                              drm_transaction_id_info_s
215  *
216  *                              if data_type = DRM_DATA_TYPE_DIVX_REGISTRATION_CODE
217  *                              then input type: input = NULL
218  *                              and output type: output = pointer to struct drm_code_info_s
219  *
220  *                              if data_type = DRM_DATA_TYPE_DIVX_DEREGISTRATION_CODE
221  *                              then input type: input = NULL
222  *                              and output type: output = pointer to struct drm_code_info_s
223  *
224  * @see
225  * @since       0.1
226  */
227 int drm_get_data(drm_data_type_e data_type, void *input, void *output);
228
229 /**
230  * An application can do particular request to DRM.
231  *
232  * @param[in]   request_type    Request types as per enum drm_request_type_e.
233  * @param[in]   input                   Pointer to appropriate structure as per
234  *                                                              request_type.
235  * @param[out]  output                  Output data. Pointer to appropriate structure as
236  *                                                              per request_type.
237  *
238  * @return              0 on success, else a negative error value
239  * @retval              DRM_RETURN_SUCCESS on success
240  * @retval              DRM_RETURN_INVALID_ARG if arguments are invalid
241  * @retval              DRM_RETURN_COMMUNICATION_ERROR if socket error
242  * @retval              DRM_RETURN_INTERNAL_ERROR if operation error
243  * @remarks             Please typecast to appropriate data structures
244  *                              as per data types.
245  *
246  *                              if request_type = DRM_REQUEST_TYPE_REGISTER_FILE
247  *                              then input type: input = pointer to const char (file_path)
248  *                              and output type: output = NULL
249  *
250  *                              if request_type = DRM_REQUEST_TYPE_UNREGISTER_FILE
251  *                              then input type: input = pointer to struct drm_unregister_info_s
252  *                              and output type: output = NULL
253  *
254  *                              if request_type = DRM_REQUEST_TYPE_UNREGISTER_ALL_FILES
255  *                              then input type: input = NULL
256  *                              and output type: output = NULL
257  *
258  *                              if request_type = DRM_REQUEST_TYPE_REGISTER_LICENSE
259  *                              then input type: input = pointer to
260  *                              struct drm_register_lic_info_s.
261  *                              and output type: output = pointer to
262  *                              struct drm_register_lic_resp_s.
263  *
264  *                              if request_type = DRM_REQUEST_TYPE_SUBMIT_INITIATOR_URL
265  *                              then input type: input = pointer to struct drm_initiator_info_s
266  *                              and output type: output = pointer to struct drm_web_server_resp_data_s
267  *
268  *                              if request_type = DRM_REQUEST_TYPE_SUBMIT_ROAP_MESSAGE
269  *                              then input type: input = pointer to struct drm_submit_roap_message_info_s
270  *                              and output type: output = NULL
271  *
272  *                              if request_type = DRM_REQUEST_TYPE_SUBMIT_ROAP_USER_CONSENT
273  *                              then input type: input = pointer to struct drm_submit_roap_user_consent_info_s
274  *                              and output type: output = NULL
275  *
276  *                              if request_type = DRM_REQUEST_TYPE_HTTP_USER_CANCEL
277  *                              then input type: input = pointer to struct drm_http_user_cancel_info_s
278  *                              and output type: output = NULL
279  *
280  *                              if request_type = DRM_REQUEST_TYPE_REGISTER_COPY_FILE
281  *                              then input type: input = pointer to struct drm_register_copy_file_info_s
282  *                              and output type: output = NULL
283  *
284  *                              if request_type = DRM_REQUEST_TYPE_REGISTER_MOVE_FILE
285  *                              then input type: input = pointer to struct drm_register_copy_file_info_s
286  *                              and output type: output = NULL
287  *
288  *                              if request_type = DRM_REQUEST_TYPE_INSERT_EXT_MEMORY
289  *                              then input type: input = NULL
290  *                              and output type: output = NULL
291  *
292  *                              if request_type = DRM_REQUEST_TYPE_EXTRACT_EXT_MEMORY
293  *                              then input type: input = NULL
294  *                              and output type: output = NULL
295  *
296  *                              if request_type = DRM_REQUEST_TYPE_REGISTER_SETAS
297  *                              then input type: input = pointer to struct drm_register_setas_info_s
298  *                              and output type: output = NULL
299  *
300  *                              if request_type = DRM_REQUEST_TYPE_UNREGISTER_SETAS
301  *                              then input type: input = pointer to struct drm_unregister_setas_info_s
302  *                              and output type: output = NULL
303  *
304  * @see
305  * @since       0.1
306  */
307 int drm_process_request(drm_request_type_e request_type,
308                 void *input, void *output);
309
310
311 /**
312  * @}
313  */
314
315 #ifdef __cplusplus
316 }
317 #endif /* __cplusplus */
318
319 #endif /*__DRM_CLIENT_H__ */