Fix passing wrong event_type when error signal received
[platform/core/api/package-manager.git] / include / package_info.h
index ea2fdb1..414ff5e 100644 (file)
@@ -40,6 +40,11 @@ extern "C" {
  */
 typedef struct package_info_s *package_info_h;
 
+/**
+ * @brief The package update information handle.
+ * @since_tizen 4.0
+ */
+typedef struct package_updateinfo_s *package_updateinfo_h;
 
 /**
  * @brief Enumeration for storage type.
@@ -48,6 +53,7 @@ typedef struct package_info_s *package_info_h;
 typedef enum {
        PACKAGE_INFO_INTERNAL_STORAGE = 0,    /**< Internal storage */
        PACKAGE_INFO_EXTERNAL_STORAGE = 1,    /**< External storage */
+       PACKAGE_INFO_EXTENDED_STORAGE = 2,    /**< Extended storage (Since 5.0) */
 } package_info_installed_storage_type_e;
 
 
@@ -59,6 +65,8 @@ typedef enum {
        PACKAGE_INFO_ALLAPP = 0,        /**< All application */
        PACKAGE_INFO_UIAPP = 1,         /**< UI application */
        PACKAGE_INFO_SERVICEAPP = 2,    /**< Service application */
+       PACKAGE_INFO_WIDGETAPP = 3,     /**< Widget application (Since 4.0) */
+       PACKAGE_INFO_WATCHAPP = 4,      /**< Watch application (Since 4.0) */
 } package_info_app_component_type_e;
 
 
@@ -78,12 +86,34 @@ typedef enum {
        PACKAGE_INFO_DISTRIBUTOR2_SIGNER_CERT = 8,       /**< Distributor2 Signer Certificate*/
 } package_cert_type_e;
 
+/**
+ * @brief Enumeration for package update info type.
+ * @since_tizen 4.0
+ */
+typedef enum {
+       PACKAGE_UPDATEINFO_TYPE_NONE = 0,   /**< None type */
+       PACKAGE_UPDATEINFO_TYPE_FORCE,      /**< Force type */
+       PACKAGE_UPDATEINFO_TYPE_OPTIONAL    /**< Optional type */
+} package_updateinfo_type_e;
+
+/**
+ * @brief Called for each update information of all packages.
+ * @since_tizen 4.0
+ * @remarks @a info should not be freed and can be used only in the callback.
+ * @param[in] info       The package update information handle
+ * @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_updateinfo_foreach_updateinfo() will invoke this callback.
+ * @see package_info_updateinfo_foreach_updateinfo()
+ */
+typedef bool (*package_info_updateinfo_cb) (package_updateinfo_h info, void *user_data);
 
 /**
  * @brief Called to get the application ID once for each installed package.
  * @since_tizen 2.3
- * @param[in] comp_type The Application Component type
- * @param[in] callback  The callback function to be invoked
+ * @param[in] comp_type The application component type
+ * @param[in] app_id    The application ID.
  * @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
@@ -96,7 +126,7 @@ typedef bool (*package_info_app_cb) (package_info_app_component_type_e comp_type
 /**
  * @brief Called to get the certification information.
  * @since_tizen 2.3
- * @param[in] package_info The package info handle
+ * @param[in] handle       The package info handle
  * @param[in] cert_type    The certificate type
  * @param[in] cert_value   The certificate value of corresponding certificate key \n
  *                         This value is base64 encoded data.
@@ -123,6 +153,25 @@ typedef bool (*package_info_privilege_info_cb) (const char *privilege_name, void
 
 
 /**
+ * @brief Called to provide dependency information.
+ * @since_tizen 5.5
+ * @remarks @a from, @a to, @a type and @a required_version are managed by the platform and will be released after the callback exits.
+ * @param[in] from             The ID of package which depends other package
+ * @param[in] to               The ID of package which depended by other package
+ * @param[in] type             The type of dependency
+ * @param[in] required_version The required version
+ * @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_dependency_info() will invoke this callback.
+ * @pre package_info_foreach_dependency_info_depends_on() will invoke this callback.
+ * @see package_info_foreach_dependency_info()
+ * @see package_info_foreach_dependency_info_depends_on()
+ */
+typedef bool (*package_info_dependency_info_cb) (const char *from, const char *to, const char *type, const char *required_version, void *user_data);
+
+
+/**
  * @brief Retrieves all application IDs of each package.
  * @since_tizen 2.3
  * @param[in] package_info  The package info handle
@@ -170,6 +219,22 @@ int package_info_get_package(package_info_h package_info, char **package);
 
 
 /**
+ * @brief Gets the main application ID of the package.
+ * @since_tizen 4.0
+ * @remarks You must release @a main_app_id using free().
+ * @param[in]  package_info     The package information
+ * @param[out] main_app_id      The main application ID 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_main_app_id(package_info_h package_info, char **main_app_id);
+
+
+/**
  * @brief Gets the label of the package.
  * @since_tizen 2.3
  * @remarks You must release @a label using free().
@@ -264,7 +329,7 @@ int package_info_get_root_path(package_info_h package_info, char **path);
 
 /**
  * @platform
- * @brief Gets the name of the TEP(Tizen Expansion Package).
+ * @brief Gets the name of the TEP (Tizen Expansion Package).
  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
  * @privlevel platform
  * @privilege %http://tizen.org/privilege/packagemanager.admin
@@ -388,7 +453,7 @@ int package_info_get_installed_time(package_info_h package_info, int *installed_
 int package_info_clone(package_info_h *clone, package_info_h package_info);
 
 /**
- * @brief Gets the package information for the given package
+ * @brief Gets the package information for the given package.
  * @since_tizen 2.3
  * @remarks You must release @a package_info using package_info_destroy().
  * @param[in]  package      The ID of the package
@@ -434,6 +499,140 @@ int package_info_foreach_cert_info(package_info_h package_info, package_info_cer
  */
 int package_info_foreach_privilege_info(package_info_h package_info, package_info_privilege_info_cb callback, void *user_data);
 
