tizen 2.3.1 release
[framework/appfw/pkgmgr-info.git] / include / pkgmgrinfo_basic.h
1 /*
2  * pkgmgrinfo-basic
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
24 #ifndef __PKGMGRINFO_BASIC_H__
25 #define __PKGMGRINFO_BASIC_H__
26
27 #define DEFAULT_LOCALE          "No Locale"
28 #define PKG_STRING_LEN_MAX 1024
29 #define PKGMGR_PARSER_EMPTY_STR         ""
30
31 typedef struct metadata_x {
32         const char *key;
33         const char *value;
34         struct metadata_x *prev;
35         struct metadata_x *next;
36 } metadata_x;
37
38 typedef struct privilege_x {
39         const char *text;
40         struct privilege_x *prev;
41         struct privilege_x *next;
42 } privilege_x;
43
44 typedef struct privileges_x {
45         struct privilege_x *privilege;
46         struct privileges_x *prev;
47         struct privileges_x *next;
48 } privileges_x;
49
50 typedef struct permission_x {
51         const char *type;
52         const char *value;
53         struct permission_x *prev;
54         struct permission_x *next;
55 } permission_x;
56
57 typedef struct icon_x {
58         const char *name;
59         const char *text;
60         const char *lang;
61         const char *section;
62         const char *size;
63         const char *resolution;
64         struct icon_x *prev;
65         struct icon_x *next;
66 } icon_x;
67
68 typedef struct image_x {
69         const char *name;
70         const char *text;
71         const char *lang;
72         const char *section;
73         struct image_x *prev;
74         struct image_x *next;
75 } image_x;
76
77 typedef struct allowed_x {
78         const char *name;
79         const char *text;
80         struct allowed_x *prev;
81         struct allowed_x *next;
82 } allowed_x;
83
84 typedef struct request_x {
85         const char *text;
86         struct request_x *prev;
87         struct request_x *next;
88 } request_x;
89
90 typedef struct define_x {
91         const char *path;
92         struct allowed_x *allowed;
93         struct request_x *request;
94         struct define_x *prev;
95         struct define_x *next;
96 } define_x;
97
98 typedef struct datashare_x {
99         struct define_x *define;
100         struct request_x *request;
101         struct datashare_x *prev;
102         struct datashare_x *next;
103 } datashare_x;
104
105 typedef struct description_x {
106         const char *name;
107         const char *text;
108         const char *lang;
109         struct description_x *prev;
110         struct description_x *next;
111 } description_x;
112
113 typedef struct registry_x {
114         const char *name;
115         const char *text;
116         struct registry_x *prev;
117         struct registry_x *next;
118 } registry_x;
119
120 typedef struct database_x {
121         const char *name;
122         const char *text;
123         struct database_x *prev;
124         struct database_x *next;
125 } database_x;
126
127 typedef struct layout_x {
128         const char *name;
129         const char *text;
130         struct layout_x *prev;
131         struct layout_x *next;
132 } layout_x;
133
134 typedef struct label_x {
135         const char *name;
136         const char *text;
137         const char *lang;
138         struct label_x *prev;
139         struct label_x *next;
140 } label_x;
141
142 typedef struct author_x {
143         const char *email;
144         const char *href;
145         const char *text;
146         const char *lang;
147         struct author_x *prev;
148         struct author_x *next;
149 } author_x;
150
151 typedef struct license_x {
152         const char *text;
153         const char *lang;
154         struct license_x *prev;
155         struct license_x *next;
156 } license_x;
157
158 typedef struct operation_x {
159         const char *name;
160         const char *text;
161         struct operation_x *prev;
162         struct operation_x *next;
163 } operation_x;
164
165 typedef struct uri_x {
166         const char *name;
167         const char *text;
168         struct uri_x *prev;
169         struct uri_x *next;
170 } uri_x;
171
172 typedef struct mime_x {
173         const char *name;
174         const char *text;
175         struct mime_x *prev;
176         struct mime_x *next;
177 } mime_x;
178
179 typedef struct subapp_x {
180         const char *name;
181         const char *text;
182         struct subapp_x *prev;
183         struct subapp_x *next;
184 } subapp_x;
185
186 typedef struct condition_x {
187         const char *name;
188         const char *text;
189         struct condition_x *prev;
190         struct condition_x *next;
191 } condition_x;
192
193 typedef struct notification_x {
194         const char *name;
195         const char *text;
196         struct notification_x *prev;
197         struct notification_x *next;
198 } notification_x;
199
200 typedef struct appsvc_x {
201         const char *text;
202         struct operation_x *operation;
203         struct uri_x *uri;
204         struct mime_x *mime;
205         struct subapp_x *subapp;
206         struct appsvc_x *prev;
207         struct appsvc_x *next;
208 } appsvc_x;
209
210 typedef struct category_x{
211         const char *name;
212         struct category_x *prev;
213         struct category_x *next;
214 } category_x;
215
216 typedef struct launchconditions_x {
217         const char *text;
218         struct condition_x *condition;
219         struct launchconditions_x *prev;
220         struct launchconditions_x *next;
221 } launchconditions_x;
222
223 typedef struct compatibility_x {
224         const char *name;
225         const char *text;
226         struct compatibility_x *prev;
227         struct compatibility_x *next;
228 }compatibility_x;
229
230 typedef struct deviceprofile_x {
231         const char *name;
232         const char *text;
233         struct deviceprofile_x *prev;
234         struct deviceprofile_x *next;
235 }deviceprofile_x;
236
237 typedef struct resolution_x {
238         const char *mimetype;
239         const char *urischeme;
240         struct resolution_x *prev;
241         struct resolution_x *next;
242 } resolution_x;
243
244 typedef struct capability_x {
245         const char *operationid;
246         const char *access;
247         struct resolution_x *resolution;
248         struct capability_x *prev;
249         struct capability_x *next;
250 } capability_x;
251
252 typedef struct datacontrol_x {
253         const char *providerid;
254         const char *access;
255         const char *type;
256         struct datacontrol_x *prev;
257         struct datacontrol_x *next;
258 } datacontrol_x;
259
260 typedef struct uiapplication_x {
261         const char *appid;
262         const char *exec;
263         const char *ambient_support;
264         const char *nodisplay;
265         const char *multiple;
266         const char *taskmanage;
267         const char *enabled;
268         const char *type;
269         const char *categories;
270         const char *extraid;
271         const char *hwacceleration;
272         const char *screenreader;
273         const char *mainapp;
274         const char *package;
275         const char *recentimage;
276         const char *launchcondition;
277         const char *indicatordisplay;
278         const char *portraitimg;
279         const char *landscapeimg;
280         const char *effectimage_type;
281         const char *guestmode_visibility;
282         const char *app_component;
283         const char *permission_type;
284         const char *component_type;
285         const char *preload;
286         const char *submode;
287         const char *submode_mainid;
288         const char *installed_storage;
289         const char *process_pool;
290         const char *autorestart;
291         const char *onboot;
292         const char *multi_instance;
293         const char *multi_instance_mainid;
294         const char *multi_window;
295         const char *support_disable;
296         const char *ui_gadget;
297         const char *removable;
298         const char *support_mode;
299         const char *support_feature;
300         const char *satui_label;
301         const char *package_type;
302         const char *package_system;
303         const char *package_installed_time;
304         struct label_x *label;
305         struct icon_x *icon;
306         struct image_x *image;
307         struct appsvc_x *appsvc;
308         struct category_x *category;
309         struct metadata_x *metadata;
310         struct permission_x *permission;
311         struct launchconditions_x *launchconditions;
312         struct notification_x *notification;
313         struct datashare_x *datashare;
314         struct datacontrol_x *datacontrol;
315         struct uiapplication_x *prev;
316         struct uiapplication_x *next;
317 } uiapplication_x;
318
319 typedef struct serviceapplication_x {
320         const char *appid;
321         const char *exec;
322         const char *onboot;
323         const char *autorestart;
324         const char *enabled;
325         const char *type;
326         const char *package;
327         const char *permission_type;
328         struct label_x *label;
329         struct icon_x *icon;
330         struct appsvc_x *appsvc;
331         struct category_x *category;
332         struct metadata_x *metadata;
333         struct permission_x *permission;
334         struct datacontrol_x *datacontrol;
335         struct launchconditions_x *launchconditions;
336         struct notification_x *notification;
337         struct datashare_x *datashare;
338         struct serviceapplication_x *prev;
339         struct serviceapplication_x *next;
340 } serviceapplication_x;
341
342 typedef struct daemon_x {
343         const char *name;
344         const char *text;
345         struct daemon_x *prev;
346         struct daemon_x *next;
347 } daemon_x;
348
349 typedef struct theme_x {
350         const char *name;
351         const char *text;
352         struct theme_x *prev;
353         struct theme_x *next;
354 } theme_x;
355
356 typedef struct font_x {
357         const char *name;
358         const char *text;
359         struct font_x *prev;
360         struct font_x *next;
361 } font_x;
362
363 typedef struct ime_x {
364         const char *name;
365         const char *text;
366         struct ime_x *prev;
367         struct ime_x *next;
368 } ime_x;
369
370 typedef struct manifest_x {
371         const char *package;            /**< package name*/
372         const char *version;            /**< package version*/
373         const char *installlocation;            /**< package install location*/
374         const char *ns;         /**<name space*/
375         const char *removable;          /**< package removable flag*/
376         const char *preload;            /**< package preload flag*/
377         const char *readonly;           /**< package readonly flag*/
378         const char *update;                     /**< package update flag*/
379         const char *appsetting;         /**< package app setting flag*/
380         const char *system;             /**< package system flag*/
381         const char *type;               /**< package type*/
382         const char *package_size;               /**< package size for external installation*/
383         const char *package_total_size;         /**< package size for total*/
384         const char *package_data_size;          /**< package size for data*/
385         const char *installed_time;             /**< installed time after finishing of installation*/
386         const char *installed_storage;          /**< package currently installed storage*/
387         const char *storeclient_id;             /**< id of store client for installed package*/
388         const char *mainapp_id;         /**< app id of main application*/
389         const char *package_url;                /**< app id of main application*/
390         const char *root_path;          /**< package root path*/
391         const char *csc_path;           /**< package csc path*/
392         const char *nodisplay_setting;          /**< package no display setting menu*/
393         const char *support_disable;            /**< package support disable flag*/
394         const char *mother_package;             /**< package is mother package*/
395         const char *support_mode;               /**< package support mode*/
396         const char *support_reset;              /**< package support reset*/
397         const char *use_reset;          /**< package use reset*/
398         const char *groupid;            /**< package groupid*/
399         const char *hash;                       /**<manifest file's hash */
400         struct icon_x *icon;            /**< package icon*/
401         struct label_x *label;          /**< package label*/
402         struct author_x *author;                /**< package author*/
403         struct description_x *description;              /**< package description*/
404         struct license_x *license;              /**< package license*/
405         struct privileges_x *privileges;        /**< package privileges*/
406         struct uiapplication_x *uiapplication;          /**< package's ui application*/
407         struct serviceapplication_x *serviceapplication;                /**< package's service application*/
408         struct daemon_x *daemon;                /**< package daemon*/
409         struct theme_x *theme;          /**< package theme*/
410         struct font_x *font;            /**< package font*/
411         struct ime_x *ime;              /**< package ime*/
412         struct compatibility_x *compatibility;          /**< package compatibility*/
413         struct deviceprofile_x *deviceprofile;          /**< package device profile*/
414 } manifest_x;
415
416 /**
417  * @brief List definitions.
418  * All lists are doubly-linked, the last element is stored to list pointer,
419  * which means that lists must be looped using the prev pointer, or by
420  * calling LISTHEAD first to go to start in order to use the next pointer.
421  */
422
423  /**
424  * @brief Convinience Macro to add node in list
425  */
426
427 #define LISTADD(list, node)                     \
428     do {                                        \
429         (node)->prev = (list);                  \
430         if (list) (node)->next = (list)->next;  \
431         else (node)->next = NULL;               \
432         if (list) (list)->next = (node);        \
433         (list) = (node);                        \
434     } while (0);
435
436  /**
437  * @brief Convinience Macro to add one node to another node
438  */
439 #define NODEADD(node1, node2)                                   \
440     do {                                                        \
441         (node2)->prev = (node1);                                \
442         (node2)->next = (node1)->next;                          \
443         if ((node1)->next) (node1)->next->prev = (node2);       \
444         (node1)->next = (node2);                                \
445     } while (0);
446
447  /**
448  * @brief Convinience Macro to concatenate two lists
449  */
450 #define LISTCAT(list, first, last)              \
451     if ((first) && (last)) {                    \
452         (first)->prev = (list);                 \
453         (list) = (last);                        \
454     }
455
456  /**
457  * @brief Convinience Macro to delete node from list
458  */
459 #define LISTDEL(list, node)                                     \
460     do {                                                        \
461         if ((node)->prev) (node)->prev->next = (node)->next;    \
462         if ((node)->next) (node)->next->prev = (node)->prev;    \
463         if (!((node)->prev) && !((node)->next)) (list) = NULL;  \
464     } while (0);
465
466  /**
467  * @brief Convinience Macro to get list head
468  */
469 #define LISTHEAD(list, node)                                    \
470     for ((node) = (list); (node)->prev; (node) = (node)->prev)
471
472 #define SAFE_LISTHEAD(list, node)        do { \
473         if (list) { \
474                 for ((node) = (list); (node)->prev; (node) = (node)->prev); \
475                 list = node; \
476         } \
477 } while (0)
478
479  /**
480  * @brief Convinience Macro to get list tail
481  */
482 #define LISTTAIL(list, node)                                    \
483     for ((node) = (list); (node)->next; (node) = (node)->next)
484
485 #define FREE_AND_STRDUP(from, to) do { \
486                 if (to) free((void *)to); \
487                 if (from) to = strdup(from); \
488         } while (0)
489
490  /**
491  * @brief Convinience Macro to free pointer
492  */
493 #define FREE_AND_NULL(ptr) do { \
494                 if (ptr) { \
495                         free((void *)ptr); \
496                         ptr = NULL; \
497                 } \
498         } while (0)
499
500 void _pkgmgrinfo_basic_free_manifest_x(manifest_x *mfx);
501
502 char* pkgmgrinfo_basic_generate_hash_for_file(const char* file);
503
504 #endif  /* __PKGMGRINFO_BASIC_H__ */