0573b03869a94edc3c5b1dce190673a8ab68c1b2
[platform/core/api/package-manager.git] / include / package_info.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
18 #ifndef __TIZEN_APPFW_PACKAGE_INFO_H
19 #define __TIZEN_APPFW_PACKAGE_INFO_H
20
21 #include <tizen.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28  * @file package_info.h
29  */
30
31 /**
32  * @addtogroup CAPI_PACKAGE_INFO_MODULE
33  * @{
34  */
35
36
37 /**
38  * @brief The package information handle.
39  * @since_tizen 2.3
40  */
41 typedef struct package_info_s *package_info_h;
42
43 /**
44  * @brief The package update information handle.
45  * @since_tizen 4.0
46  */
47 typedef struct package_updateinfo_s *package_updateinfo_h;
48
49 /**
50  * @brief Enumeration for storage type.
51  * @since_tizen 2.3
52  */
53 typedef enum {
54         PACKAGE_INFO_INTERNAL_STORAGE = 0,    /**< Internal storage */
55         PACKAGE_INFO_EXTERNAL_STORAGE = 1,    /**< External storage */
56         PACKAGE_INFO_EXTENDED_STORAGE = 2,    /**< Extended storage (Since 5.0) */
57 } package_info_installed_storage_type_e;
58
59
60 /**
61  * @brief Enumeration for app component type.
62  * @since_tizen 2.3
63  */
64 typedef enum {
65         PACKAGE_INFO_ALLAPP = 0,                                /**< All applications
66           (Deprecated since 5.5, use PACKAGE_INFO_APP_COMPONENT_TYPE_ALL instead) */
67         PACKAGE_INFO_UIAPP = 1,                                 /**< UI application
68           (Deprecated since 5.5, use PACKAGE_INFO_APP_COMPONENT_TYPE_UI instead) */
69         PACKAGE_INFO_SERVICEAPP = 2,                            /**< Service application
70           (Deprecated since 5.5, use PACKAGE_INFO_APP_COMPONENT_TYPE_SERVICE instead) */
71         PACKAGE_INFO_WIDGETAPP = 3,                             /**< Widget application (Since 4.0)
72           (Deprecated since 5.5, use PACKAGE_INFO_APP_COMPONENT_TYPE_WIDGET instead) */
73         PACKAGE_INFO_WATCHAPP = 4,                              /**< Watch application (Since 4.0)
74           (Deprecated since 5.5, use PACKAGE_INFO_APP_COMPONENT_TYPE_WATCH instead) */
75
76         PACKAGE_INFO_APP_COMPONENT_TYPE_ALL = 0,                /**< All applications (Since 5.5) */
77         PACKAGE_INFO_APP_COMPONENT_TYPE_UI = 1,                 /**< UI application (Since 5.5) */
78         PACKAGE_INFO_APP_COMPONENT_TYPE_SERVICE = 2,            /**< Service application (Since 5.5) */
79         PACKAGE_INFO_APP_COMPONENT_TYPE_WIDGET = 3,             /**< Widget application (Since 5.5) */
80         PACKAGE_INFO_APP_COMPONENT_TYPE_WATCH = 4,              /**< Watch application (Since 5.5) */
81         PACKAGE_INFO_APP_COMPONENT_TYPE_COMPONENT_BASED = 5,    /**< Component-based application (Since 5.5) */
82 } package_info_app_component_type_e;
83
84
85 /**
86  * @brief Enumeration for certification type.
87  * @since_tizen 2.3
88  */
89 typedef enum {
90         PACKAGE_INFO_AUTHOR_ROOT_CERT = 0,               /**< Author Root Certificate*/
91         PACKAGE_INFO_AUTHOR_INTERMEDIATE_CERT = 1,       /**< Author Intermediate Certificate*/
92         PACKAGE_INFO_AUTHOR_SIGNER_CERT = 2,             /**< Author Signer Certificate*/
93         PACKAGE_INFO_DISTRIBUTOR_ROOT_CERT = 3,          /**< Distributor Root Certificate*/
94         PACKAGE_INFO_DISTRIBUTOR_INTERMEDIATE_CERT = 4,  /**< Distributor Intermediate Certificate*/
95         PACKAGE_INFO_DISTRIBUTOR_SIGNER_CERT = 5,        /**< Distributor Signer Certificate*/
96         PACKAGE_INFO_DISTRIBUTOR2_ROOT_CERT = 6,         /**< Distributor2 Root Certificate*/
97         PACKAGE_INFO_DISTRIBUTOR2_INTERMEDIATE_CERT = 7, /**< Distributor2 Intermediate Certificate*/
98         PACKAGE_INFO_DISTRIBUTOR2_SIGNER_CERT = 8,       /**< Distributor2 Signer Certificate*/
99 } package_cert_type_e;
100
101 /**
102  * @brief Enumeration for package update info type.
103  * @since_tizen 4.0
104  */
105 typedef enum {
106         PACKAGE_UPDATEINFO_TYPE_NONE = 0,   /**< None type */
107         PACKAGE_UPDATEINFO_TYPE_FORCE,      /**< Force type */
108         PACKAGE_UPDATEINFO_TYPE_OPTIONAL    /**< Optional type */
109 } package_updateinfo_type_e;
110
111 /**
112  * @brief Called for each update information of all packages.
113  * @since_tizen 4.0
114  * @remarks @a info should not be freed and can be used only in the callback.
115  * @param[in] info       The package update information handle
116  * @param[in] user_data  The user data passed from the foreach function
117  * @return @c true to continue with the next iteration of the loop,
118  *         otherwise @c false to break out of the loop
119  * @pre package_info_updateinfo_foreach_updateinfo() will invoke this callback.
120  * @see package_info_updateinfo_foreach_updateinfo()
121  */
122 typedef bool (*package_info_updateinfo_cb) (package_updateinfo_h info, void *user_data);
123
124 /**
125  * @brief Called to get the application ID once for each installed package.
126  * @since_tizen 2.3
127  * @param[in] comp_type The application component type
128  * @param[in] app_id    The application ID.
129  * @param[in] user_data The user data passed from the foreach function
130  * @return @c true to continue with the next iteration of the loop,
131  *         otherwise @c false to break out of the loop
132  * @pre package_info_foreach_app_from_package() will invoke this callback.
133  * @see package_info_foreach_app_from_package()
134  */
135 typedef bool (*package_info_app_cb) (package_info_app_component_type_e comp_type, const char *app_id, void *user_data);
136
137
138 /**
139  * @brief Called to get the certification information.
140  * @since_tizen 2.3
141  * @param[in] handle       The package info handle
142  * @param[in] cert_type    The certificate type
143  * @param[in] cert_value   The certificate value of corresponding certificate key \n
144  *                         This value is base64 encoded data.
145  * @param[in] user_data    The user data passed from the foreach function
146  * @return @c true to continue with the next iteration of the loop,
147  *         otherwise @c false to break out of the loop
148  * @pre package_info_foreach_cert_info() will invoke this callback.
149  * @see package_info_foreach_cert_info()
150  */
151 typedef bool (*package_info_cert_info_cb) (package_info_h handle, package_cert_type_e cert_type, const char *cert_value, void *user_data);
152
153
154 /**
155  * @brief Called to get the privilege information.
156  * @since_tizen 2.3
157  * @param[in] privilege_name the name of the privilege
158  * @param[in] user_data    The user data passed from the foreach function
159  * @return  @c true to continue with the next iteration of the loop,
160  *          otherwise @c false to break out of the loop
161  * @pre package_info_foreach_privilege_info() will invoke this callback.
162  * @see package_info_foreach_privilege_info()
163  */
164 typedef bool (*package_info_privilege_info_cb) (const char *privilege_name, void *user_data);
165
166
167 /**
168  * @brief Called when dependency information between packages is retrieved.
169  * @since_tizen 5.5
170  * @remarks @a from, @a to, @a type and @a required_version are managed by the platform and will be released after the callback exits.
171  * @param[in] from             The ID of package that depends on another
172  * @param[in] to               The ID of package that is required by another
173  * @param[in] type             The type of dependency
174  * @param[in] required_version The required version
175  * @param[in] user_data        The user data passed from the foreach function
176  * @return  @c true to continue with the next iteration of the loop,
177  *          otherwise @c false to break out of the loop
178  * @pre package_info_foreach_dependency_info() will invoke this callback.
179  * @pre package_info_foreach_dependency_info_depends_on() will invoke this callback.
180  * @see package_info_foreach_dependency_info()
181  * @see package_info_foreach_dependency_info_depends_on()
182  */
183 typedef bool (*package_info_dependency_info_cb) (const char *from, const char *to, const char *type, const char *required_version, void *user_data);
184
185
186 /**
187  * @brief Retrieves all application IDs of each package.
188  * @since_tizen 2.3
189  * @param[in] package_info  The package info handle
190  * @param[in] comp_type     The application component type
191  * @param[in] callback      The callback function to invoke
192  * @param[in] user_data     The user data to be passed to the callback function
193  * @return @c 0 on success,
194  *         otherwise a negative error value
195  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
196  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
197  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
198  * @post This function invokes package_info_app_cb() repeatedly for each package.
199  * @see package_info_app_cb()
200  */
201 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);
202
203
204 /**
205  * @brief Destroys the package information handle and releases all its resources.
206  * @since_tizen 2.3
207  * @param[in] package_info The package information handle
208  * @return @c 0 on success,
209  *         otherwise a negative error value
210  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
211  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
212  * @see package_manager_foreach_package_info()
213  * @see package_manager_get_package_info()
214  */
215 int package_info_destroy(package_info_h package_info);
216
217
218 /**
219  * @brief Gets the package name.
220  * @since_tizen 2.3
221  * @remarks You must release @a package using free().
222  * @param[in]  package_info The package information
223  * @param[out] package      The package name
224  * @return @c 0 on success,
225  *         otherwise a negative error value
226  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
227  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
228  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
229  */
230 int package_info_get_package(package_info_h package_info, char **package);
231
232
233 /**
234  * @brief Gets the main application ID of the package.
235  * @since_tizen 4.0
236  * @remarks You must release @a main_app_id using free().
237  * @param[in]  package_info     The package information
238  * @param[out] main_app_id      The main application ID of the package
239  * @return @c 0 on success,
240  *         otherwise a negative error value
241  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
242  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
243  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
244  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
245  */
246 int package_info_get_main_app_id(package_info_h package_info, char **main_app_id);
247
248
249 /**
250  * @brief Gets the label of the package.
251  * @since_tizen 2.3
252  * @remarks You must release @a label using free().
253  * @param[in]  package_info The package information
254  * @param[out] label        The label of the package
255  * @return @c 0 on success,
256  *         otherwise a negative error value
257  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
258  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
259  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
260  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
261  */
262 int package_info_get_label(package_info_h package_info, char **label);
263
264
265 /**
266  * @brief Gets the absolute path to the icon image.
267  * @since_tizen 2.3
268  * @remarks You must release @a path using free().
269  * @param[in]  package_info The package information
270  * @param[out] path         The path of the package
271  * @return @c 0 on success,
272  *         otherwise a negative error value
273  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
274  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
275  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
276  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
277  */
278 int package_info_get_icon(package_info_h package_info, char **path);
279
280
281 /**
282  * @brief Gets the version of the package.
283  * @since_tizen 2.3
284  * @remarks You must release @a version using free().
285  * @param[in]  package_info The package information
286  * @param[out] version      The version of the package
287  * @return @c 0 on success,
288  *         otherwise a negative error value
289  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
290  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
291  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
292  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
293  */
294 int package_info_get_version(package_info_h package_info, char **version);
295
296
297 /**
298  * @brief Gets the type of the package.
299  * @since_tizen 2.3
300  * @remarks You must release @a type using free().
301  * @param[in]  package_info The package information
302  * @param[out] type         The type of the package
303  * @return @c 0 on success,
304  *         otherwise a negative error value
305  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
306  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
307  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
308  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
309  */
310 int package_info_get_type(package_info_h package_info, char **type);
311
312
313 /**
314  * @brief Gets the installed storage for the given package.
315  * @since_tizen 2.3
316  * @param[in]  package_info The package information
317  * @param[out] storage      The installed storage
318  * @return @c 0 on success,
319  *         otherwise a negative error value
320  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
321  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
322  */
323 int package_info_get_installed_storage(package_info_h package_info, package_info_installed_storage_type_e *storage);
324
325
326 /**
327  * @brief Gets the root path of the package.
328  * @since_tizen 2.3
329  * @remarks You must release @a path using free().
330  * @param[in]  package_info The package information
331  * @param[out] path         The root path of the package
332  * @return @c 0 on success,
333  *         otherwise a negative error value
334  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
335  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
336  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
337  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
338  */
339 int package_info_get_root_path(package_info_h package_info, char **path);
340
341
342 /**
343  * @platform
344  * @brief Gets the name of the TEP (Tizen Expansion Package).
345  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
346  * @privlevel platform
347  * @privilege %http://tizen.org/privilege/packagemanager.admin
348  * @remarks Name must be released using free().
349  * @param[in] package_info The package information
350  * @param[out] name The name of the tep
351  * @return 0 on success,
352  *         otherwise a negative error value
353  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
354  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
355  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
356  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR           Severe system error
357  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
358  */
359 int package_info_get_tep_name(package_info_h package_info, char **name);
360
361
362 /**
363  * @brief Checks whether the package is system package.
364  * @since_tizen 2.3
365  * @param[in]  package_info The package information
366  * @param[out] system       @c true if the package is system package,
367  *                          otherwise @c false if the package is not system package
368  * @return @c 0 on success,
369  *         otherwise a negative error value
370  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
371  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
372  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
373  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
374  */
375 int package_info_is_system_package(package_info_h package_info, bool *system);
376
377
378 /**
379  * @brief Checks whether the package is removable.
380  * @since_tizen 2.3
381  * @param[in]  package_info The package information
382  * @param[out] removable    The removable info of the package
383  * @return @c 0 on success,
384  *         otherwise a negative error value
385  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
386  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
387  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
388  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR IO error
389  */
390 int package_info_is_removable_package(package_info_h package_info, bool *removable);
391
392
393 /**
394  * @brief Checks whether the package is preloaded.
395  * @since_tizen 2.3
396  * @param[in]  package_info The package information
397  * @param[out] preload      The preload info of the package
398  * @return @c 0 on success,
399  *         otherwise a negative error value
400  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
401  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
402  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
403  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
404  */
405 int package_info_is_preload_package(package_info_h package_info, bool *preload);
406
407
408 /**
409  * @brief Checks whether two package information is equal.
410  * @since_tizen 2.3
411  * @param[in]  lhs    The first package information to be compared
412  * @param[in]  rhs    The second package information to be compared
413  * @param[out] equal  @c true if the package information are equal,
414  *                    otherwise @c false if package information are not equal
415  * @return @c 0 on success,
416  *         otherwise a negative error value
417  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
418  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
419  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
420  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Database error occurred
421  */
422 int package_info_is_equal(package_info_h lhs, package_info_h rhs, bool *equal);
423
424
425 /**
426  * @brief Checks whether the package info is accessible for the given package.
427  * @since_tizen 2.3
428  * @param[in]  package_info The package information
429  * @param[out] accessible   @c true if the package info is accessible,
430  *                          otherwise @c false if the package info is not accessible
431  * @return @c 0 on success,
432  *         otherwise a negative error value
433  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
434  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
435  */
436 int package_info_is_accessible(package_info_h package_info, bool *accessible);
437
438 /**
439  * @brief Gets the installed time for the given package.
440  * @details If the package was updated, the @a installed_time represents updated time.
441  *          So, the meaning of 'installed time' corresponds with 'last modified time'.
442  * @since_tizen 4.0
443  * @param[in]  package_info   The package information
444  * @param[out] installed_time The integer value of time_t type for installed time
445  * @return @c 0 on success,
446  *         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_IO_ERROR          Database error occurred
450  */
451 int package_info_get_installed_time(package_info_h package_info, int *installed_time);
452
453 /**
454  * @brief Clones the package information handle.
455  * @since_tizen 2.3
456  * @param[out] clone          The newly created package information handle
457  * @param[in]  package_info   The package information
458  * @return @c 0 on success,
459  *         otherwise a negative error value
460  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
461  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
462  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   The package is not installed
463  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
464  */
465 int package_info_clone(package_info_h *clone, package_info_h package_info);
466
467 /**
468  * @brief Gets the package information for the given package.
469  * @since_tizen 2.3
470  * @remarks You must release @a package_info using package_info_destroy().
471  * @param[in]  package      The ID of the package
472  * @param[out] package_info The package information for the given package ID
473  * @return @c 0 on success,
474  *         otherwise a negative error value
475  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
476  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
477  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   The package is not installed
478  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
479  */
480 int package_info_create(const char *package, package_info_h *package_info);
481
482
483 /**
484  * @brief Retrieves certification information of the package.
485  * @since_tizen 2.3
486  * @param[in] package_info The package information
487  * @param[in] callback     The iteration callback function
488  * @param[in] user_data    The user data to be passed to the callback function
489  * @return @c 0 on success,
490  *         otherwise a negative error value
491  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
492  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
493  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
494  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
495  */
496 int package_info_foreach_cert_info(package_info_h package_info, package_info_cert_info_cb callback, void *user_data);
497
498
499 /**
500  * @brief Retrieves privilege information of the package.
501  * @since_tizen 2.3
502  * @param[in] package_info The package information
503  * @param[in] callback     The iteration callback function
504  * @param[in] user_data    The user data to be passed to the callback function
505  * @return @c 0 on success,
506  *         otherwise a negative error value
507  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
508  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
509  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
510  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
511  */
512 int package_info_foreach_privilege_info(package_info_h package_info, package_info_privilege_info_cb callback, void *user_data);
513
514 /**
515  * @brief Retrieves dependencies between packages.
516  * @details @a package_info_dependency_info_cb is called whenever there is package dependency. The callback includes packages that are only directly required by the given package.
517  *          For example, if there are packages having the following relationship:
518  *
519  *                B --> E
520  *          A --> B --> C
521  *                D --> C
522  *
523  *          A --> B means that A depends on B.
524  *          When package_info_foreach_dependency_info(A) is called, the callback results in two parameters: @a from is A and @a to is B.
525  * @since_tizen 5.5
526  * @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.
527  * @param[in] package_info The package information
528  * @param[in] callback     The iteration callback function
529  * @param[in] user_data    The user data to be passed to the callback function
530  * @return @c 0 on success,
531  *         otherwise a negative error value
532  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
533  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
534  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
535  */
536 int package_info_foreach_dependency_info(package_info_h package_info, package_info_dependency_info_cb callback, void *user_data);
537
538 /**
539  * @brief Retrieves which packages depend on the given package.
540  * @details @a package_info_dependency_info_cb is called whenever there is package dependency. The callback includes packages that are both directly and indirectly depend on the given package.
541  *          For example, if there are packages having the following relationship:
542  *
543  *                B --> E
544  *          A --> B --> C
545  *                D --> C
546  *
547  *          A --> B means that A depends on B.
548  *          When package_info_foreach_dependency_info(C) is called, the callback results in two parameters: @a from is B and @a to is C, @a from is D and @a to is C, @a from is A and @a to is B.
549  * @since_tizen 5.5
550  * @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.
551  * @param[in] package_info The package information
552  * @param[in] callback     The iteration callback function
553  * @param[in] user_data    The user data to be passed to the callback function
554  * @return @c 0 on success,
555  *         otherwise a negative error value
556  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
557  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
558  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
559  */
560 int package_info_foreach_dependency_info_depends_on(package_info_h package_info, package_info_dependency_info_cb callback, void *user_data);
561
562 /**
563  * @brief Gets the package update information for the given package.
564  * @since_tizen 4.0
565  * @remarks You must release @a info using package_info_updateinfo_destroy().
566  * @param[in]  pkgid       The ID of the package
567  * @param[out] info        The package update information for the given package ID
568  * @return @c 0 on success,
569  *         otherwise a negative error value
570  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
571  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
572  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   The package is not installed
573  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
574  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Database error occurred
575  * @see package_info_updateinfo_destroy()
576  */
577 int package_info_updateinfo_create(const char *pkgid, package_updateinfo_h *info);
578
579 /**
580  * @brief Gets the package name.
581  * @since_tizen 4.0
582  * @remarks You must release @a package using free().
583  * @param[in]  info        The package update information
584  * @param[out] package     The package name
585  * @return @c 0 on success,
586  *         otherwise a negative error value
587  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
588  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
589  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
590  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Internal I/O error occurred
591  */
592 int package_info_updateinfo_get_pkgid(package_updateinfo_h info, char **package);
593
594 /**
595  * @brief Gets the update version of package.
596  * @since_tizen 4.0
597  * @remarks You must release @a version using free().
598  * @param[in]  info        The package update information
599  * @param[out] version     The package update version
600  * @return @c 0 on success,
601  *         otherwise a negative error value
602  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
603  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
604  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
605  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Internal I/O error occurred
606  */
607 int package_info_updateinfo_get_version(package_updateinfo_h info, char **version);
608
609 /**
610  * @brief Gets the update type of package.
611  * @since_tizen 4.0
612  * @param[in]  info        The package update information
613  * @param[out] type        The package update type
614  * @return @c 0 on success,
615  *         otherwise a negative error value
616  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
617  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
618  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Internal I/O error occurred
619  */
620 int package_info_updateinfo_get_type(package_updateinfo_h info,
621                                                 package_updateinfo_type_e *type);
622
623 /**
624  * @brief Destroys the package update information handle and releases all its resources.
625  * @since_tizen 4.0
626  * @param[in] info         The package update information handle
627  * @return @c 0 on success,
628  *         otherwise a negative error value
629  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
630  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
631  * @see package_info_updateinfo_create()
632  */
633 int package_info_updateinfo_destroy(package_updateinfo_h info);
634
635 /**
636  * @brief Retrieves update information of all packages and invoke callback for each of it.
637  * @since_tizen 4.0
638  * @param[in] callback     The iteration callback function
639  * @param[in] user_data    The user data to be passed to the callback function
640  * @return @c 0 on success,
641  *         otherwise a negative error value
642  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
643  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
644  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
645  */
646 int package_info_updateinfo_foreach_info(package_info_updateinfo_cb callback, void *user_data);
647
648
649 /**
650 * @}
651 */
652
653 #ifdef __cplusplus
654 }
655 #endif
656
657 #endif /* __TIZEN_APPFW_PACKAGE_INFO_H */