Print error log when check_privilege() failed
[platform/core/api/package-manager.git] / include / package_info.h
index 140fe1b..9305e02 100644 (file)
@@ -47,6 +47,13 @@ typedef struct package_info_s *package_info_h;
 typedef struct package_updateinfo_s *package_updateinfo_h;
 
 /**
+ * @brief The required privilege handle.
+ * @since_tizen 6.5
+ * @see package_info_foreach_required_privilege()
+ */
+typedef struct allowed_package_required_privilege_s *allowed_package_required_privilege_h;
+
+/**
  * @brief Enumeration for storage type.
  * @since_tizen 2.3
  */
@@ -63,15 +70,15 @@ typedef enum {
  */
 typedef enum {
        PACKAGE_INFO_ALLAPP = 0,                                /**< All applications
-          (Deprecated since 5.5, use PACKAGE_INFO_APP_COMPONENT_TYPE_ALL instead) */
+          (Deprecated since 5.5, use #PACKAGE_INFO_APP_COMPONENT_TYPE_ALL instead) */
        PACKAGE_INFO_UIAPP = 1,                                 /**< UI application
-          (Deprecated since 5.5, use PACKAGE_INFO_APP_COMPONENT_TYPE_UI instead) */
+          (Deprecated since 5.5, use #PACKAGE_INFO_APP_COMPONENT_TYPE_UI instead) */
        PACKAGE_INFO_SERVICEAPP = 2,                            /**< Service application
-          (Deprecated since 5.5, use PACKAGE_INFO_APP_COMPONENT_TYPE_SERVICE instead) */
+          (Deprecated since 5.5, use #PACKAGE_INFO_APP_COMPONENT_TYPE_SERVICE instead) */
        PACKAGE_INFO_WIDGETAPP = 3,                             /**< Widget application (Since 4.0)
-          (Deprecated since 5.5, use PACKAGE_INFO_APP_COMPONENT_TYPE_WIDGET instead) */
+          (Deprecated since 5.5, use #PACKAGE_INFO_APP_COMPONENT_TYPE_WIDGET instead) */
        PACKAGE_INFO_WATCHAPP = 4,                              /**< Watch application (Since 4.0)
-          (Deprecated since 5.5, use PACKAGE_INFO_APP_COMPONENT_TYPE_WATCH instead) */
+          (Deprecated since 5.5, use #PACKAGE_INFO_APP_COMPONENT_TYPE_WATCH instead) */
 
        PACKAGE_INFO_APP_COMPONENT_TYPE_ALL = 0,                /**< All applications (Since 5.5) */
        PACKAGE_INFO_APP_COMPONENT_TYPE_UI = 1,                 /**< UI application (Since 5.5) */
@@ -184,6 +191,21 @@ typedef bool (*package_info_dependency_info_cb) (const char *from, const char *t
 
 
 /**
+ * @brief Called to get the allowed package information of resource package.
+ * @since_tizen 6.5
+ * @remarks @a allowed_package, @a privilege_handle are managed by the platform and will be released after the callback exits.
+ * @param[in] allowed_package  The ID of allowed package
+ * @param[in] privilege_handle The privilege handle required by resource package
+ * @param[in] user_data        The user data passed from the foreach function
+ * @return  @c true to continue with the next iteration of the loop,
+ *          otherwise @c false to break out of the loop
+ * @pre package_info_foreach_res_allowed_package() will invoke this callback.
+ * @see package_info_foreach_res_allowed_package()
+ */
+typedef bool (*package_info_res_allowed_package_cb) (const char *allowed_package, allowed_package_required_privilege_h privilege_handle, void *user_data);
+
+
+/**
  * @brief Retrieves all application IDs of each package.
  * @since_tizen 2.3
  * @param[in] package_info  The package info handle
@@ -351,15 +373,47 @@ int package_info_get_root_path(package_info_h package_info, char **path);
  * @return 0 on success,
  *         otherwise a negative error value
  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
+ * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR          Severe system error
- * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
  */
 int package_info_get_tep_name(package_info_h package_info, char **name);
 
 
 /**
+ * @brief Gets the resource type of the package.
+ * @since_tizen 6.5
+ * @remarks You must release @a res_type using free().
+ * @param[in]  package_info The package information
+ * @param[out] res_type     The resource type of the package
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
+ * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
+ */
+int package_info_get_res_type(package_info_h package_info, char **res_type);
+
+
+/**
+ * @brief Gets the resource version of the package.
+ * @since_tizen 6.5
+ * @remarks You must release @a res_version using free().
+ * @param[in]  package_info The package information
+ * @param[out] res_version  The resource version of the package
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
+ * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
+ */
+int package_info_get_res_version(package_info_h package_info, char **res_version);
+
+
+/**
  * @brief Checks whether the package is system package.
  * @since_tizen 2.3
  * @param[in]  package_info The package information
@@ -453,6 +507,7 @@ int package_info_get_installed_time(package_info_h package_info, int *installed_
 /**
  * @brief Clones the package information handle.
  * @since_tizen 2.3
+ * @remarks The @a clone should be released using package_info_destroy().
  * @param[out] clone          The newly created package information handle
  * @param[in]  package_info   The package information
  * @return @c 0 on success,
@@ -513,7 +568,7 @@ int package_info_foreach_privilege_info(package_info_h package_info, package_inf
 
 /**
  * @brief Retrieves dependencies between packages.
- * @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.
+ * @details @a callback is called whenever there is package dependency. The callback includes packages that are only directly required by the given package.
  *          For example, if there are packages having the following relationship:
  *
  *                B --> E
@@ -521,7 +576,7 @@ int package_info_foreach_privilege_info(package_info_h package_info, package_inf
  *                D --> C
  *
  *          A --> B means that A depends on B.
- *          When package_info_foreach_dependency_info(A) is called, the callback results in two parameters: @a from is A and @a to is B.
+ *          When package_info_foreach_dependency_info(A) is called, the callback results in two parameters: @b from is A and @b to is B.
  * @since_tizen 5.5
  * @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.
  * @param[in] package_info The package information
@@ -537,7 +592,7 @@ int package_info_foreach_dependency_info(package_info_h package_info, package_in
 
 /**
  * @brief Retrieves which packages depend on the given package.
- * @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.
+ * @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.
  *          For example, if there are packages having the following relationship:
  *
  *                B --> E
@@ -545,7 +600,7 @@ int package_info_foreach_dependency_info(package_info_h package_info, package_in
  *                D --> C
  *
  *          A --> B means that A depends on B.
- *          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.
+ *          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.
  * @since_tizen 5.5
  * @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.
  * @param[in] package_info The package information
@@ -559,6 +614,40 @@ int package_info_foreach_dependency_info(package_info_h package_info, package_in
  */
 int package_info_foreach_dependency_info_depends_on(package_info_h package_info, package_info_dependency_info_cb callback, void *user_data);
 
+
+/**
+ * @brief Retrieves allowed package information of the resource package.
+ * @details Resource packages allow access to allowed data only for allowed packages that have specific privileges.
+ *          If not, they just allow access to global data
+ * @since_tizen 6.5
+ * @param[in] package_info The package information
+ * @param[in] callback     The iteration callback function
+ * @param[in] user_data    The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
+ * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
+ * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR      Severe system error
+ */
+int package_info_foreach_res_allowed_package(package_info_h package_info, package_info_res_allowed_package_cb callback, void *user_data);
+
+
+/**
+ * @brief Retrieves required privilege information of the allowed package.
+ * @details The packages want to access in the allowed area of resource package must have all the privileges required by resource package.
+ * @since_tizen 6.5
+ * @param[in] priv_info    The privilege information handle
+ * @param[in] callback     The iteration callback function
+ * @param[in] user_data    The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
+ * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int package_info_foreach_required_privilege(allowed_package_required_privilege_h priv_info, package_info_privilege_info_cb callback, void *user_data);
+
+
 /**
  * @brief Gets the package update information for the given package.
  * @since_tizen 4.0