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 #ifndef __TIZEN_APPFW_PACKAGE_INFO_H
19 #define __TIZEN_APPFW_PACKAGE_INFO_H
28 * @file package_info.h
32 * @addtogroup CAPI_PACKAGE_INFO_MODULE
37 * @brief The package information handle.
40 typedef struct package_info_s *package_info_h;
43 * @brief Enumeration for storage type.
47 PACKAGE_INFO_INTERNAL_STORAGE = 0, /**< Internal storage */
48 PACKAGE_INFO_EXTERNAL_STORAGE = 1, /**< External storage */
49 } package_info_installed_storage_type_e;
52 * @brief Enumeration for app component type.
56 PACKAGE_INFO_ALLAPP = 0, /**< All application */
57 PACKAGE_INFO_UIAPP = 1, /**< UI application */
58 PACKAGE_INFO_SERVICEAPP = 2, /**< Service application */
59 } package_info_app_component_type_e;
62 * @brief Enumeration for certification type.
66 PACKAGE_INFO_AUTHOR_ROOT_CERT = 0, /**< Author Root Certificate*/
67 PACKAGE_INFO_AUTHOR_INTERMEDIATE_CERT = 1, /**< Author Intermediate Certificate*/
68 PACKAGE_INFO_AUTHOR_SIGNER_CERT = 2, /**< Author Signer Certificate*/
69 PACKAGE_INFO_DISTRIBUTOR_ROOT_CERT = 3, /**< Distributor Root Certificate*/
70 PACKAGE_INFO_DISTRIBUTOR_INTERMEDIATE_CERT = 4, /**< Distributor Intermediate Certificate*/
71 PACKAGE_INFO_DISTRIBUTOR_SIGNER_CERT = 5, /**< Distributor Signer Certificate*/
72 PACKAGE_INFO_DISTRIBUTOR2_ROOT_CERT = 6, /**< Distributor2 Root Certificate*/
73 PACKAGE_INFO_DISTRIBUTOR2_INTERMEDIATE_CERT = 7, /**< Distributor2 Intermediate Certificate*/
74 PACKAGE_INFO_DISTRIBUTOR2_SIGNER_CERT = 8, /**< Distributor2 Signer Certificate*/
75 } package_cert_type_e;
78 * @brief Called to get the application ID once for each installed package.
81 * @param[in] comp_type The Application Component type
82 * @param[in] callback The callback function to be invoked
83 * @param[in] user_data The user data passed from the foreach function
85 * @return @c true to continue with the next iteration of the loop,
86 * otherwise @c false to break out of the loop
88 * @pre package_info_foreach_app_from_package() will invoke this callback.
89 * @see package_info_foreach_app_from_package()
91 typedef bool (*package_info_app_cb) (package_info_app_component_type_e comp_type, const char *app_id, void *user_data);
94 * @brief Called to get the certification information.
97 * @param[in] package_info The package info handle
98 * @param[in] cert_type The certificate type
99 * @param[in] cert_value The certificate value of corresponding certificate key \n
100 * This value is base64 encoded data.
101 * @param[in] user_data The user data passed from the foreach function
103 * @return @c true to continue with the next iteration of the loop,
104 * otherwise @c false to break out of the loop
106 * @pre package_info_foreach_cert_info() will invoke this callback.
108 * @see package_info_foreach_cert_info()
110 typedef bool (*package_info_cert_info_cb) (package_info_h handle, package_cert_type_e cert_type, const char *cert_value, void *user_data);
113 * @brief Called to get the privilege information.
116 * @param[in] privilege_name the name of the privilege
117 * @param[in] user_data The user data passed from the foreach function
119 * @return @c true to continue with the next iteration of the loop,
120 * otherwise @c false to break out of the loop
122 * @pre package_info_foreach_privilege_info() will invoke this callback.
124 * @see package_info_foreach_privilege_info()
126 typedef bool (*package_info_privilege_info_cb) (const char *privilege_name, void *user_data);
129 * @brief Retrieves all application IDs of each package.
132 * @param[in] package_info The package info handle
133 * @param[in] comp_type The application component type
134 * @param[in] callback The callback function to invoke
135 * @param[in] user_data The user data to be passed to the callback function
137 * @return @c 0 on success,
138 * otherwise a negative error value
140 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
141 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
142 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
144 * @post This function invokes package_info_app_cb() repeatedly for each package.
146 * @see package_info_app_cb()
148 int package_info_foreach_app_from_package(package_info_h package_info, package_info_app_component_type_e comp_type, package_info_app_cb callback, void *user_data);
151 * @brief Destroys the package information handle and releases all its resources.
154 * @param[in] package_info The package information handle
156 * @return @c 0 on success,
157 * otherwise a negative error value
159 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
160 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
162 * @see package_manager_foreach_package_info()
163 * @see package_manager_get_package_info()
165 int package_info_destroy(package_info_h package_info);
168 * @brief Gets the package name.
171 * @remarks You must release @a package using free().
173 * @param[in] package_info The package information
174 * @param[out] package The package name
176 * @return @c 0 on success,
177 * otherwise a negative error value
179 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
180 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
181 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
183 int package_info_get_package(package_info_h package_info, char **package);
186 * @brief Gets the label of the package.
189 * @remarks You must release @a label using free().
191 * @param[in] package_info The package information
192 * @param[out] label The label of the package
194 * @return @c 0 on success,
195 * otherwise a negative error value
197 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
198 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
199 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
200 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
202 int package_info_get_label(package_info_h package_info, char **label);
205 * @brief Gets the absolute path to the icon image.
208 * @remarks You must release @a path using free().
210 * @param[in] package_info The package information
211 * @param[out] path The path of the package
213 * @return @c 0 on success,
214 * otherwise a negative error value
216 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
217 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
218 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
219 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
221 int package_info_get_icon(package_info_h package_info, char **path);
224 * @brief Gets the version of the package.
227 * @remarks You must release @a version using free().
229 * @param[in] package_info The package information
230 * @param[out] version The version of the package
232 * @return @c 0 on success,
233 * otherwise a negative error value
235 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
236 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
237 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
238 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
240 int package_info_get_version(package_info_h package_info, char **version);
243 * @brief Gets the type of the package.
246 * @remarks You must release @a type using free().
248 * @param[in] package_info The package information
249 * @param[out] type The type of the package
251 * @return @c 0 on success,
252 * otherwise a negative error value
254 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
255 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
256 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
257 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
259 int package_info_get_type(package_info_h package_info, char **type);
262 * @brief Gets the installed storage for the given package.
265 * @param[in] package_info The package information
266 * @param[out] storage The installed storage
268 * @return @c 0 on success,
269 * otherwise a negative error value
271 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
272 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
274 int package_info_get_installed_storage(package_info_h package_info, package_info_installed_storage_type_e *storage);
277 * @brief Gets the root path of the package.
280 * @remarks You must release @a path using free().
282 * @param[in] package_info The package information
283 * @param[out] path The root path of the package
285 * @return @c 0 on success,
286 * otherwise a negative error value
288 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
289 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
290 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
291 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
293 int package_info_get_root_path(package_info_h package_info, char **path);
296 * @brief Checks whether the package is system package.
299 * @param[in] package_info The package information
300 * @param[out] system @c true if the package is system package,
301 * otherwise @c false if the package is not system package
303 * @return @c 0 on success,
304 * otherwise a negative error value
306 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
307 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
308 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
309 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
311 int package_info_is_system_package(package_info_h package_info, bool *system);
314 * @brief Checks whether the package is removable.
317 * @param[in] package_info The package information
318 * @param[out] removable The removable info of the package
320 * @return @c 0 on success,
321 * otherwise a negative error value
323 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
324 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
325 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
326 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR IO error
328 int package_info_is_removable_package(package_info_h package_info, bool *removable);
331 * @brief Checks whether the package is preloaded.
334 * @param[in] package_info The package information
335 * @param[out] preload The preload info of the package
337 * @return @c 0 on success,
338 * otherwise a negative error value
340 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
341 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
342 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
343 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
345 int package_info_is_preload_package(package_info_h package_info, bool *preload);
348 * @brief Checks whether two package information are equal.
351 * @param[in] lhs The first package information to be compared
352 * @param[in] rhs The second package information to be compared
353 * @param[out] equal @c true if the package information are equal,
354 * otherwise @c false if package information are not equal
356 * @return @c 0 on success,
357 * otherwise a negative error value
359 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
360 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
361 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
362 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
364 int package_info_is_equal(package_info_h lhs, package_info_h rhs, bool *equal);
367 * @brief Checks whether the package info is accessible for the given package.
370 * @param[in] package_info The package information
371 * @param[out] accessible @c true if the package info is accessible,
372 * otherwise @c false if the package info is not accessible
374 * @return @c 0 on success,
375 * otherwise a negative error value
377 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
378 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
380 int package_info_is_accessible(package_info_h package_info, bool *accessible);
383 * @brief Clones the package information handle.
386 * @param[out] clone The newly created package information handle
387 * @param[in] package_info The package information
389 * @return @c 0 on success,
390 * otherwise a negative error value
392 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
393 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
394 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
395 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
397 int package_info_clone(package_info_h *clone, package_info_h package_info);
400 * @brief Gets the package information for the given package
403 * @remarks You must release @a package_info using package_info_destroy().
405 * @param[in] package The ID of the package
406 * @param[out] package_info The package information for the given package ID
408 * @return @c 0 on success,
409 * otherwise a negative error value
411 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
412 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
413 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
414 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
416 int package_info_create(const char *package, package_info_h *package_info);
419 * @brief Retrieves certification information of the package.
422 * @param[in] package_info The package information
423 * @param[in] callback The iteration callback function
424 * @param[in] user_data The user data to be passed to the callback function
426 * @return @c 0 on success,
427 * otherwise a negative error value
429 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
430 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
431 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
432 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
434 int package_info_foreach_cert_info(package_info_h package_info, package_info_cert_info_cb callback, void* user_data);
437 * @brief Retrieves privilege information of the package.
440 * @param[in] package_info The package information
441 * @param[in] callback The iteration callback function
442 * @param[in] user_data The user data to be passed to the callback function
444 * @return @c 0 on success,
445 * otherwise a negative error value
447 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
448 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
449 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
450 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
452 int package_info_foreach_privilege_info(package_info_h package_info, package_info_privilege_info_cb callback, void* user_data);
462 #endif /* __TIZEN_APPFW_PACKAGE_INFO_H */