Merge "Adding Mime types parsing" into tizen_2.1
[platform/core/appfw/pkgmgr-info.git] / parser / pkgmgr_parser.h
index 39ea33d..401e32c 100755 (executable)
@@ -107,13 +107,39 @@ extern "C" {
  * @brief Convinience Macro to get list head
  */
 #define LISTHEAD(list, node)                                   \
-    for ((node) = (list); (node)->prev; (node) = (node)->prev);
+    for ((node) = (list); (node)->prev; (node) = (node)->prev)
 
  /**
  * @brief Convinience Macro to get list tail
  */
 #define LISTTAIL(list, node)                                   \
-    for ((node) = (list); (node)->next; (node) = (node)->next);
+    for ((node) = (list); (node)->next; (node) = (node)->next)
+
+typedef struct metadata_x {
+       const char *key;
+       const char *value;
+       struct metadata_x *prev;
+       struct metadata_x *next;
+} metadata_x;
+
+typedef struct privilege_x {
+       const char *text;
+       struct privilege_x *prev;
+       struct privilege_x *next;
+} privilege_x;
+
+typedef struct privileges_x {
+       struct privilege_x *privilege;
+       struct privileges_x *prev;
+       struct privileges_x *next;
+} privileges_x;
+
+typedef struct permission_x {
+       const char *type;
+       const char *value;
+       struct permission_x *prev;
+       struct permission_x *next;
+} permission_x;
 
 typedef struct icon_x {
        const char *name;
@@ -126,6 +152,15 @@ typedef struct icon_x {
        struct icon_x *next;
 } icon_x;
 
+typedef struct image_x {
+       const char *name;
+       const char *text;
+       const char *lang;
+       const char *section;
+       struct image_x *prev;
+       struct image_x *next;
+} image_x;
+
 typedef struct allowed_x {
        const char *name;
        const char *text;
@@ -324,6 +359,7 @@ typedef struct uiapplication_x {
        const char *nodisplay;
        const char *multiple;
        const char *taskmanage;
+       const char *enabled;
        const char *type;
        const char *categories;
        const char *extraid;
@@ -331,11 +367,21 @@ typedef struct uiapplication_x {
        const char *mainapp;
        const char *package;
        const char *recentimage;
+       const char *launchcondition;
+       const char *indicatordisplay;
+       const char *portraitimg;
+       const char *landscapeimg;
+       const char *guestmode_visibility;
+       const char *app_component;
+       const char *permission_type;
        struct label_x *label;
        struct icon_x *icon;
+       struct image_x *image;
        struct appsvc_x *appsvc;
        struct appcontrol_x *appcontrol;
        struct category_x *category;
+       struct metadata_x *metadata;
+       struct permission_x *permission;
        struct launchconditions_x *launchconditions;
        struct notification_x *notification;
        struct datashare_x *datashare;
@@ -348,13 +394,17 @@ typedef struct serviceapplication_x {
        const char *exec;
        const char *onboot;
        const char *autorestart;
+       const char *enabled;
        const char *type;
        const char *package;
+       const char *permission_type;
        struct label_x *label;
        struct icon_x *icon;
        struct appsvc_x *appsvc;
        struct appcontrol_x *appcontrol;
        struct category_x *category;
+       struct metadata_x *metadata;
+       struct permission_x *permission;
        struct datacontrol_x *datacontrol;
        struct launchconditions_x *launchconditions;
        struct notification_x *notification;
@@ -399,17 +449,23 @@ typedef struct manifest_x {
        const char *removable;          /**< package removable flag*/
        const char *preload;            /**< package preload flag*/
        const char *readonly;           /**< package readonly flag*/
+       const char *update;                     /**< package update flag*/
+       const char *appsetting;         /**< package app setting flag*/
        const char *type;               /**< package type*/
        const char *package_size;               /**< package size for external installation*/
        const char *installed_time;             /**< installed time after finishing of installation*/
+       const char *installed_storage;          /**< package currently installed storage*/
        const char *storeclient_id;             /**< id of store client for installed package*/
        const char *mainapp_id;         /**< app id of main application*/
        const char *package_url;                /**< app id of main application*/
+       const char *root_path;          /**< package root path*/
+       const char *nodisplay_setting;          /**< package no display setting menu*/
        struct icon_x *icon;            /**< package icon*/
        struct label_x *label;          /**< package label*/
        struct author_x *author;                /**< package author*/
        struct description_x *description;              /**< package description*/
        struct license_x *license;              /**< package license*/
+       struct privileges_x *privileges;        /**< package privileges*/
        struct uiapplication_x *uiapplication;          /**< package's ui application*/
        struct serviceapplication_x *serviceapplication;                /**< package's service application*/
        struct daemon_x *daemon;                /**< package daemon*/
@@ -608,6 +664,32 @@ static int parse_manifest_file(const char *manifest)
  */
 manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest);
 
+/**
+ * @fn manifest_x *pkgmgr_parser_get_manifest_info(const char *pkigid)
+ * @brief      This API gets the manifest info from DB and stores all the data in the manifest structure.
+ *
+ * @par                This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in]  pkgid   package id for package
+ * @return     manifest pointer on success, NULL on failure
+ * @pre                None
+ * @post               pkgmgr_parser_free_manifest_xml()
+ * @code
+static int get_manifest_info(const char *pkgid)
+{
+       manifest_x *mfx = NULL
+       mfx = pkgmgr_parser_get_manifest_info(pkgid);
+       if (mfx == NULL)
+               return -1;
+       printf("Parsing Manifest Success\n");
+       pkgmgr_parser_free_manifest_xml(mfx);
+       return 0;
+}
+ * @endcode
+ */
+manifest_x *pkgmgr_parser_get_manifest_info(const char *pkigid);
+
 /* These APIs are intended to call parser directly */
 typedef int (*ps_iter_fn) (const char *tag, int type, void *userdata);
 
@@ -701,6 +783,36 @@ static int parse_docptr_for_uninstallation(xmlDocPtr docPtr)
  */
 int pkgmgr_parser_run_parser_for_uninstallation(xmlDocPtr docPtr, const char *tag, const char *pkgid);
 
+/**
+ * @fn int pkgmgr_parser_create_desktop_file(manifest_x *mfx)
+ * @brief      This API generates the application desktop file
+ *
+ * @par                This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in]  mfx     manifest pointer
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @pre                pkgmgr_parser_process_manifest_xml()
+ * @post       pkgmgr_parser_free_manifest_xml()
+ * @code
+static int create_desktop_file(char *manifest)
+{
+       int ret = 0;
+       manifest_x *mfx = NULL;
+       mfx = pkgmgr_parser_process_manifest_xml(manifest);
+       ret = pkgmgr_parser_create_desktop_file(mfx);
+       if (ret)
+               return -1;
+       pkgmgr_parser_free_manifest_xml(mfx);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_create_desktop_file(manifest_x *mfx);
+
 /** @} */
 #ifdef __cplusplus
 }