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