2 * drm-service-core-sapps
4 * Copyright (c) 2000 - 2010 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact:Sunggun Jung <sunggun.jung@samsung.com>
10 #ifndef __DRM_OEM_SAPPS_H__
11 #define __DRM_OEM_SAPPS_H__
19 /* Return values from Samsung Apps DRM APIs */
20 #define DRM_SAPPS_SUCCESS 0 /**<success */
21 #define DRM_SAPPS_LIC_VALID 1 /**<License is valid */
22 #define DRM_SAPPS_LIC_SUSPEND 2 /**<License is valid but for future use */
24 /* All the failure cases will have a negative value */
25 #define DRM_SAPPS_INVALID_ARG -1000 /**<invalid argument*/
26 #define DRM_SAPPS_PARSING_ERROR -999 /**<parsing contents or rights error*/
27 #define DRM_SAPPS_DB_ERROR -998 /**<data base error */
28 #define DRM_SAPPS_INSUFFICIENT_MEMORY -997 /**<memory error */
29 #define DRM_SAPPS_INTERNAL_ERROR -996 /**<processing error */
30 #define DRM_SAPPS_FILE_ERROR -995 /**<file error */
32 /* License specific errors */
33 #define DRM_SAPPS_LIC_EXPIRED_DATETIME -994 /**<Datetime License is expired */
34 #define DRM_SAPPS_LIC_EXPIRED_COUNT -993 /**<Count License is expired */
35 #define DRM_SAPPS_LIC_NO_LICENCE -992 /**<No License */
36 #define DRM_SAPPS_LIC_IMEI_MISMATCH -991 /**<IMEI is mismatching */
37 #define DRM_SAPPS_LIC_PNUM_MISMATCH -990 /**<PNUM is mismatching */
39 #define DRM_SAPPS_UNKNOWN_ERROR -1 /**<dummy error value */
41 /* License Information */
43 unsigned int IsLicenseValid; /**<whether license is valid or not */
44 unsigned int OrgCount; /**<Original Count */
45 unsigned int CurCount; /**<Current Count */
46 struct tm starttime; /**<starttime in the format of struct tm */
47 struct tm endtime; /**<endtime in the format of struct tm */
48 struct tm securetime; /**<securetime in the format of struct tm */
49 } drm_sapps_license_info;
51 typedef struct _drm_sapps_license_list{
52 struct _drm_sapps_license_list* pnext;
53 drm_sapps_license_info LicenseInfo;
54 } drm_sapps_license_list;
57 * @defgroup DRM-SAPPS drm-sapps
62 * An application can request generate request for getting License.
64 * @param[in] pRespBuf Response Data String of the Purchase Request ( Null terminator string )
65 * @param[in] respBufLen pResBuf Length
66 * @param[in][out] pReqBuf License Request Data
67 * @param[in][out] pReqBufLen IN : pReqBuf Length, OUT : Rights Request Data String Size ( including null terminator )
68 * @param[in][out] pLicenseUrl License Acquisition URL Data
69 * @param[in][out] pLicenseUrlLen IN : pLicenseUrl Length, OUT : Rights Issuer Server URL Data String Size ( including null terminator )
70 * @return This function returns 1 on success or 0 on failure.
72 * @see drm_sdc_generate_purchase_request
75 int drm_oem_sapps_generate_license_request(const char *pRespBuf, unsigned int respBufLen, char *pReqBuf, unsigned int *pReqBufLen, char *pLicenseUrl, unsigned int *pLicenseUrlLen);
78 * An application can get SAD license which is encrypted.
80 * @param[in] pRespBuf Response Data String of the Rights Request ( Null terminator string )
81 * @param[in] respBufLen pResBuf Length
82 * @return This function returns 1 on success or 0 on failure.
87 int drm_oem_sapps_register_license(const char *pRespBuf, unsigned int respBufLen);
90 * API for checks whether the app drm file or not
92 * @param[in] pDcfPath File path that to be checked whether the app drm file or not
93 * @param[in] dcfPathLen File path length that to be checked whether the app drm file or not
94 * @return This function can return any of the following codes
95 * SADC_NOTSADCFILE_ERROR = 0x0640
96 * SADC_PARAMETER_ERROR = 0X0660
97 * SADC_FILE_READ_ERROR = 0x0703
98 * SADC_MEMAlOC_ERROR = 0x0662
104 int drm_oem_sapps_is_drm_file(const char *pDcfPath, int dcfPathLen);
107 * An application can get decrypted contents(Apps) which is encrypted.
109 * @param[in] pSADCFilepath SDC DRM File Path
110 * @param[in] sadcFileLen SDC DRM File length
111 * @param[in] pDecryptedFile Decrypted File Path
112 * @param[in] decryptedFileLen Decrypted File length
115 * SADC_PARAMETER_ERROR = 0X0660
116 * SADC_GET_FILEHEADER_ERROR = 0x0703
117 * SADC_GET_CEK_ERROR = 0x0704
118 * SADC_DECRYPT_PACKAGE_ERROR = 0x0705
124 int drm_oem_sapps_decrypt_package ( const char *pSADCFilepath, int sadcFileLen, const char *pDecryptedFile, int decryptedFileLen );
127 * API for checks whether the app drm file or not
129 * @param[in] pDcfPath File path that to be checked whether the app drm file or not
130 * @param[in] dcfPathLen File path length that to be checked whether the app drm file or not
131 * @return This function can return any of the following codes
133 * SADC_NOTSADCFILE_ERROR = 0x0640
134 * SADC_PARAMETER_ERROR = 0X0660
135 * SADC_FILE_READ_ERROR = 0x0703
136 * SADC_MEMAlOC_ERROR = 0x0662
142 int drm_oem_sapps_is_drm_app(const char *pszCid, int cidLen);
144 int drm_oem_sapps_uninstall_license(const char *szCid, int cidLen);
147 * An application can get file Header Info ( CID, License URL )
149 * @param[in] pSADCFilepath file path of Samsung Apps DRM contents
150 * @param[out] cid contents id of Samsung Apps DRM
151 * @param[in] cidLength Length of CID.
152 * @param[out] riurl Right Issuer URL
153 * @param[in] riurlLength Length of Right Issuer URL
154 * @return This function returns 1 on success or 0 on failure.
159 int drm_oem_sapps_get_file_header( const char *pSADCFilepath, char *cid, unsigned int cidLength, char *riurl, unsigned int riurlLength );
162 * An application can request purchase request for getting License.
164 * @param[in] pSADCFilepath File path of Samsung Apps DRM contents
165 * @param[out] pReqBuf Purchase Request Data
166 * @param[in][out] pReqBufLen IN : pReqBuf Length, OUT : Purchase Request Data String Size ( including null terminator )
167 * @param[out] pLicenseUrl License Acquisition URL Data
168 * @param[in][out] pLicenseUrlLen IN : pLicenseUrl Length, OUT : License Server URL Data String Size ( including null terminator )
169 * @return This function returns 1 on success or 0 on failure.
171 * @see DrmSdcGenerateLicenseRequest
174 int drm_oem_sapps_generate_purchase_request ( const char *pSADCFilepath, char *pReqBuf, unsigned int *pReqBufLen, char *pLicenseUrl, unsigned int *pLicenseUrlLen );
177 * An application can check contents(Apps) which has a valid licence.
179 * @param[in] szCid Content ID(CID) of the Samsung Apps contents
180 * @return This function can return any of the following codes
181 * DRM_SAPPS_SUCCESS = 0 <success
182 * DRM_SAPPS_LIC_VALID = 1 <License is valid
183 * DRM_SAPPS_LIC_SUSPEND = 2 <License is valid but for future use
184 * DRM_SAPPS_INVALID_ARG = -1000 <invalid argument
185 * DRM_SAPPS_PARSING_ERROR = -999 <parsing contents or rights error
186 * DRM_SAPPS_DB_ERROR = -998 <data base error
187 * DRM_SAPPS_INSUFFICIENT_MEMORY = -997 <memory error
188 * DRM_SAPPS_INTERNAL_ERROR = -996 <processing error
189 * DRM_SAPPS_FILE_ERROR = -995 <file error
190 * DRM_SAPPS_LIC_EXPIRED_DATETIME = -994 <Datetime License is expired
191 * DRM_SAPPS_LIC_EXPIRED_COUNT = -993 <Count License is expired
192 * DRM_SAPPS_LIC_NO_LICENCE = -992 <No License
193 * DRM_SAPPS_LIC_IMEI_MISMATCH = -991 <IMEI is mismatching
194 * DRM_SAPPS_LIC_PNUM_MISMATCH = -990 <PNUM is mismatching
195 * DRM_SAPPS_UNKNOWN_ERROR = -1 <dummy error value
197 * @see drm_sdc_get_file_header
200 int drm_oem_sapps_has_valid_license ( const char *szCid );
203 * An application can update license of Samsung Apps contents.
205 * @param[in] szCid Content ID(CID) of the Samsung Apps contents
206 * @return This function can return any of the following codes
207 * DRM_SAPPS_SUCCESS = 0 <success
208 * DRM_SAPPS_LIC_VALID = 1 <License is valid
209 * DRM_SAPPS_LIC_SUSPEND = 2 <License is valid but for future use
210 * DRM_SAPPS_INVALID_ARG = -1000 <invalid argument
211 * DRM_SAPPS_PARSING_ERROR = -999 <parsing contents or rights error
212 * DRM_SAPPS_DB_ERROR = -998 <data base error
213 * DRM_SAPPS_INSUFFICIENT_MEMORY = -997 <memory error
214 * DRM_SAPPS_INTERNAL_ERROR = -996 <processing error
215 * DRM_SAPPS_FILE_ERROR = -995 <file error
216 * DRM_SAPPS_LIC_EXPIRED_DATETIME = -994 <Datetime License is expired
217 * DRM_SAPPS_LIC_EXPIRED_COUNT = -993 <Count License is expired
218 * DRM_SAPPS_LIC_NO_LICENCE = -992 <No License
219 * DRM_SAPPS_LIC_IMEI_MISMATCH = -991 <IMEI is mismatching
220 * DRM_SAPPS_LIC_PNUM_MISMATCH = -990 <PNUM is mismatching
221 * DRM_SAPPS_UNKNOWN_ERROR = -1 <dummy error value
222 * @remarks This API must be called before rendering Samsung Apps contents
226 int drm_oem_sapps_consume_license( const char *szCid );
229 * An application can get license information for Samsung Apps content with given CID.
231 * @param[in] szCid Content ID(CID) of the Samsung Apps contents
232 * @param[out] LicenseInfoList License information list
233 * @return This function can return any of the following codes
234 * DRM_SAPPS_SUCCESS = 0 <success
235 * DRM_SAPPS_LIC_VALID = 1 <License is valid
236 * DRM_SAPPS_LIC_SUSPEND = 2 <License is valid but for future use
237 * DRM_SAPPS_INVALID_ARG = -1000 <invalid argument
238 * DRM_SAPPS_PARSING_ERROR = -999 <parsing contents or rights error
239 * DRM_SAPPS_DB_ERROR = -998 <data base error
240 * DRM_SAPPS_INSUFFICIENT_MEMORY = -997 <memory error
241 * DRM_SAPPS_INTERNAL_ERROR = -996 <processing error
242 * DRM_SAPPS_FILE_ERROR = -995 <file error
243 * DRM_SAPPS_LIC_EXPIRED_DATETIME = -994 <Datetime License is expired
244 * DRM_SAPPS_LIC_EXPIRED_COUNT = -993 <Count License is expired
245 * DRM_SAPPS_LIC_NO_LICENCE = -992 <No License
246 * DRM_SAPPS_LIC_IMEI_MISMATCH = -991 <IMEI is mismatching
247 * DRM_SAPPS_LIC_PNUM_MISMATCH = -990 <PNUM is mismatching
248 * DRM_SAPPS_UNKNOWN_ERROR = -1 <dummy error value
253 int drm_oem_sapps_get_license_info( const char *szCid ,drm_sapps_license_list **LicenseInfoList );
256 * An application frees license information list for Samsung Apps contents.
258 * @param[in] pLicenseInfoList License information list pointer
260 * @remarks This should be called after using LicenseInfoList recevied in drm_oem_sapps_get_license_info.
261 * @remarks Memory is allocated for LicenseInfoList in drm_oem_sapps_get_license_info that need to be freed by calling drm_oem_sapps_free_license_info
262 * @see drm_oem_sapps_get_license_info
265 void drm_oem_sapps_free_license_info(drm_sapps_license_list **pLicenseInfoList);
268 */ /* Doxygen : addtogroup*/