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