c894eb52635caa1867bdfb6c0d72358da3901222
[platform/core/appfw/pkgmgr-info.git] / parser / 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 /**
50  * @fn int pkgmgr_parser_insert_manifest_info_in_usr_db(manifest_x *mfx, uid_t uid)
51  * @fn int pkgmgr_parser_insert_manifest_info_in_db(manifest_x *mfx)
52  * @brief       This API inserts the parsed manifest info in db
53  *
54  * @par         This API is for package-manager installer backends
55  * @par Sync (or) Async : Synchronous API
56  *
57  * @param[in]   mfx     pointer to manifest info
58  * @param[in]   uid     the addressee user id of the instruction
59  * @return      0 if success, error code(<0) if fail
60  * @pre         None
61  * @post                None
62  * @see         pkgmgr_parser_update_manifest_info_in_db()
63  * @see         pkgmgr_parser_delete_manifest_info_from_db()
64  * @code
65 static int insert_manifest_data(manifest_x *mfx)
66 {
67         int ret = 0;
68         ret = pkgmgr_parser_insert_manifest_info_in_db(mfx);
69         if (ret < 0)
70                 return -1;
71         return 0;
72 }
73  * @endcode
74  */
75 int pkgmgr_parser_insert_manifest_info_in_db(manifest_x *mfx);
76 int pkgmgr_parser_insert_manifest_info_in_usr_db(manifest_x *mfx, uid_t uid);
77
78 /**
79  * @fn int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx)
80  * @fn int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx)
81  * @brief       This API updates the manifest info in db
82  *
83  * @par         This API is for package-manager installer backends
84  * @par Sync (or) Async : Synchronous API
85  *
86  * @param[in]   mfx     pointer to manifest info
87  * @param[in]   uid     the addressee user id of the instruction
88  * @return      0 if success, error code(<0) if fail
89  * @pre         None
90  * @post                None
91  * @see         pkgmgr_parser_insert_manifest_info_in_db()
92  * @see         pkgmgr_parser_delete_manifest_info_from_db()
93  * @code
94 static int update_manifest_data(manifest_x *mfx)
95 {
96         int ret = 0;
97         ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
98         if (ret < 0)
99                 return -1;
100         return 0;
101 }
102  * @endcode
103  */
104 int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx);
105 int pkgmgr_parser_update_manifest_info_in_usr_db(manifest_x *mfx, uid_t uid);
106
107 /**
108  * @fn int pkgmgr_parser_update_tep_info_in_db(const char * pkgid, const char * tep_path)
109  * @fn int pkgmgr_parser_update_tep_info_in_usr_db(const char * pkgid, const char * tep_path,uid_t uid)
110  * @brief       This API updates the tep info in db
111  *
112  * @par         This API is for package-manager installer backends
113  * @par Sync (or) Async : Synchronous API
114  *
115  * @param[in]   pkgid   pointer to pkgid
116  * @param[in]   tep_path        path of tep file
117  * @return      0 if success, error code(<0) if fail
118  * @pre         None
119  * @post                None
120  * @code
121 static int update_tep_data(const char *pkgid, *tep_path)
122 {
123         int ret = 0;
124         ret = pkgmgr_parser_update_tep_info_in_db(pkgid, tep_path);
125         if (ret < 0)
126                 return -1;
127         return 0;
128 }
129  * @endcode
130  */
131 int pkgmgr_parser_update_tep_info_in_db(const char *pkgid, const char *tep_path);
132 int pkgmgr_parser_update_tep_info_in_usr_db(const char *pkgid, const char *tep_path, uid_t uid);
133
134 /**
135  * @fn int pkgmgr_parser_delete_manifest_info_from_usr_db(manifest_x *mfx, uid_t uid)
136  * @fn int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx)
137  * @brief       This API deletes the parsed manifest info from db
138  *
139  * @par         This API is for package-manager installer backends
140  * @par Sync (or) Async : Synchronous API
141  *
142  * @param[in]   mfx     pointer to manifest info
143  * @param[in]   uid     the addressee user id of the instruction
144  * @return      0 if success, error code(<0) if fail
145  * @pre         None
146  * @post                None
147  * @see         pkgmgr_parser_update_manifest_info_in_db()
148  * @see         pkgmgr_parser_insert_manifest_info_in_db()
149  * @code
150 static int delete_manifest_data(manifest_x *mfx)
151 {
152         int ret = 0;
153         ret = pkgmgr_parser_delete_manifest_info_from_db(mfx);
154         if (ret < 0)
155                 return -1;
156         return 0;
157 }
158  * @endcode
159  */
160 int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx);
161 int pkgmgr_parser_delete_manifest_info_from_usr_db(manifest_x *mfx, uid_t uid);
162
163 int pkgmgr_parser_update_preload_info_in_db();
164 int pkgmgr_parser_update_preload_info_in_usr_db(uid_t uid);
165
166 /**
167  * @fn int pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(const char *appid, uid_t uid, int is_disable)
168  * @brief       This API updates disable info about global app for user specified by uid
169  *
170  * @par         This API is for package-manager installer backends
171  * @par Sync (or) Async : Synchronous API
172  *
173  * @param[in]   appid   global application ID to be enabled or disabled
174  * @param[in]   uid     the addressee user id of the instruction
175  * @param[in]is_disable determine enable or disable of app
176  * @return      0 if success, error code(<0) if fail
177  * @pre         None
178  * @post                None
179  * @code
180 static int disable_global_app_for_uid(const char *appid, uid_t uid)
181 {
182         int ret = 0;
183         ret = pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(appid, uid, 1);
184         if (ret < 0)
185                 return -1;
186         return 0;
187 }
188  * @endcode
189  */
190 int pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(const char *appid, uid_t uid, int is_disable);
191
192 /**
193  * @fn int pkgmgr_parser_update_app_disable_info_in_db(const char *appid, int is_disable);
194  * @brief       This API updates disable info about app
195  *
196  * @par         This API is for package-manager installer backends
197  * @par Sync (or) Async : Synchronous API
198  *
199  * @param[in]   appid   application ID to be enabled or disabled
200  * @param[in]   is_disable      determine enable or disable of app
201  * @return      0 if success, error code(<0) if fail
202  * @pre         None
203  * @post                None
204  * @code
205 static int disable_app(const char *appid)
206 {
207         int ret = 0;
208         ret = pkgmgr_parser_update_app_disable_info_in_db(appid, 1);
209         if (ret < 0)
210                 return -1;
211         return 0;
212 }
213  * @endcode
214  */
215 int pkgmgr_parser_update_app_disable_info_in_db(const char *appid, int is_disable);
216 int pkgmgr_parser_update_app_disable_info_in_usr_db(const char *appid, uid_t uid, int is_disable);
217
218 /**
219  * @fn int pkgmgr_parser_update_global_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag)
220  * @brief       This API updates splash screen display info about global app for user specified by uid
221  *
222  * @par         This API is for package-manager installer backends
223  * @par Sync (or) Async : Synchronous API
224  *
225  * @param[in]   appid   global application ID to be enabled or disabled
226  * @param[in]   uid     user ID
227  * @param[in]   flag    determine enable or disable of app
228  * @return      0 if success, error code(<0) if fail
229  * @pre         None
230  * @post                None
231  * @code
232 static int disable_global_app_splash_screen_for_uid(const char *appid, uid_t uid)
233 {
234         int ret = 0;
235         ret = pkgmgr_parser_update_global_app_splash_screen_info_in_usr_db(appid, uid, 1);
236         if (ret < 0)
237                 return -1;
238         return 0;
239 }
240  * @endcode
241  */
242 int pkgmgr_parser_update_global_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag);
243
244 /**
245  * @fn int pkgmgr_parser_update_app_splash_screen_display_info_in_db(const char *appid, int flag)
246  * @brief       This API updates splash screen display info about app
247  *
248  * @par         This API is for package-manager installer backends
249  * @par Sync (or) Async : Synchronous API
250  *
251  * @param[in]   appid   application ID to be enabled or disabled
252  * @param[in]   flag    determine enable or disable of app
253  * @return      0 if success, error code(<0) if fail
254  * @pre         None
255  * @post                None
256  * @code
257 static int disable_app_splash_screen(const char *appid)
258 {
259         int ret = 0;
260         ret = pkgmgr_parser_update_app_splash_screen_info_in_db(appid, 1);
261         if (ret < 0)
262                 return -1;
263         return 0;
264 }
265  * @endcode
266  */
267 int pkgmgr_parser_update_app_splash_screen_display_info_in_db(const char *appid, int flag);
268
269 /**
270  * @fn int pkgmgr_parser_update_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag)
271  * @brief       This API updates splash screen display info about app for user specified by uid
272  *
273  * @par         This API is for package-manager installer backends
274  * @par Sync (or) Async : Synchronous API
275  *
276  * @param[in]   appid   application ID to be enabled or disabled
277  * @param[in]   uid     user ID
278  * @param[in]   flag    determine enable or disable of app
279  * @return      0 if success, error code(<0) if fail
280  */
281 int pkgmgr_parser_update_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag);
282
283 int pkgmgr_parser_create_and_initialize_db(uid_t uid);
284
285
286 /** @} */
287 #ifdef __cplusplus
288 }
289 #endif
290 #endif                          /* __PKGMGR_PARSER_DB_H__ */
291 /**
292  * @}
293  * @}
294  */