Implement pkgmgr_parser_update_app_label_info_in_db for app label change
[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 /**
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 /**
164  * @fn int pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(const char *appid, uid_t uid, int is_disable)
165  * @brief       This API updates disable info about global app for user specified by uid
166  *
167  * @par         This API is for package-manager installer backends
168  * @par Sync (or) Async : Synchronous API
169  *
170  * @param[in]   appid   global application ID to be enabled or disabled
171  * @param[in]   uid     the addressee user id of the instruction
172  * @param[in]is_disable determine enable or disable of app
173  * @return      0 if success, error code(<0) if fail
174  * @pre         None
175  * @post                None
176  * @code
177 static int disable_global_app_for_uid(const char *appid, uid_t uid)
178 {
179         int ret = 0;
180         ret = pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(appid, uid, 1);
181         if (ret < 0)
182                 return -1;
183         return 0;
184 }
185  * @endcode
186  */
187 int pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(const char *appid, uid_t uid, int is_disable);
188
189 /**
190  * @fn int pkgmgr_parser_update_app_disable_info_in_db(const char *appid, int is_disable);
191  * @brief       This API updates disable info about app
192  *
193  * @par         This API is for package-manager installer backends
194  * @par Sync (or) Async : Synchronous API
195  *
196  * @param[in]   appid   application ID to be enabled or disabled
197  * @param[in]   is_disable      determine enable or disable of app
198  * @return      0 if success, error code(<0) if fail
199  * @pre         None
200  * @post                None
201  * @code
202 static int disable_app(const char *appid)
203 {
204         int ret = 0;
205         ret = pkgmgr_parser_update_app_disable_info_in_db(appid, 1);
206         if (ret < 0)
207                 return -1;
208         return 0;
209 }
210  * @endcode
211  */
212 int pkgmgr_parser_update_app_disable_info_in_db(const char *appid, int is_disable);
213 int pkgmgr_parser_update_app_disable_info_in_usr_db(const char *appid, uid_t uid, int is_disable);
214
215 /**
216  * @fn int pkgmgr_parser_update_pkg_disable_info_in_db(const char *pkgid, int is_disable);
217  * @brief       This API updates disable info about pkg
218  *
219  * @par         This API is for package-manager installer backends
220  * @par Sync (or) Async : Synchronous API
221  *
222  * @param[in]   pkgid   package ID to be enabled or disabled
223  * @param[in]   is_disable      determine enable or disable of app
224  * @return      0 if success, error code(<0) if fail
225  * @pre         None
226  * @post                None
227  * @code
228 static int disable_pkg(const char *pkgid)
229 {
230         int ret = 0;
231         ret = pkgmgr_parser_update_pkg_disable_info_in_db(pkgid, 1);
232         if (ret < 0)
233                 return -1;
234         return 0;
235 }
236  * @endcode
237  */
238 int pkgmgr_parser_update_pkg_disable_info_in_db(const char *pkgid, int is_disable);
239 int pkgmgr_parser_update_pkg_disable_info_in_usr_db(const char *pkgid, uid_t uid, int is_disable);
240
241 /**
242  * @fn int pkgmgr_parser_update_global_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag)
243  * @brief       This API updates splash screen display info about global app for user specified by uid
244  *
245  * @par         This API is for package-manager installer backends
246  * @par Sync (or) Async : Synchronous API
247  *
248  * @param[in]   appid   global application ID to be enabled or disabled
249  * @param[in]   uid     user ID
250  * @param[in]   flag    determine enable or disable of app
251  * @return      0 if success, error code(<0) if fail
252  * @pre         None
253  * @post                None
254  * @code
255 static int disable_global_app_splash_screen_for_uid(const char *appid, uid_t uid)
256 {
257         int ret = 0;
258         ret = pkgmgr_parser_update_global_app_splash_screen_info_in_usr_db(appid, uid, 1);
259         if (ret < 0)
260                 return -1;
261         return 0;
262 }
263  * @endcode
264  */
265 int pkgmgr_parser_update_global_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag);
266
267 /**
268  * @fn int pkgmgr_parser_update_app_splash_screen_display_info_in_db(const char *appid, int flag)
269  * @brief       This API updates splash screen display info about app
270  *
271  * @par         This API is for package-manager installer backends
272  * @par Sync (or) Async : Synchronous API
273  *
274  * @param[in]   appid   application ID to be enabled or disabled
275  * @param[in]   flag    determine enable or disable of app
276  * @return      0 if success, error code(<0) if fail
277  * @pre         None
278  * @post                None
279  * @code
280 static int disable_app_splash_screen(const char *appid)
281 {
282         int ret = 0;
283         ret = pkgmgr_parser_update_app_splash_screen_info_in_db(appid, 1);
284         if (ret < 0)
285                 return -1;
286         return 0;
287 }
288  * @endcode
289  */
290 int pkgmgr_parser_update_app_splash_screen_display_info_in_db(const char *appid, int flag);
291
292 /**
293  * @fn int pkgmgr_parser_update_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag)
294  * @brief       This API updates splash screen display info about app for user specified by uid
295  *
296  * @par         This API is for package-manager installer backends
297  * @par Sync (or) Async : Synchronous API
298  *
299  * @param[in]   appid   application ID to be enabled or disabled
300  * @param[in]   uid     user ID
301  * @param[in]   flag    determine enable or disable of app
302  * @return      0 if success, error code(<0) if fail
303  */
304 int pkgmgr_parser_update_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag);
305
306 /**
307  * @fn int pkgmgr_parser_update_app_label_info_in_db(const char *appid, const char *label)
308  * @brief       This API updates label info of application
309  *
310  * @par         This API is only for internal usage
311  * @par Sync (or) Async : Synchronous API
312  *
313  * @param[in]   appid   application ID to change label
314  * @param[in]   label   label to change
315  * @return      0 if success, error code(<0) if fail
316  */
317 int pkgmgr_parser_update_app_label_info_in_db(const char *appid, const char *label);
318
319 /**
320  * @fn int pkgmgr_parser_update_app_label_info_in_usr_db(const char *appid, uid_t uid, const char *label)
321  * @brief       This API updates label info of application for user specified by uid
322  *
323  * @par         This API is only for internal usage
324  * @par Sync (or) Async : Synchronous API
325  *
326  * @param[in]   appid   application ID to change label
327  * @param[in]   uid     user ID
328  * @param[in]   label   label to change
329  * @return      0 if success, error code(<0) if fail
330  */
331 int pkgmgr_parser_update_app_label_info_in_usr_db(const char *appid, uid_t uid, const char *label);
332
333 int pkgmgr_parser_create_and_initialize_db(uid_t uid);
334
335
336 /** @} */
337 #ifdef __cplusplus
338 }
339 #endif
340 #endif                          /* __PKGMGR_PARSER_DB_H__ */
341 /**
342  * @}
343  * @}
344  */