c96976b4660dc6e26de35ec2e0af6458098a3615
[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 activates package.
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   package id
382  * @return      request_id (>0) if success, error code(<0) if fail\n
383  * @retval      PKGMGR_R_OK     success
384  * @retval      PKGMGR_R_EINVAL invalid argument
385  * @retval      PKGMGR_R_ECOMM  communication error
386 */
387 int pkgmgr_client_activate(pkgmgr_client *pc, const char *pkg_type,
388                                 const char *pkgid);
389
390 /**
391  * @brief       This API deactivates package.
392  *
393  * This API is for package-manager client application.\n
394  * 
395  * @param[in]   pc      pkgmgr_client 
396  * @param[in]   pkg_type                package type 
397  * @param[in]   pkgid   package id
398  * @return      request_id (>0) if success, error code(<0) if fail\n
399  * @retval      PKGMGR_R_OK     success
400  * @retval      PKGMGR_R_EINVAL invalid argument
401  * @retval      PKGMGR_R_ECOMM  communication error
402 */
403 int pkgmgr_client_deactivate(pkgmgr_client *pc, const char *pkg_type,
404                                  const char *pkgid);
405
406 /**
407  * @brief       This API activates package.
408  *
409  * This API is for package-manager client application.\n
410  *
411  * @param[in]   pc      pkgmgr_client
412  * @param[in]   appid   applicaiton id
413  * @return      request_id (>0) if success, error code(<0) if fail\n
414  * @retval      PKGMGR_R_OK     success
415  * @retval      PKGMGR_R_EINVAL invalid argument
416  * @retval      PKGMGR_R_ECOMM  communication error
417 */
418 int pkgmgr_client_activate_app(pkgmgr_client *pc, const char *appid);
419
420 /**
421  * @brief       This API activates package.
422  *
423  * This API is for package-manager client application.\n
424  *
425  * @param[in]   pc      pkgmgr_client
426  * @param[in]   appid   applicaiton id
427  * @param[in]   argv    argument vector
428  * @return      request_id (>0) if success, error code(<0) if fail\n
429  * @retval      PKGMGR_R_OK     success
430  * @retval      PKGMGR_R_EINVAL invalid argument
431  * @retval      PKGMGR_R_ECOMM  communication error
432 */
433 int pkgmgr_client_activate_appv(pkgmgr_client * pc, const char *appid, char *const argv[]);
434
435 /**
436  * @brief       This API deactivates package.
437  *
438  * This API is for package-manager client application.\n
439  *
440  * @param[in]   pc      pkgmgr_client
441  * @param[in]   appid   applicaiton id
442  * @return      request_id (>0) if success, error code(<0) if fail\n
443  * @retval      PKGMGR_R_OK     success
444  * @retval      PKGMGR_R_EINVAL invalid argument
445  * @retval      PKGMGR_R_ECOMM  communication error
446 */
447 int pkgmgr_client_deactivate_app(pkgmgr_client *pc, const char *appid);
448
449 /**
450  * @brief       This API deletes application's private data.
451  *
452  * This API is for package-manager client application.\n
453  *
454  * @param[in]   pc      pkgmgr_client
455  * @param[in]   pkg_type                package type
456  * @param[in]   pkgid   package id
457  * @param[in]   mode            installation mode  - PM_DEFAULT, PM_QUIET
458  * @return      request_id (>0) if success, error code(<0) if fail\n
459  * @retval      PKGMGR_R_OK     success
460  * @retval      PKGMGR_R_EINVAL invalid argument
461  * @retval      PKGMGR_R_ECOMM  communication error
462 */
463 int pkgmgr_client_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
464                                 const char *appid, pkgmgr_mode mode);
465
466 /**
467  * @brief       This API request to listen the pkgmgr's broadcasting
468  *
469  * This API is for package-manager client application.\n
470  * 
471  * @param[in]   pc      pkgmgr_client 
472  * @param[in]   event_cb        user callback
473  * @param[in]   data            user data
474  * @return      request_id (>0) if success, error code(<0) if fail\n
475  * @retval      PKGMGR_R_OK     success
476  * @retval      PKGMGR_R_EINVAL invalid argument
477 */
478 int pkgmgr_client_listen_status(pkgmgr_client *pc, pkgmgr_handler event_cb,
479                                     void *data);
480
481 /**
482  * @brief       This API broadcasts pkgmgr's status
483  *
484  * This API is for package-manager client application.\n
485  * 
486  * @param[in]   pc      pkgmgr_client 
487  * @param[in]   pkg_type                package type 
488  * @param[in]   pkgid   package id
489  * @param[in]   key             key to broadcast
490  * @param[in]   val             value to broadcast
491  * @return      0 if success, error code(<0) if fail\n
492  * @retval      PKGMGR_R_OK     success
493  * @retval      PKGMGR_R_EINVAL invalid argument
494 */
495 int pkgmgr_client_broadcast_status(pkgmgr_client *pc, const char *pkg_type,
496                                          const char *pkgid,  const char *key,
497                                          const char *val);
498
499 /**
500  * @brief       This API  gets the package's information.
501  *
502  *              This API is for package-manager client application.\n
503  *
504  * @param[in]   pkg_path                package file path to get infomation
505  * @return      package entry pointer if success, NULL if fail\n
506 */
507 pkgmgr_info *pkgmgr_client_check_pkginfo_from_file(const char *pkg_path);
508
509 /**
510  * @brief       This API  get package information value
511  *
512  *              This API is for package-manager client application.\n
513  *
514  * @param[in]   pkg_info                        pointer for package info entry
515  * @return      0 if success, error code(<0) if fail\n
516 */
517 int pkgmgr_client_free_pkginfo(pkgmgr_info * pkg_info);
518
519 /**
520  * @brief       This API requests service
521  *
522  * This API is for package-manager client application.\n
523  *
524  * @param[in]   service_type            pkgmgr_request_service_type
525  * @param[in]   service_mode    mode which is used for addtional mode selection
526  * @param[in]   pc                              pkgmgr_client
527  * @param[in]   pkg_type                package type
528  * @param[in]   pkgid                   package id
529  * @param[in]   custom_info             custom information which is used for addtional information
530  * @param[in]   event_cb                user callback
531  * @param[in]   data                    user data
532  * @return      request_id (>0) if success, error code(<0) if fail\n
533  * @retval      PKGMGR_R_OK     success
534  * @retval      PKGMGR_R_EINVAL invalid argument
535  * @retval      PKGMGR_R_ECOMM  communication error
536 */
537 int pkgmgr_client_request_service(pkgmgr_request_service_type service_type, int service_mode,
538                                         pkgmgr_client * pc, const char *pkg_type, const char *pkgid,
539                                         const char *custom_info, pkgmgr_handler event_cb, void *data);
540
541 /**
542  * @brief       This API provides package list
543  *
544  * This API is for package-manager client application.\n
545  * 
546  * @param[in]   iter_fn iteration function for list 
547  * @param[in]   data            user data
548  * @return      0 if success, error code(<0) if fail\n
549  * @retval      PKGMGR_R_OK     success
550  * @retval      PKGMGR_R_EINVAL invalid argument
551  * @retval      PKGMGR_R_ERROR  internal error
552 */
553 int pkgmgr_get_pkg_list(pkgmgr_iter_fn iter_fn, void *data);
554 /** @} */
555
556 /**
557  * @defgroup pkg_list           APIs to get package information
558  * @ingroup pkgmgr
559  * @brief
560  *      API to get package information
561 */
562
563 /**
564  * @addtogroup pkg_list
565  * @{
566  */
567  
568
569 /**
570  * @brief       This API  gets the package's information.
571  *
572  *              This API is for package-manager client application.\n
573  * 
574  * @param[in]   pkg_type                package type for the package to get infomation
575  * @param[in]   pkgid   package id for the package to get infomation
576  * @return      package entry pointer if success, NULL if fail\n
577 */
578 pkgmgr_info * pkgmgr_info_new(const char *pkg_type, const char *pkgid);
579
580 /**
581  * @brief       This API  gets the package's information.
582  *
583  *              This API is for package-manager client application.\n
584  * 
585  * @param[in]   pkg_type                package type for the package to get infomation
586  * @param[in]   pkg_path                package file path to get infomation
587  * @return      package entry pointer if success, NULL if fail\n
588 */
589 pkgmgr_info * pkgmgr_info_new_from_file(const char *pkg_type,
590                                              const char *pkg_path);
591
592 /**
593  * @brief       This API  get package information value
594  *
595  *              This API is for package-manager client application.\n
596  * 
597  * @param[in]   pkg_info        pointer for package info entry
598  * @param[in]   key                             key for package info field
599  * @return      string value if success, NULL if fail\n
600 */
601 char * pkgmgr_info_get_string(pkgmgr_info * pkg_info, const char *key);
602
603 /**
604  * @brief       This API  get package information value
605  *
606  *              This API is for package-manager client application.\n
607  * 
608  * @param[in]   pkg_info                        pointer for package info entry
609  * @return      0 if success, error code(<0) if fail\n
610 */
611 int pkgmgr_info_free(pkgmgr_info * pkg_info);
612
613 /**
614  * @brief       This API gets list of installed applications.
615  *
616  *              This API is for package-manager client application.\n
617  *
618  * @param[in]   pkg_list_cb     iteration function for list
619  * @param[in]   user_data                       user data to be passed to callback function
620  * @return      0 if success, error code(<0) if fail\n
621 */
622 int pkgmgr_pkginfo_get_list(pkgmgr_info_pkg_list_cb pkg_list_cb, void *user_data);
623
624 /**
625  * @brief       This API  get package info entry from db
626  *
627  *              This API is for package-manager client application.\n
628  *
629  * @param[in]   pkgid                   pointer to package id
630  * @param[out]  handle                          pointer to the package info handle.
631  * @return      0 if success, error code(<0) if fail\n
632 */
633 int pkgmgr_pkginfo_get_pkginfo(const char *pkgid, pkgmgr_pkginfo_h *handle);
634
635 /**
636  * @brief       This API  gets type of the given package.
637  *
638  *              This API is for package-manager client application.\n
639  *
640  * @param[in]   handle                          pointer to package info handle
641  * @param[out]  type                            to hold package type.
642  * @return      0 if success, error code(<0) if fail\n
643 */
644 int pkgmgr_pkginfo_get_pkgname(pkgmgr_pkginfo_h handle, char **pkg_name);
645
646 /**
647  * @brief       This API  gets id of the given package.
648  *
649  *              This API is for package-manager client application.\n
650  *
651  * @param[in]   handle                          pointer to package info handle
652  * @param[out]pkgid                             to hold package id.
653  * @return      0 if success, error code(<0) if fail\n
654 */
655 int pkgmgr_pkginfo_get_pkgid(pkgmgr_pkginfo_h handle, char **pkgid);
656
657 /**
658  * @brief       This API  gets type of the given package.
659  *
660  *              This API is for package-manager client application.\n
661  *
662  * @param[in]   handle                          pointer to package info handle
663  * @param[out]  type                            to hold package type.
664  * @return      0 if success, error code(<0) if fail\n
665 */
666 int pkgmgr_pkginfo_get_type(pkgmgr_pkginfo_h handle, char **type);
667
668 /**
669  * @brief       This API  gets version  of the given package.
670  *
671  *              This API is for package-manager client application.\n
672  *
673  * @param[in]   handle                          pointer to package info handle
674  * @param[out]  version                         to hold package version.
675  * @return      0 if success, error code(<0) if fail\n
676 */
677 int pkgmgr_pkginfo_get_version(pkgmgr_pkginfo_h handle, char **version);
678
679 /**
680  * @brief       This API  gets install location of the given package.
681  *
682  *              This API is for package-manager client application.\n
683  *
684  * @param[in]   handle                          pointer to package info handle
685  * @param[out]  location                        to hold install location.
686  * @return      0 if success, error code(<0) if fail\n
687 */
688 int pkgmgr_pkginfo_get_install_location(pkgmgr_pkginfo_h handle, pkgmgr_install_location *location);
689
690 /**
691  * @brief       This API  gets package size of the given package in case of external installation.
692  * size will be 0 if package install location is internal-only.
693  * size will be 0 if package install location is prefer-external but size is not specified in manifest file.
694  * Application should check the return value and use it distinguish the above cases.
695  *
696  *              This API is for package-manager client application.\n
697  *
698  * @param[in]   handle                          pointer to package info handle
699  * @param[out]  size                    to hold package size.
700  * @return      0 if success, error code(<0) if fail\n
701  * @return
702 */
703 int pkgmgr_pkginfo_get_package_size(pkgmgr_pkginfo_h handle, int *size);
704
705 /**
706  * @brief       This API gets icon of the given package.
707  *
708  *              This API is for package-manager client application.\n
709  *
710  * @param[in]   handle                          pointer to package info handle
711  * @param[out]  icon                            to hold package icon.
712  * @return      0 if success, error code(<0) if fail\n
713 */
714 int pkgmgr_pkginfo_get_icon(pkgmgr_pkginfo_h handle, char **icon);
715
716 /**
717  * @brief       This API gets label of the given package.
718  *
719  *              This API is for package-manager client application.\n
720  *
721  * @param[in]   handle                          pointer to package info handle
722  * @param[out]  label                           to hold package label.
723  * @return      0 if success, error code(<0) if fail\n
724 */
725 int pkgmgr_pkginfo_get_label(pkgmgr_pkginfo_h handle, char **label);
726
727 /**
728  * @brief       This API gets desription of the given package.
729  *
730  *              This API is for package-manager client application.\n
731  *
732  * @param[in]   handle                          pointer to package info handle
733  * @param[out]  description                     to hold package description.
734  * @return      0 if success, error code(<0) if fail\n
735 */
736 int pkgmgr_pkginfo_get_description(pkgmgr_pkginfo_h handle, char **description);
737
738 /**
739  * @brief       This API gets author's name of the given package.
740  *
741  *              This API is for package-manager client application.\n
742  *
743  * @param[in]   handle                          pointer to package info handle
744  * @param[out]  author_name                     to hold author's name.
745  * @return      0 if success, error code(<0) if fail\n
746 */
747 int pkgmgr_pkginfo_get_author_name(pkgmgr_pkginfo_h handle, char **author_name);
748
749 /**
750  * @brief       This API gets author's email of the given package.
751  *
752  *              This API is for package-manager client application.\n
753  *
754  * @param[in]   handle                          pointer to package info handle
755  * @param[out]  author_email                    to hold author's email id.
756  * @return      0 if success, error code(<0) if fail\n
757 */
758 int pkgmgr_pkginfo_get_author_email(pkgmgr_pkginfo_h handle, char **author_email);
759
760 /**
761  * @brief       This API gets author's href of the given package.
762  *
763  *              This API is for package-manager client application.\n
764  *
765  * @param[in]   handle                          pointer to package info handle
766  * @param[out]  author_href                     to hold author's href.
767  * @return      0 if success, error code(<0) if fail\n
768 */
769 int pkgmgr_pkginfo_get_author_href(pkgmgr_pkginfo_h handle, char **author_href);
770
771 /**
772  * @brief       This API gets removable of the given package.
773  *
774  *              This API is for package-manager client application.\n
775  *
776  * @param[in]   handle                          pointer to package info handle
777  * @param[out]  removable                       to hold removable value.
778  * @return      0 if success, error code(<0) if fail\n
779 */
780 int pkgmgr_pkginfo_is_removable(pkgmgr_pkginfo_h handle, bool *removable);
781
782 /**
783  * @brief       This API gets preload of the given package.
784  *
785  *              This API is for package-manager client application.\n
786  *
787  * @param[in]   handle                          pointer to package info handle
788  * @param[out]  preload                         to hold preload value
789  * @return      0 if success, error code(<0) if fail\n
790 */
791 int pkgmgr_pkginfo_is_preload(pkgmgr_pkginfo_h handle, bool *preload);
792
793 /**
794  * @brief       This API gets readonly value of the given package.
795  *
796  *              This API is for package-manager client application.\n
797  *
798  * @param[in]   handle                          pointer to package info handle
799  * @param[out]  readonly                                to hold readonly value
800  * @return      0 if success, error code(<0) if fail\n
801 */
802 int pkgmgr_pkginfo_is_readonly(pkgmgr_pkginfo_h handle, bool *readonly);
803
804 /**
805  * @brief       This API gets accessible of the given package.
806  *
807  *              This API is for package-manager client application.\n
808  *
809  * @param[in]   pkgid                   id of package
810  * @param[out]accessible                accessible of package
811  * @return      0 if success, error code(<0) if fail\n
812 */
813 int pkgmgr_pkginfo_is_accessible(pkgmgr_pkginfo_h handle, bool *accessible);
814
815 /**
816  * @brief       This API destroy the pacakge info handle
817  *
818  *              This API is for package-manager client application.\n
819  *
820  * @param[in]   handle                          pointer to package info handle
821  * @return      0 if success, error code(<0) if fail\n
822 */
823 int pkgmgr_pkginfo_destroy_pkginfo(pkgmgr_pkginfo_h handle);
824
825 /**
826  * @brief       This API gets installed storage of the given package.
827  *
828  *              This API is for package-manager client application.\n
829  *
830  * @param[in]   pkgid                   id of package
831  * @param[out]  storage                 storage of package
832  * @return      0 if success, error code(<0) if fail\n
833 */
834 int pkgmgr_pkginfo_get_installed_storage(pkgmgr_pkginfo_h handle, pkgmgr_installed_storage *storage);
835
836 /**
837  * @brief       This API gets installed time of the given package.
838  *
839  *              This API is for package-manager client application.\n
840  *
841  * @param[in]   handle                          pointer to package info handle
842  * @param[out]  installed_time                  installed time of package
843  * @return      0 if success, error code(<0) if fail\n
844 */
845 int pkgmgr_pkginfo_get_installed_time(pkgmgr_pkginfo_h handle, int *installed_time);
846
847 /**
848  * @brief       This API gets list of ui-application/service application of the given package.
849  *
850  *              This API is for package-manager client application.\n
851  *
852  * @param[in]   handle                          pointer to package info handle
853  * @param[in]   component               application component type.
854  * @param[in]   app_func                        application's callback function.
855  * @param[in]   user_data                       user data to be passed to callback function
856  * @return      0 if success, error code(<0) if fail\n
857 */
858 int pkgmgr_appinfo_get_list(pkgmgr_pkginfo_h handle, pkgmgr_app_component component,
859                                                         pkgmgr_info_app_list_cb app_func, void *user_data);
860
861 /**
862  * @brief       This API gets list of category for ui-application/service application.
863  *
864  *              This API is for package-manager client application.\n
865  *
866  * @param[in]   handle                          pointer to package info handle
867  * @param[in]   category_func                   callback function.
868  * @param[in]   user_data                       user data to be passed to callback function
869  * @return      0 if success, error code(<0) if fail\n
870 */
871 int pkgmgr_appinfo_foreach_category(pkgmgr_appinfo_h handle, pkgmgr_info_app_category_list_cb category_func,
872                                                         void *user_data);
873
874 /**
875  * @brief       This API gets application info entry from db.
876  *
877  *              This API is for package-manager client application.\n
878  *
879  * @param[in]   appid                           application id
880  * @param[out]  handle                          pointer to app info handle
881  * @return      0 if success, error code(<0) if fail\n
882 */
883 int pkgmgr_appinfo_get_appinfo(const char *appid, pkgmgr_appinfo_h *handle);
884
885 /**
886  * @brief       This API gets appid of the given appid.
887  *
888  *              This API is for package-manager client application.\n
889  *
890  * @param[in]   handle                          pointer to app info handle
891  * @param[out]  appid                           to hold appid value
892  * @return      0 if success, error code(<0) if fail\n
893 */
894 int pkgmgr_appinfo_get_appid(pkgmgr_appinfo_h  handle, char **appid);
895
896 /**
897  * @brief       This API gets pkgid of the given appid.
898  *
899  *              This API is for package-manager client application.\n
900  *
901  * @param[in]   handle                          pointer to app info handle
902  * @param[out]pkg_name                  to hold pkgid value
903  * @return      0 if success, error code(<0) if fail\n
904 */
905 int pkgmgr_appinfo_get_pkgname(pkgmgr_appinfo_h  handle, char **pkg_name);
906
907 /**
908  * @brief       This API gets pkgid of the given appid.
909  *
910  *              This API is for package-manager client application.\n
911  *
912  * @param[in]   handle                          pointer to app info handle
913  * @param[out]  pkgid                   to hold pkgid value
914  * @return      0 if success, error code(<0) if fail\n
915 */
916 int pkgmgr_appinfo_get_pkgid(pkgmgr_appinfo_h  handle, char **pkgid);
917
918 /**
919  * @brief       This API gets exec of the given appid.
920  *
921  *              This API is for package-manager client application.\n
922  *
923  * @param[in]   handle                          pointer to app info handle
924  * @param[out]  exec                            to hold exec value
925  * @return      0 if success, error code(<0) if fail\n
926 */
927 int pkgmgr_appinfo_get_exec(pkgmgr_appinfo_h  handle, char **exec);
928
929 /**
930  * @brief       This API gets icon name of the given appid.
931  *
932  *              This API is for package-manager client application.\n
933  *
934  * @param[in]   handle                          pointer to app info handle
935  * @param[out]  icon                            to hold icon value
936  * @return      0 if success, error code(<0) if fail\n
937 */
938 int pkgmgr_appinfo_get_icon(pkgmgr_appinfo_h  handle, char **icon);
939
940 /**
941  * @brief       This API gets label of the given appid.
942  *
943  *              This API is for package-manager client application.\n
944  *
945  * @param[in]   handle                          pointer to app info handle
946  * @param[out]  label                           to hold label value
947  * @return      0 if success, error code(<0) if fail\n
948 */
949 int pkgmgr_appinfo_get_label(pkgmgr_appinfo_h  handle, char **label);
950
951 /**
952  * @brief       This API gets package name of the given appid.
953  *
954  *              This API is for package-manager client application.\n
955  *
956  * @param[in]   handle                          pointer to app info handle
957  * @param[out]  package                         to hold package value
958  * @return      0 if success, error code(<0) if fail\n
959 */
960 int pkgmgr_appinfo_get_package(pkgmgr_appinfo_h  handle, char **package);
961
962 /**
963  * @brief       This API gets component type of the given appid.
964  *
965  *              This API is for package-manager client application.\n
966  *
967  * @param[in]   handle                          pointer to app info handle
968  * @param[out]  component                               to hold component value
969  * @return      0 if success, error code(<0) if fail\n
970 */
971 int pkgmgr_appinfo_get_component(pkgmgr_appinfo_h  handle, pkgmgr_app_component *component);
972
973 /**
974  * @brief       This API gets app type of the given appid.
975  *
976  *              This API is for package-manager client application.\n
977  *
978  * @param[in]   handle                          pointer to app info handle
979  * @param[out]  app_type                        to hold the apptype.
980  * @return      0 if success, error code(<0) if fail\n
981 */
982 int pkgmgr_appinfo_get_apptype(pkgmgr_appinfo_h  handle, char **app_type);
983
984 /**
985  * @brief       This API gets nodisplay value of the given appid.
986  *
987  *              This API is for package-manager client application.\n
988  *
989  * @param[in]   handle                          pointer to app info handle
990  * @param[out]  nodisplay                       to hold the nodisplay value
991  * @return      0 if success, error code(<0) if fail\n
992 */
993 int pkgmgr_appinfo_is_nodisplay(pkgmgr_appinfo_h  handle, bool *nodisplay);
994
995 /**
996  * @brief       This API gets multiple value of the given appid.
997  *
998  *              This API is for package-manager client application.\n
999  *
1000  * @param[in]   handle                          pointer to app info handle
1001  * @param[out]  multiple                        to hold the multiple value
1002  * @return      0 if success, error code(<0) if fail\n
1003 */
1004 int pkgmgr_appinfo_is_multiple(pkgmgr_appinfo_h  handle, bool *multiple);
1005
1006 /**
1007  * @brief       This API gets taskmanage value of the given appid.
1008  *
1009  *              This API is for package-manager client application.\n
1010  *
1011  * @param[in]   handle                          pointer to app info handle
1012  * @param[out]  taskmanage                      to hold the taskmanage value
1013  * @return      0 if success, error code(<0) if fail\n
1014 */
1015 int pkgmgr_appinfo_is_taskmanage(pkgmgr_appinfo_h  handle, bool *taskmanage);
1016
1017 /**
1018  * @brief       This API gets hwacceleration value of the given appid.
1019  *
1020  *              This API is for package-manager client application.\n
1021  *
1022  * @param[in]   handle                          pointer to app info handle
1023  * @param[out]  hwacceleration                  to hold the hwacceleration value
1024  * @return      0 if success, error code(<0) if fail\n
1025 */
1026 int pkgmgr_appinfo_get_hwacceleration(pkgmgr_appinfo_h  handle, pkgmgr_hwacceleration_type *hwacceleration);
1027
1028 /**
1029  * @brief       This API gets onboot value of the given appid.
1030  *
1031  *              This API is for package-manager client application.\n
1032  *
1033  * @param[in]   handle                          pointer to app info handle
1034  * @param[out]  onboot                  to hold the onboot value
1035  * @return      0 if success, error code(<0) if fail\n
1036 */
1037 int pkgmgr_appinfo_is_onboot(pkgmgr_appinfo_h  handle, bool *onboot);
1038
1039 /**
1040  * @brief       This API gets autorestart value of the given appid.
1041  *
1042  *              This API is for package-manager client application.\n
1043  *
1044  * @param[in]   handle                          pointer to app info handle
1045  * @param[out]  autorestart                     to hold the autorestart value
1046  * @return      0 if success, error code(<0) if fail\n
1047 */
1048 int pkgmgr_appinfo_is_autorestart(pkgmgr_appinfo_h  handle, bool *autorestart);
1049
1050 /**
1051  * @brief       This API destroy the appinfo handle.
1052  *
1053  *              This API is for package-manager client application.\n
1054  *
1055  * @param[in]   handle                          pointer to app info handle
1056  * @return      0 if success, error code(<0) if fail\n
1057 */
1058 int pkgmgr_appinfo_destroy_appinfo(pkgmgr_appinfo_h  handle);
1059
1060 /**
1061  * @brief       This API creates the certinfo handle.
1062  *
1063  *              This API is for package-manager client application.\n
1064  *
1065  * @param[out]  handle                          pointer to cert info handle
1066  * @return      0 if success, error code(<0) if fail\n
1067 */
1068 int pkgmgr_pkginfo_create_certinfo(pkgmgr_certinfo_h *handle);
1069
1070 /**
1071  * @brief       This API loads cert info in the handle.
1072  *
1073  *              This API is for package-manager client application.\n
1074  *
1075  * @param[in]   handle                          pointer to cert info handle
1076  * @param[in]   pkgid                           package ID
1077  * @return      0 if success, error code(<0) if fail\n
1078 */
1079 int pkgmgr_pkginfo_load_certinfo(const char *pkgid, pkgmgr_certinfo_h handle);
1080
1081 /**
1082  * @brief       This API gets cert value for corresponding cert type.
1083  *
1084  *              This API is for package-manager client application.\n
1085  *
1086  * @param[in]   handle                          pointer to cert info handle
1087  * @param[in]   cert_type                       enum value for certificate type
1088  * @param[out]  cert_value                      pointer to store cert value
1089  * @return      0 if success, error code(<0) if fail\n
1090 */
1091 int pkgmgr_pkginfo_get_cert_value(pkgmgr_certinfo_h handle, pkgmgr_cert_type cert_type, const char **cert_value);
1092
1093 /**
1094  * @brief       This API destroys cert info handle freeing all resources.
1095  *
1096  *              This API is for package-manager client application.\n
1097  *
1098  * @param[in]   handle                          pointer to cert info handle
1099  * @return      0 if success, error code(<0) if fail\n
1100 */
1101 int pkgmgr_pkginfo_destroy_certinfo(pkgmgr_certinfo_h handle);
1102
1103 /**
1104  * @brief       This API gets datacontrol info entry from db.
1105  *
1106  *              This API is for package-manager client application.\n
1107  *
1108  * @param[in]   providerid              pointer to providerid
1109  * @param[in]   type                            pointer to type
1110  * @param[out]  appid                   pointer to appid value
1111  * @param[out]  access                  pointer to access value
1112  * @return      0 if success, error code(<0) if fail\n
1113 */
1114 int pkgmgr_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access);
1115 /** @} */
1116
1117
1118 #ifdef __cplusplus
1119 }
1120 #endif
1121 #endif                          /* __PKG_MANAGER_H__ */
1122 /**
1123  * @}
1124  * @}
1125  */
1126