45d9997843cf91c4bc96d09d047ebe8d604258bf
[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 permission_x {
126         const char *type;
127         const char *value;
128         struct permission_x *prev;
129         struct permission_x *next;
130 } permission_x;
131
132 typedef struct icon_x {
133         const char *name;
134         const char *text;
135         const char *lang;
136         const char *section;
137         const char *size;
138         const char *resolution;
139         struct icon_x *prev;
140         struct icon_x *next;
141 } icon_x;
142
143 typedef struct image_x {
144         const char *name;
145         const char *text;
146         const char *lang;
147         const char *section;
148         struct icon_x *prev;
149         struct icon_x *next;
150 } image_x;
151
152 typedef struct allowed_x {
153         const char *name;
154         const char *text;
155         struct allowed_x *prev;
156         struct allowed_x *next;
157 } allowed_x;
158
159 typedef struct request_x {
160         const char *text;
161         struct request_x *prev;
162         struct request_x *next;
163 } request_x;
164
165 typedef struct define_x {
166         const char *path;
167         struct allowed_x *allowed;
168         struct request_x *request;
169         struct define_x *prev;
170         struct define_x *next;
171 } define_x;
172
173 typedef struct datashare_x {
174         struct define_x *define;
175         struct request_x *request;
176         struct datashare_x *prev;
177         struct datashare_x *next;
178 } datashare_x;
179
180 typedef struct description_x {
181         const char *name;
182         const char *text;
183         const char *lang;
184         struct description_x *prev;
185         struct description_x *next;
186 } description_x;
187
188 typedef struct registry_x {
189         const char *name;
190         const char *text;
191         struct registry_x *prev;
192         struct registry_x *next;
193 } registry_x;
194
195 typedef struct database_x {
196         const char *name;
197         const char *text;
198         struct database_x *prev;
199         struct database_x *next;
200 } database_x;
201
202 typedef struct layout_x {
203         const char *name;
204         const char *text;
205         struct layout_x *prev;
206         struct layout_x *next;
207 } layout_x;
208
209 typedef struct label_x {
210         const char *name;
211         const char *text;
212         const char *lang;
213         struct label_x *prev;
214         struct label_x *next;
215 } label_x;
216
217 typedef struct author_x {
218         const char *email;
219         const char *href;
220         const char *text;
221         const char *lang;
222         struct author_x *prev;
223         struct author_x *next;
224 } author_x;
225
226 typedef struct license_x {
227         const char *text;
228         const char *lang;
229         struct license_x *prev;
230         struct license_x *next;
231 } license_x;
232
233 typedef struct operation_x {
234         const char *name;
235         const char *text;
236         struct operation_x *prev;
237         struct operation_x *next;
238 } operation_x;
239
240 typedef struct uri_x {
241         const char *name;
242         const char *text;
243         struct uri_x *prev;
244         struct uri_x *next;
245 } uri_x;
246
247 typedef struct mime_x {
248         const char *name;
249         const char *text;
250         struct mime_x *prev;
251         struct mime_x *next;
252 } mime_x;
253
254 typedef struct subapp_x {
255         const char *name;
256         const char *text;
257         struct subapp_x *prev;
258         struct subapp_x *next;
259 } subapp_x;
260
261 typedef struct condition_x {
262         const char *name;
263         const char *text;
264         struct condition_x *prev;
265         struct condition_x *next;
266 } condition_x;
267
268 typedef struct notification_x {
269         const char *name;
270         const char *text;
271         struct notification_x *prev;
272         struct notification_x *next;
273 } notification_x;
274
275 typedef struct appsvc_x {
276         const char *text;
277         struct operation_x *operation;
278         struct uri_x *uri;
279         struct mime_x *mime;
280         struct subapp_x *subapp;
281         struct appsvc_x *prev;
282         struct appsvc_x *next;
283 } appsvc_x;
284
285 typedef struct appcontrol_x {
286         const char *text;
287         struct operation_x *operation;
288         struct uri_x *uri;
289         struct mime_x *mime;
290         struct subapp_x *subapp;
291         struct appcontrol_x *prev;
292         struct appcontrol_x *next;
293 } appcontrol_x;
294
295 typedef struct category_x{
296         const char *name;
297         struct category_x *prev;
298         struct category_x *next;
299 } category_x;
300
301 typedef struct launchconditions_x {
302         const char *text;
303         struct condition_x *condition;
304         struct launchconditions_x *prev;
305         struct launchconditions_x *next;
306 } launchconditions_x;
307
308 typedef struct compatibility_x {
309         const char *name;
310         const char *text;
311         struct compatibility_x *prev;
312         struct compatibility_x *next;
313 }compatibility_x;
314
315 typedef struct deviceprofile_x {
316         const char *name;
317         const char *text;
318         struct deviceprofile_x *prev;
319         struct deviceprofile_x *next;
320 }deviceprofile_x;
321
322 typedef struct resolution_x {
323         const char *mimetype;
324         const char *urischeme;
325         struct resolution_x *prev;
326         struct resolution_x *next;
327 } resolution_x;
328
329 typedef struct capability_x {
330         const char *operationid;
331         const char *access;
332         struct resolution_x *resolution;
333         struct capability_x *prev;
334         struct capability_x *next;
335 } capability_x;
336
337 typedef struct datacontrol_x {
338         const char *providerid;
339         struct capability_x *capability;
340         struct datacontrol_x *prev;
341         struct datacontrol_x *next;
342 } datacontrol_x;
343
344 typedef struct uiapplication_x {
345         const char *appid;
346         const char *exec;
347         const char *nodisplay;
348         const char *multiple;
349         const char *taskmanage;
350         const char *enabled;
351         const char *type;
352         const char *categories;
353         const char *extraid;
354         const char *hwacceleration;
355         const char *mainapp;
356         const char *package;
357         const char *recentimage;
358         const char *indicatordisplay;
359         const char *portraitimg;
360         const char *landscapeimg;
361         const char *guestmode_visibility;
362         struct label_x *label;
363         struct icon_x *icon;
364         struct image_x *image;
365         struct appsvc_x *appsvc;
366         struct appcontrol_x *appcontrol;
367         struct category_x *category;
368         struct metadata_x *metadata;
369         struct permission_x *permission;
370         struct launchconditions_x *launchconditions;
371         struct notification_x *notification;
372         struct datashare_x *datashare;
373         struct uiapplication_x *prev;
374         struct uiapplication_x *next;
375 } uiapplication_x;
376
377 typedef struct serviceapplication_x {
378         const char *appid;
379         const char *exec;
380         const char *onboot;
381         const char *autorestart;
382         const char *enabled;
383         const char *type;
384         const char *package;
385         struct label_x *label;
386         struct icon_x *icon;
387         struct appsvc_x *appsvc;
388         struct appcontrol_x *appcontrol;
389         struct category_x *category;
390         struct metadata_x *metadata;
391         struct permission_x *permission;
392         struct datacontrol_x *datacontrol;
393         struct launchconditions_x *launchconditions;
394         struct notification_x *notification;
395         struct datashare_x *datashare;
396         struct serviceapplication_x *prev;
397         struct serviceapplication_x *next;
398 } serviceapplication_x;
399
400 typedef struct daemon_x {
401         const char *name;
402         const char *text;
403         struct daemon_x *prev;
404         struct daemon_x *next;
405 } daemon_x;
406
407 typedef struct theme_x {
408         const char *name;
409         const char *text;
410         struct theme_x *prev;
411         struct theme_x *next;
412 } theme_x;
413
414 typedef struct font_x {
415         const char *name;
416         const char *text;
417         struct font_x *prev;
418         struct font_x *next;
419 } font_x;
420
421 typedef struct ime_x {
422         const char *name;
423         const char *text;
424         struct ime_x *prev;
425         struct ime_x *next;
426 } ime_x;
427
428 typedef struct manifest_x {
429         const char *package;            /**< package name*/
430         const char *version;            /**< package version*/
431         const char *installlocation;            /**< package install location*/
432         const char *ns;         /**<name space*/
433         const char *removable;          /**< package removable flag*/
434         const char *preload;            /**< package preload flag*/
435         const char *readonly;           /**< package readonly flag*/
436         const char *update;                     /**< package update flag*/
437         const char *appsetting;         /**< package app setting flag*/
438         const char *type;               /**< package type*/
439         const char *package_size;               /**< package size for external installation*/
440         const char *installed_time;             /**< installed time after finishing of installation*/
441         const char *installed_storage;          /**< package currently installed storage*/
442         const char *storeclient_id;             /**< id of store client for installed package*/
443         const char *mainapp_id;         /**< app id of main application*/
444         const char *package_url;                /**< app id of main application*/
445         const char *root_path;          /**< package root path*/
446         struct icon_x *icon;            /**< package icon*/
447         struct label_x *label;          /**< package label*/
448         struct author_x *author;                /**< package author*/
449         struct description_x *description;              /**< package description*/
450         struct license_x *license;              /**< package license*/
451         struct uiapplication_x *uiapplication;          /**< package's ui application*/
452         struct serviceapplication_x *serviceapplication;                /**< package's service application*/
453         struct daemon_x *daemon;                /**< package daemon*/
454         struct theme_x *theme;          /**< package theme*/
455         struct font_x *font;            /**< package font*/
456         struct ime_x *ime;              /**< package ime*/
457         struct compatibility_x *compatibility;          /**< package compatibility*/
458         struct deviceprofile_x *deviceprofile;          /**< package device profile*/
459 } manifest_x;
460
461 /**
462  * @fn char *pkgmgr_parser_get_manifest_file(const char *pkgid)
463  * @brief       This API gets the manifest file of the package.
464  *
465  * @par         This API is for package-manager installer backends.
466  * @par Sync (or) Async : Synchronous API
467  *
468  * @param[in]   pkgid   pointer to package ID
469  * @return      manifest file path on success, NULL on failure
470  * @pre         None
471  * @post                Free the manifest file pointer that is returned by API
472  * @code
473 static int get_manifest_file(const char *pkgid)
474 {
475         char *manifest = NULL;
476         manifest = pkgmgr_parser_get_manifest_file(pkgid);
477         if (manifest == NULL)
478                 return -1;
479         printf("Manifest File Path is %s\n", manifest);
480         free(manifest);
481         return 0;
482 }
483  * @endcode
484  */
485 char *pkgmgr_parser_get_manifest_file(const char *pkgid);
486
487 /**
488  * @fn int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[])
489  * @brief       This API parses the manifest file of the package after installation and stores the data in DB.
490  *
491  * @par         This API is for package-manager installer backends.
492  * @par Sync (or) Async : Synchronous API
493  *
494  * @param[in]   manifest        pointer to package manifest file
495  * @param[in]   tagv            array of xml tags or NULL
496  * @return      0 if success, error code(<0) if fail
497  * @retval      PMINFO_R_OK     success
498  * @retval      PMINFO_R_EINVAL invalid argument
499  * @retval      PMINFO_R_ERROR  internal error
500  * @pre         None
501  * @post                None
502  * @code
503 static int parse_manifest_file_for_installation(const char *manifest)
504 {
505         int ret = 0;
506         ret = pkgmgr_parser_parse_manifest_for_installation(manifest, NULL);
507         if (ret)
508                 return -1;
509         return 0;
510 }
511  * @endcode
512  */
513 int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[]);
514
515 /**
516  * @fn int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
517  * @brief       This API parses the manifest file of the package after upgrade and stores the data in DB.
518  *
519  * @par         This API is for package-manager installer backends.
520  * @par Sync (or) Async : Synchronous API
521  *
522  * @param[in]   manifest        pointer to package manifest file
523  * @param[in]   tagv            array of xml tags or NULL
524  * @return      0 if success, error code(<0) if fail
525  * @retval      PMINFO_R_OK     success
526  * @retval      PMINFO_R_EINVAL invalid argument
527  * @retval      PMINFO_R_ERROR  internal error
528  * @pre         None
529  * @post                None
530  * @code
531 static int parse_manifest_file_for_upgrade(const char *manifest)
532 {
533         int ret = 0;
534         ret = pkgmgr_parser_parse_manifest_for_upgrade(manifest, NULL);
535         if (ret)
536                 return -1;
537         return 0;
538 }
539  * @endcode
540  */
541 int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[]);
542
543 /**
544  * @fn int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, char *const tagv[])
545  * @brief       This API parses the manifest file of the package after uninstallation and deletes the data from DB.
546  *
547  * @par         This API is for package-manager installer backends.
548  * @par Sync (or) Async : Synchronous API
549  *
550  * @param[in]   manifest        pointer to package manifest file
551  * @param[in]   tagv            array of xml tags or NULL
552  * @return      0 if success, error code(<0) if fail
553  * @retval      PMINFO_R_OK     success
554  * @retval      PMINFO_R_EINVAL invalid argument
555  * @retval      PMINFO_R_ERROR  internal error
556  * @pre         None
557  * @post                None
558  * @code
559 static int parse_manifest_file_for_uninstallation(const char *manifest)
560 {
561         int ret = 0;
562         ret = pkgmgr_parser_parse_manifest_for_uninstallation(manifest, NULL);
563         if (ret)
564                 return -1;
565         return 0;
566 }
567  * @endcode
568  */
569 int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, char *const tagv[]);
570
571 /**
572  * @fn int pkgmgr_parser_check_manifest_validation(const char *manifest)
573  * @brief       This API validates the manifest file against the manifest schema.
574  *
575  * @par         This API is for package-manager installer backends.
576  * @par Sync (or) Async : Synchronous API
577  *
578  * @param[in]   manifest        pointer to package manifest file
579  * @return      0 if success, error code(<0) if fail
580  * @retval      PMINFO_R_OK     success
581  * @retval      PMINFO_R_EINVAL invalid argument
582  * @retval      PMINFO_R_ERROR  internal error
583  * @pre         None
584  * @post                None
585  * @code
586 static int validate_manifest_file(const char *manifest)
587 {
588         int ret = 0;
589         ret = pkgmgr_parser_check_manifest_validation(manifest);
590         if (ret)
591                 return -1;
592         return 0;
593 }
594  * @endcode
595  */
596 int pkgmgr_parser_check_manifest_validation(const char *manifest);
597
598 /**
599  * @fn void pkgmgr_parser_free_manifest_xml(manifest_x *mfx)
600  * @brief       This API will free the manifest pointer by recursively freeing all sub elements.
601  *
602  * @par         This API is for package-manager installer backends.
603  * @par Sync (or) Async : Synchronous API
604  *
605  * @param[in]   mfx     pointer to parsed manifest data
606  * @pre         pkgmgr_parser_process_manifest_xml()
607  * @post                None
608  * @code
609 static int parse_manifest_file(const char *manifest)
610 {
611         manifest_x *mfx = NULL
612         mfx = pkgmgr_parser_process_manifest_xml(manifest);
613         if (mfx == NULL)
614                 return -1;
615         printf("Parsing Manifest Success\n");
616         pkgmgr_parser_free_manifest_xml(mfx);
617         return 0;
618 }
619  * @endcode
620  */
621 void pkgmgr_parser_free_manifest_xml(manifest_x *mfx);
622
623 /**
624  * @fn manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest)
625  * @brief       This API parses the manifest file and stores all the data in the manifest structure.
626  *
627  * @par         This API is for package-manager installer backends.
628  * @par Sync (or) Async : Synchronous API
629  *
630  * @param[in]   manifest        pointer to package manifest file
631  * @return      manifest pointer on success, NULL on failure
632  * @pre         None
633  * @post                pkgmgr_parser_free_manifest_xml()
634  * @code
635 static int parse_manifest_file(const char *manifest)
636 {
637         manifest_x *mfx = NULL
638         mfx = pkgmgr_parser_process_manifest_xml(manifest);
639         if (mfx == NULL)
640                 return -1;
641         printf("Parsing Manifest Success\n");
642         pkgmgr_parser_free_manifest_xml(mfx);
643         return 0;
644 }
645  * @endcode
646  */
647 manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest);
648
649 /**
650  * @fn manifest_x *pkgmgr_parser_get_manifest_info(const char *pkigid)
651  * @brief       This API gets the manifest info from DB and stores all the data in the manifest structure.
652  *
653  * @par         This API is for package-manager installer backends.
654  * @par Sync (or) Async : Synchronous API
655  *
656  * @param[in]   pkgid   package id for package
657  * @return      manifest pointer on success, NULL on failure
658  * @pre         None
659  * @post                pkgmgr_parser_free_manifest_xml()
660  * @code
661 static int get_manifest_info(const char *pkgid)
662 {
663         manifest_x *mfx = NULL
664         mfx = pkgmgr_parser_get_manifest_info(pkgid);
665         if (mfx == NULL)
666                 return -1;
667         printf("Parsing Manifest Success\n");
668         pkgmgr_parser_free_manifest_xml(mfx);
669         return 0;
670 }
671  * @endcode
672  */
673 manifest_x *pkgmgr_parser_get_manifest_info(const char *pkigid);
674
675 /* These APIs are intended to call parser directly */
676 typedef int (*ps_iter_fn) (const char *tag, int type, void *userdata);
677
678 int pkgmgr_parser_has_parser(const char *tag, int *type);
679 int pkgmgr_parser_get_list(ps_iter_fn iter_fn, void *data);
680
681 /**
682  * @fn int pkgmgr_parser_run_parser_for_installation(xmlDocPtr docPtr, const char *tag, const char *pkgid)
683  * @brief       This API calls the parser directly by supplying the xml docptr. It is used during package installation
684  *
685  * @par         This API is for package-manager installer backends.
686  * @par Sync (or) Async : Synchronous API
687  *
688  * @param[in]   docPtr  XML doxument pointer
689  * @param[in]   tag             the xml tag corresponding to the parser that will parse the docPtr
690  * @param[in]   pkgid           the package id
691  * @return      0 if success, error code(<0) if fail
692  * @retval      PMINFO_R_OK     success
693  * @retval      PMINFO_R_EINVAL invalid argument
694  * @retval      PMINFO_R_ERROR  internal error
695  * @pre         None
696  * @post                None
697  * @code
698 static int parse_docptr_for_installation(xmlDocPtr docPtr)
699 {
700         int ret = 0;
701         ret = pkgmgr_parser_run_parser_for_installation(docPtr, "theme", "com.samsung.test");
702         if (ret)
703                 return -1;
704         return 0;
705 }
706  * @endcode
707  */
708 int pkgmgr_parser_run_parser_for_installation(xmlDocPtr docPtr, const char *tag, const char *pkgid);
709
710 /**
711  * @fn int pkgmgr_parser_run_parser_for_upgrade(xmlDocPtr docPtr, const char *tag, const char *pkgid)
712  * @brief       This API calls the parser directly by supplying the xml docptr. It is used during package upgrade
713  *
714  * @par         This API is for package-manager installer backends.
715  * @par Sync (or) Async : Synchronous API
716  *
717  * @param[in]   docPtr  XML doxument pointer
718  * @param[in]   tag             the xml tag corresponding to the parser that will parse the docPtr
719  * @param[in]   pkgid           the package id
720  * @return      0 if success, error code(<0) if fail
721  * @retval      PMINFO_R_OK     success
722  * @retval      PMINFO_R_EINVAL invalid argument
723  * @retval      PMINFO_R_ERROR  internal error
724  * @pre         None
725  * @post                None
726  * @code
727 static int parse_docptr_for_upgrade(xmlDocPtr docPtr)
728 {
729         int ret = 0;
730         ret = pkgmgr_parser_run_parser_for_upgrade(docPtr, "theme", "com.samsung.test");
731         if (ret)
732                 return -1;
733         return 0;
734 }
735  * @endcode
736  */
737 int pkgmgr_parser_run_parser_for_upgrade(xmlDocPtr docPtr, const char *tag, const char *pkgid);
738
739 /**
740  * @fn int pkgmgr_parser_run_parser_for_uninstallation(xmlDocPtr docPtr, const char *tag, const char *pkgid)
741  * @brief       This API calls the parser directly by supplying the xml docptr. It is used during package uninstallation
742  *
743  * @par         This API is for package-manager installer backends.
744  * @par Sync (or) Async : Synchronous API
745  *
746  * @param[in]   docPtr  XML doxument pointer
747  * @param[in]   tag             the xml tag corresponding to the parser that will parse the docPtr
748  * @param[in]   pkgid           the package id
749  * @return      0 if success, error code(<0) if fail
750  * @retval      PMINFO_R_OK     success
751  * @retval      PMINFO_R_EINVAL invalid argument
752  * @retval      PMINFO_R_ERROR  internal error
753  * @pre         None
754  * @post                None
755  * @code
756 static int parse_docptr_for_uninstallation(xmlDocPtr docPtr)
757 {
758         int ret = 0;
759         ret = pkgmgr_parser_run_parser_for_uninstallation(docPtr, "theme", "com.samsung.test");
760         if (ret)
761                 return -1;
762         return 0;
763 }
764  * @endcode
765  */
766 int pkgmgr_parser_run_parser_for_uninstallation(xmlDocPtr docPtr, const char *tag, const char *pkgid);
767
768 /**
769  * @fn int pkgmgr_parser_create_desktop_file(manifest_x *mfx)
770  * @brief       This API generates the application desktop file
771  *
772  * @par         This API is for package-manager installer backends.
773  * @par Sync (or) Async : Synchronous API
774  *
775  * @param[in]   mfx     manifest pointer
776  * @return      0 if success, error code(<0) if fail
777  * @retval      PMINFO_R_OK     success
778  * @retval      PMINFO_R_EINVAL invalid argument
779  * @retval      PMINFO_R_ERROR  internal error
780  * @pre         pkgmgr_parser_process_manifest_xml()
781  * @post        pkgmgr_parser_free_manifest_xml()
782  * @code
783 static int create_desktop_file(char *manifest)
784 {
785         int ret = 0;
786         manifest_x *mfx = NULL;
787         mfx = pkgmgr_parser_process_manifest_xml(manifest);
788         ret = pkgmgr_parser_create_desktop_file(mfx);
789         if (ret)
790                 return -1;
791         pkgmgr_parser_free_manifest_xml(mfx);
792         return 0;
793 }
794  * @endcode
795  */
796 int pkgmgr_parser_create_desktop_file(manifest_x *mfx);
797
798 /** @} */
799 #ifdef __cplusplus
800 }
801 #endif
802 #endif                          /* __PKGMGR_PARSER_H__ */