delete livebox db during fota upgrade
[framework/appfw/slp-pkgmgr.git] / client / include / package-manager.h
1 /*
2  * slp-pkgmgr
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
24
25
26
27
28
29
30
31 /**
32  * @file                package-manager.h
33  * @author              Sewook Park <sewook7.park@samsung.com>
34  * @version             0.1
35  * @brief               This file declares API of slp-pkgmgr library
36  *
37  * @addtogroup APPLICATION_FRAMEWORK
38  * @{
39  *
40   * @defgroup   PackageManager
41  * @section             Header to use them:
42  * @code
43  * #include "package-manager.h"
44  * @endcode
45  *
46  * @addtogroup PackageManager
47  * @{
48  */
49
50 #ifndef __PKG_MANAGER_H__
51 #define __PKG_MANAGER_H__
52
53 #include <errno.h>
54 #include <stdbool.h>
55
56
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60
61 #ifndef DEPRECATED
62 #define DEPRECATED      __attribute__ ((__deprecated__))
63 #endif
64
65 /**
66  * @mainpage
67  * 
68  * This is package manager
69  *
70  * Packaeg manager is used to install/uninstall the packages.\n
71  * package includes dpkg, java, widget, etc. and it can be added\n
72  * Security is considered on current package manager\n
73  * 
74  */
75
76 /**
77  * @file        package-manager.h
78  * @brief Package Manager header
79  *
80  * Generated by    Sewook Park <sewook7.park@samsung.com>
81  */
82
83
84
85 /**
86  * @addtogroup PackageManager
87  * @{
88  */
89
90 /**
91  * @brief pkgmgr info types. 
92  */
93 #define PKGMGR_INFO_STR_PKGTYPE         "pkg_type"
94 #define PKGMGR_INFO_STR_PKGNAME         "pkg_name"
95 #define PKGMGR_INFO_STR_VERSION         "version"
96 #define PKGMGR_INFO_STR_INSTALLED_SIZE  "installed_size"
97 #define PKGMGR_INFO_STR_DATA_SIZE       "data_size"
98 #define PKGMGR_INFO_STR_APP_SIZE        "app_size"
99 #define PKGMGR_INFO_STR_INSTALLED_TIME  "installed_time"
100 /** @} */
101
102 /* 1 -100 : Package command errors */
103 /* 101-120 : reserved for Core installer */
104 /* 121-140 : reserved for Web installer */
105 /* 141-160 : reserved for Native installer */
106 #define PKGCMD_ERR_PACKAGE_NOT_FOUND                                    1
107 #define PKGCMD_ERR_PACKAGE_INVALID                                              2
108 #define PKGCMD_ERR_PACKAGE_LOWER_VERSION                                3
109 #define PKGCMD_ERR_PACKAGE_EXECUTABLE_NOT_FOUND                 4
110 #define PKGCMD_ERR_MANIFEST_NOT_FOUND                                   11
111 #define PKGCMD_ERR_MANIFEST_INVALID                                             12
112 #define PKGCMD_ERR_CONFIG_NOT_FOUND                                             13
113 #define PKGCMD_ERR_CONFIG_INVALID                                               14
114 #define PKGCMD_ERR_SIGNATURE_NOT_FOUND                                  21
115 #define PKGCMD_ERR_SIGNATURE_INVALID                                    22
116 #define PKGCMD_ERR_SIGNATURE_VERIFICATION_FAILED                23
117 #define PKGCMD_ERR_ROOT_CERTIFICATE_NOT_FOUND                   31
118 #define PKGCMD_ERR_CERTIFICATE_INVALID                                  32
119 #define PKGCMD_ERR_CERTIFICATE_CHAIN_VERIFICATION_FAILED        33
120 #define PKGCMD_ERR_CERTIFICATE_EXPIRED                                  34
121 #define PKGCMD_ERR_INVALID_PRIVILEGE                                    41
122 #define PKGCMD_ERR_MENU_ICON_NOT_FOUND                                  51
123 #define PKGCMD_ERR_FATAL_ERROR                                                  61
124 #define PKGCMD_ERR_OUT_OF_STORAGE                                               62
125 #define PKGCMD_ERR_OUT_OF_MEMORY                                                63
126 #define PKGCMD_ERR_ARGUMENT_INVALID                                             64
127
128 #define PKGCMD_ERR_PACKAGE_NOT_FOUND_STR                                        "PACKAGE_NOT_FOUND"
129 #define PKGCMD_ERR_PACKAGE_INVALID_STR                                          "PACKAGE_INVALID"
130 #define PKGCMD_ERR_PACKAGE_LOWER_VERSION_STR                            "PACKAGE_LOWER_VERSION"
131 #define PKGCMD_ERR_PACKAGE_EXECUTABLE_NOT_FOUND_STR                     "PACKAGE_EXECUTABLE_NOT_FOUND"
132 #define PKGCMD_ERR_MANIFEST_NOT_FOUND_STR                                       "MANIFEST_NOT_FOUND"
133 #define PKGCMD_ERR_MANIFEST_INVALID_STR                                         "MANIFEST_INVALID"
134 #define PKGCMD_ERR_CONFIG_NOT_FOUND_STR                                         "CONFIG_NOT_FOUND"
135 #define PKGCMD_ERR_CONFIG_INVALID_STR                                           "CONFIG_INVALID"
136 #define PKGCMD_ERR_SIGNATURE_NOT_FOUND_STR                                      "SIGNATURE_NOT_FOUND"
137 #define PKGCMD_ERR_SIGNATURE_INVALID_STR                                        "SIGNATURE_INVALID"
138 #define PKGCMD_ERR_SIGNATURE_VERIFICATION_FAILED_STR            "SIGNATURE_VERIFICATION_FAILED"
139 #define PKGCMD_ERR_ROOT_CERTIFICATE_NOT_FOUND_STR                       "ROOT_CERTIFICATE_NOT_FOUND"
140 #define PKGCMD_ERR_CERTIFICATE_INVALID_STR                                      "CERTIFICATE_INVALID"
141 #define PKGCMD_ERR_CERTIFICATE_CHAIN_VERIFICATION_FAILED_STR    "CERTIFICATE_CHAIN_VERIFICATION_FAILED"
142 #define PKGCMD_ERR_CERTIFICATE_EXPIRED_STR                                      "CERTIFICATE_EXPIRED"
143 #define PKGCMD_ERR_INVALID_PRIVILEGE_STR                                        "INVALID_PRIVILEGE"
144 #define PKGCMD_ERR_MENU_ICON_NOT_FOUND_STR                                      "MENU_ICON_NOT_FOUND"
145 #define PKGCMD_ERR_FATAL_ERROR_STR                                                      "FATAL_ERROR"
146 #define PKGCMD_ERR_OUT_OF_STORAGE_STR                                           "OUT_OF_STORAGE"
147 #define PKGCMD_ERR_OUT_OF_MEMORY_STR                                            "OUT_OF_MEMORY"
148 #define PKGCMD_ERR_ARGUMENT_INVALID_STR                                         "ARGUMENT_INVALID"
149 #define PKGCMD_ERR_UNKNOWN_STR                                                          "Unknown Error"
150
151 /**
152  * @brief Return values in pkgmgr. 
153  */
154 typedef enum _pkgmgr_return_val {
155         PKGMGR_R_ETIMEOUT = -4,         /**< Timeout */
156         PKGMGR_R_EINVAL = -3,           /**< Invalid argument */
157         PKGMGR_R_ECOMM = -2,            /**< Comunication Error */
158         PKGMGR_R_ERROR = -1,            /**< General error */
159         PKGMGR_R_OK = 0                 /**< General success */
160 } pkgmgr_return_val;
161 /** @} */
162
163 /**
164  * @defgroup pkg_operate        APIs to install /uninstall / activate application
165  * @ingroup pkgmgr
166  * @brief
167  *      APIs to install /uninstall / activate application 
168  *      - Install application using application package filepath
169  *      - Uninstall application using application package name
170  *      - Activate application using application package name
171  *
172  */
173
174
175 /**
176  * @addtogroup pkg_operate
177  * @{
178  */
179
180 typedef void* pkgmgr_pkginfo_h;
181 typedef void* pkgmgr_appinfo_h;
182 typedef void* pkgmgr_certinfo_h;
183
184 typedef int (*pkgmgr_iter_fn)(const char* pkg_type, const char* pkgid,
185                                 const char* version, void *data);
186
187 typedef int (*pkgmgr_handler)(int req_id, const char *pkg_type,
188                                 const char *pkgid, const char *key,
189                                 const char *val, const void *pmsg, void *data);
190
191 typedef int (*pkgmgr_info_pkg_list_cb ) (const pkgmgr_pkginfo_h handle,
192                                                         void *user_data);
193
194 typedef int (*pkgmgr_info_app_list_cb ) (const pkgmgr_appinfo_h handle,
195                                                         void *user_data);
196
197 typedef int (*pkgmgr_info_app_category_list_cb ) (const char *category_name,
198                                                         void *user_data);
199
200
201 typedef void pkgmgr_client;
202
203 typedef void pkgmgr_info;
204
205 typedef enum {
206         PC_REQUEST = 0,
207         PC_LISTENING,
208         PC_BROADCAST,
209 }client_type;
210
211 typedef enum {
212         PM_DEFAULT,
213         PM_QUIET
214 }pkgmgr_mode;
215
216 typedef enum {
217         PM_INSTALL_LOCATION_AUTO = 0,
218         PM_INSTALL_LOCATION_INTERNAL_ONLY,
219         PM_INSTALL_LOCATION_PREFER_EXTERNAL,
220 }pkgmgr_install_location;
221
222 typedef enum {
223         PM_HWACCELERATION_NOT_USE_GL = 0,
224         PM_HWACCELERATION_USE_GL = 1,
225         PM_HWACCELERATION_USE_SYSTEM_SETTING = 2,
226 }pkgmgr_hwacceleration_type;
227
228 typedef enum {
229         PM_ALL_APP = 0,
230         PM_UI_APP,
231         PM_SVC_APP
232 }pkgmgr_app_component;
233
234 typedef enum {
235         PM_MOVE_TO_INTERNAL = 0,
236         PM_MOVE_TO_SDCARD = 1,
237 }pkgmgr_move_type;
238
239 typedef enum {
240         PM_INTERNAL_STORAGE = 0,
241         PM_EXTERNAL_STORAGE = 1,
242 }pkgmgr_installed_storage;
243
244 typedef enum {
245         PM_AUTHOR_ROOT_CERT = 0,
246         PM_AUTHOR_INTERMEDIATE_CERT = 1,
247         PM_AUTHOR_SIGNER_CERT = 2,
248         PM_DISTRIBUTOR_ROOT_CERT = 3,
249         PM_DISTRIBUTOR_INTERMEDIATE_CERT = 4,
250         PM_DISTRIBUTOR_SIGNER_CERT = 5,
251         PM_DISTRIBUTOR2_ROOT_CERT = 6,
252         PM_DISTRIBUTOR2_INTERMEDIATE_CERT = 7,
253         PM_DISTRIBUTOR2_SIGNER_CERT = 8,
254 }pkgmgr_cert_type;
255
256 typedef enum {
257         PM_REQUEST_CSC = 0,
258         PM_REQUEST_MOVE = 1,
259         PM_REQUEST_GET_SIZE = 2,
260         PM_REQUEST_KILL_APP = 3,
261         PM_REQUEST_MAX
262 }pkgmgr_request_service_type;
263
264 typedef enum {
265         PM_GET_TOTAL_SIZE= 0,
266         PM_GET_DATA_SIZE = 1,
267 }pkgmgr_getsize_type;
268
269 /**
270  * @brief       This API creates pkgmgr client.
271  *
272  * This API is for package-manager client application.\n
273  *  
274  * @param[in]   ctype   client type - PC_REQUEST, PC_LISTENING, PC_BROADCAST 
275  * @return      pkgmgr_client object
276  * @retval      NULL    on failure creating an object
277 */
278 pkgmgr_client *pkgmgr_client_new(client_type ctype);
279
280 /**
281  * @brief       This API deletes pkgmgr client.
282  *
283  * This API is for package-manager client application.\n
284  *  
285  * @param[in]   pc      pkgmgr_client
286  * @return      Operation result;
287  * @retval      PKGMGR_R_OK     success
288  * @retval      PKGMGR_R_EINVAL invalid argument
289  * @retval      PKGMGR_R_ERROR  internal error
290 */
291 int pkgmgr_client_free(pkgmgr_client *pc);
292
293 /**
294  * @brief       This API installs package.
295  *
296  * This API is for package-manager client application.\n
297  * 
298  * @param[in]   pc      pkgmgr_client 
299  * @param[in]   pkg_type                package type 
300  * @param[in]   descriptor_path full path that descriptor is located
301  * @param[in]   pkg_path                full path that package file is located
302  * @param[in]   optional_file   optional file which is used for installation
303  * @param[in]   mode            installation mode  - PM_DEFAULT, PM_QUIET
304  * @param[in]   event_cb        user callback
305  * @param[in]   data            user data
306  * @return      request_id (>0) if success, error code(<0) if fail\n
307  * @retval      PKGMGR_R_OK     success
308  * @retval      PKGMGR_R_EINVAL invalid argument
309  * @retval      PKGMGR_R_ECOMM  communication error
310 */
311 int pkgmgr_client_install(pkgmgr_client *pc, const char *pkg_type,
312                             const char *descriptor_path, const char *pkg_path,
313                             const char *optional_file, pkgmgr_mode mode,
314                             pkgmgr_handler event_cb, void *data);
315
316 /**
317  * @brief       This API reinstalls package.
318  *
319  * This API is for package-manager client application.\n
320  *
321  * @param[in]   pc      pkgmgr_client
322  * @param[in]   pkg_type                package type
323  * @param[in]   pkg_path                full path that package file is located
324  * @param[in]   optional_file   optional file which is used for installation
325  * @param[in]   mode            installation mode  - PM_DEFAULT, PM_QUIET
326  * @param[in]   event_cb        user callback
327  * @param[in]   data            user data
328  * @return      request_id (>0) if success, error code(<0) if fail\n
329  * @retval      PKGMGR_R_OK     success
330  * @retval      PKGMGR_R_EINVAL invalid argument
331  * @retval      PKGMGR_R_ECOMM  communication error
332 */
333 int pkgmgr_client_reinstall(pkgmgr_client *pc, const char *pkg_type, const char *pkgid,
334                             const char *optional_file, pkgmgr_mode mode,
335                             pkgmgr_handler event_cb, void *data);
336
337 /**
338  * @brief       This API uninstalls package.
339  *
340  * This API is for package-manager client application.\n
341  * 
342  * @param[in]   pc      pkgmgr_client 
343  * @param[in]   pkg_type                package type 
344  * @param[in]   pkgid   package id
345  * @param[in]   mode            installation mode  - PM_DEFAULT, PM_QUIET
346  * @param[in]   event_cb        user callback
347  * @param[in]   data            user data
348  * @return      request_id (>0), error code(<0) if fail\n
349  * @retval      PKGMGR_R_OK     success
350  * @retval      PKGMGR_R_EINVAL invalid argument
351  * @retval      PKGMGR_R_ECOMM  communication error
352 */
353 int pkgmgr_client_uninstall(pkgmgr_client *pc, const char *pkg_type,
354                                 const char *pkgid, pkgmgr_mode mode,
355                                 pkgmgr_handler event_cb, void *data);
356
357 /**
358  * @brief       This API moves installed package to SD card or vice versa.
359  *
360  * This API is for package-manager client application.\n
361  *
362  * @param[in]   pc      pkgmgr_client
363  * @param[in]   pkg_type                package type
364  * @param[in]   pkgid   application package id
365  * @param[in]   move_type               PM_MOVE_TO_INTERNAL or PM_MOVE_TO_SDCARD
366  * @param[in]   mode            installation mode  - PM_DEFAULT, PM_QUIET
367  * @retval      PKGMGR_R_OK     success
368  * @retval      PKGMGR_R_EINVAL invalid argument
369  * @retval      PKGMGR_R_ERROR  general error
370 */
371 int pkgmgr_client_move(pkgmgr_client *pc, const char *pkg_type,
372                                 const char *pkgid, pkgmgr_move_type move_type, pkgmgr_mode mode);
373
374 /**
375  * @brief       This API moves installed package to SD card or vice versa.
376  *
377  * This API is for package-manager client application.\n
378  *
379  * @param[in]   pc      pkgmgr_client
380  * @param[in]   pkg_type                package type
381  * @param[in]   pkgid   application package id
382  * @param[in]   move_type               PM_MOVE_TO_INTERNAL or PM_MOVE_TO_SDCARD
383  * @param[in]   mode            installation mode  - PM_DEFAULT, PM_QUIET
384  * @param[in]   event_cb        user callback
385  * @param[in]   data            user data
386  * @retval      PKGMGR_R_OK     success
387  * @retval      PKGMGR_R_EINVAL invalid argument
388  * @retval      PKGMGR_R_ERROR  general error
389 */
390 int pkgmgr_client_move_pkg(pkgmgr_client *pc, const char *pkg_type,
391                                 const char *pkgid, pkgmgr_move_type move_type, pkgmgr_mode mode,
392                                 pkgmgr_handler event_cb, void *data);
393
394 /**
395  * @brief       This API activates package.
396  *
397  * This API is for package-manager client application.\n
398  * 
399  * @param[in]   pc      pkgmgr_client 
400  * @param[in]   pkg_type                package type 
401  * @param[in]   pkgid   package id
402  * @return      request_id (>0) if success, error code(<0) if fail\n
403  * @retval      PKGMGR_R_OK     success
404  * @retval      PKGMGR_R_EINVAL invalid argument
405  * @retval      PKGMGR_R_ECOMM  communication error
406 */
407 int pkgmgr_client_activate(pkgmgr_client *pc, const char *pkg_type,
408                                 const char *pkgid);
409
410 /**
411  * @brief       This API deactivates package.
412  *
413  * This API is for package-manager client application.\n
414  * 
415  * @param[in]   pc      pkgmgr_client 
416  * @param[in]   pkg_type                package type 
417  * @param[in]   pkgid   package id
418  * @return      request_id (>0) if success, error code(<0) if fail\n
419  * @retval      PKGMGR_R_OK     success
420  * @retval      PKGMGR_R_EINVAL invalid argument
421  * @retval      PKGMGR_R_ECOMM  communication error
422 */
423 int pkgmgr_client_deactivate(pkgmgr_client *pc, const char *pkg_type,
424                                  const char *pkgid);
425
426 /**
427  * @brief       This API activates package.
428  *
429  * This API is for package-manager client application.\n
430  *
431  * @param[in]   pc      pkgmgr_client
432  * @param[in]   appid   applicaiton id
433  * @return      request_id (>0) if success, error code(<0) if fail\n
434  * @retval      PKGMGR_R_OK     success
435  * @retval      PKGMGR_R_EINVAL invalid argument
436  * @retval      PKGMGR_R_ECOMM  communication error
437 */
438 int pkgmgr_client_activate_app(pkgmgr_client *pc, const char *appid);
439
440 /**
441  * @brief       This API activates package.
442  *
443  * This API is for package-manager client application.\n
444  *
445  * @param[in]   pc      pkgmgr_client
446  * @param[in]   appid   applicaiton id
447  * @param[in]   argv    argument vector
448  * @return      request_id (>0) if success, error code(<0) if fail\n
449  * @retval      PKGMGR_R_OK     success
450  * @retval      PKGMGR_R_EINVAL invalid argument
451  * @retval      PKGMGR_R_ECOMM  communication error
452 */
453 int pkgmgr_client_activate_appv(pkgmgr_client * pc, const char *appid, char *const argv[]);
454
455 /**
456  * @brief       This API deactivates package.
457  *
458  * This API is for package-manager client application.\n
459  *
460  * @param[in]   pc      pkgmgr_client
461  * @param[in]   appid   applicaiton id
462  * @return      request_id (>0) if success, error code(<0) if fail\n
463  * @retval      PKGMGR_R_OK     success
464  * @retval      PKGMGR_R_EINVAL invalid argument
465  * @retval      PKGMGR_R_ECOMM  communication error
466 */
467 int pkgmgr_client_deactivate_app(pkgmgr_client *pc, const char *appid);
468
469 /**
470  * @brief       This API deletes application's private data.
471  *
472  * This API is for package-manager client application.\n
473  *
474  * @param[in]   pc      pkgmgr_client
475  * @param[in]   pkg_type                package type
476  * @param[in]   pkgid   package id
477  * @param[in]   mode            installation mode  - PM_DEFAULT, PM_QUIET
478  * @return      request_id (>0) if success, error code(<0) if fail\n
479  * @retval      PKGMGR_R_OK     success
480  * @retval      PKGMGR_R_EINVAL invalid argument
481  * @retval      PKGMGR_R_ECOMM  communication error
482 */
483 int pkgmgr_client_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
484                                 const char *appid, pkgmgr_mode mode);
485
486 /**
487  * @brief       This API request to listen the pkgmgr's broadcasting
488  *
489  * This API is for package-manager client application.\n
490  * 
491  * @param[in]   pc      pkgmgr_client 
492  * @param[in]   event_cb        user callback
493  * @param[in]   data            user data
494  * @return      request_id (>0) if success, error code(<0) if fail\n
495  * @retval      PKGMGR_R_OK     success
496  * @retval      PKGMGR_R_EINVAL invalid argument
497 */
498 int pkgmgr_client_listen_status(pkgmgr_client *pc, pkgmgr_handler event_cb,
499                                     void *data);
500
501 /**
502  * @brief       This API broadcasts pkgmgr's status
503  *
504  * This API is for package-manager client application.\n
505  * 
506  * @param[in]   pc      pkgmgr_client 
507  * @param[in]   pkg_type                package type 
508  * @param[in]   pkgid   package id
509  * @param[in]   key             key to broadcast
510  * @param[in]   val             value to broadcast
511  * @return      0 if success, error code(<0) if fail\n
512  * @retval      PKGMGR_R_OK     success
513  * @retval      PKGMGR_R_EINVAL invalid argument
514 */
515 int pkgmgr_client_broadcast_status(pkgmgr_client *pc, const char *pkg_type,
516                                          const char *pkgid,  const char *key,
517                                          const char *val);
518
519 /**
520  * @brief       This API  gets the package's information.
521  *
522  *              This API is for package-manager client application.\n
523  *
524  * @param[in]   pkg_path                package file path to get infomation
525  * @return      package entry pointer if success, NULL if fail\n
526 */
527 pkgmgr_info *pkgmgr_client_check_pkginfo_from_file(const char *pkg_path);
528
529 /**
530  * @brief       This API  get package information value
531  *
532  *              This API is for package-manager client application.\n
533  *
534  * @param[in]   pkg_info                        pointer for package info entry
535  * @return      0 if success, error code(<0) if fail\n
536 */
537 int pkgmgr_client_free_pkginfo(pkgmgr_info * pkg_info);
538
539 /**
540  * @brief       This API requests service
541  *
542  * This API is for package-manager client application.\n
543  *
544  * @param[in]   service_type            pkgmgr_request_service_type
545  * @param[in]   service_mode    mode which is used for addtional mode selection
546  * @param[in]   pc                              pkgmgr_client
547  * @param[in]   pkg_type                package type
548  * @param[in]   pkgid                   package id
549  * @param[in]   custom_info             custom information which is used for addtional information
550  * @param[in]   event_cb                user callback
551  * @param[in]   data                    user data
552  * @return      request_id (>0) if success, error code(<0) if fail\n
553  * @retval      PKGMGR_R_OK     success
554  * @retval      PKGMGR_R_EINVAL invalid argument
555  * @retval      PKGMGR_R_ECOMM  communication error
556 */
557 int pkgmgr_client_request_service(pkgmgr_request_service_type service_type, int service_mode,
558                                         pkgmgr_client * pc, const char *pkg_type, const char *pkgid,
559                                         const char *custom_info, pkgmgr_handler event_cb, void *data);
560
561 /**
562  * @brief       This API provides package list
563  *
564  * This API is for package-manager client application.\n
565  * 
566  * @param[in]   iter_fn iteration function for list 
567  * @param[in]   data            user data
568  * @return      0 if success, error code(<0) if fail\n
569  * @retval      PKGMGR_R_OK     success
570  * @retval      PKGMGR_R_EINVAL invalid argument
571  * @retval      PKGMGR_R_ERROR  internal error
572 */
573 int pkgmgr_get_pkg_list(pkgmgr_iter_fn iter_fn, void *data);
574 /** @} */
575
576 /**
577  * @defgroup pkg_list           APIs to get package information
578  * @ingroup pkgmgr
579  * @brief
580  *      API to get package information
581 */
582
583 /**
584  * @addtogroup pkg_list
585  * @{
586  */
587  
588
589 /**
590  * @brief       This API  gets the package's information.
591  *
592  *              This API is for package-manager client application.\n
593  * 
594  * @param[in]   pkg_type                package type for the package to get infomation
595  * @param[in]   pkgid   package id for the package to get infomation
596  * @return      package entry pointer if success, NULL if fail\n
597 */
598 pkgmgr_info * pkgmgr_info_new(const char *pkg_type, const char *pkgid);
599
600 /**
601  * @brief       This API  gets the package's information.
602  *
603  *              This API is for package-manager client application.\n
604  * 
605  * @param[in]   pkg_type                package type for the package to get infomation
606  * @param[in]   pkg_path                package file path to get infomation
607  * @return      package entry pointer if success, NULL if fail\n
608 */
609 pkgmgr_info * pkgmgr_info_new_from_file(const char *pkg_type,
610                                              const char *pkg_path);
611
612 /**
613  * @brief       This API  get package information value
614  *
615  *              This API is for package-manager client application.\n
616  * 
617  * @param[in]   pkg_info        pointer for package info entry
618  * @param[in]   key                             key for package info field
619  * @return      string value if success, NULL if fail\n
620 */
621 char * pkgmgr_info_get_string(pkgmgr_info * pkg_info, const char *key);
622
623 /**
624  * @brief       This API  get package information value
625  *
626  *              This API is for package-manager client application.\n
627  * 
628  * @param[in]   pkg_info                        pointer for package info entry
629  * @return      0 if success, error code(<0) if fail\n
630 */
631 int pkgmgr_info_free(pkgmgr_info * pkg_info);
632
633 /**
634  * @brief       This API gets list of installed applications.
635  *
636  *              This API is for package-manager client application.\n
637  *
638  * @param[in]   pkg_list_cb     iteration function for list
639  * @param[in]   user_data                       user data to be passed to callback function
640  * @return      0 if success, error code(<0) if fail\n
641 */
642 int pkgmgr_pkginfo_get_list(pkgmgr_info_pkg_list_cb pkg_list_cb, void *user_data);
643
644 /**
645  * @brief       This API  get package info entry from db
646  *
647  *              This API is for package-manager client application.\n
648  *
649  * @param[in]   pkgid                   pointer to package id
650  * @param[out]  handle                          pointer to the package info handle.
651  * @return      0 if success, error code(<0) if fail\n
652 */
653 int pkgmgr_pkginfo_get_pkginfo(const char *pkgid, pkgmgr_pkginfo_h *handle);
654
655 /**
656  * @brief       This API  gets type of the given package.
657  *
658  *              This API is for package-manager client application.\n
659  *
660  * @param[in]   handle                          pointer to package info handle
661  * @param[out]  type                            to hold package type.
662  * @return      0 if success, error code(<0) if fail\n
663 */
664 int pkgmgr_pkginfo_get_pkgname(pkgmgr_pkginfo_h handle, char **pkg_name);
665
666 /**
667  * @brief       This API  gets id of the given package.
668  *
669  *              This API is for package-manager client application.\n
670  *
671  * @param[in]   handle                          pointer to package info handle
672  * @param[out]pkgid                             to hold package id.
673  * @return      0 if success, error code(<0) if fail\n
674 */
675 int pkgmgr_pkginfo_get_pkgid(pkgmgr_pkginfo_h handle, char **pkgid);
676
677 /**
678  * @brief       This API  gets type of the given package.
679  *
680  *              This API is for package-manager client application.\n
681  *
682  * @param[in]   handle                          pointer to package info handle
683  * @param[out]  type                            to hold package type.
684  * @return      0 if success, error code(<0) if fail\n
685 */
686 int pkgmgr_pkginfo_get_type(pkgmgr_pkginfo_h handle, char **type);
687
688 /**
689  * @brief       This API  gets version  of the given package.
690  *
691  *              This API is for package-manager client application.\n
692  *
693  * @param[in]   handle                          pointer to package info handle
694  * @param[out]  version                         to hold package version.
695  * @return      0 if success, error code(<0) if fail\n
696 */
697 int pkgmgr_pkginfo_get_version(pkgmgr_pkginfo_h handle, char **version);
698
699 /**
700  * @brief       This API  gets install location of the given package.
701  *
702  *              This API is for package-manager client application.\n
703  *
704  * @param[in]   handle                          pointer to package info handle
705  * @param[out]  location                        to hold install location.
706  * @return      0 if success, error code(<0) if fail\n
707 */
708 int pkgmgr_pkginfo_get_install_location(pkgmgr_pkginfo_h handle, pkgmgr_install_location *location);
709
710 /**
711  * @brief       This API  gets package size of the given package in case of external installation.
712  * size will be 0 if package install location is internal-only.
713  * size will be 0 if package install location is prefer-external but size is not specified in manifest file.
714  * Application should check the return value and use it distinguish the above cases.
715  *
716  *              This API is for package-manager client application.\n
717  *
718  * @param[in]   handle                          pointer to package info handle
719  * @param[out]  size                    to hold package size.
720  * @return      0 if success, error code(<0) if fail\n
721  * @return
722 */
723 int pkgmgr_pkginfo_get_package_size(pkgmgr_pkginfo_h handle, int *size);
724
725 /**
726  * @brief       This API gets icon of the given package.
727  *
728  *              This API is for package-manager client application.\n
729  *
730  * @param[in]   handle                          pointer to package info handle
731  * @param[out]  icon                            to hold package icon.
732  * @return      0 if success, error code(<0) if fail\n
733 */
734 int pkgmgr_pkginfo_get_icon(pkgmgr_pkginfo_h handle, char **icon);
735
736 /**
737  * @brief       This API gets label of the given package.
738  *
739  *              This API is for package-manager client application.\n
740  *
741  * @param[in]   handle                          pointer to package info handle
742  * @param[out]  label                           to hold package label.
743  * @return      0 if success, error code(<0) if fail\n
744 */
745 int pkgmgr_pkginfo_get_label(pkgmgr_pkginfo_h handle, char **label);
746
747 /**
748  * @brief       This API gets desription of the given package.
749  *
750  *              This API is for package-manager client application.\n
751  *
752  * @param[in]   handle                          pointer to package info handle
753  * @param[out]  description                     to hold package description.
754  * @return      0 if success, error code(<0) if fail\n
755 */
756 int pkgmgr_pkginfo_get_description(pkgmgr_pkginfo_h handle, char **description);
757
758 /**
759  * @brief       This API gets author's name of the given package.
760  *
761  *              This API is for package-manager client application.\n
762  *
763  * @param[in]   handle                          pointer to package info handle
764  * @param[out]  author_name                     to hold author's name.
765  * @return      0 if success, error code(<0) if fail\n
766 */
767 int pkgmgr_pkginfo_get_author_name(pkgmgr_pkginfo_h handle, char **author_name);
768
769 /**
770  * @brief       This API gets author's email of the given package.
771  *
772  *              This API is for package-manager client application.\n
773  *
774  * @param[in]   handle                          pointer to package info handle
775  * @param[out]  author_email                    to hold author's email id.
776  * @return      0 if success, error code(<0) if fail\n
777 */
778 int pkgmgr_pkginfo_get_author_email(pkgmgr_pkginfo_h handle, char **author_email);
779
780 /**
781  * @brief       This API gets author's href of the given package.
782  *
783  *              This API is for package-manager client application.\n
784  *
785  * @param[in]   handle                          pointer to package info handle
786  * @param[out]  author_href                     to hold author's href.
787  * @return      0 if success, error code(<0) if fail\n
788 */
789 int pkgmgr_pkginfo_get_author_href(pkgmgr_pkginfo_h handle, char **author_href);
790
791 /**
792  * @brief       This API gets removable of the given package.
793  *
794  *              This API is for package-manager client application.\n
795  *
796  * @param[in]   handle                          pointer to package info handle
797  * @param[out]  removable                       to hold removable value.
798  * @return      0 if success, error code(<0) if fail\n
799 */
800 int pkgmgr_pkginfo_is_removable(pkgmgr_pkginfo_h handle, bool *removable);
801
802 /**
803  * @brief       This API gets preload of the given package.
804  *
805  *              This API is for package-manager client application.\n
806  *
807  * @param[in]   handle                          pointer to package info handle
808  * @param[out]  preload                         to hold preload value
809  * @return      0 if success, error code(<0) if fail\n
810 */
811 int pkgmgr_pkginfo_is_preload(pkgmgr_pkginfo_h handle, bool *preload);
812
813 /**
814  * @brief       This API gets readonly value of the given package.
815  *
816  *              This API is for package-manager client application.\n
817  *
818  * @param[in]   handle                          pointer to package info handle
819  * @param[out]  readonly                                to hold readonly value
820  * @return      0 if success, error code(<0) if fail\n
821 */
822 int pkgmgr_pkginfo_is_readonly(pkgmgr_pkginfo_h handle, bool *readonly);
823
824 /**
825  * @brief       This API gets accessible of the given package.
826  *
827  *              This API is for package-manager client application.\n
828  *
829  * @param[in]   pkgid                   id of package
830  * @param[out]accessible                accessible of package
831  * @return      0 if success, error code(<0) if fail\n
832 */
833 int pkgmgr_pkginfo_is_accessible(pkgmgr_pkginfo_h handle, bool *accessible);
834
835 /**
836  * @brief       This API destroy the pacakge info handle
837  *
838  *              This API is for package-manager client application.\n
839  *
840  * @param[in]   handle                          pointer to package info handle
841  * @return      0 if success, error code(<0) if fail\n
842 */
843 int pkgmgr_pkginfo_destroy_pkginfo(pkgmgr_pkginfo_h handle);
844
845 /**
846  * @brief       This API gets installed storage of the given package.
847  *
848  *              This API is for package-manager client application.\n
849  *
850  * @param[in]   pkgid                   id of package
851  * @param[out]  storage                 storage of package
852  * @return      0 if success, error code(<0) if fail\n
853 */
854 int pkgmgr_pkginfo_get_installed_storage(pkgmgr_pkginfo_h handle, pkgmgr_installed_storage *storage);
855
856 /**
857  * @brief       This API gets installed time of the given package.
858  *
859  *              This API is for package-manager client application.\n
860  *
861  * @param[in]   handle                          pointer to package info handle
862  * @param[out]  installed_time                  installed time of package
863  * @return      0 if success, error code(<0) if fail\n
864 */
865 int pkgmgr_pkginfo_get_installed_time(pkgmgr_pkginfo_h handle, int *installed_time);
866
867 /**
868  * @brief       This API gets list of ui-application/service application of the given package.
869  *
870  *              This API is for package-manager client application.\n
871  *
872  * @param[in]   handle                          pointer to package info handle
873  * @param[in]   component               application component type.
874  * @param[in]   app_func                        application's callback function.
875  * @param[in]   user_data                       user data to be passed to callback function
876  * @return      0 if success, error code(<0) if fail\n
877 */
878 int pkgmgr_appinfo_get_list(pkgmgr_pkginfo_h handle, pkgmgr_app_component component,
879                                                         pkgmgr_info_app_list_cb app_func, void *user_data);
880
881 /**
882  * @brief       This API gets list of category for ui-application/service application.
883  *
884  *              This API is for package-manager client application.\n
885  *
886  * @param[in]   handle                          pointer to package info handle
887  * @param[in]   category_func                   callback function.
888  * @param[in]   user_data                       user data to be passed to callback function
889  * @return      0 if success, error code(<0) if fail\n
890 */
891 int pkgmgr_appinfo_foreach_category(pkgmgr_appinfo_h handle, pkgmgr_info_app_category_list_cb category_func,
892                                                         void *user_data);
893
894 /**
895  * @brief       This API gets application info entry from db.
896  *
897  *              This API is for package-manager client application.\n
898  *
899  * @param[in]   appid                           application id
900  * @param[out]  handle                          pointer to app info handle
901  * @return      0 if success, error code(<0) if fail\n
902 */
903 int pkgmgr_appinfo_get_appinfo(const char *appid, pkgmgr_appinfo_h *handle);
904
905 /**
906  * @brief       This API gets appid of the given appid.
907  *
908  *              This API is for package-manager client application.\n
909  *
910  * @param[in]   handle                          pointer to app info handle
911  * @param[out]  appid                           to hold appid value
912  * @return      0 if success, error code(<0) if fail\n
913 */
914 int pkgmgr_appinfo_get_appid(pkgmgr_appinfo_h  handle, char **appid);
915
916 /**
917  * @brief       This API gets pkgid of the given appid.
918  *
919  *              This API is for package-manager client application.\n
920  *
921  * @param[in]   handle                          pointer to app info handle
922  * @param[out]pkg_name                  to hold pkgid value
923  * @return      0 if success, error code(<0) if fail\n
924 */
925 int pkgmgr_appinfo_get_pkgname(pkgmgr_appinfo_h  handle, char **pkg_name);
926
927 /**
928  * @brief       This API gets pkgid of the given appid.
929  *
930  *              This API is for package-manager client application.\n
931  *
932  * @param[in]   handle                          pointer to app info handle
933  * @param[out]  pkgid                   to hold pkgid value
934  * @return      0 if success, error code(<0) if fail\n
935 */
936 int pkgmgr_appinfo_get_pkgid(pkgmgr_appinfo_h  handle, char **pkgid);
937
938 /**
939  * @brief       This API gets exec of the given appid.
940  *
941  *              This API is for package-manager client application.\n
942  *
943  * @param[in]   handle                          pointer to app info handle
944  * @param[out]  exec                            to hold exec value
945  * @return      0 if success, error code(<0) if fail\n
946 */
947 int pkgmgr_appinfo_get_exec(pkgmgr_appinfo_h  handle, char **exec);
948
949 /**
950  * @brief       This API gets icon name of the given appid.
951  *
952  *              This API is for package-manager client application.\n
953  *
954  * @param[in]   handle                          pointer to app info handle
955  * @param[out]  icon                            to hold icon value
956  * @return      0 if success, error code(<0) if fail\n
957 */
958 int pkgmgr_appinfo_get_icon(pkgmgr_appinfo_h  handle, char **icon);
959
960 /**
961  * @brief       This API gets label of the given appid.
962  *
963  *              This API is for package-manager client application.\n
964  *
965  * @param[in]   handle                          pointer to app info handle
966  * @param[out]  label                           to hold label value
967  * @return      0 if success, error code(<0) if fail\n
968 */
969 int pkgmgr_appinfo_get_label(pkgmgr_appinfo_h  handle, char **label);
970
971 /**
972  * @brief       This API gets package name of the given appid.
973  *
974  *              This API is for package-manager client application.\n
975  *
976  * @param[in]   handle                          pointer to app info handle
977  * @param[out]  package                         to hold package value
978  * @return      0 if success, error code(<0) if fail\n
979 */
980 int pkgmgr_appinfo_get_package(pkgmgr_appinfo_h  handle, char **package);
981
982 /**
983  * @brief       This API gets component type of the given appid.
984  *
985  *              This API is for package-manager client application.\n
986  *
987  * @param[in]   handle                          pointer to app info handle
988  * @param[out]  component                               to hold component value
989  * @return      0 if success, error code(<0) if fail\n
990 */
991 int pkgmgr_appinfo_get_component(pkgmgr_appinfo_h  handle, pkgmgr_app_component *component);
992
993 /**
994  * @brief       This API gets app type of the given appid.
995  *
996  *              This API is for package-manager client application.\n
997  *
998  * @param[in]   handle                          pointer to app info handle
999  * @param[out]  app_type                        to hold the apptype.
1000  * @return      0 if success, error code(<0) if fail\n
1001 */
1002 int pkgmgr_appinfo_get_apptype(pkgmgr_appinfo_h  handle, char **app_type);
1003
1004 /**
1005  * @brief       This API gets nodisplay value of the given appid.
1006  *
1007  *              This API is for package-manager client application.\n
1008  *
1009  * @param[in]   handle                          pointer to app info handle
1010  * @param[out]  nodisplay                       to hold the nodisplay value
1011  * @return      0 if success, error code(<0) if fail\n
1012 */
1013 int pkgmgr_appinfo_is_nodisplay(pkgmgr_appinfo_h  handle, bool *nodisplay);
1014
1015 /**
1016  * @brief       This API gets multiple value of the given appid.
1017  *
1018  *              This API is for package-manager client application.\n
1019  *
1020  * @param[in]   handle                          pointer to app info handle
1021  * @param[out]  multiple                        to hold the multiple value
1022  * @return      0 if success, error code(<0) if fail\n
1023 */
1024 int pkgmgr_appinfo_is_multiple(pkgmgr_appinfo_h  handle, bool *multiple);
1025
1026 /**
1027  * @brief       This API gets taskmanage value of the given appid.
1028  *
1029  *              This API is for package-manager client application.\n
1030  *
1031  * @param[in]   handle                          pointer to app info handle
1032  * @param[out]  taskmanage                      to hold the taskmanage value
1033  * @return      0 if success, error code(<0) if fail\n
1034 */
1035 int pkgmgr_appinfo_is_taskmanage(pkgmgr_appinfo_h  handle, bool *taskmanage);
1036
1037 /**
1038  * @brief       This API gets hwacceleration value of the given appid.
1039  *
1040  *              This API is for package-manager client application.\n
1041  *
1042  * @param[in]   handle                          pointer to app info handle
1043  * @param[out]  hwacceleration                  to hold the hwacceleration value
1044  * @return      0 if success, error code(<0) if fail\n
1045 */
1046 int pkgmgr_appinfo_get_hwacceleration(pkgmgr_appinfo_h  handle, pkgmgr_hwacceleration_type *hwacceleration);
1047
1048 /**
1049  * @brief       This API gets onboot value of the given appid.
1050  *
1051  *              This API is for package-manager client application.\n
1052  *
1053  * @param[in]   handle                          pointer to app info handle
1054  * @param[out]  onboot                  to hold the onboot value
1055  * @return      0 if success, error code(<0) if fail\n
1056 */
1057 int pkgmgr_appinfo_is_onboot(pkgmgr_appinfo_h  handle, bool *onboot);
1058
1059 /**
1060  * @brief       This API gets autorestart value of the given appid.
1061  *
1062  *              This API is for package-manager client application.\n
1063  *
1064  * @param[in]   handle                          pointer to app info handle
1065  * @param[out]  autorestart                     to hold the autorestart value
1066  * @return      0 if success, error code(<0) if fail\n
1067 */
1068 int pkgmgr_appinfo_is_autorestart(pkgmgr_appinfo_h  handle, bool *autorestart);
1069
1070 /**
1071  * @brief       This API destroy the appinfo handle.
1072  *
1073  *              This API is for package-manager client application.\n
1074  *
1075  * @param[in]   handle                          pointer to app info handle
1076  * @return      0 if success, error code(<0) if fail\n
1077 */
1078 int pkgmgr_appinfo_destroy_appinfo(pkgmgr_appinfo_h  handle);
1079
1080 /**
1081  * @brief       This API creates the certinfo handle.
1082  *
1083  *              This API is for package-manager client application.\n
1084  *
1085  * @param[out]  handle                          pointer to cert info handle
1086  * @return      0 if success, error code(<0) if fail\n
1087 */
1088 int pkgmgr_pkginfo_create_certinfo(pkgmgr_certinfo_h *handle);
1089
1090 /**
1091  * @brief       This API loads cert info in the handle.
1092  *
1093  *              This API is for package-manager client application.\n
1094  *
1095  * @param[in]   handle                          pointer to cert info handle
1096  * @param[in]   pkgid                           package ID
1097  * @return      0 if success, error code(<0) if fail\n
1098 */
1099 int pkgmgr_pkginfo_load_certinfo(const char *pkgid, pkgmgr_certinfo_h handle);
1100
1101 /**
1102  * @brief       This API gets cert value for corresponding cert type.
1103  *
1104  *              This API is for package-manager client application.\n
1105  *
1106  * @param[in]   handle                          pointer to cert info handle
1107  * @param[in]   cert_type                       enum value for certificate type
1108  * @param[out]  cert_value                      pointer to store cert value
1109  * @return      0 if success, error code(<0) if fail\n
1110 */
1111 int pkgmgr_pkginfo_get_cert_value(pkgmgr_certinfo_h handle, pkgmgr_cert_type cert_type, const char **cert_value);
1112
1113 /**
1114  * @brief       This API destroys cert info handle freeing all resources.
1115  *
1116  *              This API is for package-manager client application.\n
1117  *
1118  * @param[in]   handle                          pointer to cert info handle
1119  * @return      0 if success, error code(<0) if fail\n
1120 */
1121 int pkgmgr_pkginfo_destroy_certinfo(pkgmgr_certinfo_h handle);
1122
1123 /**
1124  * @brief       This API gets datacontrol info entry from db.
1125  *
1126  *              This API is for package-manager client application.\n
1127  *
1128  * @param[in]   providerid              pointer to providerid
1129  * @param[in]   type                            pointer to type
1130  * @param[out]  appid                   pointer to appid value
1131  * @param[out]  access                  pointer to access value
1132  * @return      0 if success, error code(<0) if fail\n
1133 */
1134 int pkgmgr_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access);
1135 /** @} */
1136
1137
1138 #ifdef __cplusplus
1139 }
1140 #endif
1141 #endif                          /* __PKG_MANAGER_H__ */
1142 /**
1143  * @}
1144  * @}
1145  */
1146