e138d145d42ef8151edd14a171ded05a2f484b3f
[platform/core/appfw/pkgmgr-info.git] / include / pkgmgrinfo_type.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 __PKGMGRINFO_TYPE_H__
24 #define __PKGMGRINFO_TYPE_H__
25
26 #include <sys/types.h>
27
28 /* app background category value */
29 #define APP_BG_CATEGORY_USER_DISABLE_FALSE_VAL          0x00000
30 #define APP_BG_CATEGORY_USER_DISABLE_TRUE_VAL           0x00001
31 #define APP_BG_CATEGORY_MEDIA_VAL                       0x00002
32 #define APP_BG_CATEGORY_DOWNLOAD_VAL                    0x00004
33 #define APP_BG_CATEGORY_BGNETWORK_VAL                   0x00008
34 #define APP_BG_CATEGORY_LOCATION_VAL                    0x00010
35 #define APP_BG_CATEGORY_SENSOR_VAL                      0x00020
36 #define APP_BG_CATEGORY_IOTCOMM_VAL                     0x00040
37 #define APP_BG_CATEGORY_SYSTEM_VAL                      0x00080
38
39 #define APP_BG_CATEGORY_USER_DISABLE_FALSE_STR          "enable"
40 #define APP_BG_CATEGORY_USER_DISABLE_TRUE_STR           "disable"
41 #define APP_BG_CATEGORY_MEDIA_STR                       "media"
42 #define APP_BG_CATEGORY_DOWNLOAD_STR                    "download"
43 #define APP_BG_CATEGORY_BGNETWORK_STR                   "background-network"
44 #define APP_BG_CATEGORY_LOCATION_STR                    "location"
45 #define APP_BG_CATEGORY_SENSOR_STR                      "sensor"
46 #define APP_BG_CATEGORY_IOTCOMM_STR                     "iot-communication"
47 #define APP_BG_CATEGORY_SYSTEM                          "system"
48
49 /* Integer property for support-mode */
50 #define APP_SUPPORT_MODE_ULTRA_POWER_SAVING_VAL         0x00001
51 #define APP_SUPPORT_MODE_COOL_DOWN_VAL                          0x00002
52 #define APP_SUPPORT_MODE_SCREEN_READER_VAL                      0x00004
53
54 /* String property for support-mode */
55 #define APP_SUPPORT_MODE_ULTRA_POWER_SAVING_STR         "ultra-power-saving"
56 #define APP_SUPPORT_MODE_COOL_DOWN_STR          "cool-down"
57 #define APP_SUPPORT_MODE_SCREEN_READER_STR              "screen-reader"
58
59 /**
60  * @brief A type to retrieve uid information from the manifest handle
61  */
62 typedef struct {
63         uid_t uid;
64 } pkgmgrinfo_uidinfo_t;
65
66 /**
67  * @brief A handle to insert certificate information
68  */
69 typedef void *pkgmgrinfo_instcertinfo_h;
70
71 /**
72  * @brief Certificate Types to be used for setting information
73  */
74 typedef enum {
75         PMINFO_SET_AUTHOR_ROOT_CERT = 0,                /**< Author Root Certificate*/
76         PMINFO_SET_AUTHOR_INTERMEDIATE_CERT = 1,                /**< Author Intermediate Certificate*/
77         PMINFO_SET_AUTHOR_SIGNER_CERT = 2,              /**< Author Signer Certificate*/
78         PMINFO_SET_DISTRIBUTOR_ROOT_CERT = 3,           /**< Distributor Root Certificate*/
79         PMINFO_SET_DISTRIBUTOR_INTERMEDIATE_CERT = 4,           /**< Distributor Intermediate Certificate*/
80         PMINFO_SET_DISTRIBUTOR_SIGNER_CERT = 5,         /**< Distributor Signer Certificate*/
81         PMINFO_SET_DISTRIBUTOR2_ROOT_CERT = 6,          /**< End Entity Root Certificate*/
82         PMINFO_SET_DISTRIBUTOR2_INTERMEDIATE_CERT = 7,          /**< End Entity Intermediate Certificate*/
83         PMINFO_SET_DISTRIBUTOR2_SIGNER_CERT = 8,                /**< End Entity Signer Certificate*/
84 } pkgmgrinfo_instcert_type;
85
86 typedef enum {
87         PMINFO_CERT_COMPARE_MATCH,
88         PMINFO_CERT_COMPARE_MISMATCH,
89         PMINFO_CERT_COMPARE_LHS_NO_CERT,
90         PMINFO_CERT_COMPARE_RHS_NO_CERT,
91         PMINFO_CERT_COMPARE_BOTH_NO_CERT,
92         PMINFO_CERT_COMPARE_ERROR,
93 } pkgmgrinfo_cert_compare_result_type_e;
94
95 typedef enum {
96         PMINFO_APPINFO_GET_BASICINFO = 0x0001,
97         PMINFO_APPINFO_GET_LABEL = 0x0002,
98         PMINFO_APPINFO_GET_ICON = 0x0004,
99         PMINFO_APPINFO_GET_CATEGORY = 0x0008,
100         PMINFO_APPINFO_GET_APP_CONTROL = 0x0010,
101         PMINFO_APPINFO_GET_METADATA = 0x0020,
102         PMINFO_APPINFO_GET_SPLASH_SCREEN = 0x0040,
103         PMINFO_APPINFO_GET_ALL = 0x007F
104 } pkgmgrinfo_appinfo_get_option;
105
106 typedef enum {
107         PMINFO_PKGINFO_GET_BASICINFO = 0x0001,
108         PMINFO_PKGINFO_GET_LABEL = 0x0002,
109         PMINFO_PKGINFO_GET_ICON = 0x0004,
110         PMINFO_PKGINFO_GET_AUTHOR = 0x0008,
111         PMINFO_PKGINFO_GET_DESCRIPTION = 0x0010,
112         PMINFO_PKGINFO_GET_PRIVILEGE = 0x0020,
113         PMINFO_PKGINFO_GET_ALL = 0x003F
114 } pkgmgrinfo_pkginfo_get_option;
115
116 /**
117  * @brief API return values
118  */
119 enum {
120         PMINFO_R_ENOENT = -3,           /**< No result */
121         PMINFO_R_EINVAL = -2,           /**< Invalid argument */
122         PMINFO_R_ERROR = -1,            /**< General error */
123         PMINFO_R_OK = 0                 /**< General success */
124 };
125
126 /**
127  * @brief Value to be used when filtering based on install location
128  */
129 #define PMINFO_PKGINFO_INSTALL_LOCATION_AUTO            "LOCATION_AUTO"
130
131 /**
132  * @brief Value to be used when filtering based on install location
133  */
134 #define PMINFO_PKGINFO_INSTALL_LOCATION_INTERNAL        "LOCATION_INTERNAL"
135
136 /**
137  * @brief Value to be used when filtering based on install location
138  */
139 #define PMINFO_PKGINFO_INSTALL_LOCATION_EXTERNAL        "LOCATION_EXTERNAL"
140
141 /**
142  * @brief Value to be used when get/set update information
143  */
144 #define PMINFO_UPDATEINFO_TYPE_FORCE    "force"
145
146 /**
147  * @brief Value to be used when get/set update information
148  */
149 #define PMINFO_UPDATEINFO_TYPE_OPTIONAL "optional"
150
151 /**
152  * @brief Value to be used when get/set update information
153  */
154 #define PMINFO_UPDATEINFO_TYPE_NONE     "none"
155
156 typedef enum {
157         PMINFO_UPDATEINFO_NONE = 0,             /**<No update info exists*/
158         PMINFO_UPDATEINFO_FORCE,                /**<Don't launch application if it's not updated*/
159         PMINFO_UPDATEINFO_OPTIONAL              /**<Update exists but not force user to update it*/
160 } pkgmgrinfo_updateinfo_update_type;
161
162 typedef enum {
163         PMINFO_HWACCELERATION_OFF = 0,          /**< Don't use hardware acceleration*/
164         PMINFO_HWACCELERATION_ON = 1,           /**< Use hardware acceleration*/
165         PMINFO_HWACCELERATION_DEFAULT = 2               /**< Follow system setting for hardware acceleration */
166 } pkgmgrinfo_app_hwacceleration;
167
168 typedef enum {
169         PMINFO_SCREENREADER_OFF = 0,            /**< Don't use screen reader*/
170         PMINFO_SCREENREADER_ON = 1,             /**< Use screen reader*/
171         PMINFO_SCREENREADER_USE_SYSTEM_SETTING = 2              /**< Follow system setting for screen reader */
172 } pkgmgrinfo_app_screenreader;
173
174 typedef enum {
175         PMINFO_RECENTIMAGE_USE_ICON = 0,                /**<Use icon for recent image*/
176         PMINFO_RECENTIMAGE_USE_CAPTURE = 1,             /**< Use capture for recent image*/
177         PMINFO_RECENTIMAGE_USE_NOTHING = 2              /**< Don't use recent image */
178 } pkgmgrinfo_app_recentimage;
179
180 /**
181  * @brief A handle to get package information
182  */
183 typedef void *pkgmgrinfo_pkginfo_h;
184
185 /**
186  * @brief A handle to get application information
187  */
188 typedef void *pkgmgrinfo_appinfo_h;
189
190 /**
191  * @brief A handle to get certificate information
192  */
193 typedef void *pkgmgrinfo_certinfo_h;
194
195 /**
196  * @brief A handle to filter package information
197  */
198 typedef void *pkgmgrinfo_pkginfo_filter_h;
199
200 /**
201  * @brief A handle to get/set package update information
202  */
203 typedef void *pkgmgrinfo_updateinfo_h;
204
205 /**
206  * @brief A handle to filter application information
207  */
208 typedef void *pkgmgrinfo_appinfo_filter_h;
209
210 /**
211  * @brief A handle to filter application metadata  information
212  */
213 typedef void *pkgmgrinfo_appinfo_metadata_filter_h;
214
215 /**
216  * @brief A handle to get appcontrol information
217  */
218 typedef void *pkgmgrinfo_appcontrol_h;
219
220 /**
221  * @brief A handle to get package archive information
222  */
223 typedef void *pkgmgrinfo_archiveinfo_h;
224
225 /**
226  * @brief type definition.
227  */
228 typedef void pkgmgrinfo_client;
229
230 /**
231  * @fn int (*pkgmgrinfo_foreach_updateinfo_cb) (const pkgmgrinfo_updateinfo_h handle, void *user_data)
232  *
233  * @brief Specifies the type of function passed to pkgmgrinfo_updateinfo_foreach_updateinfo()
234  *
235  * @param[in] handle the package update info handle
236  * @param[in] user_data user data passed to pkgmgrinfo_foreach_pkg_update info()
237  *
238  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
239  *
240  * @see  pkgmgrinfo_updateinfo_foreach_updateinfo()
241  */
242 typedef int (*pkgmgrinfo_foreach_updateinfo_cb) (const pkgmgrinfo_updateinfo_h handle,
243                                                         void *user_data);
244
245 /**
246  * @fn int (*pkgmgrinfo_pkg_list_cb) (const pkgmgrinfo_pkginfo_h handle, void *user_data)
247  *
248  * @brief Specifies the type of function passed to pkgmgrinfo_pkginfo_get_list(), pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
249  *
250  * @param[in] handle the pkginfo handle
251  * @param[in] user_data user data passed to pkgmgrinfo_pkginfo_get_list(), pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
252  *
253  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
254  *
255  * @see  pkgmgrinfo_pkginfo_get_list()
256  * @see  pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
257  */
258 typedef int (*pkgmgrinfo_pkg_list_cb) (const pkgmgrinfo_pkginfo_h handle,
259                                                         void *user_data);
260
261 /**
262  * @fn int (*pkgmgrinfo_app_list_cb) (const pkgmgrinfo_appinfo_h handle, void *user_data)
263  *
264  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_get_list(), pkgmgrinfo_appinfo_filter_foreach_appinfo(), pkgmgrinfo_appinfo_metadata_filter_foreach()
265  *
266  * @param[in] handle the appinfo handle
267  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_get_list(), pkgmgrinfo_appinfo_filter_foreach_appinfo(), pkgmgrinfo_appinfo_metadata_filter_foreach()
268  *
269  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
270  *
271  * @see  pkgmgrinfo_appinfo_get_list()
272  * @see  pkgmgrinfo_appinfo_filter_foreach_appinfo()
273  * @see  pkgmgrinfo_appinfo_metadata_filter_foreach()
274  */
275 typedef int (*pkgmgrinfo_app_list_cb) (const pkgmgrinfo_appinfo_h handle,
276                                                         void *user_data);
277
278 /**
279  * @fn int (*pkgmgrinfo_app_category_list_cb) (const char *category_name, void *user_data)
280  *
281  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_category()
282  *
283  * @param[in] category_name the name of the category
284  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_category()
285  *
286  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
287  *
288  * @see  pkgmgrinfo_appinfo_foreach_category()
289  */
290 typedef int (*pkgmgrinfo_app_category_list_cb) (const char *category_name,
291                                                         void *user_data);
292
293 /**
294  * @fn int (*pkgmgrinfo_pkg_privilege_list_cb) (const char *privilege_name, void *user_data)
295  *
296  * @brief Specifies the type of function passed to pkgmgrinfo_pkginfo_foreach_privilege()
297  *
298  * @param[in] privilege_name the name of the privilege
299  * @param[in] user_data user data passed to pkgmgrinfo_pkginfo_foreach_privilege()
300  *
301  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
302  *
303  * @see  pkgmgrinfo_pkginfo_foreach_privilege()
304  */
305 typedef int (*pkgmgrinfo_pkg_privilege_list_cb) (const char *privilege_name,
306                                                         void *user_data);
307
308 /**
309  * @fn int (*pkgmgrinfo_app_metadata_list_cb) (const char *metadata_key, const char *metadata_value, void *user_data)
310  *
311  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_metadata()
312  *
313  * @param[in] metadata_name the name of the metadata
314  * @param[in] metadata_value the value of the metadata
315  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_metadata()
316  *
317  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
318  *
319  * @see  pkgmgrinfo_appinfo_foreach_metadata()
320  */
321 typedef int (*pkgmgrinfo_app_metadata_list_cb) (const char *metadata_key,
322                                                         const char *metadata_value, void *user_data);
323
324 /**
325  * @fn int (*pkgmgrinfo_app_control_list_cb) (pkgmgrinfo_appcontrol_h handle, void *user_data)
326  *
327  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_appcontrol()
328  *
329  * @param[in] handle the appcontrol handle to be used to get operation, uri and mime info
330  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_appcontrol()
331  *
332  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
333  *
334  * @see  pkgmgrinfo_appinfo_foreach_appcontrol()
335  */
336 typedef int (*pkgmgrinfo_app_control_list_cb) (const char *operation, const char *uri, const char *mime,
337                                                         void *user_data);
338
339 /**
340  * @fn int (*pkgmgrinfo_app_background_category_list_cb) (const char *category_name, void *user_data)
341  *
342  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_background_category()
343  *
344  * @param[in] category_name retrieved background category name
345  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_background_category
346  *
347  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
348  *
349  * @see  pkgmgrinfo_appinfo_foreach_background_category()
350  */
351 typedef int (*pkgmgrinfo_app_background_category_list_cb) (const char *category_name, void *user_data);
352
353 /**
354  * @fn int (*pkgmgrinfo_app_splash_screen_list_cb)(const char *src,
355  *              const char *type, const char *orientation,
356  *              const char *indicatordisplay, const char *color_depth,
357  *              void *user_data);
358  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_splash_screen()
359  *
360  * @param[in] src the source of the splashscreen
361  * @param[in] type the type of the splashscreen
362  * @param[in] orientation the orientation of the splashscreen
363  * @param[in] indicatordisplay the indicator-display of the splashscreen
364  * @param[in] operation the app-control operation of the splashscreen
365  * @param[in] color_depth the color-depth of the splashscreen
366  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_splash_screen()
367  *
368  * @return 0 if success, negative value(<0) if fail, Callback is not called if return value is negative.\n
369  *
370  * @see pkgmgrinfo_appinfo_foreach_splash_screen()
371  */
372 typedef int (*pkgmgrinfo_app_splash_screen_list_cb)(const char *src,
373                 const char *type, const char *orientation,
374                 const char *indicatordisplay, const char *operation,
375                 const char *color_depth, void *user_data);
376
377 /**
378  * @brief Install Location Types
379  */
380 typedef enum {
381         PMINFO_INSTALL_LOCATION_AUTO = 0,               /**< Auto*/
382         PMINFO_INSTALL_LOCATION_INTERNAL_ONLY,          /**< Internal Installation*/
383         PMINFO_INSTALL_LOCATION_PREFER_EXTERNAL,                /**< External Installation*/
384 } pkgmgrinfo_install_location;
385
386 /**
387  * @brief Application Component Types
388  */
389 typedef enum {
390         PMINFO_ALL_APP = 0,     /**< All Application*/
391         PMINFO_UI_APP,          /**< UI Application*/
392         PMINFO_SVC_APP,         /**< Service Application*/
393         PMINFO_WIDGET_APP,      /**< Widget Application*/
394         PMINFO_WATCH_APP,  /**< Watch Application*/
395 } pkgmgrinfo_app_component;
396
397 /**
398  * @brief Application Storage Types
399  */
400 typedef enum {
401         PMINFO_INTERNAL_STORAGE = 0,            /**< Internal Storage*/
402         PMINFO_EXTERNAL_STORAGE = 1,            /**< External Storage*/
403         PMINFO_EXTENDED_STORAGE = 2,            /**< Extended Storage*/
404 } pkgmgrinfo_installed_storage;
405
406 /**
407  * @brief Certificate Types to be used for getting information
408  */
409 typedef enum {
410         PMINFO_AUTHOR_ROOT_CERT = 0,            /**< Author Root Certificate*/
411         PMINFO_AUTHOR_INTERMEDIATE_CERT = 1,            /**< Author Intermediate Certificate*/
412         PMINFO_AUTHOR_SIGNER_CERT = 2,          /**< Author Signer Certificate*/
413         PMINFO_DISTRIBUTOR_ROOT_CERT = 3,               /**< Distributor Root Certificate*/
414         PMINFO_DISTRIBUTOR_INTERMEDIATE_CERT = 4,               /**< Distributor Intermediate Certificate*/
415         PMINFO_DISTRIBUTOR_SIGNER_CERT = 5,             /**< Distributor Signer Certificate*/
416         PMINFO_DISTRIBUTOR2_ROOT_CERT = 6,              /**< End Entity Root Certificate*/
417         PMINFO_DISTRIBUTOR2_INTERMEDIATE_CERT = 7,              /**< End Entity Intermediate Certificate*/
418         PMINFO_DISTRIBUTOR2_SIGNER_CERT = 8,            /**< End Entity Signer Certificate*/
419 } pkgmgrinfo_cert_type;
420
421 /**
422  * @brief version comparison Types
423  */
424 typedef enum {
425         PMINFO_VERSION_OLD = -1,
426         PMINFO_VERSION_SAME,
427         PMINFO_VERSION_NEW,
428 } pkgmgrinfo_version_compare_type;
429
430 /**
431  * @brief Install Location Types to be used when setting data in DB
432  */
433 typedef enum {
434         INSTALL_INTERNAL = 0,           /**< Internal Installation*/
435         INSTALL_EXTERNAL,               /**< External Installation*/
436 } INSTALL_LOCATION;
437
438 /**
439  * @brief permission Types
440  */
441 typedef enum {
442         PMINFO_PERMISSION_NORMAL = 0,           /**< permission normal*/
443         PMINFO_PERMISSION_SIGNATURE,            /**< permission type is signature*/
444         PMINFO_PERMISSION_PRIVILEGE,            /**< permission type is privilege*/
445 } pkgmgrinfo_permission_type;
446
447 #endif