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