Update doxygen comments
[platform/core/api/package-manager.git] / include / package_info.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #ifndef __TIZEN_APPFW_PACKAGE_INFO_H
19 #define __TIZEN_APPFW_PACKAGE_INFO_H
20
21 #include <tizen.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28  * @file package_info.h
29  */
30
31 /**
32  * @addtogroup CAPI_PACKAGE_INFO_MODULE
33  * @{
34  */
35
36
37 /**
38  * @brief The package information handle.
39  * @since_tizen 2.3
40  */
41 typedef struct package_info_s *package_info_h;
42
43
44 /**
45  * @brief Enumeration for storage type.
46  * @since_tizen 2.3
47  */
48 typedef enum {
49         PACKAGE_INFO_INTERNAL_STORAGE = 0,    /**< Internal storage */
50         PACKAGE_INFO_EXTERNAL_STORAGE = 1,    /**< External storage */
51 } package_info_installed_storage_type_e;
52
53
54 /**
55  * @brief Enumeration for app component type.
56  * @since_tizen 2.3
57  */
58 typedef enum {
59         PACKAGE_INFO_ALLAPP = 0,        /**< All application */
60         PACKAGE_INFO_UIAPP = 1,         /**< UI application */
61         PACKAGE_INFO_SERVICEAPP = 2,    /**< Service application */
62 } package_info_app_component_type_e;
63
64
65 /**
66  * @brief Enumeration for certification type.
67  * @since_tizen 2.3
68  */
69 typedef enum {
70         PACKAGE_INFO_AUTHOR_ROOT_CERT = 0,               /**< Author Root Certificate*/
71         PACKAGE_INFO_AUTHOR_INTERMEDIATE_CERT = 1,       /**< Author Intermediate Certificate*/
72         PACKAGE_INFO_AUTHOR_SIGNER_CERT = 2,             /**< Author Signer Certificate*/
73         PACKAGE_INFO_DISTRIBUTOR_ROOT_CERT = 3,          /**< Distributor Root Certificate*/
74         PACKAGE_INFO_DISTRIBUTOR_INTERMEDIATE_CERT = 4,  /**< Distributor Intermediate Certificate*/
75         PACKAGE_INFO_DISTRIBUTOR_SIGNER_CERT = 5,        /**< Distributor Signer Certificate*/
76         PACKAGE_INFO_DISTRIBUTOR2_ROOT_CERT = 6,         /**< Distributor2 Root Certificate*/
77         PACKAGE_INFO_DISTRIBUTOR2_INTERMEDIATE_CERT = 7, /**< Distributor2 Intermediate Certificate*/
78         PACKAGE_INFO_DISTRIBUTOR2_SIGNER_CERT = 8,       /**< Distributor2 Signer Certificate*/
79 } package_cert_type_e;
80
81
82 /**
83  * @brief Called to get the application ID once for each installed package.
84  * @since_tizen 2.3
85  * @param[in] comp_type The Application Component type
86  * @param[in] callback  The callback function to be invoked
87  * @param[in] user_data The user data passed from the foreach function
88  * @return @c true to continue with the next iteration of the loop,
89  *         otherwise @c false to break out of the loop
90  * @pre package_info_foreach_app_from_package() will invoke this callback.
91  * @see package_info_foreach_app_from_package()
92  */
93 typedef bool (*package_info_app_cb) (package_info_app_component_type_e comp_type, const char *app_id, void *user_data);
94
95
96 /**
97  * @brief Called to get the certification information.
98  * @since_tizen 2.3
99  * @param[in] package_info The package info handle
100  * @param[in] cert_type    The certificate type
101  * @param[in] cert_value   The certificate value of corresponding certificate key \n
102  *                         This value is base64 encoded data.
103  * @param[in] user_data    The user data passed from the foreach function
104  * @return @c true to continue with the next iteration of the loop,
105  *         otherwise @c false to break out of the loop
106  * @pre package_info_foreach_cert_info() will invoke this callback.
107  * @see package_info_foreach_cert_info()
108  */
109 typedef bool (*package_info_cert_info_cb) (package_info_h handle, package_cert_type_e cert_type, const char *cert_value, void *user_data);
110
111
112 /**
113  * @brief Called to get the privilege information.
114  * @since_tizen 2.3
115  * @param[in] privilege_name the name of the privilege
116  * @param[in] user_data    The user data passed from the foreach function
117  * @return  @c true to continue with the next iteration of the loop,
118  *          otherwise @c false to break out of the loop
119  * @pre package_info_foreach_privilege_info() will invoke this callback.
120  * @see package_info_foreach_privilege_info()
121  */
122 typedef bool (*package_info_privilege_info_cb) (const char *privilege_name, void *user_data);
123
124
125 /**
126  * @brief Retrieves all application IDs of each package.
127  * @since_tizen 2.3
128  * @param[in] package_info  The package info handle
129  * @param[in] comp_type     The application component type
130  * @param[in] callback      The callback function to invoke
131  * @param[in] user_data     The user data to be passed to the callback function
132  * @return @c 0 on success,
133  *         otherwise a negative error value
134  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
135  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
136  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   No such package
137  * @post This function invokes package_info_app_cb() repeatedly for each package.
138  * @see package_info_app_cb()
139  */
140 int package_info_foreach_app_from_package(package_info_h package_info, package_info_app_component_type_e comp_type, package_info_app_cb callback, void *user_data);
141
142
143 /**
144  * @brief Destroys the package information handle and releases all its resources.
145  * @since_tizen 2.3
146  * @param[in] package_info The package information handle
147  * @return @c 0 on success,
148  *         otherwise a negative error value
149  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
150  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
151  * @see package_manager_foreach_package_info()
152  * @see package_manager_get_package_info()
153  */
154 int package_info_destroy(package_info_h package_info);
155
156
157 /**
158  * @brief Gets the package name.
159  * @since_tizen 2.3
160  * @remarks You must release @a package using free().
161  * @param[in]  package_info The package information
162  * @param[out] package      The package name
163  * @return @c 0 on success,
164  *         otherwise a negative error value
165  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
166  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
167  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
168  */
169 int package_info_get_package(package_info_h package_info, char **package);
170
171
172 /**
173  * @brief Gets the label of the package.
174  * @since_tizen 2.3
175  * @remarks You must release @a label using free().
176  * @param[in]  package_info The package information
177  * @param[out] label        The label of the package
178  * @return @c 0 on success,
179  *         otherwise a negative error value
180  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
181  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
182  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
183  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
184  */
185 int package_info_get_label(package_info_h package_info, char **label);
186
187
188 /**
189  * @brief Gets the absolute path to the icon image.
190  * @since_tizen 2.3
191  * @remarks You must release @a path using free().
192  * @param[in]  package_info The package information
193  * @param[out] path         The path of the package
194  * @return @c 0 on success,
195  *         otherwise a negative error value
196  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
197  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
198  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
199  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
200  */
201 int package_info_get_icon(package_info_h package_info, char **path);
202
203
204 /**
205  * @brief Gets the version of the package.
206  * @since_tizen 2.3
207  * @remarks You must release @a version using free().
208  * @param[in]  package_info The package information
209  * @param[out] version      The version of the package
210  * @return @c 0 on success,
211  *         otherwise a negative error value
212  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
213  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
214  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
215  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
216  */
217 int package_info_get_version(package_info_h package_info, char **version);
218
219
220 /**
221  * @brief Gets the type of the package.
222  * @since_tizen 2.3
223  * @remarks You must release @a type using free().
224  * @param[in]  package_info The package information
225  * @param[out] type         The type of the package
226  * @return @c 0 on success,
227  *         otherwise a negative error value
228  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
229  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
230  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
231  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
232  */
233 int package_info_get_type(package_info_h package_info, char **type);
234
235
236 /**
237  * @brief Gets the installed storage for the given package.
238  * @since_tizen 2.3
239  * @param[in]  package_info The package information
240  * @param[out] storage      The installed storage
241  * @return @c 0 on success,
242  *         otherwise a negative error value
243  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
244  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
245  */
246 int package_info_get_installed_storage(package_info_h package_info, package_info_installed_storage_type_e *storage);
247
248
249 /**
250  * @brief Gets the root path of the package.
251  * @since_tizen 2.3
252  * @remarks You must release @a path using free().
253  * @param[in]  package_info The package information
254  * @param[out] path         The root path of the package
255  * @return @c 0 on success,
256  *         otherwise a negative error value
257  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
258  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
259  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
260  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
261  */
262 int package_info_get_root_path(package_info_h package_info, char **path);
263
264
265 /**
266  * @platform
267  * @brief Gets the name of the TEP(Tizen Expansion Package).
268  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
269  * @privlevel platform
270  * @privilege %http://tizen.org/privilege/packagemanager.admin
271  * @remarks Name must be released using free().
272  * @param[in] package_info The package information
273  * @param[out] name The name of the tep
274  * @return 0 on success,
275  *         otherwise a negative error value
276  * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
277  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
278  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
279  * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR           Severe system error
280  * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
281  */
282 int package_info_get_tep_name(package_info_h package_info, char **name);
283
284
285 /**
286  * @brief Checks whether the package is system package.
287  * @since_tizen 2.3
288  * @param[in]  package_info The package information
289  * @param[out] system       @c true if the package is system package,
290  *                          otherwise @c false if the package is not system package
291  * @return @c 0 on success,
292  *         otherwise a negative error value
293  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
294  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
295  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
296  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
297  */
298 int package_info_is_system_package(package_info_h package_info, bool *system);
299
300
301 /**
302  * @brief Checks whether the package is removable.
303  * @since_tizen 2.3
304  * @param[in]  package_info The package information
305  * @param[out] removable    The removable info of the package
306  * @return @c 0 on success,
307  *         otherwise a negative error value
308  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
309  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
310  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
311  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR IO error
312  */
313 int package_info_is_removable_package(package_info_h package_info, bool *removable);
314
315
316 /**
317  * @brief Checks whether the package is preloaded.
318  * @since_tizen 2.3
319  * @param[in]  package_info The package information
320  * @param[out] preload      The preload info of the package
321  * @return @c 0 on success,
322  *         otherwise a negative error value
323  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
324  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
325  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
326  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
327  */
328 int package_info_is_preload_package(package_info_h package_info, bool *preload);
329
330
331 /**
332  * @brief Checks whether two package information is equal.
333  * @since_tizen 2.3
334  * @param[in]  lhs    The first package information to be compared
335  * @param[in]  rhs    The second package information to be compared
336  * @param[out] equal  @c true if the package information are equal,
337  *                    otherwise @c false if package information are not equal
338  * @return @c 0 on success,
339  *         otherwise a negative error value
340  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
341  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
342  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
343  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Database error occurred
344  */
345 int package_info_is_equal(package_info_h lhs, package_info_h rhs, bool *equal);
346
347
348 /**
349  * @brief Checks whether the package info is accessible for the given package.
350  * @since_tizen 2.3
351  * @param[in]  package_info The package information
352  * @param[out] accessible   @c true if the package info is accessible,
353  *                          otherwise @c false if the package info is not accessible
354  * @return @c 0 on success,
355  *         otherwise a negative error value
356  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
357  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
358  */
359 int package_info_is_accessible(package_info_h package_info, bool *accessible);
360
361
362 /**
363  * @brief Clones the package information handle.
364  * @since_tizen 2.3
365  * @param[out] clone          The newly created package information handle
366  * @param[in]  package_info   The package information
367  * @return @c 0 on success,
368  *         otherwise a negative error value
369  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
370  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
371  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   The package is not installed
372  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
373  */
374 int package_info_clone(package_info_h *clone, package_info_h package_info);
375
376
377 /**
378  * @brief Gets the package information for the given package
379  * @since_tizen 2.3
380  * @remarks You must release @a package_info using package_info_destroy().
381  * @param[in]  package      The ID of the package
382  * @param[out] package_info The package information for the given package ID
383  * @return @c 0 on success,
384  *         otherwise a negative error value
385  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
386  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
387  * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE   The package is not installed
388  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
389  */
390 int package_info_create(const char *package, package_info_h *package_info);
391
392
393 /**
394  * @brief Retrieves certification information of the package.
395  * @since_tizen 2.3
396  * @param[in] package_info The package information
397  * @param[in] callback     The iteration callback function
398  * @param[in] user_data    The user data to be passed to the callback function
399  * @return @c 0 on success,
400  *         otherwise a negative error value
401  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
402  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
403  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
404  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
405  */
406 int package_info_foreach_cert_info(package_info_h package_info, package_info_cert_info_cb callback, void *user_data);
407
408
409 /**
410  * @brief Retrieves privilege information of the package.
411  * @since_tizen 2.3
412  * @param[in] package_info The package information
413  * @param[in] callback     The iteration callback function
414  * @param[in] user_data    The user data to be passed to the callback function
415  * @return @c 0 on success,
416  *         otherwise a negative error value
417  * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
418  * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
419  * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY     Out of memory
420  * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          I/O error
421  */
422 int package_info_foreach_privilege_info(package_info_h package_info, package_info_privilege_info_cb callback, void *user_data);
423
424
425 /**
426 * @}
427 */
428
429 #ifdef __cplusplus
430 }
431 #endif
432
433 #endif /* __TIZEN_APPFW_PACKAGE_INFO_H */