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_register_pkg_update_info_in_usr_db(pkgmgrinfo_updateinfo_h handle, uid_t uid)
336 * @brief This API registers update informations of given packages for user specified by uid
338 * @par This API is only for internal usage
339 * @par Sync (or) Async : Synchronous API
341 * @param[in] handle update information handle
342 * @param[in] uid user ID
343 * @return 0 if success, error code(<0) if fail
347 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info, uid_t uid)
350 ret = pkgmgr_parser_register_pkg_update_info_in_usr_db(update_info, uid);
357 int pkgmgr_parser_register_pkg_update_info_in_usr_db(pkgmgrinfo_updateinfo_h handle, uid_t uid);
360 * @fn int pkgmgr_parser_register_pkg_update_info_in_db(pkgmgrinfo_updateinfo_h update_info)
361 * @brief This API registers update informations of given packages
363 * @par This API is only for internal usage
364 * @par Sync (or) Async : Synchronous API
366 * @param[in] update_info update information handle
367 * @return 0 if success, error code(<0) if fail
371 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info)
374 ret = pkgmgr_parser_register_pkg_update_info_in_db(update_info);
381 int pkgmgr_parser_register_pkg_update_info_in_db(pkgmgrinfo_updateinfo_h update_info);
384 * @fn int pkgmgr_parser_unregister_pkg_update_info_in_usr_db(const char *pkgid, uid_t uid)
385 * @brief This API unregister update information of certain package for user specified by uid.
387 * @par This API is only for internal usage
388 * @par Sync (or) Async : Synchronous API
390 * @param[in] pkgid package ID
391 * @param[in] uid user ID
392 * @return 0 if success, error code(<0) if fail
396 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info, uid_t uid)
399 ret = pkgmgr_parser_register_pkg_update_info_in_db(update_info, uid);
406 int pkgmgr_parser_unregister_pkg_update_info_in_usr_db(const char *pkgid, uid_t uid);
409 * @fn int pkgmgr_parser_unregister_pkg_update_info_in_db(const char * pkgid)
410 * @brief This API unregister update information of certain package
412 * @par This API is only for internal usage
413 * @par Sync (or) Async : Synchronous API
415 * @param[in] pkgid package ID
416 * @return 0 if success, error code(<0) if fail
420 static int unregister_pkg_update_info(const char *pkgid)
423 ret = pkgmgr_parser_unregister_pkg_update_info_in_db(pkgid);
430 int pkgmgr_parser_unregister_pkg_update_info_in_db(const char *pkgid);
433 * @fn int pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid_t uid)
434 * @brief This API unregister update information of all packages
436 * @par This API is only for internal usage
437 * @par Sync (or) Async : Synchronous API
439 * @param[in] uid user ID
440 * @return 0 if success, error code(<0) if fail
444 static int unregister_all_pkg_update_info(uid_t uid)
447 ret = pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid);
454 int pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid_t uid);
457 * @fn int pkgmgr_parser_unregister_all_pkg_update_info_in_db(void)
458 * @brief This API unregisters update information of all packages
460 * @par This API is only for internal usage
461 * @par Sync (or) Async : Synchronous API
463 * @return 0 if success, error code(<0) if fail
467 static int unregister_all_pkg_update_info(void)
470 ret = pkgmgr_parser_unregister_all_pkg_update_info_in_db();
477 int pkgmgr_parser_unregister_all_pkg_update_info_in_db(void);
479 int pkgmgr_parser_create_and_initialize_db(uid_t uid);
480 int pkgmgr_parser_initialize_parser_db(uid_t uid);
481 int pkgmgr_parser_initialize_cert_db(void);
487 #endif /* __PKGMGR_PARSER_DB_H__ */