4f1849d4650beff6a80f9b266e1cb3f434abab5b
[platform/core/security/cert-svc.git] / vcore / cert-svc / cinstance.h
1 /**
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (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://www.apache.org/licenses/LICENSE-2.0
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 /*
17  * @file        cinstance.h
18  * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
19  * @version     1.0
20  * @brief       This is part of C api for ValidationCore.
21  */
22 #ifndef _CERTSVC_CINSTANCE_H_
23 #define _CERTSVC_CINSTANCE_H_
24
25 #include <cert-svc/cerror.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 typedef struct CertSvcInstance_t {
32     void *privatePtr;
33 } CertSvcInstance;
34
35 /**
36  * Allocate internal data of CertSvc library and put it in the CertSvcInstance structure.
37  * Initialize Openssl interanal structures.
38  *
39  * @param[out] instance Pointer to CertSvcInstance.
40  * @return CERTSVC_SUCCESS or CERTSVC_FAIL.
41  */
42 int certsvc_instance_new(CertSvcInstance *instance);
43
44 /**
45  * This function will free all allocated data. All certificate identificator will
46  * be released and all strings allocated by certsvc_certificate_get_string field will be
47  * released also.
48  *
49  * This fucntion does not release CertSvcInstnace!
50  *
51  * Plese note: It is safe to use this function after use certsvc_string_free.
52  *
53  * @param[in] instance CertSvcInstance object.
54  */
55 void certsvc_instance_reset(CertSvcInstance instance);
56
57 /**
58  * This function will free all allocated data. All certificate identificator will
59  * be released and all strings allocated by certsvc_certificate_get_string field will be
60  * released also.
61  *
62  * This fucntion also release CertSvcInstnace!
63  *
64  * Please note: It is safe use this function after use certsvc_string_free.
65  *
66  * @param[in] instance CertSvcInstance object
67  */
68 void certsvc_instance_free(CertSvcInstance instance);
69
70 #ifdef __cplusplus
71 }
72 #endif
73
74 #endif // _CERTSVC_CINSTANCE_H_
75