4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
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>
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
25 * @file pkgmgr_parser_db.h
26 * @author Shobhit Srivastava <shobhit.s@samsung.com>
28 * @brief This file declares API to store/retrieve manifest data in DB
30 * @addtogroup APPLICATION_FRAMEWORK
33 * @defgroup PackageManagerParserDB
34 * @section Header Header file to include:
36 * #include <pkgmgr_parser_db.h>
42 #ifndef __PKGMGR_PARSER_DB_H__
43 #define __PKGMGR_PARSER_DB_H__
48 #include "pkgmgr_parser.h"
49 #include "pkgmgrinfo_type.h"
51 * @fn int pkgmgr_parser_insert_manifest_info_in_usr_db(manifest_x *mfx, uid_t uid)
52 * @fn int pkgmgr_parser_insert_manifest_info_in_db(manifest_x *mfx)
53 * @brief This API inserts the parsed manifest info in db
55 * @par This API is for package-manager installer backends
56 * @par Sync (or) Async : Synchronous API
58 * @param[in] mfx pointer to manifest info
59 * @param[in] uid the addressee user id of the instruction
60 * @return 0 if success, error code(<0) if fail
63 * @see pkgmgr_parser_update_manifest_info_in_db()
64 * @see pkgmgr_parser_delete_manifest_info_from_db()
66 static int insert_manifest_data(manifest_x *mfx)
69 ret = pkgmgr_parser_insert_manifest_info_in_db(mfx);
76 int pkgmgr_parser_insert_manifest_info_in_db(manifest_x *mfx);
77 int pkgmgr_parser_insert_manifest_info_in_usr_db(manifest_x *mfx, uid_t uid);
80 * @fn int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx)
81 * @fn int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx)
82 * @brief This API updates the manifest info in db
84 * @par This API is for package-manager installer backends
85 * @par Sync (or) Async : Synchronous API
87 * @param[in] mfx pointer to manifest info
88 * @param[in] uid the addressee user id of the instruction
89 * @return 0 if success, error code(<0) if fail
92 * @see pkgmgr_parser_insert_manifest_info_in_db()
93 * @see pkgmgr_parser_delete_manifest_info_from_db()
95 static int update_manifest_data(manifest_x *mfx)
98 ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
105 int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx);
106 int pkgmgr_parser_update_manifest_info_in_usr_db(manifest_x *mfx, uid_t uid);
109 * @fn int pkgmgr_parser_update_tep_info_in_db(const char * pkgid, const char * tep_path)
110 * @fn int pkgmgr_parser_update_tep_info_in_usr_db(const char * pkgid, const char * tep_path,uid_t uid)
111 * @brief This API updates the tep info in db
113 * @par This API is for package-manager installer backends
114 * @par Sync (or) Async : Synchronous API
116 * @param[in] pkgid pointer to pkgid
117 * @param[in] tep_path path of tep file
118 * @return 0 if success, error code(<0) if fail
122 static int update_tep_data(const char *pkgid, *tep_path)
125 ret = pkgmgr_parser_update_tep_info_in_db(pkgid, tep_path);
132 int pkgmgr_parser_update_tep_info_in_db(const char *pkgid, const char *tep_path);
133 int pkgmgr_parser_update_tep_info_in_usr_db(const char *pkgid, const char *tep_path, uid_t uid);
136 * @fn int pkgmgr_parser_delete_manifest_info_from_usr_db(manifest_x *mfx, uid_t uid)
137 * @fn int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx)
138 * @brief This API deletes the parsed manifest info from db
140 * @par This API is for package-manager installer backends
141 * @par Sync (or) Async : Synchronous API
143 * @param[in] mfx pointer to manifest info
144 * @param[in] uid the addressee user id of the instruction
145 * @return 0 if success, error code(<0) if fail
148 * @see pkgmgr_parser_update_manifest_info_in_db()
149 * @see pkgmgr_parser_insert_manifest_info_in_db()
151 static int delete_manifest_data(manifest_x *mfx)
154 ret = pkgmgr_parser_delete_manifest_info_from_db(mfx);
161 int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx);
162 int pkgmgr_parser_delete_manifest_info_from_usr_db(manifest_x *mfx, uid_t uid);
165 * @fn int pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(const char *appid, uid_t uid, int is_disable)
166 * @brief This API updates disable info about global app for user specified by uid
168 * @par This API is for package-manager installer backends
169 * @par Sync (or) Async : Synchronous API
171 * @param[in] appid global application ID to be enabled or disabled
172 * @param[in] uid the addressee user id of the instruction
173 * @param[in]is_disable determine enable or disable of app
174 * @return 0 if success, error code(<0) if fail
178 static int disable_global_app_for_uid(const char *appid, uid_t uid)
181 ret = pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(appid, uid, 1);
188 int pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(const char *appid, uid_t uid, int is_disable);
191 * @fn int pkgmgr_parser_update_app_disable_info_in_db(const char *appid, int is_disable);
192 * @brief This API updates disable info about app
194 * @par This API is for package-manager installer backends
195 * @par Sync (or) Async : Synchronous API
197 * @param[in] appid application ID to be enabled or disabled
198 * @param[in] is_disable determine enable or disable of app
199 * @return 0 if success, error code(<0) if fail
203 static int disable_app(const char *appid)
206 ret = pkgmgr_parser_update_app_disable_info_in_db(appid, 1);
213 int pkgmgr_parser_update_app_disable_info_in_db(const char *appid, int is_disable);
214 int pkgmgr_parser_update_app_disable_info_in_usr_db(const char *appid, uid_t uid, int is_disable);
217 * @fn int pkgmgr_parser_update_pkg_disable_info_in_db(const char *pkgid, int is_disable);
218 * @brief This API updates disable info about pkg
220 * @par This API is for package-manager installer backends
221 * @par Sync (or) Async : Synchronous API
223 * @param[in] pkgid package ID to be enabled or disabled
224 * @param[in] is_disable determine enable or disable of app
225 * @return 0 if success, error code(<0) if fail
229 static int disable_pkg(const char *pkgid)
232 ret = pkgmgr_parser_update_pkg_disable_info_in_db(pkgid, 1);
239 int pkgmgr_parser_update_pkg_disable_info_in_db(const char *pkgid, int is_disable);
240 int pkgmgr_parser_update_pkg_disable_info_in_usr_db(const char *pkgid, uid_t uid, int is_disable);
243 * @fn int pkgmgr_parser_update_global_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag)
244 * @brief This API updates splash screen display info about global app for user specified by uid
246 * @par This API is for package-manager installer backends
247 * @par Sync (or) Async : Synchronous API
249 * @param[in] appid global application ID to be enabled or disabled
250 * @param[in] uid user ID
251 * @param[in] flag determine enable or disable of app
252 * @return 0 if success, error code(<0) if fail
256 static int disable_global_app_splash_screen_for_uid(const char *appid, uid_t uid)
259 ret = pkgmgr_parser_update_global_app_splash_screen_info_in_usr_db(appid, uid, 1);
266 int pkgmgr_parser_update_global_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag);
269 * @fn int pkgmgr_parser_update_app_splash_screen_display_info_in_db(const char *appid, int flag)
270 * @brief This API updates splash screen display info about app
272 * @par This API is for package-manager installer backends
273 * @par Sync (or) Async : Synchronous API
275 * @param[in] appid application ID to be enabled or disabled
276 * @param[in] flag determine enable or disable of app
277 * @return 0 if success, error code(<0) if fail
281 static int disable_app_splash_screen(const char *appid)
284 ret = pkgmgr_parser_update_app_splash_screen_info_in_db(appid, 1);
291 int pkgmgr_parser_update_app_splash_screen_display_info_in_db(const char *appid, int flag);
294 * @fn int pkgmgr_parser_update_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag)
295 * @brief This API updates splash screen display info about app for user specified by uid
297 * @par This API is for package-manager installer backends
298 * @par Sync (or) Async : Synchronous API
300 * @param[in] appid application ID to be enabled or disabled
301 * @param[in] uid user ID
302 * @param[in] flag determine enable or disable of app
303 * @return 0 if success, error code(<0) if fail
305 int pkgmgr_parser_update_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag);
308 * @fn int pkgmgr_parser_update_app_label_info_in_db(const char *appid, const char *label)
309 * @brief This API updates label info of application
311 * @par This API is only for internal usage
312 * @par Sync (or) Async : Synchronous API
314 * @param[in] appid application ID to change label
315 * @param[in] label label to change
316 * @return 0 if success, error code(<0) if fail
318 int pkgmgr_parser_update_app_label_info_in_db(const char *appid, const char *label);
321 * @fn int pkgmgr_parser_update_app_label_info_in_usr_db(const char *appid, uid_t uid, const char *label)
322 * @brief This API updates label info of application for user specified by uid
324 * @par This API is only for internal usage
325 * @par Sync (or) Async : Synchronous API
327 * @param[in] appid application ID to change label
328 * @param[in] uid user ID
329 * @param[in] label label to change
330 * @return 0 if success, error code(<0) if fail
332 int pkgmgr_parser_update_app_label_info_in_usr_db(const char *appid, uid_t uid, const char *label);
335 * @fn int pkgmgr_parser_update_app_icon_info_in_db(const char *appid, const char *icon_path)
336 * @brief This API updates icon info of application
338 * @par This API is only for internal usage
339 * @par Sync (or) Async : Synchronous API
341 * @param[in] appid application ID to change label
342 * @param[in] icon_path icon path to change
343 * @return 0 if success, error code(<0) if fail
345 int pkgmgr_parser_update_app_icon_info_in_db(const char *appid, const char *icon_path);
348 * @fn int pkgmgr_parser_update_app_icon_info_in_usr_db(const char *appid, uid_t uid, const char *icon_path)
349 * @brief This API updates icon info of application for user specified by uid
351 * @par This API is only for internal usage
352 * @par Sync (or) Async : Synchronous API
354 * @param[in] appid application ID to change label
355 * @param[in] uid user ID
356 * @param[in] icon_path icon path to change
357 * @return 0 if success, error code(<0) if fail
359 int pkgmgr_parser_update_app_icon_info_in_usr_db(const char *appid, uid_t uid, const char *icon_path);
362 * @fn int pkgmgr_parser_register_pkg_update_info_in_usr_db(pkgmgrinfo_updateinfo_h handle, uid_t uid)
363 * @brief This API registers update informations of given packages for user specified by uid
365 * @par This API is only for internal usage
366 * @par Sync (or) Async : Synchronous API
368 * @param[in] handle update information handle
369 * @param[in] uid user ID
370 * @return 0 if success, error code(<0) if fail
374 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info, uid_t uid)
377 ret = pkgmgr_parser_register_pkg_update_info_in_usr_db(update_info, uid);
384 int pkgmgr_parser_register_pkg_update_info_in_usr_db(pkgmgrinfo_updateinfo_h handle, uid_t uid);
387 * @fn int pkgmgr_parser_register_pkg_update_info_in_db(pkgmgrinfo_updateinfo_h update_info)
388 * @brief This API registers update informations of given packages
390 * @par This API is only for internal usage
391 * @par Sync (or) Async : Synchronous API
393 * @param[in] update_info update information handle
394 * @return 0 if success, error code(<0) if fail
398 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info)
401 ret = pkgmgr_parser_register_pkg_update_info_in_db(update_info);
408 int pkgmgr_parser_register_pkg_update_info_in_db(pkgmgrinfo_updateinfo_h update_info);
411 * @fn int pkgmgr_parser_unregister_pkg_update_info_in_usr_db(const char *pkgid, uid_t uid)
412 * @brief This API unregister update information of certain package for user specified by uid.
414 * @par This API is only for internal usage
415 * @par Sync (or) Async : Synchronous API
417 * @param[in] pkgid package ID
418 * @param[in] uid user ID
419 * @return 0 if success, error code(<0) if fail
423 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info, uid_t uid)
426 ret = pkgmgr_parser_register_pkg_update_info_in_db(update_info, uid);
433 int pkgmgr_parser_unregister_pkg_update_info_in_usr_db(const char *pkgid, uid_t uid);
436 * @fn int pkgmgr_parser_unregister_pkg_update_info_in_db(const char * pkgid)
437 * @brief This API unregister update information of certain package
439 * @par This API is only for internal usage
440 * @par Sync (or) Async : Synchronous API
442 * @param[in] pkgid package ID
443 * @return 0 if success, error code(<0) if fail
447 static int unregister_pkg_update_info(const char *pkgid)
450 ret = pkgmgr_parser_unregister_pkg_update_info_in_db(pkgid);
457 int pkgmgr_parser_unregister_pkg_update_info_in_db(const char *pkgid);
460 * @fn int pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid_t uid)
461 * @brief This API unregister update information of all packages
463 * @par This API is only for internal usage
464 * @par Sync (or) Async : Synchronous API
466 * @param[in] uid user ID
467 * @return 0 if success, error code(<0) if fail
471 static int unregister_all_pkg_update_info(uid_t uid)
474 ret = pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid);
481 int pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid_t uid);
484 * @fn int pkgmgr_parser_unregister_all_pkg_update_info_in_db(void)
485 * @brief This API unregisters update information of all packages
487 * @par This API is only for internal usage
488 * @par Sync (or) Async : Synchronous API
490 * @return 0 if success, error code(<0) if fail
494 static int unregister_all_pkg_update_info(void)
497 ret = pkgmgr_parser_unregister_all_pkg_update_info_in_db();
504 int pkgmgr_parser_unregister_all_pkg_update_info_in_db(void);
506 int pkgmgr_parser_create_and_initialize_db(uid_t uid);
507 int pkgmgr_parser_initialize_parser_db(uid_t uid);
508 int pkgmgr_parser_initialize_cert_db(void);
514 #endif /* __PKGMGR_PARSER_DB_H__ */