2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef __TIZEN_APPFW_PACKAGE_INFO_H
19 #define __TIZEN_APPFW_PACKAGE_INFO_H
28 * @file package_info.h
32 * @addtogroup CAPI_PACKAGE_INFO_MODULE
38 * @brief The package information handle.
41 typedef struct package_info_s *package_info_h;
45 * @brief Enumeration for storage type.
49 PACKAGE_INFO_INTERNAL_STORAGE = 0, /**< Internal storage */
50 PACKAGE_INFO_EXTERNAL_STORAGE = 1, /**< External storage */
51 } package_info_installed_storage_type_e;
55 * @brief Enumeration for app component type.
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;
66 * @brief Enumeration for certification type.
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;
83 * @brief Called to get the application ID once for each installed package.
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()
93 typedef bool (*package_info_app_cb) (package_info_app_component_type_e comp_type, const char *app_id, void *user_data);
97 * @brief Called to get the certification information.
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()
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);
113 * @brief Called to get the privilege information.
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()
122 typedef bool (*package_info_privilege_info_cb) (const char *privilege_name, void *user_data);
126 * @brief Retrieves all application IDs of each package.
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()
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);
144 * @brief Destroys the package information handle and releases all its resources.
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()
154 int package_info_destroy(package_info_h package_info);
158 * @brief Gets the package name.
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
169 int package_info_get_package(package_info_h package_info, char **package);
173 * @brief Gets the main application ID of the package.
175 * @remarks You must release @a main_app_id using free().
176 * @param[in] package_info The package information
177 * @param[out] main_app_id The main application ID 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
185 int package_info_get_main_app_id(package_info_h package_info, char **main_app_id);
189 * @brief Gets the label of the package.
191 * @remarks You must release @a label using free().
192 * @param[in] package_info The package information
193 * @param[out] label The label 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
201 int package_info_get_label(package_info_h package_info, char **label);
205 * @brief Gets the absolute path to the icon image.
207 * @remarks You must release @a path using free().
208 * @param[in] package_info The package information
209 * @param[out] path The path 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
217 int package_info_get_icon(package_info_h package_info, char **path);
221 * @brief Gets the version of the package.
223 * @remarks You must release @a version using free().
224 * @param[in] package_info The package information
225 * @param[out] version The version 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
233 int package_info_get_version(package_info_h package_info, char **version);
237 * @brief Gets the type of the package.
239 * @remarks You must release @a type using free().
240 * @param[in] package_info The package information
241 * @param[out] type The type of the package
242 * @return @c 0 on success,
243 * otherwise a negative error value
244 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
245 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
246 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
247 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
249 int package_info_get_type(package_info_h package_info, char **type);
253 * @brief Gets the installed storage for the given package.
255 * @param[in] package_info The package information
256 * @param[out] storage The installed storage
257 * @return @c 0 on success,
258 * otherwise a negative error value
259 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
260 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
262 int package_info_get_installed_storage(package_info_h package_info, package_info_installed_storage_type_e *storage);
266 * @brief Gets the root path of the package.
268 * @remarks You must release @a path using free().
269 * @param[in] package_info The package information
270 * @param[out] path The root path of the package
271 * @return @c 0 on success,
272 * otherwise a negative error value
273 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
274 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
275 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
276 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
278 int package_info_get_root_path(package_info_h package_info, char **path);
283 * @brief Gets the name of the TEP(Tizen Expansion Package).
284 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
285 * @privlevel platform
286 * @privilege %http://tizen.org/privilege/packagemanager.admin
287 * @remarks Name must be released using free().
288 * @param[in] package_info The package information
289 * @param[out] name The name of the tep
290 * @return 0 on success,
291 * otherwise a negative error value
292 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
293 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
294 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
295 * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
296 * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
298 int package_info_get_tep_name(package_info_h package_info, char **name);
302 * @brief Checks whether the package is system package.
304 * @param[in] package_info The package information
305 * @param[out] system @c true if the package is system package,
306 * otherwise @c false if the package is not system package
307 * @return @c 0 on success,
308 * otherwise a negative error value
309 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
310 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
311 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
312 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
314 int package_info_is_system_package(package_info_h package_info, bool *system);
318 * @brief Checks whether the package is removable.
320 * @param[in] package_info The package information
321 * @param[out] removable The removable info of the package
322 * @return @c 0 on success,
323 * otherwise a negative error value
324 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
325 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
326 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
327 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR IO error
329 int package_info_is_removable_package(package_info_h package_info, bool *removable);
333 * @brief Checks whether the package is preloaded.
335 * @param[in] package_info The package information
336 * @param[out] preload The preload info of the package
337 * @return @c 0 on success,
338 * otherwise a negative error value
339 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
340 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
341 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
342 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
344 int package_info_is_preload_package(package_info_h package_info, bool *preload);
348 * @brief Checks whether two package information is equal.
350 * @param[in] lhs The first package information to be compared
351 * @param[in] rhs The second package information to be compared
352 * @param[out] equal @c true if the package information are equal,
353 * otherwise @c false if package information are not equal
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 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
359 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
361 int package_info_is_equal(package_info_h lhs, package_info_h rhs, bool *equal);
365 * @brief Checks whether the package info is accessible for the given package.
367 * @param[in] package_info The package information
368 * @param[out] accessible @c true if the package info is accessible,
369 * otherwise @c false if the package info is not accessible
370 * @return @c 0 on success,
371 * otherwise a negative error value
372 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
373 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
375 int package_info_is_accessible(package_info_h package_info, bool *accessible);
378 * @brief Gets the installed time for the given package.
379 * @details If the package was updated, the @a installed_time represents updated time.
380 * So, the meaning of 'installed time' corresponds with 'last modified time'.
382 * @param[in] package_info The package information
383 * @param[out] installed_time The integer value of time_t type for installed time
384 * @return @c 0 on success,
385 * otherwise a negative error value
386 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
387 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
388 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR Database error occurred
390 int package_info_get_installed_time(package_info_h package_info, int *installed_time);
393 * @brief Clones the package information handle.
395 * @param[out] clone The newly created package information handle
396 * @param[in] package_info The package information
397 * @return @c 0 on success,
398 * otherwise a negative error value
399 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
400 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
401 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
402 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
404 int package_info_clone(package_info_h *clone, package_info_h package_info);
407 * @brief Gets the package information for the given package
409 * @remarks You must release @a package_info using package_info_destroy().
410 * @param[in] package The ID of the package
411 * @param[out] package_info The package information for the given package ID
412 * @return @c 0 on success,
413 * otherwise a negative error value
414 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
415 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
416 * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE The package is not installed
417 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
419 int package_info_create(const char *package, package_info_h *package_info);
423 * @brief Retrieves certification information of the package.
425 * @param[in] package_info The package information
426 * @param[in] callback The iteration callback function
427 * @param[in] user_data The user data to be passed to the callback function
428 * @return @c 0 on success,
429 * otherwise a negative error value
430 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
431 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
432 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
433 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
435 int package_info_foreach_cert_info(package_info_h package_info, package_info_cert_info_cb callback, void *user_data);
439 * @brief Retrieves privilege information of the package.
441 * @param[in] package_info The package information
442 * @param[in] callback The iteration callback function
443 * @param[in] user_data The user data to be passed to the callback function
444 * @return @c 0 on success,
445 * otherwise a negative error value
446 * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
447 * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
448 * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
449 * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
451 int package_info_foreach_privilege_info(package_info_h package_info, package_info_privilege_info_cb callback, void *user_data);
462 #endif /* __TIZEN_APPFW_PACKAGE_INFO_H */