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__
51 #include "pkgmgr_parser.h"
52 #include "pkgmgrinfo_type.h"
54 // TODO: add descriptions
55 int pkgmgr_parser_insert_pkg_info(sqlite3 *db, manifest_x *mfx, uid_t uid);
56 int pkgmgr_parser_update_pkg_info(sqlite3 *db, manifest_x *mfx, uid_t uid);
57 int pkgmgr_parser_delete_pkg_info(sqlite3 *db, const char *package, uid_t uid);
60 * @fn int pkgmgr_parser_insert_manifest_info_in_usr_db(manifest_x *mfx, uid_t uid)
61 * @fn int pkgmgr_parser_insert_manifest_info_in_db(manifest_x *mfx)
62 * @brief This API inserts the parsed manifest info in db
64 * @par This API is for package-manager installer backends
65 * @par Sync (or) Async : Synchronous API
67 * @param[in] mfx pointer to manifest info
68 * @param[in] uid the addressee user id of the instruction
69 * @return 0 if success, error code(<0) if fail
72 * @see pkgmgr_parser_update_manifest_info_in_db()
73 * @see pkgmgr_parser_delete_manifest_info_from_db()
75 static int insert_manifest_data(manifest_x *mfx)
78 ret = pkgmgr_parser_insert_manifest_info_in_db(mfx);
85 int pkgmgr_parser_insert_manifest_info_in_db(manifest_x *mfx);
86 int pkgmgr_parser_insert_manifest_info_in_usr_db(manifest_x *mfx, uid_t uid);
89 * @fn int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx)
90 * @fn int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx)
91 * @brief This API updates the manifest info in db
93 * @par This API is for package-manager installer backends
94 * @par Sync (or) Async : Synchronous API
96 * @param[in] mfx pointer to manifest info
97 * @param[in] uid the addressee user id of the instruction
98 * @return 0 if success, error code(<0) if fail
101 * @see pkgmgr_parser_insert_manifest_info_in_db()
102 * @see pkgmgr_parser_delete_manifest_info_from_db()
104 static int update_manifest_data(manifest_x *mfx)
107 ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
114 int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx);
115 int pkgmgr_parser_update_manifest_info_in_usr_db(manifest_x *mfx, uid_t uid);
118 * @fn int pkgmgr_parser_update_tep_info_in_db(const char * pkgid, const char * tep_path)
119 * @fn int pkgmgr_parser_update_tep_info_in_usr_db(const char * pkgid, const char * tep_path,uid_t uid)
120 * @brief This API updates the tep info in db
122 * @par This API is for package-manager installer backends
123 * @par Sync (or) Async : Synchronous API
125 * @param[in] pkgid pointer to pkgid
126 * @param[in] tep_path path of tep file
127 * @return 0 if success, error code(<0) if fail
131 static int update_tep_data(const char *pkgid, *tep_path)
134 ret = pkgmgr_parser_update_tep_info_in_db(pkgid, tep_path);
141 int pkgmgr_parser_update_tep_info_in_db(const char *pkgid, const char *tep_path);
142 int pkgmgr_parser_update_tep_info_in_usr_db(const char *pkgid, const char *tep_path, uid_t uid);
145 * @fn int pkgmgr_parser_delete_manifest_info_from_usr_db(manifest_x *mfx, uid_t uid)
146 * @fn int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx)
147 * @brief This API deletes the parsed manifest info from db
149 * @par This API is for package-manager installer backends
150 * @par Sync (or) Async : Synchronous API
152 * @param[in] mfx pointer to manifest info
153 * @param[in] uid the addressee user id of the instruction
154 * @return 0 if success, error code(<0) if fail
157 * @see pkgmgr_parser_update_manifest_info_in_db()
158 * @see pkgmgr_parser_insert_manifest_info_in_db()
160 static int delete_manifest_data(manifest_x *mfx)
163 ret = pkgmgr_parser_delete_manifest_info_from_db(mfx);
170 int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx);
171 int pkgmgr_parser_delete_manifest_info_from_usr_db(manifest_x *mfx, uid_t uid);
174 * @fn int pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(const char *appid, uid_t uid, int is_disable)
175 * @brief This API updates disable info about global app for user specified by uid
177 * @par This API is for package-manager installer backends
178 * @par Sync (or) Async : Synchronous API
180 * @param[in] appid global application ID to be enabled or disabled
181 * @param[in] uid the addressee user id of the instruction
182 * @param[in]is_disable determine enable or disable of app
183 * @return 0 if success, error code(<0) if fail
187 static int disable_global_app_for_uid(const char *appid, uid_t uid)
190 ret = pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(appid, uid, 1);
197 int pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(const char *appid, uid_t uid, int is_disable);
200 * @fn int pkgmgr_parser_update_app_disable_info_in_db(const char *appid, int is_disable);
201 * @brief This API updates disable info about app
203 * @par This API is for package-manager installer backends
204 * @par Sync (or) Async : Synchronous API
206 * @param[in] appid application ID to be enabled or disabled
207 * @param[in] is_disable determine enable or disable of app
208 * @return 0 if success, error code(<0) if fail
212 static int disable_app(const char *appid)
215 ret = pkgmgr_parser_update_app_disable_info_in_db(appid, 1);
222 int pkgmgr_parser_update_app_disable_info_in_db(const char *appid, int is_disable);
223 int pkgmgr_parser_update_app_disable_info_in_usr_db(const char *appid, uid_t uid, int is_disable);
226 * @fn int pkgmgr_parser_update_pkg_disable_info_in_db(const char *pkgid, int is_disable);
227 * @brief This API updates disable info about pkg
229 * @par This API is for package-manager installer backends
230 * @par Sync (or) Async : Synchronous API
232 * @param[in] pkgid package ID to be enabled or disabled
233 * @param[in] is_disable determine enable or disable of app
234 * @return 0 if success, error code(<0) if fail
238 static int disable_pkg(const char *pkgid)
241 ret = pkgmgr_parser_update_pkg_disable_info_in_db(pkgid, 1);
248 int pkgmgr_parser_update_pkg_disable_info_in_db(const char *pkgid, int is_disable);
249 int pkgmgr_parser_update_pkg_disable_info_in_usr_db(const char *pkgid, uid_t uid, int is_disable);
252 * @fn int pkgmgr_parser_update_global_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag)
253 * @brief This API updates splash screen display info about global app for user specified by uid
255 * @par This API is for package-manager installer backends
256 * @par Sync (or) Async : Synchronous API
258 * @param[in] appid global application ID to be enabled or disabled
259 * @param[in] uid user ID
260 * @param[in] flag determine enable or disable of app
261 * @return 0 if success, error code(<0) if fail
265 static int disable_global_app_splash_screen_for_uid(const char *appid, uid_t uid)
268 ret = pkgmgr_parser_update_global_app_splash_screen_info_in_usr_db(appid, uid, 1);
275 int pkgmgr_parser_update_global_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag);
278 * @fn int pkgmgr_parser_update_app_splash_screen_display_info_in_db(const char *appid, int flag)
279 * @brief This API updates splash screen display info about app
281 * @par This API is for package-manager installer backends
282 * @par Sync (or) Async : Synchronous API
284 * @param[in] appid application ID to be enabled or disabled
285 * @param[in] flag determine enable or disable of app
286 * @return 0 if success, error code(<0) if fail
290 static int disable_app_splash_screen(const char *appid)
293 ret = pkgmgr_parser_update_app_splash_screen_info_in_db(appid, 1);
300 int pkgmgr_parser_update_app_splash_screen_display_info_in_db(const char *appid, int flag);
303 * @fn int pkgmgr_parser_update_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag)
304 * @brief This API updates splash screen display info about app for user specified by uid
306 * @par This API is for package-manager installer backends
307 * @par Sync (or) Async : Synchronous API
309 * @param[in] appid application ID to be enabled or disabled
310 * @param[in] uid user ID
311 * @param[in] flag determine enable or disable of app
312 * @return 0 if success, error code(<0) if fail
314 int pkgmgr_parser_update_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag);
317 * @fn int pkgmgr_parser_update_app_label_info_in_db(const char *appid, const char *label)
318 * @brief This API updates label info of application
320 * @par This API is only for internal usage
321 * @par Sync (or) Async : Synchronous API
323 * @param[in] appid application ID to change label
324 * @param[in] label label to change
325 * @return 0 if success, error code(<0) if fail
327 int pkgmgr_parser_update_app_label_info_in_db(const char *appid, const char *label);
330 * @fn int pkgmgr_parser_update_app_label_info_in_usr_db(const char *appid, uid_t uid, const char *label)
331 * @brief This API updates label info of application for user specified by uid
333 * @par This API is only for internal usage
334 * @par Sync (or) Async : Synchronous API
336 * @param[in] appid application ID to change label
337 * @param[in] uid user ID
338 * @param[in] label label to change
339 * @return 0 if success, error code(<0) if fail
341 int pkgmgr_parser_update_app_label_info_in_usr_db(const char *appid, uid_t uid, const char *label);
344 * @fn int pkgmgr_parser_update_app_icon_info_in_db(const char *appid, const char *icon_path)
345 * @brief This API updates icon info of application
347 * @par This API is only for internal usage
348 * @par Sync (or) Async : Synchronous API
350 * @param[in] appid application ID to change label
351 * @param[in] icon_path icon path to change
352 * @return 0 if success, error code(<0) if fail
354 int pkgmgr_parser_update_app_icon_info_in_db(const char *appid, const char *icon_path);
357 * @fn int pkgmgr_parser_update_app_icon_info_in_usr_db(const char *appid, uid_t uid, const char *icon_path)
358 * @brief This API updates icon info of application for user specified by uid
360 * @par This API is only for internal usage
361 * @par Sync (or) Async : Synchronous API
363 * @param[in] appid application ID to change label
364 * @param[in] uid user ID
365 * @param[in] icon_path icon path to change
366 * @return 0 if success, error code(<0) if fail
368 int pkgmgr_parser_update_app_icon_info_in_usr_db(const char *appid, uid_t uid, const char *icon_path);
371 * @fn int pkgmgr_parser_register_pkg_update_info_in_usr_db(pkgmgrinfo_updateinfo_h handle, uid_t uid)
372 * @brief This API registers update informations of given packages for user specified by uid
374 * @par This API is only for internal usage
375 * @par Sync (or) Async : Synchronous API
377 * @param[in] handle update information handle
378 * @param[in] uid user ID
379 * @return 0 if success, error code(<0) if fail
383 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info, uid_t uid)
386 ret = pkgmgr_parser_register_pkg_update_info_in_usr_db(update_info, uid);
393 int pkgmgr_parser_register_pkg_update_info_in_usr_db(pkgmgrinfo_updateinfo_h handle, uid_t uid);
396 * @fn int pkgmgr_parser_register_pkg_update_info_in_db(pkgmgrinfo_updateinfo_h update_info)
397 * @brief This API registers update informations of given packages
399 * @par This API is only for internal usage
400 * @par Sync (or) Async : Synchronous API
402 * @param[in] update_info update information handle
403 * @return 0 if success, error code(<0) if fail
407 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info)
410 ret = pkgmgr_parser_register_pkg_update_info_in_db(update_info);
417 int pkgmgr_parser_register_pkg_update_info_in_db(pkgmgrinfo_updateinfo_h update_info);
420 * @fn int pkgmgr_parser_unregister_pkg_update_info_in_usr_db(const char *pkgid, uid_t uid)
421 * @brief This API unregister update information of certain package for user specified by uid.
423 * @par This API is only for internal usage
424 * @par Sync (or) Async : Synchronous API
426 * @param[in] pkgid package ID
427 * @param[in] uid user ID
428 * @return 0 if success, error code(<0) if fail
432 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info, uid_t uid)
435 ret = pkgmgr_parser_register_pkg_update_info_in_db(update_info, uid);
442 int pkgmgr_parser_unregister_pkg_update_info_in_usr_db(const char *pkgid, uid_t uid);
445 * @fn int pkgmgr_parser_unregister_pkg_update_info_in_db(const char * pkgid)
446 * @brief This API unregister update information of certain package
448 * @par This API is only for internal usage
449 * @par Sync (or) Async : Synchronous API
451 * @param[in] pkgid package ID
452 * @return 0 if success, error code(<0) if fail
456 static int unregister_pkg_update_info(const char *pkgid)
459 ret = pkgmgr_parser_unregister_pkg_update_info_in_db(pkgid);
466 int pkgmgr_parser_unregister_pkg_update_info_in_db(const char *pkgid);
469 * @fn int pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid_t uid)
470 * @brief This API unregister update information of all packages
472 * @par This API is only for internal usage
473 * @par Sync (or) Async : Synchronous API
475 * @param[in] uid user ID
476 * @return 0 if success, error code(<0) if fail
480 static int unregister_all_pkg_update_info(uid_t uid)
483 ret = pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid);
490 int pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid_t uid);
493 * @fn int pkgmgr_parser_unregister_all_pkg_update_info_in_db(void)
494 * @brief This API unregisters update information of all packages
496 * @par This API is only for internal usage
497 * @par Sync (or) Async : Synchronous API
499 * @return 0 if success, error code(<0) if fail
503 static int unregister_all_pkg_update_info(void)
506 ret = pkgmgr_parser_unregister_all_pkg_update_info_in_db();
513 int pkgmgr_parser_unregister_all_pkg_update_info_in_db(void);
516 * @fn int pkgmgr_parser_register_pkg_plugin_info_in_usr_db(manifest_x *mfx, uid_t uid)
517 * @brief This API registers package plugin execution information
519 * @par This API is only for internal usage
520 * @par Sync (or) Async : Synchronous API
522 * @param[in] mfx manifest structure pointer which contains plugin execution info
523 * @return 0 if success, error code(<0) if fail
527 static int register_pkg_plugin_info(manifest_x *mfx)
530 ret = pkgmgr_parser_register_pkg_plugin_info_in_db(mfx);
537 int pkgmgr_parser_register_pkg_plugin_info_in_db(manifest_x *mfx);
538 int pkgmgr_parser_register_pkg_plugin_info_in_usr_db(manifest_x *mfx, uid_t uid);
541 * @fn int pkgmgr_parser_update_pkg_plugin_info_in_usr_db(manifest_x *mfx, uid_t uid)
542 * @brief This API updates package plugin execution information
544 * @par This API is only for internal usage
545 * @par Sync (or) Async : Synchronous API
547 * @param[in] mfx manifest structure pointer which contains plugin execution info
548 * @return 0 if success, error code(<0) if fail
552 static int update_pkg_plugin_info(manifest_x *mfx)
555 ret = pkgmgr_parser_update_pkg_plugin_info_in_db(mfx);
562 int pkgmgr_parser_update_pkg_plugin_info_in_db(manifest_x *mfx);
563 int pkgmgr_parser_update_pkg_plugin_info_in_usr_db(manifest_x *mfx, uid_t uid);
566 * @fn int pkgmgr_parser_unregister_pkg_plugin_info_in_usr_db(const char *pkgid, uid_t uid)
567 * @brief This API unregisters package plugin execution information
569 * @par This API is only for internal usage
570 * @par Sync (or) Async : Synchronous API
572 * @param[in] pkgid package ID
573 * @return 0 if success, error code(<0) if fail
577 static int unregister_pkg_plugin_info(const char *pkgid)
580 ret = pkgmgr_parser_unregister_pkg_plugin_info_in_db(pkgid);
587 int pkgmgr_parser_unregister_pkg_plugin_info_in_db(const char *pkgid);
588 int pkgmgr_parser_unregister_pkg_plugin_info_in_usr_db(const char *pkgid, uid_t uid);
590 int pkgmgr_parser_create_and_initialize_db(uid_t uid);
591 int pkgmgr_parser_initialize_parser_db(uid_t uid);
592 int pkgmgr_parser_initialize_cert_db(void);
598 #endif /* __PKGMGR_PARSER_DB_H__ */