implement app screen reader
[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 *screenreader;
368         const char *mainapp;
369         const char *package;
370         const char *recentimage;
371         const char *launchcondition;
372         const char *indicatordisplay;
373         const char *portraitimg;
374         const char *landscapeimg;
375         const char *guestmode_visibility;
376         const char *app_component;
377         const char *permission_type;
378         const char *component_type;
379         const char *preload;
380         const char *submode;
381         const char *submode_mainid;
382         struct label_x *label;
383         struct icon_x *icon;
384         struct image_x *image;
385         struct appsvc_x *appsvc;
386         struct appcontrol_x *appcontrol;
387         struct category_x *category;
388         struct metadata_x *metadata;
389         struct permission_x *permission;
390         struct launchconditions_x *launchconditions;
391         struct notification_x *notification;
392         struct datashare_x *datashare;
393         struct uiapplication_x *prev;
394         struct uiapplication_x *next;
395 } uiapplication_x;
396
397 typedef struct serviceapplication_x {
398         const char *appid;
399         const char *exec;
400         const char *onboot;
401         const char *autorestart;
402         const char *enabled;
403         const char *type;
404         const char *package;
405         const char *permission_type;
406         struct label_x *label;
407         struct icon_x *icon;
408         struct appsvc_x *appsvc;
409         struct appcontrol_x *appcontrol;
410         struct category_x *category;
411         struct metadata_x *metadata;
412         struct permission_x *permission;
413         struct datacontrol_x *datacontrol;
414         struct launchconditions_x *launchconditions;
415         struct notification_x *notification;
416         struct datashare_x *datashare;
417         struct serviceapplication_x *prev;
418         struct serviceapplication_x *next;
419 } serviceapplication_x;
420
421 typedef struct daemon_x {
422         const char *name;
423         const char *text;
424         struct daemon_x *prev;
425         struct daemon_x *next;
426 } daemon_x;
427
428 typedef struct theme_x {
429         const char *name;
430         const char *text;
431         struct theme_x *prev;
432         struct theme_x *next;
433 } theme_x;
434
435 typedef struct font_x {
436         const char *name;
437         const char *text;
438         struct font_x *prev;
439         struct font_x *next;
440 } font_x;
441
442 typedef struct ime_x {
443         const char *name;
444         const char *text;
445         struct ime_x *prev;
446         struct ime_x *next;
447 } ime_x;
448
449 typedef struct manifest_x {
450         const char *package;            /**< package name*/
451         const char *version;            /**< package version*/
452         const char *installlocation;            /**< package install location*/
453         const char *ns;         /**<name space*/
454         const char *removable;          /**< package removable flag*/
455         const char *preload;            /**< package preload flag*/
456         const char *readonly;           /**< package readonly flag*/
457         const char *update;                     /**< package update flag*/
458         const char *appsetting;         /**< package app setting flag*/
459         const char *type;               /**< package type*/
460         const char *package_size;               /**< package size for external installation*/
461         const char *installed_time;             /**< installed time after finishing of installation*/
462         const char *installed_storage;          /**< package currently installed storage*/
463         const char *storeclient_id;             /**< id of store client for installed package*/
464         const char *mainapp_id;         /**< app id of main application*/
465         const char *package_url;                /**< app id of main application*/
466         const char *root_path;          /**< package root path*/
467         const char *csc_path;           /**< package csc path*/
468         const char *nodisplay_setting;          /**< package no display setting menu*/
469         struct icon_x *icon;            /**< package icon*/
470         struct label_x *label;          /**< package label*/
471         struct author_x *author;                /**< package author*/
472         struct description_x *description;              /**< package description*/
473         struct license_x *license;              /**< package license*/
474         struct privileges_x *privileges;        /**< package privileges*/
475         struct uiapplication_x *uiapplication;          /**< package's ui application*/
476         struct serviceapplication_x *serviceapplication;                /**< package's service application*/
477         struct daemon_x *daemon;                /**< package daemon*/
478         struct theme_x *theme;          /**< package theme*/
479         struct font_x *font;            /**< package font*/
480         struct ime_x *ime;              /**< package ime*/
481         struct compatibility_x *compatibility;          /**< package compatibility*/
482         struct deviceprofile_x *deviceprofile;          /**< package device profile*/
483 } manifest_x;
484
485 /**
486  * @fn char *pkgmgr_parser_get_manifest_file(const char *pkgid)
487  * @brief       This API gets the manifest file of the package.
488  *
489  * @par         This API is for package-manager installer backends.
490  * @par Sync (or) Async : Synchronous API
491  *
492  * @param[in]   pkgid   pointer to package ID
493  * @return      manifest file path on success, NULL on failure
494  * @pre         None
495  * @post                Free the manifest file pointer that is returned by API
496  * @code
497 static int get_manifest_file(const char *pkgid)
498 {
499         char *manifest = NULL;
500         manifest = pkgmgr_parser_get_manifest_file(pkgid);
501         if (manifest == NULL)
502                 return -1;
503         printf("Manifest File Path is %s\n", manifest);
504         free(manifest);
505         return 0;
506 }
507  * @endcode
508  */
509 char *pkgmgr_parser_get_manifest_file(const char *pkgid);
510
511 /**
512  * @fn int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[])
513  * @brief       This API parses the manifest file of the package after installation and stores the data in DB.
514  *
515  * @par         This API is for package-manager installer backends.
516  * @par Sync (or) Async : Synchronous API
517  *
518  * @param[in]   manifest        pointer to package manifest file
519  * @param[in]   tagv            array of xml tags or NULL
520  * @return      0 if success, error code(<0) if fail
521  * @retval      PMINFO_R_OK     success
522  * @retval      PMINFO_R_EINVAL invalid argument
523  * @retval      PMINFO_R_ERROR  internal error
524  * @pre         None
525  * @post                None
526  * @code
527 static int parse_manifest_file_for_installation(const char *manifest)
528 {
529         int ret = 0;
530         ret = pkgmgr_parser_parse_manifest_for_installation(manifest, NULL);
531         if (ret)
532                 return -1;
533         return 0;
534 }
535  * @endcode
536  */
537 int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[]);
538
539 /**
540  * @fn int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
541  * @brief       This API parses the manifest file of the package after upgrade and stores the data in DB.
542  *
543  * @par         This API is for package-manager installer backends.
544  * @par Sync (or) Async : Synchronous API
545  *
546  * @param[in]   manifest        pointer to package manifest file
547  * @param[in]   tagv            array of xml tags or NULL
548  * @return      0 if success, error code(<0) if fail
549  * @retval      PMINFO_R_OK     success
550  * @retval      PMINFO_R_EINVAL invalid argument
551  * @retval      PMINFO_R_ERROR  internal error
552  * @pre         None
553  * @post                None
554  * @code
555 static int parse_manifest_file_for_upgrade(const char *manifest)
556 {
557         int ret = 0;
558         ret = pkgmgr_parser_parse_manifest_for_upgrade(manifest, NULL);
559         if (ret)
560                 return -1;
561         return 0;
562 }
563  * @endcode
564  */
565 int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[]);
566
567 /**
568  * @fn int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, char *const tagv[])
569  * @brief       This API parses the manifest file of the package after uninstallation and deletes the data from DB.
570  *
571  * @par         This API is for package-manager installer backends.
572  * @par Sync (or) Async : Synchronous API
573  *
574  * @param[in]   manifest        pointer to package manifest file
575  * @param[in]   tagv            array of xml tags or NULL
576  * @return      0 if success, error code(<0) if fail
577  * @retval      PMINFO_R_OK     success
578  * @retval      PMINFO_R_EINVAL invalid argument
579  * @retval      PMINFO_R_ERROR  internal error
580  * @pre         None
581  * @post                None
582  * @code
583 static int parse_manifest_file_for_uninstallation(const char *manifest)
584 {
585         int ret = 0;
586         ret = pkgmgr_parser_parse_manifest_for_uninstallation(manifest, NULL);
587         if (ret)
588                 return -1;
589         return 0;
590 }
591  * @endcode
592  */
593 int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, char *const tagv[]);
594
595 /**
596  * @fn int pkgmgr_parser_parse_manifest_for_preload()
597  * @brief       This API update  preload information to DB.
598  *
599  * @par         This API is for package-manager installer backends.
600  * @par Sync (or) Async : Synchronous API
601  *
602  * @return      0 if success, error code(<0) if fail
603  * @retval      PMINFO_R_OK     success
604  * @retval      PMINFO_R_EINVAL invalid argument
605  * @retval      PMINFO_R_ERROR  internal error
606  * @pre         None
607  * @post                None
608  * @code
609 static int parser_parse_manifest_for_preload()
610 {
611         int ret = 0;
612         ret = pkgmgr_parser_parse_manifest_for_preload();
613         if (ret)
614                 return -1;
615         return 0;
616 }
617  * @endcode
618  */
619 int pkgmgr_parser_parse_manifest_for_preload();
620
621 /**
622  * @fn int pkgmgr_parser_check_manifest_validation(const char *manifest)
623  * @brief       This API validates the manifest file against the manifest schema.
624  *
625  * @par         This API is for package-manager installer backends.
626  * @par Sync (or) Async : Synchronous API
627  *
628  * @param[in]   manifest        pointer to package manifest file
629  * @return      0 if success, error code(<0) if fail
630  * @retval      PMINFO_R_OK     success
631  * @retval      PMINFO_R_EINVAL invalid argument
632  * @retval      PMINFO_R_ERROR  internal error
633  * @pre         None
634  * @post                None
635  * @code
636 static int validate_manifest_file(const char *manifest)
637 {
638         int ret = 0;
639         ret = pkgmgr_parser_check_manifest_validation(manifest);
640         if (ret)
641                 return -1;
642         return 0;
643 }
644  * @endcode
645  */
646 int pkgmgr_parser_check_manifest_validation(const char *manifest);
647
648 /**
649  * @fn void pkgmgr_parser_free_manifest_xml(manifest_x *mfx)
650  * @brief       This API will free the manifest pointer by recursively freeing all sub elements.
651  *
652  * @par         This API is for package-manager installer backends.
653  * @par Sync (or) Async : Synchronous API
654  *
655  * @param[in]   mfx     pointer to parsed manifest data
656  * @pre         pkgmgr_parser_process_manifest_xml()
657  * @post                None
658  * @code
659 static int parse_manifest_file(const char *manifest)
660 {
661         manifest_x *mfx = NULL
662         mfx = pkgmgr_parser_process_manifest_xml(manifest);
663         if (mfx == NULL)
664                 return -1;
665         printf("Parsing Manifest Success\n");
666         pkgmgr_parser_free_manifest_xml(mfx);
667         return 0;
668 }
669  * @endcode
670  */
671 void pkgmgr_parser_free_manifest_xml(manifest_x *mfx);
672
673 /**
674  * @fn manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest)
675  * @brief       This API parses the manifest file and stores all the data in the manifest structure.
676  *
677  * @par         This API is for package-manager installer backends.
678  * @par Sync (or) Async : Synchronous API
679  *
680  * @param[in]   manifest        pointer to package manifest file
681  * @return      manifest pointer on success, NULL on failure
682  * @pre         None
683  * @post                pkgmgr_parser_free_manifest_xml()
684  * @code
685 static int parse_manifest_file(const char *manifest)
686 {
687         manifest_x *mfx = NULL
688         mfx = pkgmgr_parser_process_manifest_xml(manifest);
689         if (mfx == NULL)
690                 return -1;
691         printf("Parsing Manifest Success\n");
692         pkgmgr_parser_free_manifest_xml(mfx);
693         return 0;
694 }
695  * @endcode
696  */
697 manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest);
698
699 /**
700  * @fn manifest_x *pkgmgr_parser_get_manifest_info(const char *pkigid)
701  * @brief       This API gets the manifest info from DB and stores all the data in the manifest structure.
702  *
703  * @par         This API is for package-manager installer backends.
704  * @par Sync (or) Async : Synchronous API
705  *
706  * @param[in]   pkgid   package id for package
707  * @return      manifest pointer on success, NULL on failure
708  * @pre         None
709  * @post                pkgmgr_parser_free_manifest_xml()
710  * @code
711 static int get_manifest_info(const char *pkgid)
712 {
713         manifest_x *mfx = NULL
714         mfx = pkgmgr_parser_get_manifest_info(pkgid);
715         if (mfx == NULL)
716                 return -1;
717         printf("Parsing Manifest Success\n");
718         pkgmgr_parser_free_manifest_xml(mfx);
719         return 0;
720 }
721  * @endcode
722  */
723 manifest_x *pkgmgr_parser_get_manifest_info(const char *pkigid);
724
725 /* These APIs are intended to call parser directly */
726 typedef int (*ps_iter_fn) (const char *tag, int type, void *userdata);
727
728 int pkgmgr_parser_has_parser(const char *tag, int *type);
729 int pkgmgr_parser_get_list(ps_iter_fn iter_fn, void *data);
730
731 /**
732  * @fn int pkgmgr_parser_run_parser_for_installation(xmlDocPtr docPtr, const char *tag, const char *pkgid)
733  * @brief       This API calls the parser directly by supplying the xml docptr. It is used during package installation
734  *
735  * @par         This API is for package-manager installer backends.
736  * @par Sync (or) Async : Synchronous API
737  *
738  * @param[in]   docPtr  XML doxument pointer
739  * @param[in]   tag             the xml tag corresponding to the parser that will parse the docPtr
740  * @param[in]   pkgid           the package id
741  * @return      0 if success, error code(<0) if fail
742  * @retval      PMINFO_R_OK     success
743  * @retval      PMINFO_R_EINVAL invalid argument
744  * @retval      PMINFO_R_ERROR  internal error
745  * @pre         None
746  * @post                None
747  * @code
748 static int parse_docptr_for_installation(xmlDocPtr docPtr)
749 {
750         int ret = 0;
751         ret = pkgmgr_parser_run_parser_for_installation(docPtr, "theme", "com.samsung.test");
752         if (ret)
753                 return -1;
754         return 0;
755 }
756  * @endcode
757  */
758 int pkgmgr_parser_run_parser_for_installation(xmlDocPtr docPtr, const char *tag, const char *pkgid);
759
760 /**
761  * @fn int pkgmgr_parser_run_parser_for_upgrade(xmlDocPtr docPtr, const char *tag, const char *pkgid)
762  * @brief       This API calls the parser directly by supplying the xml docptr. It is used during package upgrade
763  *
764  * @par         This API is for package-manager installer backends.
765  * @par Sync (or) Async : Synchronous API
766  *
767  * @param[in]   docPtr  XML doxument pointer
768  * @param[in]   tag             the xml tag corresponding to the parser that will parse the docPtr
769  * @param[in]   pkgid           the package id
770  * @return      0 if success, error code(<0) if fail
771  * @retval      PMINFO_R_OK     success
772  * @retval      PMINFO_R_EINVAL invalid argument
773  * @retval      PMINFO_R_ERROR  internal error
774  * @pre         None
775  * @post                None
776  * @code
777 static int parse_docptr_for_upgrade(xmlDocPtr docPtr)
778 {
779         int ret = 0;
780         ret = pkgmgr_parser_run_parser_for_upgrade(docPtr, "theme", "com.samsung.test");
781         if (ret)
782                 return -1;
783         return 0;
784 }
785  * @endcode
786  */
787 int pkgmgr_parser_run_parser_for_upgrade(xmlDocPtr docPtr, const char *tag, const char *pkgid);
788
789 /**
790  * @fn int pkgmgr_parser_run_parser_for_uninstallation(xmlDocPtr docPtr, const char *tag, const char *pkgid)
791  * @brief       This API calls the parser directly by supplying the xml docptr. It is used during package uninstallation
792  *
793  * @par         This API is for package-manager installer backends.
794  * @par Sync (or) Async : Synchronous API
795  *
796  * @param[in]   docPtr  XML doxument pointer
797  * @param[in]   tag             the xml tag corresponding to the parser that will parse the docPtr
798  * @param[in]   pkgid           the package id
799  * @return      0 if success, error code(<0) if fail
800  * @retval      PMINFO_R_OK     success
801  * @retval      PMINFO_R_EINVAL invalid argument
802  * @retval      PMINFO_R_ERROR  internal error
803  * @pre         None
804  * @post                None
805  * @code
806 static int parse_docptr_for_uninstallation(xmlDocPtr docPtr)
807 {
808         int ret = 0;
809         ret = pkgmgr_parser_run_parser_for_uninstallation(docPtr, "theme", "com.samsung.test");
810         if (ret)
811                 return -1;
812         return 0;
813 }
814  * @endcode
815  */
816 int pkgmgr_parser_run_parser_for_uninstallation(xmlDocPtr docPtr, const char *tag, const char *pkgid);
817
818
819
820 /**
821  * @fn int pkgmgr_parser_create_desktop_file(manifest_x *mfx)
822  * @brief       This API generates the application desktop file
823  *
824  * @par         This API is for package-manager installer backends.
825  * @par Sync (or) Async : Synchronous API
826  *
827  * @param[in]   mfx     manifest pointer
828  * @return      0 if success, error code(<0) if fail
829  * @retval      PMINFO_R_OK     success
830  * @retval      PMINFO_R_EINVAL invalid argument
831  * @retval      PMINFO_R_ERROR  internal error
832  * @pre         pkgmgr_parser_process_manifest_xml()
833  * @post        pkgmgr_parser_free_manifest_xml()
834  * @code
835 static int create_desktop_file(char *manifest)
836 {
837         int ret = 0;
838         manifest_x *mfx = NULL;
839         mfx = pkgmgr_parser_process_manifest_xml(manifest);
840         ret = pkgmgr_parser_create_desktop_file(mfx);
841         if (ret)
842                 return -1;
843         pkgmgr_parser_free_manifest_xml(mfx);
844         return 0;
845 }
846  * @endcode
847  */
848 int pkgmgr_parser_create_desktop_file(manifest_x *mfx);
849
850 /** @} */
851 #ifdef __cplusplus
852 }
853 #endif
854 #endif                          /* __PKGMGR_PARSER_H__ */