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 label of the package.
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
185 int package_info_get_label(package_info_h package_info, char **label);
189 * @brief Gets the absolute path to the icon image.
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
201 int package_info_get_icon(package_info_h package_info, char **path);
205 * @brief Gets the version of the package.
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
217 int package_info_get_version(package_info_h package_info, char **version);
221 * @brief Gets the type of the package.
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
233 int package_info_get_type(package_info_h package_info, char **type);
237 * @brief Gets the installed storage for the given package.
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
246 int package_info_get_installed_storage(package_info_h package_info, package_info_installed_storage_type_e *storage);
250 * @brief Gets the root path of the package.
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
262 int package_info_get_root_path(package_info_h package_info, char **path);
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
282 int package_info_get_tep_name(package_info_h package_info, char **name);
286 * @brief Checks whether the package is system package.
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
298 int package_info_is_system_package(package_info_h package_info, bool *system);
302 * @brief Checks whether the package is removable.
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
313 int package_info_is_removable_package(package_info_h package_info, bool *removable);
317 * @brief Checks whether the package is preloaded.
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
328 int package_info_is_preload_package(package_info_h package_info, bool *preload);
332 * @brief Checks whether two package information is equal.
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
345 int package_info_is_equal(package_info_h lhs, package_info_h rhs, bool *equal);
349 * @brief Checks whether the package info is accessible for the given package.
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
359 int package_info_is_accessible(package_info_h package_info, bool *accessible);
363 * @brief Clones the package information handle.
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
374 int package_info_clone(package_info_h *clone, package_info_h package_info);
378 * @brief Gets the package information for the given package
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
390 int package_info_create(const char *package, package_info_h *package_info);
394 * @brief Retrieves certification information of the package.
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
406 int package_info_foreach_cert_info(package_info_h package_info, package_info_cert_info_cb callback, void *user_data);
410 * @brief Retrieves privilege information of the package.
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
422 int package_info_foreach_privilege_info(package_info_h package_info, package_info_privilege_info_cb callback, void *user_data);
433 #endif /* __TIZEN_APPFW_PACKAGE_INFO_H */