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