Implement pkgmgr plugin execution info
[platform/core/appfw/pkgmgr-info.git] / parser / include / pkgmgr_parser_db.h
1 /*
2  * pkgmgr-info
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
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>
8  *
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
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
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.
20  *
21  */
22
23
24 /**
25  * @file                pkgmgr_parser_db.h
26  * @author      Shobhit Srivastava <shobhit.s@samsung.com>
27  * @version     0.1
28  * @brief               This file declares API to store/retrieve manifest data in DB
29  *
30  * @addtogroup APPLICATION_FRAMEWORK
31  * @{
32  *
33   * @defgroup   PackageManagerParserDB
34  * @section     Header Header file to include:
35  * @code
36  * #include <pkgmgr_parser_db.h>
37  * @endcode
38  *
39  * @}
40  */
41
42 #ifndef __PKGMGR_PARSER_DB_H__
43 #define __PKGMGR_PARSER_DB_H__
44
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 #include "pkgmgr_parser.h"
49 #include "pkgmgrinfo_type.h"
50 /**
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
54  *
55  * @par         This API is for package-manager installer backends
56  * @par Sync (or) Async : Synchronous API
57  *
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
61  * @pre         None
62  * @post                None
63  * @see         pkgmgr_parser_update_manifest_info_in_db()
64  * @see         pkgmgr_parser_delete_manifest_info_from_db()
65  * @code
66 static int insert_manifest_data(manifest_x *mfx)
67 {
68         int ret = 0;
69         ret = pkgmgr_parser_insert_manifest_info_in_db(mfx);
70         if (ret < 0)
71                 return -1;
72         return 0;
73 }
74  * @endcode
75  */
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);
78
79 /**
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
83  *
84  * @par         This API is for package-manager installer backends
85  * @par Sync (or) Async : Synchronous API
86  *
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
90  * @pre         None
91  * @post                None
92  * @see         pkgmgr_parser_insert_manifest_info_in_db()
93  * @see         pkgmgr_parser_delete_manifest_info_from_db()
94  * @code
95 static int update_manifest_data(manifest_x *mfx)
96 {
97         int ret = 0;
98         ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
99         if (ret < 0)
100                 return -1;
101         return 0;
102 }
103  * @endcode
104  */
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);
107
108 /**
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
112  *
113  * @par         This API is for package-manager installer backends
114  * @par Sync (or) Async : Synchronous API
115  *
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
119  * @pre         None
120  * @post                None
121  * @code
122 static int update_tep_data(const char *pkgid, *tep_path)
123 {
124         int ret = 0;
125         ret = pkgmgr_parser_update_tep_info_in_db(pkgid, tep_path);
126         if (ret < 0)
127                 return -1;
128         return 0;
129 }
130  * @endcode
131  */
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);
134
135 /**
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
139  *
140  * @par         This API is for package-manager installer backends
141  * @par Sync (or) Async : Synchronous API
142  *
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
146  * @pre         None
147  * @post                None
148  * @see         pkgmgr_parser_update_manifest_info_in_db()
149  * @see         pkgmgr_parser_insert_manifest_info_in_db()
150  * @code
151 static int delete_manifest_data(manifest_x *mfx)
152 {
153         int ret = 0;
154         ret = pkgmgr_parser_delete_manifest_info_from_db(mfx);
155         if (ret < 0)
156                 return -1;
157         return 0;
158 }
159  * @endcode
160  */
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);
163
164 /**
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
167  *
168  * @par         This API is for package-manager installer backends
169  * @par Sync (or) Async : Synchronous API
170  *
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
175  * @pre         None
176  * @post                None
177  * @code
178 static int disable_global_app_for_uid(const char *appid, uid_t uid)
179 {
180         int ret = 0;
181         ret = pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(appid, uid, 1);
182         if (ret < 0)
183                 return -1;
184         return 0;
185 }
186  * @endcode
187  */
188 int pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(const char *appid, uid_t uid, int is_disable);
189
190 /**
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
193  *
194  * @par         This API is for package-manager installer backends
195  * @par Sync (or) Async : Synchronous API
196  *
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
200  * @pre         None
201  * @post                None
202  * @code
203 static int disable_app(const char *appid)
204 {
205         int ret = 0;
206         ret = pkgmgr_parser_update_app_disable_info_in_db(appid, 1);
207         if (ret < 0)
208                 return -1;
209         return 0;
210 }
211  * @endcode
212  */
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);
215
216 /**
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
219  *
220  * @par         This API is for package-manager installer backends
221  * @par Sync (or) Async : Synchronous API
222  *
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
226  * @pre         None
227  * @post                None
228  * @code
229 static int disable_pkg(const char *pkgid)
230 {
231         int ret = 0;
232         ret = pkgmgr_parser_update_pkg_disable_info_in_db(pkgid, 1);
233         if (ret < 0)
234                 return -1;
235         return 0;
236 }
237  * @endcode
238  */
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);
241
242 /**
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
245  *
246  * @par         This API is for package-manager installer backends
247  * @par Sync (or) Async : Synchronous API
248  *
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
253  * @pre         None
254  * @post                None
255  * @code
256 static int disable_global_app_splash_screen_for_uid(const char *appid, uid_t uid)
257 {
258         int ret = 0;
259         ret = pkgmgr_parser_update_global_app_splash_screen_info_in_usr_db(appid, uid, 1);
260         if (ret < 0)
261                 return -1;
262         return 0;
263 }
264  * @endcode
265  */
266 int pkgmgr_parser_update_global_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag);
267
268 /**
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
271  *
272  * @par         This API is for package-manager installer backends
273  * @par Sync (or) Async : Synchronous API
274  *
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
278  * @pre         None
279  * @post                None
280  * @code
281 static int disable_app_splash_screen(const char *appid)
282 {
283         int ret = 0;
284         ret = pkgmgr_parser_update_app_splash_screen_info_in_db(appid, 1);
285         if (ret < 0)
286                 return -1;
287         return 0;
288 }
289  * @endcode
290  */
291 int pkgmgr_parser_update_app_splash_screen_display_info_in_db(const char *appid, int flag);
292
293 /**
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
296  *
297  * @par         This API is for package-manager installer backends
298  * @par Sync (or) Async : Synchronous API
299  *
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
304  */
305 int pkgmgr_parser_update_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag);
306
307 /**
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
310  *
311  * @par         This API is only for internal usage
312  * @par Sync (or) Async : Synchronous API
313  *
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
317  */
318 int pkgmgr_parser_update_app_label_info_in_db(const char *appid, const char *label);
319
320 /**
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
323  *
324  * @par         This API is only for internal usage
325  * @par Sync (or) Async : Synchronous API
326  *
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
331  */
332 int pkgmgr_parser_update_app_label_info_in_usr_db(const char *appid, uid_t uid, const char *label);
333
334 /**
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
337  *
338  * @par         This API is only for internal usage
339  * @par Sync (or) Async : Synchronous API
340  *
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
344  */
345 int pkgmgr_parser_update_app_icon_info_in_db(const char *appid, const char *icon_path);
346
347 /**
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
350  *
351  * @par         This API is only for internal usage
352  * @par Sync (or) Async : Synchronous API
353  *
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
358  */
359 int pkgmgr_parser_update_app_icon_info_in_usr_db(const char *appid, uid_t uid, const char *icon_path);
360
361 /**
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
364  *
365  * @par         This API is only for internal usage
366  * @par Sync (or) Async : Synchronous API
367  *
368  * @param[in]   handle  update information handle
369  * @param[in]   uid     user ID
370  * @return      0 if success, error code(<0) if fail
371  * @pre None
372  * @post         None
373  * @code
374 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info, uid_t uid)
375 {
376         int ret = 0;
377         ret = pkgmgr_parser_register_pkg_update_info_in_usr_db(update_info, uid);
378         if (ret < 0)
379                 return -1;
380         return 0;
381 }
382  * @endcode
383  */
384 int pkgmgr_parser_register_pkg_update_info_in_usr_db(pkgmgrinfo_updateinfo_h handle, uid_t uid);
385
386 /**
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
389  *
390  * @par         This API is only for internal usage
391  * @par Sync (or) Async : Synchronous API
392  *
393  * @param[in]   update_info     update information handle
394  * @return      0 if success, error code(<0) if fail
395  * @pre None
396  * @post        None
397  * @code
398 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info)
399 {
400         int ret = 0;
401         ret = pkgmgr_parser_register_pkg_update_info_in_db(update_info);
402         if (ret < 0)
403                 return -1;
404         return 0;
405 }
406  * @endcode
407  */
408 int pkgmgr_parser_register_pkg_update_info_in_db(pkgmgrinfo_updateinfo_h update_info);
409
410 /**
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.
413  *
414  * @par         This API is only for internal usage
415  * @par Sync (or) Async : Synchronous API
416  *
417  * @param[in]   pkgid   package ID
418  * @param[in]   uid     user ID
419  * @return      0 if success, error code(<0) if fail
420  * @pre None
421  * @post        None
422  * @code
423 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info, uid_t uid)
424 {
425         int ret = 0;
426         ret = pkgmgr_parser_register_pkg_update_info_in_db(update_info, uid);
427         if (ret < 0)
428                 return -1;
429         return 0;
430 }
431  * @endcode
432  */
433 int pkgmgr_parser_unregister_pkg_update_info_in_usr_db(const char *pkgid, uid_t uid);
434
435 /**
436  * @fn int pkgmgr_parser_unregister_pkg_update_info_in_db(const char * pkgid)
437  * @brief       This API unregister update information of certain package
438  *
439  * @par         This API is only for internal usage
440  * @par Sync (or) Async : Synchronous API
441  *
442  * @param[in]   pkgid   package ID
443  * @return      0 if success, error code(<0) if fail
444  * @pre None
445  * @post        None
446  * @code
447 static int unregister_pkg_update_info(const char *pkgid)
448 {
449         int ret = 0;
450         ret = pkgmgr_parser_unregister_pkg_update_info_in_db(pkgid);
451         if (ret < 0)
452                 return -1;
453         return 0;
454 }
455  * @endcode
456  */
457 int pkgmgr_parser_unregister_pkg_update_info_in_db(const char *pkgid);
458
459 /**
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
462  *
463  * @par         This API is only for internal usage
464  * @par Sync (or) Async : Synchronous API
465  *
466  * @param[in]   uid     user ID
467  * @return      0 if success, error code(<0) if fail
468  * @pre None
469  * @post        None
470  * @code
471 static int unregister_all_pkg_update_info(uid_t uid)
472 {
473         int ret = 0;
474         ret = pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid);
475         if (ret < 0)
476                 return -1;
477         return 0;
478 }
479  * @endcode
480  */
481 int pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid_t uid);
482
483 /**
484  * @fn int pkgmgr_parser_unregister_all_pkg_update_info_in_db(void)
485  * @brief       This API unregisters update information of all packages
486  *
487  * @par         This API is only for internal usage
488  * @par Sync (or) Async : Synchronous API
489  *
490  * @return      0 if success, error code(<0) if fail
491  * @pre None
492  * @post         None
493  * @code
494 static int unregister_all_pkg_update_info(void)
495 {
496         int ret = 0;
497         ret = pkgmgr_parser_unregister_all_pkg_update_info_in_db();
498         if (ret < 0)
499                 return -1;
500         return 0;
501 }
502  * @endcode
503  */
504 int pkgmgr_parser_unregister_all_pkg_update_info_in_db(void);
505
506 /**
507  * @fn int pkgmgr_parser_register_pkg_plugin_info_in_usr_db(manifest_x *mfx, uid_t uid)
508  * @brief       This API registers package plugin execution information
509  *
510  * @par         This API is only for internal usage
511  * @par Sync (or) Async : Synchronous API
512  *
513  * @param[in]   mfx     manifest structure pointer which contains plugin execution info
514  * @return      0 if success, error code(<0) if fail
515  * @pre None
516  * @post         None
517  * @code
518 static int register_pkg_plugin_info(manifest_x *mfx)
519 {
520         int ret = 0;
521         ret = pkgmgr_parser_register_pkg_plugin_info_in_db(mfx);
522         if (ret < 0)
523                 return -1;
524         return 0;
525 }
526  * @endcode
527  */
528 int pkgmgr_parser_register_pkg_plugin_info_in_db(manifest_x *mfx);
529 int pkgmgr_parser_register_pkg_plugin_info_in_usr_db(manifest_x *mfx, uid_t uid);
530
531 /**
532  * @fn int pkgmgr_parser_update_pkg_plugin_info_in_usr_db(manifest_x *mfx, uid_t uid)
533  * @brief       This API updates package plugin execution information
534  *
535  * @par         This API is only for internal usage
536  * @par Sync (or) Async : Synchronous API
537  *
538  * @param[in]   mfx     manifest structure pointer which contains plugin execution info
539  * @return      0 if success, error code(<0) if fail
540  * @pre None
541  * @post         None
542  * @code
543 static int update_pkg_plugin_info(manifest_x *mfx)
544 {
545         int ret = 0;
546         ret = pkgmgr_parser_update_pkg_plugin_info_in_db(mfx);
547         if (ret < 0)
548                 return -1;
549         return 0;
550 }
551  * @endcode
552  */
553 int pkgmgr_parser_update_pkg_plugin_info_in_db(manifest_x *mfx);
554 int pkgmgr_parser_update_pkg_plugin_info_in_usr_db(manifest_x *mfx, uid_t uid);
555
556 /**
557  * @fn int pkgmgr_parser_unregister_pkg_plugin_info_in_usr_db(const char *pkgid, uid_t uid)
558  * @brief       This API unregisters package plugin execution information
559  *
560  * @par         This API is only for internal usage
561  * @par Sync (or) Async : Synchronous API
562  *
563  * @param[in]   pkgid   package ID
564  * @return      0 if success, error code(<0) if fail
565  * @pre None
566  * @post         None
567  * @code
568 static int unregister_pkg_plugin_info(const char *pkgid)
569 {
570         int ret = 0;
571         ret = pkgmgr_parser_unregister_pkg_plugin_info_in_db(pkgid);
572         if (ret < 0)
573                 return -1;
574         return 0;
575 }
576  * @endcode
577  */
578 int pkgmgr_parser_unregister_pkg_plugin_info_in_db(const char *pkgid);
579 int pkgmgr_parser_unregister_pkg_plugin_info_in_usr_db(const char *pkgid, uid_t uid);
580
581 int pkgmgr_parser_create_and_initialize_db(uid_t uid);
582 int pkgmgr_parser_initialize_parser_db(uid_t uid);
583 int pkgmgr_parser_initialize_cert_db(void);
584
585 /** @} */
586 #ifdef __cplusplus
587 }
588 #endif
589 #endif                          /* __PKGMGR_PARSER_DB_H__ */
590 /**
591  * @}
592  * @}
593  */