6a9496fce3819cb7e664e8eb686479d3852e8488
[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_delete_manifest_info_from_usr_db(manifest_x *mfx, uid_t uid)
109  * @fn int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx)
110  * @brief       This API deletes the parsed manifest info from db
111  *
112  * @par         This API is for package-manager installer backends
113  * @par Sync (or) Async : Synchronous API
114  *
115  * @param[in]   mfx     pointer to manifest info
116  * @param[in]   uid     the addressee user id of the instruction
117  * @return      0 if success, error code(<0) if fail
118  * @pre         None
119  * @post                None
120  * @see         pkgmgr_parser_update_manifest_info_in_db()
121  * @see         pkgmgr_parser_insert_manifest_info_in_db()
122  * @code
123 static int delete_manifest_data(manifest_x *mfx)
124 {
125         int ret = 0;
126         ret = pkgmgr_parser_delete_manifest_info_from_db(mfx);
127         if (ret < 0)
128                 return -1;
129         return 0;
130 }
131  * @endcode
132  */
133 int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx);
134 int pkgmgr_parser_delete_manifest_info_from_usr_db(manifest_x *mfx, uid_t uid);
135
136 int pkgmgr_parser_update_preload_info_in_db();
137 int pkgmgr_parser_update_preload_info_in_usr_db(uid_t uid);
138
139 int pkgmgr_parser_create_and_initialize_db(uid_t uid);
140
141
142 /** @} */
143 #ifdef __cplusplus
144 }
145 #endif
146 #endif                          /* __PKGMGR_PARSER_DB_H__ */
147 /**
148  * @}
149  * @}
150  */