Add pkg update info features
[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_LABEL = 0x0001,
97         PMINFO_APPINFO_GET_ICON = 0x0002,
98         PMINFO_APPINFO_GET_CATEGORY = 0x0004,
99         PMINFO_APPINFO_GET_APP_CONTROL = 0x0008,
100         PMINFO_APPINFO_GET_DATA_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_LABEL = 0x0001,
108         PMINFO_PKGINFO_GET_ICON = 0x0002,
109         PMINFO_PKGINFO_GET_AUTHOR = 0x0004,
110         PMINFO_PKGINFO_GET_DESCRIPTION = 0x0008,
111         PMINFO_PKGINFO_GET_PRIVILEGE = 0x0010,
112         PMINFO_PKGINFO_GET_ALL = 0x001F
113 } pkgmgrinfo_pkginfo_get_option;
114
115 /**
116  * @brief API return values
117  */
118 enum {
119         PMINFO_R_ENOENT = -3,           /**< No result */
120         PMINFO_R_EINVAL = -2,           /**< Invalid argument */
121         PMINFO_R_ERROR = -1,            /**< General error */
122         PMINFO_R_OK = 0                 /**< General success */
123 };
124
125 /**
126  * @brief Value to be used when filtering based on install location
127  */
128 #define PMINFO_PKGINFO_INSTALL_LOCATION_AUTO            "LOCATION_AUTO"
129
130 /**
131  * @brief Value to be used when filtering based on install location
132  */
133 #define PMINFO_PKGINFO_INSTALL_LOCATION_INTERNAL        "LOCATION_INTERNAL"
134
135 /**
136  * @brief Value to be used when filtering based on install location
137  */
138 #define PMINFO_PKGINFO_INSTALL_LOCATION_EXTERNAL        "LOCATION_EXTERNAL"
139
140 /**
141  * @brief Value to be used when get/set update information
142  */
143 #define PMINFO_UPDATEINFO_TYPE_FORCE    "force"
144
145 /**
146  * @brief Value to be used when get/set update information
147  */
148 #define PMINFO_UPDATEINFO_TYPE_OPTIONAL "optional"
149
150 /**
151  * @brief Value to be used when get/set update information
152  */
153 #define PMINFO_UPDATEINFO_TYPE_NONE     "none"
154
155 typedef enum {
156         PMINFO_UPDATEINFO_NONE = 0,             /**<No update info exists*/
157         PMINFO_UPDATEINFO_FORCE,                /**<Don't launch application if it's not updated*/
158         PMINFO_UPDATEINFO_OPTIONAL              /**<Update exists but not force user to update it*/
159 } pkgmgrinfo_updateinfo_update_type;
160
161 typedef enum {
162         PMINFO_HWACCELERATION_OFF = 0,          /**< Don't use hardware acceleration*/
163         PMINFO_HWACCELERATION_ON = 1,           /**< Use hardware acceleration*/
164         PMINFO_HWACCELERATION_DEFAULT = 2               /**< Follow system setting for hardware acceleration */
165 } pkgmgrinfo_app_hwacceleration;
166
167 typedef enum {
168         PMINFO_SCREENREADER_OFF = 0,            /**< Don't use screen reader*/
169         PMINFO_SCREENREADER_ON = 1,             /**< Use screen reader*/
170         PMINFO_SCREENREADER_USE_SYSTEM_SETTING = 2              /**< Follow system setting for screen reader */
171 } pkgmgrinfo_app_screenreader;
172
173 typedef enum {
174         PMINFO_RECENTIMAGE_USE_ICON = 0,                /**<Use icon for recent image*/
175         PMINFO_RECENTIMAGE_USE_CAPTURE = 1,             /**< Use capture for recent image*/
176         PMINFO_RECENTIMAGE_USE_NOTHING = 2              /**< Don't use recent image */
177 } pkgmgrinfo_app_recentimage;
178
179 /**
180  * @brief A handle to get package information
181  */
182 typedef void *pkgmgrinfo_pkginfo_h;
183
184 /**
185  * @brief A handle to get application information
186  */
187 typedef void *pkgmgrinfo_appinfo_h;
188
189 /**
190  * @brief A handle to get certificate information
191  */
192 typedef void *pkgmgrinfo_certinfo_h;
193
194 /**
195  * @brief A handle to filter package information
196  */
197 typedef void *pkgmgrinfo_pkginfo_filter_h;
198
199 /**
200  * @brief A handle to get/set package update information
201  */
202 typedef void *pkgmgrinfo_updateinfo_h;
203
204 /**
205  * @brief A handle to filter application information
206  */
207 typedef void *pkgmgrinfo_appinfo_filter_h;
208
209 /**
210  * @brief A handle to filter application metadata  information
211  */
212 typedef void *pkgmgrinfo_appinfo_metadata_filter_h;
213
214 /**
215  * @brief A handle to get appcontrol information
216  */
217 typedef void *pkgmgrinfo_appcontrol_h;
218
219 /**
220  * @brief type definition.
221  */
222 typedef void pkgmgrinfo_client;
223
224 /**
225  * @fn int (*pkgmgrinfo_foreach_updateinfo_cb) (const pkgmgrinfo_updateinfo_h handle, void *user_data)
226  *
227  * @brief Specifies the type of function passed to pkgmgrinfo_updateinfo_foreach_updateinfo()
228  *
229  * @param[in] handle the package update info handle
230  * @param[in] user_data user data passed to pkgmgrinfo_foreach_pkg_update info()
231  *
232  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
233  *
234  * @see  pkgmgrinfo_updateinfo_foreach_updateinfo()
235  */
236 typedef int (*pkgmgrinfo_foreach_updateinfo_cb) (const pkgmgrinfo_updateinfo_h handle,
237                                                         void *user_data);
238
239 /**
240  * @fn int (*pkgmgrinfo_pkg_list_cb) (const pkgmgrinfo_pkginfo_h handle, void *user_data)
241  *
242  * @brief Specifies the type of function passed to pkgmgrinfo_pkginfo_get_list(), pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
243  *
244  * @param[in] handle the pkginfo handle
245  * @param[in] user_data user data passed to pkgmgrinfo_pkginfo_get_list(), pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
246  *
247  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
248  *
249  * @see  pkgmgrinfo_pkginfo_get_list()
250  * @see  pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
251  */
252 typedef int (*pkgmgrinfo_pkg_list_cb) (const pkgmgrinfo_pkginfo_h handle,
253                                                         void *user_data);
254
255 /**
256  * @fn int (*pkgmgrinfo_app_list_cb) (const pkgmgrinfo_appinfo_h handle, void *user_data)
257  *
258  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_get_list(), pkgmgrinfo_appinfo_filter_foreach_appinfo(), pkgmgrinfo_appinfo_metadata_filter_foreach()
259  *
260  * @param[in] handle the appinfo handle
261  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_get_list(), pkgmgrinfo_appinfo_filter_foreach_appinfo(), pkgmgrinfo_appinfo_metadata_filter_foreach()
262  *
263  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
264  *
265  * @see  pkgmgrinfo_appinfo_get_list()
266  * @see  pkgmgrinfo_appinfo_filter_foreach_appinfo()
267  * @see  pkgmgrinfo_appinfo_metadata_filter_foreach()
268  */
269 typedef int (*pkgmgrinfo_app_list_cb) (const pkgmgrinfo_appinfo_h handle,
270                                                         void *user_data);
271
272 /**
273  * @fn int (*pkgmgrinfo_app_category_list_cb) (const char *category_name, void *user_data)
274  *
275  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_category()
276  *
277  * @param[in] category_name the name of the category
278  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_category()
279  *
280  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
281  *
282  * @see  pkgmgrinfo_appinfo_foreach_category()
283  */
284 typedef int (*pkgmgrinfo_app_category_list_cb) (const char *category_name,
285                                                         void *user_data);
286
287 /**
288  * @fn int (*pkgmgrinfo_app_permission_list_cb) (const char *permission_type, void *user_data)
289  *
290  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_category()
291  *
292  * @param[in] permission_name the name of the permission
293  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_category()
294  *
295  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
296  *
297  * @see  pkgmgrinfo_appinfo_foreach_category()
298  */
299 typedef int (*pkgmgrinfo_app_permission_list_cb) (const char *permission_type,
300                                                         void *user_data);
301
302 /**
303  * @fn int (*pkgmgrinfo_pkg_privilege_list_cb) (const char *privilege_name, void *user_data)
304  *
305  * @brief Specifies the type of function passed to pkgmgrinfo_pkginfo_foreach_privilege()
306  *
307  * @param[in] privilege_name the name of the privilege
308  * @param[in] user_data user data passed to pkgmgrinfo_pkginfo_foreach_privilege()
309  *
310  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
311  *
312  * @see  pkgmgrinfo_pkginfo_foreach_privilege()
313  */
314 typedef int (*pkgmgrinfo_pkg_privilege_list_cb) (const char *privilege_name,
315                                                         void *user_data);
316
317 /**
318  * @fn int (*pkgmgrinfo_app_metadata_list_cb) (const char *metadata_key, const char *metadata_value, void *user_data)
319  *
320  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_metadata()
321  *
322  * @param[in] metadata_name the name of the metadata
323  * @param[in] metadata_value the value of the metadata
324  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_metadata()
325  *
326  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
327  *
328  * @see  pkgmgrinfo_appinfo_foreach_metadata()
329  */
330 typedef int (*pkgmgrinfo_app_metadata_list_cb) (const char *metadata_key,
331                                                         const char *metadata_value, void *user_data);
332
333 /**
334  * @fn int (*pkgmgrinfo_app_control_list_cb) (pkgmgrinfo_appcontrol_h handle, void *user_data)
335  *
336  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_appcontrol()
337  *
338  * @param[in] handle the appcontrol handle to be used to get operation, uri and mime info
339  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_appcontrol()
340  *
341  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
342  *
343  * @see  pkgmgrinfo_appinfo_foreach_appcontrol()
344  */
345 typedef int (*pkgmgrinfo_app_control_list_cb) (const char *operation, const char *uri, const char *mime,
346                                                         void *user_data);
347
348 /**
349  * @fn int (*pkgmgrinfo_app_background_category_list_cb) (const char *category_name, void *user_data)
350  *
351  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_background_category()
352  *
353  * @param[in] category_name retrieved background category name
354  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_background_category
355  *
356  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
357  *
358  * @see  pkgmgrinfo_appinfo_foreach_background_category()
359  */
360 typedef int (*pkgmgrinfo_app_background_category_list_cb) (const char *category_name, void *user_data);
361
362 /**
363  * @fn int (*pkgmgrinfo_app_splash_screen_list_cb)(const char *src,
364  *              const char *type, const char *orientation,
365  *              const char *indicatordisplay, const char *color_depth,
366  *              void *user_data);
367  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_splash_screen()
368  *
369  * @param[in] src the source of the splashscreen
370  * @param[in] type the type of the splashscreen
371  * @param[in] orientation the orientation of the splashscreen
372  * @param[in] indicatordisplay the indicator-display of the splashscreen
373  * @param[in] operation the app-control operation of the splashscreen
374  * @param[in] color_depth the color-depth of the splashscreen
375  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_splash_screen()
376  *
377  * @return 0 if success, negative value(<0) if fail, Callback is not called if return value is negative.\n
378  *
379  * @see pkgmgrinfo_appinfo_foreach_splash_screen()
380  */
381 typedef int (*pkgmgrinfo_app_splash_screen_list_cb)(const char *src,
382                 const char *type, const char *orientation,
383                 const char *indicatordisplay, const char *operation,
384                 const char *color_depth, void *user_data);
385
386 /**
387  * @brief Install Location Types
388  */
389 typedef enum {
390         PMINFO_INSTALL_LOCATION_AUTO = 0,               /**< Auto*/
391         PMINFO_INSTALL_LOCATION_INTERNAL_ONLY,          /**< Internal Installation*/
392         PMINFO_INSTALL_LOCATION_PREFER_EXTERNAL,                /**< External Installation*/
393 } pkgmgrinfo_install_location;
394
395 /**
396  * @brief Application Component Types
397  */
398 typedef enum {
399         PMINFO_ALL_APP = 0,     /**< All Application*/
400         PMINFO_UI_APP,          /**< UI Application*/
401         PMINFO_SVC_APP,         /**< Service Application*/
402         PMINFO_WIDGET_APP,      /**< Widget Application*/
403         PMINFO_WATCH_APP,  /**< Watch Application*/
404 } pkgmgrinfo_app_component;
405
406 /**
407  * @brief Application Storage Types
408  */
409 typedef enum {
410         PMINFO_INTERNAL_STORAGE = 0,            /**< Internal Storage*/
411         PMINFO_EXTERNAL_STORAGE = 1,            /**< External Storage*/
412 } pkgmgrinfo_installed_storage;
413
414 /**
415  * @brief Certificate Types to be used for getting information
416  */
417 typedef enum {
418         PMINFO_AUTHOR_ROOT_CERT = 0,            /**< Author Root Certificate*/
419         PMINFO_AUTHOR_INTERMEDIATE_CERT = 1,            /**< Author Intermediate Certificate*/
420         PMINFO_AUTHOR_SIGNER_CERT = 2,          /**< Author Signer Certificate*/
421         PMINFO_DISTRIBUTOR_ROOT_CERT = 3,               /**< Distributor Root Certificate*/
422         PMINFO_DISTRIBUTOR_INTERMEDIATE_CERT = 4,               /**< Distributor Intermediate Certificate*/
423         PMINFO_DISTRIBUTOR_SIGNER_CERT = 5,             /**< Distributor Signer Certificate*/
424         PMINFO_DISTRIBUTOR2_ROOT_CERT = 6,              /**< End Entity Root Certificate*/
425         PMINFO_DISTRIBUTOR2_INTERMEDIATE_CERT = 7,              /**< End Entity Intermediate Certificate*/
426         PMINFO_DISTRIBUTOR2_SIGNER_CERT = 8,            /**< End Entity Signer Certificate*/
427 } pkgmgrinfo_cert_type;
428
429 /**
430  * @brief version comparison Types
431  */
432 typedef enum {
433         PMINFO_VERSION_OLD = -1,
434         PMINFO_VERSION_SAME,
435         PMINFO_VERSION_NEW,
436 } pkgmgrinfo_version_compare_type;
437
438 /**
439  * @brief Install Location Types to be used when setting data in DB
440  */
441 typedef enum {
442         INSTALL_INTERNAL = 0,           /**< Internal Installation*/
443         INSTALL_EXTERNAL,               /**< External Installation*/
444 } INSTALL_LOCATION;
445
446 /**
447  * @brief permission Types
448  */
449 typedef enum {
450         PMINFO_PERMISSION_NORMAL = 0,           /**< permission normal*/
451         PMINFO_PERMISSION_SIGNATURE,            /**< permission type is signature*/
452         PMINFO_PERMISSION_PRIVILEGE,            /**< permission type is privilege*/
453 } pkgmgrinfo_permission_type;
454
455 #endif