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
38 * @brief The package information handle.
41 typedef struct package_info_s *package_info_h;
44 * @brief The package update information handle.
47 typedef struct package_updateinfo_s *package_updateinfo_h;
50 * @brief Enumeration for storage type.
54 PACKAGE_INFO_INTERNAL_STORAGE = 0, /**< Internal storage */
55 PACKAGE_INFO_EXTERNAL_STORAGE = 1, /**< External storage */
56 } package_info_installed_storage_type_e;
60 * @brief Enumeration for app component type.
64 PACKAGE_INFO_ALLAPP = 0, /**< All application */
65 PACKAGE_INFO_UIAPP = 1, /**< UI application */
66 PACKAGE_INFO_SERVICEAPP = 2, /**< Service application */
67 } package_info_app_component_type_e;
71 * @brief Enumeration for certification type.
75 PACKAGE_INFO_AUTHOR_ROOT_CERT = 0, /**< Author Root Certificate*/
76 PACKAGE_INFO_AUTHOR_INTERMEDIATE_CERT = 1, /**< Author Intermediate Certificate*/
77 PACKAGE_INFO_AUTHOR_SIGNER_CERT = 2, /**< Author Signer Certificate*/
78 PACKAGE_INFO_DISTRIBUTOR_ROOT_CERT = 3, /**< Distributor Root Certificate*/
79 PACKAGE_INFO_DISTRIBUTOR_INTERMEDIATE_CERT = 4, /**< Distributor Intermediate Certificate*/
80 PACKAGE_INFO_DISTRIBUTOR_SIGNER_CERT = 5, /**< Distributor Signer Certificate*/
81 PACKAGE_INFO_DISTRIBUTOR2_ROOT_CERT = 6, /**< Distributor2 Root Certificate*/
82 PACKAGE_INFO_DISTRIBUTOR2_INTERMEDIATE_CERT = 7, /**< Distributor2 Intermediate Certificate*/
83 PACKAGE_INFO_DISTRIBUTOR2_SIGNER_CERT = 8, /**< Distributor2 Signer Certificate*/
84 } package_cert_type_e;
87 * @brief Enumeration for package update info type.
91 PACKAGE_UPDATEINFO_TYPE_NONE = 0, /**< None type */
92 PACKAGE_UPDATEINFO_TYPE_FORCE, /**< Force type */
93 PACKAGE_UPDATEINFO_TYPE_OPTIONAL /**< Optional type */
94 } package_updateinfo_type_e;
97 * @brief Called for each update information of all packages.
99 * @remarks @a info should not be freed and can be used only in the callback.
100 * @param[in] info The package update information handle
101 * @param[in] user_data The user data passed from the foreach function
102 * @return @c true to continue with the next iteration of the loop,
103 * otherwise @c false to break out of the loop
104 * @pre package_info_updateinfo_foreach_updateinfo() will invoke this callback.
105 * @see package_info_updateinfo_foreach_updateinfo()
107 typedef bool (*package_info_updateinfo_cb) (package_updateinfo_h info, void *user_data);
110 * @brief Called to get the application ID once for each installed package.
112 * @param[in] comp_type The Application Component type
113 * @param[in] callback The callback function to be invoked
114 * @param[in] user_data The user data passed from the foreach function
115 * @return @c true to continue with the next iteration of the loop,
116 * otherwise @c false to break out of the loop
117 * @pre package_info_foreach_app_from_package() will invoke this callback.
118 * @see package_info_foreach_app_from_package()
120 typedef bool (*package_info_app_cb) (package_info_app_component_type_e comp_type, const char *app_id, void *user_data);
124 * @brief Called to get the certification information.
126 * @param[in] package_info The package info handle
127 * @param[in] cert_type The certificate type
128 * @param[in] cert_value The certificate value of corresponding certificate key \n
129 * This value is base64 encoded data.
130 * @param[in] user_data The user data passed from the foreach function
131 * @return @c true to continue with the next iteration of the loop,
132 * otherwise @c false to break out of the loop
133 * @pre package_info_foreach_cert_info() will invoke this callback.
134 * @see package_info_foreach_cert_info()
136 typedef bool (*package_info_cert_info_cb) (package_info_h handle, package_cert_type_e cert_type, const char *cert_value, void *user_data);
140 * @brief Called to get the privilege information.
142 * @param[in] privilege_name the name of the privilege
143 * @param[in] user_data The user data passed from the foreach function
144 * @return @c true to continue with the next iteration of the loop,
145 * otherwise @c false to break out of the loop
146 * @pre package_info_foreach_privilege_info() will invoke this callback.
147 * @see package_info_foreach_privilege_info()
149 typedef bool (*package_info_privilege_info_cb) (const char *privilege_name, void *user_data);
153 * @brief Retrieves all application IDs of each package.
155 * @param[in] package_info The package info handle
156 * @param[in] comp_type The application component type
157 * @param[in] callback The callback function to invoke
158 * @param[in] user_data The user data to be passed to the callback function
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_NO_SUCH_PACKAGE No such package
164 * @post This function invokes package_info_app_cb() repeatedly for each package.
165 * @see package_info_app_cb()
167 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);
171 * @brief Destroys the package information handle and releases all its resources.
173 * @param[in] package_info The package information handle
174 * @return @c 0 on success,
175 * otherwise a negative error value
176 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
177 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
178 * @see package_manager_foreach_package_info()
179 * @see package_manager_get_package_info()
181 int package_info_destroy(package_info_h package_info);
185 * @brief Gets the package name.
187 * @remarks You must release @a package using free().
188 * @param[in] package_info The package information
189 * @param[out] package The package name
190 * @return @c 0 on success,
191 * otherwise a negative error value
192 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
193 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
194 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
196 int package_info_get_package(package_info_h package_info, char **package);
200 * @brief Gets the main application ID of the package.
202 * @remarks You must release @a main_app_id using free().
203 * @param[in] package_info The package information
204 * @param[out] main_app_id The main application ID of the package
205 * @return @c 0 on success,
206 * otherwise a negative error value
207 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
208 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
209 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
210 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
212 int package_info_get_main_app_id(package_info_h package_info, char **main_app_id);
216 * @brief Gets the label of the package.
218 * @remarks You must release @a label using free().
219 * @param[in] package_info The package information
220 * @param[out] label The label of the package
221 * @return @c 0 on success,
222 * otherwise a negative error value
223 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
224 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
225 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
226 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
228 int package_info_get_label(package_info_h package_info, char **label);
232 * @brief Gets the absolute path to the icon image.
234 * @remarks You must release @a path using free().
235 * @param[in] package_info The package information
236 * @param[out] path The path of the package
237 * @return @c 0 on success,
238 * otherwise a negative error value
239 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
240 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
241 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
242 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
244 int package_info_get_icon(package_info_h package_info, char **path);
248 * @brief Gets the version of the package.
250 * @remarks You must release @a version using free().
251 * @param[in] package_info The package information
252 * @param[out] version The version of the package
253 * @return @c 0 on success,
254 * otherwise a negative error value
255 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
256 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
257 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
258 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
260 int package_info_get_version(package_info_h package_info, char **version);
264 * @brief Gets the type of the package.
266 * @remarks You must release @a type using free().
267 * @param[in] package_info The package information
268 * @param[out] type The type of the package
269 * @return @c 0 on success,
270 * otherwise a negative error value
271 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
272 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
273 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
274 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
276 int package_info_get_type(package_info_h package_info, char **type);
280 * @brief Gets the installed storage for the given package.
282 * @param[in] package_info The package information
283 * @param[out] storage The installed storage
284 * @return @c 0 on success,
285 * otherwise a negative error value
286 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
287 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
289 int package_info_get_installed_storage(package_info_h package_info, package_info_installed_storage_type_e *storage);
293 * @brief Gets the root path of the package.
295 * @remarks You must release @a path using free().
296 * @param[in] package_info The package information
297 * @param[out] path The root path of the package
298 * @return @c 0 on success,
299 * otherwise a negative error value
300 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
301 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
302 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
303 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
305 int package_info_get_root_path(package_info_h package_info, char **path);
310 * @brief Gets the name of the TEP(Tizen Expansion Package).
311 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
312 * @privlevel platform
313 * @privilege %http://tizen.org/privilege/packagemanager.admin
314 * @remarks Name must be released using free().
315 * @param[in] package_info The package information
316 * @param[out] name The name of the tep
317 * @return 0 on success,
318 * otherwise a negative error value
319 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
320 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
321 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
322 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
323 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
325 int package_info_get_tep_name(package_info_h package_info, char **name);
329 * @brief Checks whether the package is system package.
331 * @param[in] package_info The package information
332 * @param[out] system @c true if the package is system package,
333 * otherwise @c false if the package is not system package
334 * @return @c 0 on success,
335 * otherwise a negative error value
336 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
337 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
338 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
339 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
341 int package_info_is_system_package(package_info_h package_info, bool *system);
345 * @brief Checks whether the package is removable.
347 * @param[in] package_info The package information
348 * @param[out] removable The removable info of the package
349 * @return @c 0 on success,
350 * otherwise a negative error value
351 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
352 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
353 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
354 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR IO error
356 int package_info_is_removable_package(package_info_h package_info, bool *removable);
360 * @brief Checks whether the package is preloaded.
362 * @param[in] package_info The package information
363 * @param[out] preload The preload info of the package
364 * @return @c 0 on success,
365 * otherwise a negative error value
366 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
367 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
368 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
369 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
371 int package_info_is_preload_package(package_info_h package_info, bool *preload);
375 * @brief Checks whether two package information is equal.
377 * @param[in] lhs The first package information to be compared
378 * @param[in] rhs The second package information to be compared
379 * @param[out] equal @c true if the package information are equal,
380 * otherwise @c false if package information are not equal
381 * @return @c 0 on success,
382 * otherwise a negative error value
383 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
384 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
385 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
386 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
388 int package_info_is_equal(package_info_h lhs, package_info_h rhs, bool *equal);
392 * @brief Checks whether the package info is accessible for the given package.
394 * @param[in] package_info The package information
395 * @param[out] accessible @c true if the package info is accessible,
396 * otherwise @c false if the package info is not accessible
397 * @return @c 0 on success,
398 * otherwise a negative error value
399 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
400 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
402 int package_info_is_accessible(package_info_h package_info, bool *accessible);
405 * @brief Gets the installed time for the given package.
406 * @details If the package was updated, the @a installed_time represents updated time.
407 * So, the meaning of 'installed time' corresponds with 'last modified time'.
409 * @param[in] package_info The package information
410 * @param[out] installed_time The integer value of time_t type for installed time
411 * @return @c 0 on success,
412 * otherwise a negative error value
413 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
414 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
415 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
417 int package_info_get_installed_time(package_info_h package_info, int *installed_time);
420 * @brief Clones the package information handle.
422 * @param[out] clone The newly created package information handle
423 * @param[in] package_info The package information
424 * @return @c 0 on success,
425 * otherwise a negative error value
426 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
427 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
428 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
429 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
431 int package_info_clone(package_info_h *clone, package_info_h package_info);
434 * @brief Gets the package information for the given package
436 * @remarks You must release @a package_info using package_info_destroy().
437 * @param[in] package The ID of the package
438 * @param[out] package_info The package information for the given package ID
439 * @return @c 0 on success,
440 * otherwise a negative error value
441 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
442 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
443 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
444 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
446 int package_info_create(const char *package, package_info_h *package_info);
450 * @brief Retrieves certification information of the package.
452 * @param[in] package_info The package information
453 * @param[in] callback The iteration callback function
454 * @param[in] user_data The user data to be passed to the callback function
455 * @return @c 0 on success,
456 * otherwise a negative error value
457 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
458 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
459 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
460 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
462 int package_info_foreach_cert_info(package_info_h package_info, package_info_cert_info_cb callback, void *user_data);
466 * @brief Retrieves privilege information of the package.
468 * @param[in] package_info The package information
469 * @param[in] callback The iteration callback function
470 * @param[in] user_data The user data to be passed to the callback function
471 * @return @c 0 on success,
472 * otherwise a negative error value
473 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
474 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
475 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
476 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
478 int package_info_foreach_privilege_info(package_info_h package_info, package_info_privilege_info_cb callback, void *user_data);
481 * @brief Gets the package update information for the given package.
483 * @remarks You must release @a package_updateinfo using package_info_updateinfo_destroy().
484 * @param[in] pkgid The ID of the package
485 * @param[out] package_updateinfo The package update information for the given package ID
486 * @return @c 0 on success,
487 * otherwise a negative error value
488 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
489 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
490 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
491 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
492 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
493 * @see package_info_updateinfo_destroy()
495 int package_info_updateinfo_create(const char *pkgid, package_updateinfo_h *info);
498 * @brief Gets the package name.
500 * @remarks You must release @a package using free().
501 * @param[in] package_updateinfo The package update information
502 * @param[out] package The package name
503 * @return @c 0 on success,
504 * otherwise a negative error value
505 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
506 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
507 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
508 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error occured
510 int package_info_updateinfo_get_pkgid(package_updateinfo_h info, char **package);
513 * @brief Gets the update version of package.
515 * @remarks You must release @a version using free().
516 * @param[in] package_updateinfo The package update information
517 * @param[out] version The package update version
518 * @return @c 0 on success,
519 * otherwise a negative error value
520 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
521 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
522 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
523 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error occured
525 int package_info_updateinfo_get_version(package_updateinfo_h info, char **version);
528 * @brief Gets the update type of package.
530 * @param[in] package_updateinfo The package update information
531 * @param[out] type The package update type
532 * @return @c 0 on success,
533 * otherwise a negative error value
534 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
535 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
536 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Internal I/O error occured
538 int package_info_updateinfo_get_type(package_updateinfo_h info,
539 package_updateinfo_type_e *type);
542 * @brief Destroys the package update information handle and releases all its resources.
544 * @param[in] package_updateinfo The package update information handle
545 * @return @c 0 on success,
546 * otherwise a negative error value
547 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
548 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
549 * @see package_info_updateinfo_create()
551 int package_info_updateinfo_destroy(package_updateinfo_h info);
554 * @brief Retrieve update information of all packages and invoke callback for each of it.
556 * @param[in] callback The iteration callback function
557 * @param[in] user_data The user data to be passed to the callback function
558 * @return @c 0 on success,
559 * otherwise a negative error value
560 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
561 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
562 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
564 int package_info_updateinfo_foreach_info(package_info_updateinfo_cb callback, void *user_data);
575 #endif /* __TIZEN_APPFW_PACKAGE_INFO_H */