2 * Copyright (c) 2017 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.
17 #ifndef __TIZEN_APPFW_PACKAGE_ARCHIVE_INFO_H
18 #define __TIZEN_APPFW_PACKAGE_ARCHIVE_INFO_H
20 #include <package_info.h>
27 * @file package_archive_info.h
31 * @addtogroup CAPI_PACKAGE_ARCHIVE_INFO_MODULE
37 * @brief The package archive information handle.
40 typedef struct package_archive_info_s *package_archive_info_h;
43 * @brief Creates the package archive information for the given package.
45 * @remarks If the given path is relevant to media storage, the privilege
46 * http://tizen.org/privilege/mediastorage is needed.
47 * @remarks If the given path is relevant to external storage, the privilege
48 * http://tizen.org/privilege/externalstorage is needed.
49 * @remarks You must release @a archive_info
50 * using package_archive_info_destroy().
51 * @param[in] path The path of the package
52 * @param[out] archive_info The package archive information for
54 * @return @c 0 on success,
55 * otherwise a negative error value
56 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
57 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
58 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
59 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error
60 * @see package_archive_info_destroy()
62 int package_archive_info_create(const char *path,
63 package_archive_info_h *archive_info);
66 * @brief Destroys the package archive information handle.
68 * @param[in] archive_info The package archive information handle
69 * @return @c 0 on success,
70 * otherwise a negative error value
71 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
72 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
73 * @see package_archive_info_create()
75 int package_archive_info_destroy(package_archive_info_h archive_info);
78 * @brief Gets the package name.
80 * @remarks You must release @a package using free().
81 * @param[in] archive_info The package archive information
82 * @param[out] package The package name
83 * @return @c 0 on success,
84 * otherwise a negative error value
85 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
86 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
87 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
89 int package_archive_info_get_package(package_archive_info_h archive_info,
93 * @brief Gets the type of the package.
95 * @remarks You must release @a type using free().
96 * @param[in] archive_info The package archive information
97 * @param[out] type The type of the package
98 * @return @c 0 on success,
99 * otherwise a negative error value
100 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
101 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
102 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
104 int package_archive_info_get_type(package_archive_info_h archive_info,
108 * @brief Gets the version of the package.
110 * @remarks You must release @a version using free().
111 * @param[in] archive_info The package archive information
112 * @param[out] version The version of the package
113 * @return @c 0 on success,
114 * otherwise a negative error value
115 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
116 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
117 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
119 int package_archive_info_get_version(package_archive_info_h archive_info,
123 * @brief Gets the API version of the package.
125 * @remarks You must release @a api_version using free().
126 * @param[in] archive_info The package archive information
127 * @param[out] api_version The API version of the package
128 * @return @c 0 on success,
129 * otherwise a negative error value
130 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
131 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
132 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
134 int package_archive_info_get_api_version(package_archive_info_h archive_info,
138 * @brief Gets the description of the package.
140 * @remarks You must release @a description using free().
141 * @param[in] archive_info The package archive information
142 * @param[out] description The description of the package
143 * @return @c 0 on success,
144 * otherwise a negative error value
145 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
146 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
147 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
148 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
150 int package_archive_info_get_description(package_archive_info_h archive_info,
154 * @brief Gets the label of the package.
156 * @remarks You must release @a label using free().
157 * @param[in] archive_info The package archive information
158 * @param[out] label The label of the package
159 * @return @c 0 on success,
160 * otherwise a negative error value
161 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
162 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
163 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
164 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
166 int package_archive_info_get_label(package_archive_info_h archive_info,
170 * @brief Gets the author of the package.
172 * @remarks You must release @a author using free().
173 * @param[in] archive_info The package archive information
174 * @param[out] author The author of the package
175 * @return @c 0 on success,
176 * otherwise a negative error value
177 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
178 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
179 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
180 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
182 int package_archive_info_get_author(package_archive_info_h archive_info,
186 * @brief Gets the raw icon of the package.
188 * @remarks You must release @a icon using free().
189 * @param[in] archive_info The package archive information
190 * @param[out] icon The raw icon of the package
191 * @param[out] icon_size The size of the icon
192 * @return @c 0 on success,
193 * otherwise a negative error value
194 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
195 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
196 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
197 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
199 int package_archive_info_get_icon(package_archive_info_h archive_info,
200 unsigned char **icon, size_t *icon_size);
203 * @brief Retrieves direct dependencies of the given package.
204 * @details package_info_dependency_info_cb() is called for each direct dependency of the given package.
205 * For example, if there are packages having the following relationship:
212 * A --> B means that A depends on B.
214 * If package_archive_info_foreach_direct_dependency(A) is called, the callback will be called once with the following argument values: @e from = A, @e to = B.
216 * @remarks The function provides the results synchronously. If there are no dependencies, this function will return PACKAGE_MANAGER_ERROR_NONE immediately and the callback will not be invoked.
217 * @param[in] archive_info The package archive information
218 * @param[in] callback The iteration callback function
219 * @param[in] user_data The user data to be passed to the callback function
220 * @return @c 0 on success,
221 * otherwise a negative error value
222 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
223 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
224 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
226 int package_archive_info_foreach_direct_dependency(
227 package_archive_info_h archive_info,
228 package_info_dependency_info_cb callback, void *user_data);
239 #endif /* __TIZEN_APPFW_PACKAGE_ARCHIVE_INFO_H */