+/**
+ * @brief Retrieves dependency information of the package.
+ * @details The results include packages that are only directly required by a given package.
+ *          For example, if we have:
+ *
+ *                B --> E
+ *          A --> B --> C
+ *                D --> C
+ *
+ *          where A --> B means that A depends on B, and package_info_foreach_dependency_info(A) is called,
+ *          the results will be: {from A to 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
+ * @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_SYSTEM_ERROR      Severe system error
+ */
+int package_info_foreach_dependency_info(package_info_h package_info, package_info_dependency_info_cb callback, void *user_data);
+
+/**
+ * @brief Retrieves information about which packages depend on a given package.
+ * @details The results include packages that both directly and indirectly depend on a given package.
+ *          For example, if we have:
+ *
+ *                B --> E
+ *          A --> B --> C
+ *                D --> C
+ *
+ *          where A --> B means that A depends on B, and package_info_foreach_dependency_info_depends_on(C) is called,
+ *          the results will be: {from B to C}, {from D to C}, {from A to 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
+ * @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_SYSTEM_ERROR      Severe system error
+ */
+int package_info_foreach_dependency_info_depends_on(package_info_h package_info, package_info_dependency_info_cb callback, void *user_data);
+
+/**
+ * @brief Gets the package update information for the given package.
+ * @since_tizen 4.0
+ * @remarks You must release @a info using package_info_updateinfo_destroy().
+ * @param[in]  pkgid       The ID of the package
+ * @param[out] info        The package update information for the given package ID
+ * @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_NO_SUCH_PACKAGE   The package is not installed
+ * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
+ * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Database error occurred
+ * @see package_info_updateinfo_destroy()
+ */
+int package_info_updateinfo_create(const char *pkgid, package_updateinfo_h *info);
+
+/**
+ * @brief Gets the package name.
+ * @since_tizen 4.0
+ * @remarks You must release @a package using free().
+ * @param[in]  info        The package update information
+ * @param[out] package     The package name
+ * @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          Internal I/O error occurred
+ */
+int package_info_updateinfo_get_pkgid(package_updateinfo_h info, char **package);
+
+/**
+ * @brief Gets the update version of package.
+ * @since_tizen 4.0
+ * @remarks You must release @a version using free().
+ * @param[in]  info        The package update information
+ * @param[out] version     The package update version
+ * @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          Internal I/O error occurred
+ */
+int package_info_updateinfo_get_version(package_updateinfo_h info, char **version);
+
+/**
+ * @brief Gets the update type of package.
+ * @since_tizen 4.0
+ * @param[in]  info        The package update information
+ * @param[out] type        The package update type
+ * @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          Internal I/O error occurred
+ */
+int package_info_updateinfo_get_type(package_updateinfo_h info,
+                                               package_updateinfo_type_e *type);
+
+/**
+ * @brief Destroys the package update information handle and releases all its resources.
+ * @since_tizen 4.0
+ * @param[in] info         The package update information handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
+ * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see package_info_updateinfo_create()
+ */
+int package_info_updateinfo_destroy(package_updateinfo_h info);
+
+/**
+ * @brief Retrieves update information of all packages and invoke callback for each of it.
+ * @since_tizen 4.0
+ * @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
+ */
+int package_info_updateinfo_foreach_info(package_info_updateinfo_cb callback, void *user_data);
+
 
 /**
 * @}