Fix coding style according to tizen rule
[platform/core/security/drm-service-core-tizen.git] / tadcore / include / DrmTdcSvc.h
1 /*
2  * Copyright (c) 2000-2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Flora License, Version 1.1 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://floralicense.org/license/
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef __DRMTDCSVC_H_
17 #define __DRMTDCSVC_H_
18
19 #include "TADC_Core.h"
20
21 /**
22  * TDC DRM File Header Info
23  */
24 typedef struct {
25         char cid[1024];   // Content ID
26         char riurl[1024]; // Rights Issuer URL
27 } DrmTdcFileHeader;
28
29 /**
30  * An application can get file Header Info
31  *
32  * @param[in]  filePath    file path of Tizen Apps DRM contents
33  * @param[out] pFileHeader Pointer to be stored TAD Header information.
34  *
35  * @return TRUE on success or FALSE on failure.
36  */
37 bool DrmTdcGetFileHeader(const char *pTADCFilepath,
38                                                  DrmTdcFileHeader *pFileHeader);
39
40 /**
41  * An application can request purchase request for getting License.
42  *
43  * @param[in]      pTADCFilepath  File path of Tizen Apps DRM contents
44  * @param[out]     pReqBuf        Purchase Request Data
45  * @param[in][out] pReqBufLen     IN : pReqBuf Length
46  *                                OUT : Purchase Request Data String Size
47  *                                (including null terminator)
48  * @param[out]     pLicenseUrl    License Acquisition URL Data
49  * @param[in][out] pLicenseUrlLen IN : pLicenseUrl Length
50  *                                OUT : License Server URL Data String Size
51  *                                (including null terminator)
52  *
53  * @return TRUE on success or FALSE on failure.
54  *
55  * @see DrmTdcGenerateLicenseRequest()
56  */
57 bool DrmTdcGeneratePurchaseRequest(const char *pTADCFilepath, char *pReqBuf,
58                                                                    unsigned int *pReqBufLen, char *pLicenseUrl, unsigned int *pLicenseUrlLen);
59
60 /**
61  * An application can request generate request for getting License.
62  *
63  * @param[in]      pRespBuf       Response Data String of the Purchase Request
64  *                                (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
68  *                                OUT : Rights Request Data String Size
69  *                                (including null terminator)
70  * @param[in][out] pLicenseUrl    License Acquisition URL Data
71  * @param[in][out] pLicenseUrlLen IN : IN : pLicenseUrl Length
72  *                                OUT : Rights Issuer Server URL Data String Size
73  *                                (including null terminator)
74  *
75  * @return TRUE on success or FALSE on failure.
76  *
77  * @see DrmTdcGeneratePurchaseRequest()
78  */
79 int DrmTdcGenerateLicenseRequest(const char *pRespBuf, unsigned int respBufLen,
80                                                                  char *pReqBuf, unsigned int *pReqBufLen, char *pLicenseUrl,
81                                                                  unsigned int *pLicenseUrlLen);
82
83 /**
84  * An application can get TAD license which is encrypted.
85  *
86  * @param[in]      pRespBuf         Response Data String of the Rights Request
87  *                                  (Null terminator string)
88  * @param[in]      respBufLen       pResBuf Length
89  * @param[in][out] pDecLicenseBuf   Decrypted Rights Object
90  * @param[in][out] decLicenseBufLen IN : pDecLicenseBuf Length
91  *                                  OUT : Decrypted Rights Object String Size
92  *                                  (including null terminator)
93  *
94  * @return TRUE on success or FALSE on failure.
95  *
96  * @see DrmTdcDecryptPackage()
97  */
98 int DrmTdcDecryptLicense(const char *pRespBuf, unsigned int respBufLen,
99                                                  char *pDecLicenseBuf, unsigned int *decLicenseBufLen);
100
101 /**
102  * An application can get decrypted contents(Apps) which is encrypted.
103  *
104  * @param[in] pTADCFilepath   TDC DRM File Path
105  * @param[in] pLicenseBuf     pResBuf Length
106  * @param[in] licenseBufLen   pDecLicenseBuf Length
107  * @param[in] pDecryptedFile  Decrypted File Path
108  *
109  * @return TRUE on success or FALSE on failure.
110  *
111  * @see DrmTdcDecryptLicense()
112  */
113 bool DrmTdcDecryptPackage(const char *pTADCFilepath, const char *pLicenseBuf,
114                                                   unsigned int licenseBufLen, const char *pDecryptedFile);
115
116 /**
117  * An application can get decrypted contents(Apps) which is encrypted.
118  *
119  * @param[in] pTADCFilepath   TDC DRM File Path
120  * @param[in] t_RO            Decrypted RO Info
121  * @param[in] pDecryptedFile  Decrypted File Path
122  *
123  * @return TRUE on success or FALSE on failure.
124  *
125  * @see DrmTdcDecryptLicense()
126  */
127 bool DrmTdcDecryptPackage2(const char *pTADCFilepath, T_RO t_RO,
128                                                    const char *pDecryptedFile);
129
130 /**
131  * An application can check contents(Apps) which is valid.
132  *
133  * @param[in] szCid Content ID
134  *
135  * @see DrmTdcGetFileHeader()
136  *
137  * @return TRUE on success or FALSE on failure.
138  */
139 bool DrmTdcHasValidLicense(const char *szCid);
140
141 //DrmTdcDHInfo Structure Init
142 void DrmTdcDHInfoInit(void);
143
144 //DrmTdcDHInfo Structure Free
145 bool DrmTdcDHInfoFree(int idx);
146
147 #endif //__DRMTDCSVC_H_