merge master branch
[platform/core/appfw/pkgmgr-info.git] / parser / pkgmgr_parser.h
1 /*
2  * pkgmgr-info
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7  * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23 #ifndef __PKGMGR_PARSER_H__
24 #define __PKGMGR_PARSER_H__
25
26 /**
27  * @file pkgmgr_parser.h
28  * @author Sewook Park <sewook7.park@samsung.com>
29  * @author Shobhit Srivastava <shobhit.s@samsung.com>
30  * @version 0.1
31  * @brief    This file declares API of pkgmgr_parser
32  * @addtogroup          APPLICATION_FRAMEWORK
33  * @{
34  *
35  * @defgroup            PackageManagerParser
36  * @section             Header Header file to include:
37  * @code
38  * #include             <pkgmgr_parser.h>
39  * @endcode
40  *
41  * @}
42  */
43
44 #include <libxml/xmlreader.h>
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 #define DEFAULT_LOCALE          "No Locale"
50
51 #define PKG_PARSERLIB   "parserlib:"
52 #define PKG_PARSER_CONF_PATH    "/usr/etc/package-manager/parser_path.conf"
53
54 #define PKG_STRING_LEN_MAX 1024
55
56 /**
57  * @brief List definitions.
58  * All lists are doubly-linked, the last element is stored to list pointer,
59  * which means that lists must be looped using the prev pointer, or by
60  * calling LISTHEAD first to go to start in order to use the next pointer.
61  */
62
63  /**
64  * @brief Convinience Macro to add node in list
65  */
66
67 #define LISTADD(list, node)                     \
68     do {                                        \
69         (node)->prev = (list);                  \
70         if (list) (node)->next = (list)->next;  \
71         else (node)->next = NULL;               \
72         if (list) (list)->next = (node);        \
73         (list) = (node);                        \
74     } while (0);
75
76  /**
77  * @brief Convinience Macro to add one node to another node
78  */
79 #define NODEADD(node1, node2)                                   \
80     do {                                                        \
81         (node2)->prev = (node1);                                \
82         (node2)->next = (node1)->next;                          \
83         if ((node1)->next) (node1)->next->prev = (node2);       \
84         (node1)->next = (node2);                                \
85     } while (0);
86
87  /**
88  * @brief Convinience Macro to concatenate two lists
89  */
90 #define LISTCAT(list, first, last)              \
91     if ((first) && (last)) {                    \
92         (first)->prev = (list);                 \
93         (list) = (last);                        \
94     }
95
96  /**
97  * @brief Convinience Macro to delete node from list
98  */
99 #define LISTDEL(list, node)                                     \
100     do {                                                        \
101         if ((node)->prev) (node)->prev->next = (node)->next;    \
102         if ((node)->next) (node)->next->prev = (node)->prev;    \
103         if (!((node)->prev) && !((node)->next)) (list) = NULL;  \
104     } while (0);
105
106  /**
107  * @brief Convinience Macro to get list head
108  */
109 #define LISTHEAD(list, node)                                    \
110     for ((node) = (list); (node)->prev; (node) = (node)->prev)
111
112  /**
113  * @brief Convinience Macro to get list tail
114  */
115 #define LISTTAIL(list, node)                                    \
116     for ((node) = (list); (node)->next; (node) = (node)->next)
117
118 typedef struct metadata_x {
119         const char *key;
120         const char *value;
121         struct metadata_x *prev;
122         struct metadata_x *next;
123 } metadata_x;
124
125 typedef struct privilege_x {
126         const char *text;
127         struct privilege_x *prev;
128         struct privilege_x *next;
129 } privilege_x;
130
131 typedef struct privileges_x {
132         struct privilege_x *privilege;
133         struct privileges_x *prev;
134         struct privileges_x *next;
135 } privileges_x;
136
137 typedef struct permission_x {
138         const char *type;
139         const char *value;
140         struct permission_x *prev;
141         struct permission_x *next;
142 } permission_x;
143
144 typedef struct icon_x {
145         const char *name;
146         const char *text;
147         const char *lang;
148         const char *section;
149         const char *size;
150         const char *resolution;
151         struct icon_x *prev;
152         struct icon_x *next;
153 } icon_x;
154
155 typedef struct image_x {
156         const char *name;
157         const char *text;
158         const char *lang;
159         const char *section;
160         struct image_x *prev;
161         struct image_x *next;
162 } image_x;
163
164 typedef struct allowed_x {
165         const char *name;
166         const char *text;
167         struct allowed_x *prev;
168         struct allowed_x *next;
169 } allowed_x;
170
171 typedef struct request_x {
172         const char *text;
173         struct request_x *prev;
174         struct request_x *next;
175 } request_x;
176
177 typedef struct define_x {
178         const char *path;
179         struct allowed_x *allowed;
180         struct request_x *request;
181         struct define_x *prev;
182         struct define_x *next;
183 } define_x;
184
185 typedef struct datashare_x {
186         struct define_x *define;
187         struct request_x *request;
188         struct datashare_x *prev;
189         struct datashare_x *next;
190 } datashare_x;
191
192 typedef struct description_x {
193         const char *name;
194         const char *text;
195         const char *lang;
196         struct description_x *prev;
197         struct description_x *next;
198 } description_x;
199
200 typedef struct registry_x {
201         const char *name;
202         const char *text;
203         struct registry_x *prev;
204         struct registry_x *next;
205 } registry_x;
206
207 typedef struct database_x {
208         const char *name;
209         const char *text;
210         struct database_x *prev;
211         struct database_x *next;
212 } database_x;
213
214 typedef struct layout_x {
215         const char *name;
216         const char *text;
217         struct layout_x *prev;
218         struct layout_x *next;
219 } layout_x;
220
221 typedef struct label_x {
222         const char *name;
223         const char *text;
224         const char *lang;
225         struct label_x *prev;
226         struct label_x *next;
227 } label_x;
228
229 typedef struct author_x {
230         const char *email;
231         const char *href;
232         const char *text;
233         const char *lang;
234         struct author_x *prev;
235         struct author_x *next;
236 } author_x;
237
238 typedef struct license_x {
239         const char *text;
240         const char *lang;
241         struct license_x *prev;
242         struct license_x *next;
243 } license_x;
244
245 typedef struct operation_x {
246         const char *name;
247         const char *text;
248         struct operation_x *prev;
249         struct operation_x *next;
250 } operation_x;
251
252 typedef struct uri_x {
253         const char *name;
254         const char *text;
255         struct uri_x *prev;
256         struct uri_x *next;
257 } uri_x;
258
259 typedef struct mime_x {
260         const char *name;
261         const char *text;
262         struct mime_x *prev;
263         struct mime_x *next;
264 } mime_x;
265
266 typedef struct subapp_x {
267         const char *name;
268         const char *text;
269         struct subapp_x *prev;
270         struct subapp_x *next;
271 } subapp_x;
272
273 typedef struct condition_x {
274         const char *name;
275         const char *text;
276         struct condition_x *prev;
277         struct condition_x *next;
278 } condition_x;
279
280 typedef struct notification_x {
281         const char *name;
282         const char *text;
283         struct notification_x *prev;
284         struct notification_x *next;
285 } notification_x;
286
287 typedef struct appsvc_x {
288         const char *text;
289         struct operation_x *operation;
290         struct uri_x *uri;
291         struct mime_x *mime;
292         struct subapp_x *subapp;
293         struct appsvc_x *prev;
294         struct appsvc_x *next;
295 } appsvc_x;
296
297 typedef struct appcontrol_x {
298         const char *text;
299         struct operation_x *operation;
300         struct uri_x *uri;
301         struct mime_x *mime;
302         struct subapp_x *subapp;
303         struct appcontrol_x *prev;
304         struct appcontrol_x *next;
305 } appcontrol_x;
306
307 typedef struct category_x{
308         const char *name;
309         struct category_x *prev;
310         struct category_x *next;
311 } category_x;
312
313 typedef struct launchconditions_x {
314         const char *text;
315         struct condition_x *condition;
316         struct launchconditions_x *prev;
317         struct launchconditions_x *next;
318 } launchconditions_x;
319
320 typedef struct compatibility_x {
321         const char *name;
322         const char *text;
323         struct compatibility_x *prev;
324         struct compatibility_x *next;
325 }compatibility_x;
326
327 typedef struct deviceprofile_x {
328         const char *name;
329         const char *text;
330         struct deviceprofile_x *prev;
331         struct deviceprofile_x *next;
332 }deviceprofile_x;
333
334 typedef struct resolution_x {
335         const char *mimetype;
336         const char *urischeme;
337         struct resolution_x *prev;
338         struct resolution_x *next;
339 } resolution_x;
340
341 typedef struct capability_x {
342         const char *operationid;
343         const char *access;
344         struct resolution_x *resolution;
345         struct capability_x *prev;
346         struct capability_x *next;
347 } capability_x;
348
349 typedef struct datacontrol_x {
350         const char *providerid;
351         struct capability_x *capability;
352         struct datacontrol_x *prev;
353         struct datacontrol_x *next;
354 } datacontrol_x;
355
356 typedef struct uiapplication_x {
357         const char *appid;
358         const char *exec;
359         const char *nodisplay;
360         const char *multiple;
361         const char *taskmanage;
362         const char *enabled;
363         const char *type;
364         const char *categories;
365         const char *extraid;
366         const char *hwacceleration;
367         const char *mainapp;
368         const char *package;
369         const char *recentimage;
370         const char *launchcondition;
371         const char *indicatordisplay;
372         const char *portraitimg;
373         const char *landscapeimg;
374         const char *guestmode_visibility;
375         struct label_x *label;
376         struct icon_x *icon;
377         struct image_x *image;
378         struct appsvc_x *appsvc;
379         struct appcontrol_x *appcontrol;
380         struct category_x *category;
381         struct metadata_x *metadata;
382         struct permission_x *permission;
383         struct launchconditions_x *launchconditions;
384         struct notification_x *notification;
385         struct datashare_x *datashare;
386         struct uiapplication_x *prev;
387         struct uiapplication_x *next;
388 } uiapplication_x;
389
390 typedef struct serviceapplication_x {
391         const char *appid;
392         const char *exec;
393         const char *onboot;
394         const char *autorestart;
395         const char *enabled;
396         const char *type;
397         const char *package;
398         struct label_x *label;
399         struct icon_x *icon;
400         struct appsvc_x *appsvc;
401         struct appcontrol_x *appcontrol;
402         struct category_x *category;
403         struct metadata_x *metadata;
404         struct permission_x *permission;
405         struct datacontrol_x *datacontrol;
406         struct launchconditions_x *launchconditions;
407         struct notification_x *notification;
408         struct datashare_x *datashare;
409         struct serviceapplication_x *prev;
410         struct serviceapplication_x *next;
411 } serviceapplication_x;
412
413 typedef struct daemon_x {
414         const char *name;
415         const char *text;
416         struct daemon_x *prev;
417         struct daemon_x *next;
418 } daemon_x;
419
420 typedef struct theme_x {
421         const char *name;
422         const char *text;
423         struct theme_x *prev;
424         struct theme_x *next;
425 } theme_x;
426
427 typedef struct font_x {
428         const char *name;
429         const char *text;
430         struct font_x *prev;
431         struct font_x *next;
432 } font_x;
433
434 typedef struct ime_x {
435         const char *name;
436         const char *text;
437         struct ime_x *prev;
438         struct ime_x *next;
439 } ime_x;
440
441 typedef struct manifest_x {
442         const char *package;            /**< package name*/
443         const char *version;            /**< package version*/
444         const char *installlocation;            /**< package install location*/
445         const char *ns;         /**<name space*/
446         const char *removable;          /**< package removable flag*/
447         const char *preload;            /**< package preload flag*/
448         const char *readonly;           /**< package readonly flag*/
449         const char *update;                     /**< package update flag*/
450         const char *appsetting;         /**< package app setting flag*/
451         const char *type;               /**< package type*/
452         const char *package_size;               /**< package size for external installation*/
453         const char *installed_time;             /**< installed time after finishing of installation*/
454         const char *installed_storage;          /**< package currently installed storage*/
455         const char *storeclient_id;             /**< id of store client for installed package*/
456         const char *mainapp_id;         /**< app id of main application*/
457         const char *package_url;                /**< app id of main application*/
458         const char *root_path;          /**< package root path*/
459         const char *nodisplay_setting;          /**< package no display setting menu*/
460         struct icon_x *icon;            /**< package icon*/
461         struct label_x *label;          /**< package label*/
462         struct author_x *author;                /**< package author*/
463         struct description_x *description;              /**< package description*/
464         struct license_x *license;              /**< package license*/
465         struct privileges_x *privileges;        /**< package privileges*/
466         struct uiapplication_x *uiapplication;          /**< package's ui application*/
467         struct serviceapplication_x *serviceapplication;                /**< package's service application*/
468         struct daemon_x *daemon;                /**< package daemon*/
469         struct theme_x *theme;          /**< package theme*/
470         struct font_x *font;            /**< package font*/
471         struct ime_x *ime;              /**< package ime*/
472         struct compatibility_x *compatibility;          /**< package compatibility*/
473         struct deviceprofile_x *deviceprofile;          /**< package device profile*/
474 } manifest_x;
475
476 /**
477  * @fn char *pkgmgr_parser_get_manifest_file(const char *pkgid)
478  * @brief       This API gets the manifest file of the package.
479  *
480  * @par         This API is for package-manager installer backends.
481  * @par Sync (or) Async : Synchronous API
482  *
483  * @param[in]   pkgid   pointer to package ID
484  * @return      manifest file path on success, NULL on failure
485  * @pre         None
486  * @post                Free the manifest file pointer that is returned by API
487  * @code
488 static int get_manifest_file(const char *pkgid)
489 {
490         char *manifest = NULL;
491         manifest = pkgmgr_parser_get_manifest_file(pkgid);
492         if (manifest == NULL)
493                 return -1;
494         printf("Manifest File Path is %s\n", manifest);
495         free(manifest);
496         return 0;
497 }
498  * @endcode
499  */
500 char *pkgmgr_parser_get_manifest_file(const char *pkgid);
501
502 /**
503  * @fn int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[])
504  * @brief       This API parses the manifest file of the package after installation and stores the data in DB.
505  *
506  * @par         This API is for package-manager installer backends.
507  * @par Sync (or) Async : Synchronous API
508  *
509  * @param[in]   manifest        pointer to package manifest file
510  * @param[in]   tagv            array of xml tags or NULL
511  * @return      0 if success, error code(<0) if fail
512  * @retval      PMINFO_R_OK     success
513  * @retval      PMINFO_R_EINVAL invalid argument
514  * @retval      PMINFO_R_ERROR  internal error
515  * @pre         None
516  * @post                None
517  * @code
518 static int parse_manifest_file_for_installation(const char *manifest)
519 {
520         int ret = 0;
521         ret = pkgmgr_parser_parse_manifest_for_installation(manifest, NULL);
522         if (ret)
523                 return -1;
524         return 0;
525 }
526  * @endcode
527  */
528 int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[]);
529
530 /**
531  * @fn int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
532  * @brief       This API parses the manifest file of the package after upgrade and stores the data in DB.
533  *
534  * @par         This API is for package-manager installer backends.
535  * @par Sync (or) Async : Synchronous API
536  *
537  * @param[in]   manifest        pointer to package manifest file
538  * @param[in]   tagv            array of xml tags or NULL
539  * @return      0 if success, error code(<0) if fail
540  * @retval      PMINFO_R_OK     success
541  * @retval      PMINFO_R_EINVAL invalid argument
542  * @retval      PMINFO_R_ERROR  internal error
543  * @pre         None
544  * @post                None
545  * @code
546 static int parse_manifest_file_for_upgrade(const char *manifest)
547 {
548         int ret = 0;
549         ret = pkgmgr_parser_parse_manifest_for_upgrade(manifest, NULL);
550         if (ret)
551                 return -1;
552         return 0;
553 }
554  * @endcode
555  */
556 int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[]);
557
558 /**
559  * @fn int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, char *const tagv[])
560  * @brief       This API parses the manifest file of the package after uninstallation and deletes the data from DB.
561  *
562  * @par         This API is for package-manager installer backends.
563  * @par Sync (or) Async : Synchronous API
564  *
565  * @param[in]   manifest        pointer to package manifest file
566  * @param[in]   tagv            array of xml tags or NULL
567  * @return      0 if success, error code(<0) if fail
568  * @retval      PMINFO_R_OK     success
569  * @retval      PMINFO_R_EINVAL invalid argument
570  * @retval      PMINFO_R_ERROR  internal error
571  * @pre         None
572  * @post                None
573  * @code
574 static int parse_manifest_file_for_uninstallation(const char *manifest)
575 {
576         int ret = 0;
577         ret = pkgmgr_parser_parse_manifest_for_uninstallation(manifest, NULL);
578         if (ret)
579                 return -1;
580         return 0;
581 }
582  * @endcode
583  */
584 int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, char *const tagv[]);
585
586 /**
587  * @fn int pkgmgr_parser_check_manifest_validation(const char *manifest)
588  * @brief       This API validates the manifest file against the manifest schema.
589  *
590  * @par         This API is for package-manager installer backends.
591  * @par Sync (or) Async : Synchronous API
592  *
593  * @param[in]   manifest        pointer to package manifest file
594  * @return      0 if success, error code(<0) if fail
595  * @retval      PMINFO_R_OK     success
596  * @retval      PMINFO_R_EINVAL invalid argument
597  * @retval      PMINFO_R_ERROR  internal error
598  * @pre         None
599  * @post                None
600  * @code
601 static int validate_manifest_file(const char *manifest)
602 {
603         int ret = 0;
604         ret = pkgmgr_parser_check_manifest_validation(manifest);
605         if (ret)
606                 return -1;
607         return 0;
608 }
609  * @endcode
610  */
611 int pkgmgr_parser_check_manifest_validation(const char *manifest);
612
613 /**
614  * @fn void pkgmgr_parser_free_manifest_xml(manifest_x *mfx)
615  * @brief       This API will free the manifest pointer by recursively freeing all sub elements.
616  *
617  * @par         This API is for package-manager installer backends.
618  * @par Sync (or) Async : Synchronous API
619  *
620  * @param[in]   mfx     pointer to parsed manifest data
621  * @pre         pkgmgr_parser_process_manifest_xml()
622  * @post                None
623  * @code
624 static int parse_manifest_file(const char *manifest)
625 {
626         manifest_x *mfx = NULL
627         mfx = pkgmgr_parser_process_manifest_xml(manifest);
628         if (mfx == NULL)
629                 return -1;
630         printf("Parsing Manifest Success\n");
631         pkgmgr_parser_free_manifest_xml(mfx);
632         return 0;
633 }
634  * @endcode
635  */
636 void pkgmgr_parser_free_manifest_xml(manifest_x *mfx);
637
638 /**
639  * @fn manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest)
640  * @brief       This API parses the manifest file and stores all the data in the manifest structure.
641  *
642  * @par         This API is for package-manager installer backends.
643  * @par Sync (or) Async : Synchronous API
644  *
645  * @param[in]   manifest        pointer to package manifest file
646  * @return      manifest pointer on success, NULL on failure
647  * @pre         None
648  * @post                pkgmgr_parser_free_manifest_xml()
649  * @code
650 static int parse_manifest_file(const char *manifest)
651 {
652         manifest_x *mfx = NULL
653         mfx = pkgmgr_parser_process_manifest_xml(manifest);
654         if (mfx == NULL)
655                 return -1;
656         printf("Parsing Manifest Success\n");
657         pkgmgr_parser_free_manifest_xml(mfx);
658         return 0;
659 }
660  * @endcode
661  */
662 manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest);
663
664 /**
665  * @fn manifest_x *pkgmgr_parser_get_manifest_info(const char *pkigid)
666  * @brief       This API gets the manifest info from DB and stores all the data in the manifest structure.
667  *
668  * @par         This API is for package-manager installer backends.
669  * @par Sync (or) Async : Synchronous API
670  *
671  * @param[in]   pkgid   package id for package
672  * @return      manifest pointer on success, NULL on failure
673  * @pre         None
674  * @post                pkgmgr_parser_free_manifest_xml()
675  * @code
676 static int get_manifest_info(const char *pkgid)
677 {
678         manifest_x *mfx = NULL
679         mfx = pkgmgr_parser_get_manifest_info(pkgid);
680         if (mfx == NULL)
681                 return -1;
682         printf("Parsing Manifest Success\n");
683         pkgmgr_parser_free_manifest_xml(mfx);
684         return 0;
685 }
686  * @endcode
687  */
688 manifest_x *pkgmgr_parser_get_manifest_info(const char *pkigid);
689
690 /* These APIs are intended to call parser directly */
691 typedef int (*ps_iter_fn) (const char *tag, int type, void *userdata);
692
693 int pkgmgr_parser_has_parser(const char *tag, int *type);
694 int pkgmgr_parser_get_list(ps_iter_fn iter_fn, void *data);
695
696 /**
697  * @fn int pkgmgr_parser_run_parser_for_installation(xmlDocPtr docPtr, const char *tag, const char *pkgid)
698  * @brief       This API calls the parser directly by supplying the xml docptr. It is used during package installation
699  *
700  * @par         This API is for package-manager installer backends.
701  * @par Sync (or) Async : Synchronous API
702  *
703  * @param[in]   docPtr  XML doxument pointer
704  * @param[in]   tag             the xml tag corresponding to the parser that will parse the docPtr
705  * @param[in]   pkgid           the package id
706  * @return      0 if success, error code(<0) if fail
707  * @retval      PMINFO_R_OK     success
708  * @retval      PMINFO_R_EINVAL invalid argument
709  * @retval      PMINFO_R_ERROR  internal error
710  * @pre         None
711  * @post                None
712  * @code
713 static int parse_docptr_for_installation(xmlDocPtr docPtr)
714 {
715         int ret = 0;
716         ret = pkgmgr_parser_run_parser_for_installation(docPtr, "theme", "com.samsung.test");
717         if (ret)
718                 return -1;
719         return 0;
720 }
721  * @endcode
722  */
723 int pkgmgr_parser_run_parser_for_installation(xmlDocPtr docPtr, const char *tag, const char *pkgid);
724
725 /**
726  * @fn int pkgmgr_parser_run_parser_for_upgrade(xmlDocPtr docPtr, const char *tag, const char *pkgid)
727  * @brief       This API calls the parser directly by supplying the xml docptr. It is used during package upgrade
728  *
729  * @par         This API is for package-manager installer backends.
730  * @par Sync (or) Async : Synchronous API
731  *
732  * @param[in]   docPtr  XML doxument pointer
733  * @param[in]   tag             the xml tag corresponding to the parser that will parse the docPtr
734  * @param[in]   pkgid           the package id
735  * @return      0 if success, error code(<0) if fail
736  * @retval      PMINFO_R_OK     success
737  * @retval      PMINFO_R_EINVAL invalid argument
738  * @retval      PMINFO_R_ERROR  internal error
739  * @pre         None
740  * @post                None
741  * @code
742 static int parse_docptr_for_upgrade(xmlDocPtr docPtr)
743 {
744         int ret = 0;
745         ret = pkgmgr_parser_run_parser_for_upgrade(docPtr, "theme", "com.samsung.test");
746         if (ret)
747                 return -1;
748         return 0;
749 }
750  * @endcode
751  */
752 int pkgmgr_parser_run_parser_for_upgrade(xmlDocPtr docPtr, const char *tag, const char *pkgid);
753
754 /**
755  * @fn int pkgmgr_parser_run_parser_for_uninstallation(xmlDocPtr docPtr, const char *tag, const char *pkgid)
756  * @brief       This API calls the parser directly by supplying the xml docptr. It is used during package uninstallation
757  *
758  * @par         This API is for package-manager installer backends.
759  * @par Sync (or) Async : Synchronous API
760  *
761  * @param[in]   docPtr  XML doxument pointer
762  * @param[in]   tag             the xml tag corresponding to the parser that will parse the docPtr
763  * @param[in]   pkgid           the package id
764  * @return      0 if success, error code(<0) if fail
765  * @retval      PMINFO_R_OK     success
766  * @retval      PMINFO_R_EINVAL invalid argument
767  * @retval      PMINFO_R_ERROR  internal error
768  * @pre         None
769  * @post                None
770  * @code
771 static int parse_docptr_for_uninstallation(xmlDocPtr docPtr)
772 {
773         int ret = 0;
774         ret = pkgmgr_parser_run_parser_for_uninstallation(docPtr, "theme", "com.samsung.test");
775         if (ret)
776                 return -1;
777         return 0;
778 }
779  * @endcode
780  */
781 int pkgmgr_parser_run_parser_for_uninstallation(xmlDocPtr docPtr, const char *tag, const char *pkgid);
782
783 /**
784  * @fn int pkgmgr_parser_create_desktop_file(manifest_x *mfx)
785  * @brief       This API generates the application desktop file
786  *
787  * @par         This API is for package-manager installer backends.
788  * @par Sync (or) Async : Synchronous API
789  *
790  * @param[in]   mfx     manifest pointer
791  * @return      0 if success, error code(<0) if fail
792  * @retval      PMINFO_R_OK     success
793  * @retval      PMINFO_R_EINVAL invalid argument
794  * @retval      PMINFO_R_ERROR  internal error
795  * @pre         pkgmgr_parser_process_manifest_xml()
796  * @post        pkgmgr_parser_free_manifest_xml()
797  * @code
798 static int create_desktop_file(char *manifest)
799 {
800         int ret = 0;
801         manifest_x *mfx = NULL;
802         mfx = pkgmgr_parser_process_manifest_xml(manifest);
803         ret = pkgmgr_parser_create_desktop_file(mfx);
804         if (ret)
805                 return -1;
806         pkgmgr_parser_free_manifest_xml(mfx);
807         return 0;
808 }
809  * @endcode
810  */
811 int pkgmgr_parser_create_desktop_file(manifest_x *mfx);
812
813 /** @} */
814 #ifdef __cplusplus
815 }
816 #endif
817 #endif                          /* __PKGMGR_PARSER_H__ */