Implement support_mode related feature
[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 mode */
50 #define APP_SUPPORT_MODE_ULTRA_POWER_SAVING             0x00001
51 #define APP_SUPPORT_MODE_COOL_DOWN                              0x00002
52 #define APP_SUPPORT_MODE_SCREEN_READER                  0x00004
53
54 /**
55  * @brief A type to retrieve uid information from the manifest handle
56  */
57 typedef struct {
58         uid_t uid;
59 } pkgmgrinfo_uidinfo_t;
60
61 /**
62  * @brief A handle to insert certificate information
63  */
64 typedef void *pkgmgrinfo_instcertinfo_h;
65
66 /**
67  * @brief Certificate Types to be used for setting information
68  */
69 typedef enum {
70         PMINFO_SET_AUTHOR_ROOT_CERT = 0,                /**< Author Root Certificate*/
71         PMINFO_SET_AUTHOR_INTERMEDIATE_CERT = 1,                /**< Author Intermediate Certificate*/
72         PMINFO_SET_AUTHOR_SIGNER_CERT = 2,              /**< Author Signer Certificate*/
73         PMINFO_SET_DISTRIBUTOR_ROOT_CERT = 3,           /**< Distributor Root Certificate*/
74         PMINFO_SET_DISTRIBUTOR_INTERMEDIATE_CERT = 4,           /**< Distributor Intermediate Certificate*/
75         PMINFO_SET_DISTRIBUTOR_SIGNER_CERT = 5,         /**< Distributor Signer Certificate*/
76         PMINFO_SET_DISTRIBUTOR2_ROOT_CERT = 6,          /**< End Entity Root Certificate*/
77         PMINFO_SET_DISTRIBUTOR2_INTERMEDIATE_CERT = 7,          /**< End Entity Intermediate Certificate*/
78         PMINFO_SET_DISTRIBUTOR2_SIGNER_CERT = 8,                /**< End Entity Signer Certificate*/
79 } pkgmgrinfo_instcert_type;
80
81 typedef enum {
82         PMINFO_CERT_COMPARE_MATCH,
83         PMINFO_CERT_COMPARE_MISMATCH,
84         PMINFO_CERT_COMPARE_LHS_NO_CERT,
85         PMINFO_CERT_COMPARE_RHS_NO_CERT,
86         PMINFO_CERT_COMPARE_BOTH_NO_CERT,
87         PMINFO_CERT_COMPARE_ERROR,
88 } pkgmgrinfo_cert_compare_result_type_e;
89
90 typedef enum {
91         PMINFO_APPINFO_GET_LABEL = 0x0001,
92         PMINFO_APPINFO_GET_ICON = 0x0002,
93         PMINFO_APPINFO_GET_CATEGORY = 0x0004,
94         PMINFO_APPINFO_GET_APP_CONTROL = 0x0008,
95         PMINFO_APPINFO_GET_DATA_CONTROL = 0x0010,
96         PMINFO_APPINFO_GET_METADATA = 0x0020,
97         PMINFO_APPINFO_GET_SPLASH_SCREEN = 0x0040,
98         PMINFO_APPINFO_GET_ALL = 0x007F
99 } pkgmgrinfo_appinfo_get_option;
100
101 typedef enum {
102         PMINFO_PKGINFO_GET_LABEL = 0x0001,
103         PMINFO_PKGINFO_GET_ICON = 0x0002,
104         PMINFO_PKGINFO_GET_AUTHOR = 0x0004,
105         PMINFO_PKGINFO_GET_DESCRIPTION = 0x0008,
106         PMINFO_PKGINFO_GET_PRIVILEGE = 0x0010,
107         PMINFO_PKGINFO_GET_ALL = 0x001F
108 } pkgmgrinfo_pkginfo_get_option;
109
110 /**
111  * @brief API return values
112  */
113 enum {
114         PMINFO_R_ENOENT = -3,           /**< No result */
115         PMINFO_R_EINVAL = -2,           /**< Invalid argument */
116         PMINFO_R_ERROR = -1,            /**< General error */
117         PMINFO_R_OK = 0                 /**< General success */
118 };
119
120 /**
121  * @brief Value to be used when filtering based on install location
122  */
123 #define PMINFO_PKGINFO_INSTALL_LOCATION_AUTO            "LOCATION_AUTO"
124
125 /**
126  * @brief Value to be used when filtering based on install location
127  */
128 #define PMINFO_PKGINFO_INSTALL_LOCATION_INTERNAL        "LOCATION_INTERNAL"
129
130 /**
131  * @brief Value to be used when filtering based on install location
132  */
133 #define PMINFO_PKGINFO_INSTALL_LOCATION_EXTERNAL        "LOCATION_EXTERNAL"
134
135 typedef enum {
136         PMINFO_HWACCELERATION_OFF = 0,          /**< Don't use hardware acceleration*/
137         PMINFO_HWACCELERATION_ON = 1,           /**< Use hardware acceleration*/
138         PMINFO_HWACCELERATION_DEFAULT = 2               /**< Follow system setting for hardware acceleration */
139 } pkgmgrinfo_app_hwacceleration;
140
141 typedef enum {
142         PMINFO_SCREENREADER_OFF = 0,            /**< Don't use screen reader*/
143         PMINFO_SCREENREADER_ON = 1,             /**< Use screen reader*/
144         PMINFO_SCREENREADER_USE_SYSTEM_SETTING = 2              /**< Follow system setting for screen reader */
145 } pkgmgrinfo_app_screenreader;
146
147 typedef enum {
148         PMINFO_RECENTIMAGE_USE_ICON = 0,                /**<Use icon for recent image*/
149         PMINFO_RECENTIMAGE_USE_CAPTURE = 1,             /**< Use capture for recent image*/
150         PMINFO_RECENTIMAGE_USE_NOTHING = 2              /**< Don't use recent image */
151 } pkgmgrinfo_app_recentimage;
152
153 /**
154  * @brief A handle to get package information
155  */
156 typedef void *pkgmgrinfo_pkginfo_h;
157
158 /**
159  * @brief A handle to get application information
160  */
161 typedef void *pkgmgrinfo_appinfo_h;
162
163 /**
164  * @brief A handle to get certificate information
165  */
166 typedef void *pkgmgrinfo_certinfo_h;
167
168 /**
169  * @brief A handle to filter package information
170  */
171 typedef void *pkgmgrinfo_pkginfo_filter_h;
172
173 /**
174  * @brief A handle to filter application information
175  */
176 typedef void *pkgmgrinfo_appinfo_filter_h;
177
178 /**
179  * @brief A handle to filter application metadata  information
180  */
181 typedef void *pkgmgrinfo_appinfo_metadata_filter_h;
182
183 /**
184  * @brief A handle to get appcontrol information
185  */
186 typedef void *pkgmgrinfo_appcontrol_h;
187
188 /**
189  * @brief type definition.
190  */
191 typedef void pkgmgrinfo_client;
192
193 /**
194  * @fn int (*pkgmgrinfo_pkg_list_cb) (const pkgmgrinfo_pkginfo_h handle, void *user_data)
195  *
196  * @brief Specifies the type of function passed to pkgmgrinfo_pkginfo_get_list(), pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
197  *
198  * @param[in] handle the pkginfo handle
199  * @param[in] user_data user data passed to pkgmgrinfo_pkginfo_get_list(), pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
200  *
201  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
202  *
203  * @see  pkgmgrinfo_pkginfo_get_list()
204  * @see  pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
205  */
206 typedef int (*pkgmgrinfo_pkg_list_cb) (const pkgmgrinfo_pkginfo_h handle,
207                                                         void *user_data);
208
209 /**
210  * @fn int (*pkgmgrinfo_app_list_cb) (const pkgmgrinfo_appinfo_h handle, void *user_data)
211  *
212  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_get_list(), pkgmgrinfo_appinfo_filter_foreach_appinfo(), pkgmgrinfo_appinfo_metadata_filter_foreach()
213  *
214  * @param[in] handle the appinfo handle
215  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_get_list(), pkgmgrinfo_appinfo_filter_foreach_appinfo(), pkgmgrinfo_appinfo_metadata_filter_foreach()
216  *
217  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
218  *
219  * @see  pkgmgrinfo_appinfo_get_list()
220  * @see  pkgmgrinfo_appinfo_filter_foreach_appinfo()
221  * @see  pkgmgrinfo_appinfo_metadata_filter_foreach()
222  */
223 typedef int (*pkgmgrinfo_app_list_cb) (const pkgmgrinfo_appinfo_h handle,
224                                                         void *user_data);
225
226 /**
227  * @fn int (*pkgmgrinfo_app_category_list_cb) (const char *category_name, void *user_data)
228  *
229  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_category()
230  *
231  * @param[in] category_name the name of the category
232  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_category()
233  *
234  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
235  *
236  * @see  pkgmgrinfo_appinfo_foreach_category()
237  */
238 typedef int (*pkgmgrinfo_app_category_list_cb) (const char *category_name,
239                                                         void *user_data);
240
241 /**
242  * @fn int (*pkgmgrinfo_app_permission_list_cb) (const char *permission_type, void *user_data)
243  *
244  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_category()
245  *
246  * @param[in] permission_name the name of the permission
247  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_category()
248  *
249  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
250  *
251  * @see  pkgmgrinfo_appinfo_foreach_category()
252  */
253 typedef int (*pkgmgrinfo_app_permission_list_cb) (const char *permission_type,
254                                                         void *user_data);
255
256 /**
257  * @fn int (*pkgmgrinfo_pkg_privilege_list_cb) (const char *privilege_name, void *user_data)
258  *
259  * @brief Specifies the type of function passed to pkgmgrinfo_pkginfo_foreach_privilege()
260  *
261  * @param[in] privilege_name the name of the privilege
262  * @param[in] user_data user data passed to pkgmgrinfo_pkginfo_foreach_privilege()
263  *
264  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
265  *
266  * @see  pkgmgrinfo_pkginfo_foreach_privilege()
267  */
268 typedef int (*pkgmgrinfo_pkg_privilege_list_cb) (const char *privilege_name,
269                                                         void *user_data);
270
271 /**
272  * @fn int (*pkgmgrinfo_app_metadata_list_cb) (const char *metadata_key, const char *metadata_value, void *user_data)
273  *
274  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_metadata()
275  *
276  * @param[in] metadata_name the name of the metadata
277  * @param[in] metadata_value the value of the metadata
278  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_metadata()
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_metadata()
283  */
284 typedef int (*pkgmgrinfo_app_metadata_list_cb) (const char *metadata_key,
285                                                         const char *metadata_value, void *user_data);
286
287 /**
288  * @fn int (*pkgmgrinfo_app_control_list_cb) (pkgmgrinfo_appcontrol_h handle, void *user_data)
289  *
290  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_appcontrol()
291  *
292  * @param[in] handle the appcontrol handle to be used to get operation, uri and mime info
293  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_appcontrol()
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_appcontrol()
298  */
299 typedef int (*pkgmgrinfo_app_control_list_cb) (const char *operation, const char *uri, const char *mime,
300                                                         void *user_data);
301
302 /**
303  * @fn int (*pkgmgrinfo_app_background_category_list_cb) (const char *category_name, void *user_data)
304  *
305  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_background_category()
306  *
307  * @param[in] category_name retrieved background category name
308  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_background_category
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_appinfo_foreach_background_category()
313  */
314 typedef int (*pkgmgrinfo_app_background_category_list_cb) (const char *category_name, void *user_data);
315
316 /**
317  * @fn int (*pkgmgrinfo_app_splash_screen_list_cb)(const char *src,
318  *              const char *type, const char *orientation,
319  *              const char *indicatordisplay, const char *color_depth,
320  *              void *user_data);
321  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_splash_screen()
322  *
323  * @param[in] src the source of the splashscreen
324  * @param[in] type the type of the splashscreen
325  * @param[in] orientation the orientation of the splashscreen
326  * @param[in] indicatordisplay the indicator-display of the splashscreen
327  * @param[in] operation the app-control operation of the splashscreen
328  * @param[in] color_depth the color-depth of the splashscreen
329  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_splash_screen()
330  *
331  * @return 0 if success, negative value(<0) if fail, Callback is not called if return value is negative.\n
332  *
333  * @see pkgmgrinfo_appinfo_foreach_splash_screen()
334  */
335 typedef int (*pkgmgrinfo_app_splash_screen_list_cb)(const char *src,
336                 const char *type, const char *orientation,
337                 const char *indicatordisplay, const char *operation,
338                 const char *color_depth, void *user_data);
339
340 typedef int (*pkgmgrinfo_handler)(uid_t target_uid, int req_id, const char *pkg_type,
341                                 const char *pkgid, const char *key,
342                                 const char *val, const void *pmsg, void *data);
343
344
345 /**
346  * @brief Install Location Types
347  */
348 typedef enum {
349         PMINFO_INSTALL_LOCATION_AUTO = 0,               /**< Auto*/
350         PMINFO_INSTALL_LOCATION_INTERNAL_ONLY,          /**< Internal Installation*/
351         PMINFO_INSTALL_LOCATION_PREFER_EXTERNAL,                /**< External Installation*/
352 } pkgmgrinfo_install_location;
353
354 /**
355  * @brief Application Component Types
356  */
357 typedef enum {
358         PMINFO_ALL_APP = 0,     /**< All Application*/
359         PMINFO_UI_APP,          /**< UI Application*/
360         PMINFO_SVC_APP,         /**< Service Application*/
361         PMINFO_WIDGET_APP,      /**< Widget Application*/
362         PMINFO_WATCH_APP,  /**< Watch Application*/
363 } pkgmgrinfo_app_component;
364
365 /**
366  * @brief Application Storage Types
367  */
368 typedef enum {
369         PMINFO_INTERNAL_STORAGE = 0,            /**< Internal Storage*/
370         PMINFO_EXTERNAL_STORAGE = 1,            /**< External Storage*/
371 } pkgmgrinfo_installed_storage;
372
373 /**
374  * @brief Certificate Types to be used for getting information
375  */
376 typedef enum {
377         PMINFO_AUTHOR_ROOT_CERT = 0,            /**< Author Root Certificate*/
378         PMINFO_AUTHOR_INTERMEDIATE_CERT = 1,            /**< Author Intermediate Certificate*/
379         PMINFO_AUTHOR_SIGNER_CERT = 2,          /**< Author Signer Certificate*/
380         PMINFO_DISTRIBUTOR_ROOT_CERT = 3,               /**< Distributor Root Certificate*/
381         PMINFO_DISTRIBUTOR_INTERMEDIATE_CERT = 4,               /**< Distributor Intermediate Certificate*/
382         PMINFO_DISTRIBUTOR_SIGNER_CERT = 5,             /**< Distributor Signer Certificate*/
383         PMINFO_DISTRIBUTOR2_ROOT_CERT = 6,              /**< End Entity Root Certificate*/
384         PMINFO_DISTRIBUTOR2_INTERMEDIATE_CERT = 7,              /**< End Entity Intermediate Certificate*/
385         PMINFO_DISTRIBUTOR2_SIGNER_CERT = 8,            /**< End Entity Signer Certificate*/
386 } pkgmgrinfo_cert_type;
387
388 /**
389  * @brief Install Location Types to be used when setting data in DB
390  */
391 typedef enum {
392         INSTALL_INTERNAL = 0,           /**< Internal Installation*/
393         INSTALL_EXTERNAL,               /**< External Installation*/
394 } INSTALL_LOCATION;
395
396  /**
397   * @brief permission Types
398   */
399 typedef enum {
400         PMINFO_PERMISSION_NORMAL = 0,           /**< permission normal*/
401         PMINFO_PERMISSION_SIGNATURE,            /**< permission type is signature*/
402         PMINFO_PERMISSION_PRIVILEGE,            /**< permission type is privilege*/
403 } pkgmgrinfo_permission_type;
404
405 typedef enum {
406         PMINFO_REQUEST = 0,
407         PMINFO_LISTENING,
408         PMINFO_BROADCAST,
409 } pkgmgrinfo_client_type;
410
411 #endif