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