2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
20 * @brief This is part of C api for ValidationCore.
22 #ifndef _CERTSVC_CSTRING_H_
23 #define _CERTSVC_CSTRING_H_
25 #include <cert-svc/cinstance.h>
26 #include <cert-svc/cstring.h>
33 typedef struct CertSvcStringList_t {
35 CertSvcInstance privateInstance;
38 typedef struct CertSvcString_t {
41 CertSvcInstance privateInstance;
45 * This function will duplicate input data. Data in ouput string will be managed by certsvc.
47 * @param[in] instance CertSvcString will be conected with this instance.
48 * @param[in] input Input data.
49 * @param[in] size Input buffer size.
50 * @param[out] output Buffer with output data.
51 * @return CERTSVC_SUCCESS, CERTSVC_FAIL, CERTSVC_WRONG_ARGUMENT
53 int certsvc_string_new(
54 CertSvcInstance instance,
57 CertSvcString *output);
60 * This function wont duplicate input data. Output param will contain pointer to input
61 * so input could not be free as long as ouput param is used.
63 * @param[in] instance CertSvcString will be conected with this instance.
64 * @param[in] input Input data.
65 * @param[in] size Input buffer size.
66 * @param[out] output Buffer with output data.
67 * @return CERTSVC_SUCCESS, CERTSVC_WRONG_ARGUMENT
69 int certsvc_string_not_managed(
70 CertSvcInstance instance,
73 CertSvcString *output);
76 * Extract next result from result set. Function certsvc_string_list_free
77 * does not free results returned by this function. CertSvcString is valid
78 * until certsvc_string_free or vcore_instance_reset or vcore_instance_free
81 * @param[in] handler Handler to set of strings.
82 * @param[out] buffer The buffer will be pointing to string with distrubution point url or will be set to NULL if error occures.
83 * @param[out] size Size of data pointed by buffer or 0 if error occures.
84 * @return CERTSVC_SUCCESS, CERTSVC_FAIL, CERTSVC_WRONG_ARGUMENT, CERTSVC_BAD_ALLOC
86 int certsvc_string_list_get_one(CertSvcStringList hander,
88 CertSvcString *buffer);
91 * Extract CertSvcStringList size.
93 * @param[in] handler Handler to string list.
94 * @param[out] size Number of elements on the list.
95 * @return CERTSVC_SUCCESS, CERTSVC_WRONG_ARGUMENT
97 int certsvc_string_list_get_length(CertSvcStringList hander,int *size);
102 * @param[in] string Data allocated by certsvc_certificate_get_string_field
104 void certsvc_string_free(CertSvcString string);
109 * Note: This function does not free strings returned by certsvc_string_list_get_one_result.
111 * @param[in] handler String set handler.
113 void certsvc_string_list_free(CertSvcStringList handler);
116 * Convert CertSvcStringPtr into pure c pointer. Please note that this pointer is valid as long as CertSvcString is valid.
118 * @param[in] string CertSvcStringPtr.
119 * @param[out] buffer cstring
120 * @param[out] len Length of cstring
122 void certsvc_string_to_cstring(CertSvcString string, const char **buffer, int *len);