3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #ifndef INTERFACE_MAPPING_H_
19 #define INTERFACE_MAPPING_H_
25 #endif /* __cplusplus */
28 * @file interface_mapping.h
32 /** @addtogroup data_adapter
37 * @brief Structure of framework mapping instance
40 int account_id; /**< F/W account id */
41 int data_store_id; /**< service data connector pluIn's ID described in F/W config file */
42 char *luid; /**< Locally unique identifier */
43 char *guid; /**< Globally unique identifier */
45 /**< name of accessor */
46 } sync_agent_da_mapping_s;
49 * @brief Enumerations of option used to delete framework mapping instance
52 SYNC_AGENT_DA_DELETE_MAPPING_OPTION_ACCOUNT_ID,
53 /**< delete mapping by account id */
54 SYNC_AGENT_DA_DELETE_MAPPING_OPTION_LUID, /**< delete mapping by luid */
55 } sync_agent_da_delete_mapping_option_e;
58 * @brief Structure of query used to delete framework mapping
61 sync_agent_da_delete_mapping_option_e option;
62 /**< sync_agent_da_delete_mapping_option_e type of option */
64 /**< F/W account id - SYNC_AGENT_DA_DELETE_MAPPING_OPTION_ACCOUNT_ID, SYNC_AGENT_DA_DELETE_MAPPING_OPTION_LUID */
65 char *luid; /**< F/W luid - SYNC_AGENT_DA_DELETE_MAPPING_OPTION_LUID */
66 } sync_agent_da_delete_mapping_query_s;
69 * @brief Structure of query used to fetch framework mapping
73 /**< F/W account id */
74 char *luid; /**< F/W luid */
75 } sync_agent_da_get_mapping_query_s;
78 * @brief Enumerations of option used to fetch list of framework mapping instance
81 SYNC_AGENT_DA_GET_MAPPING_LIST_OPTION_ACCOUNT_ID,
82 /**< get mapping list by account id */
83 } sync_agent_da_get_mapping_list_option_e;
86 * @brief Structure of query used to fetch list of framework mapping instance
89 sync_agent_da_get_mapping_list_option_e option;
90 /**< sync_agent_da_get_mapping_list_option_e type of option */
92 /**< F/W account id - SYNC_AGENT_DA_GET_MAPPING_LIST_OPTION_ACCOUNT_ID */
93 } sync_agent_da_get_mapping_list_query_s;
96 * @brief Create initialized framework mapping instance
100 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
101 sync_agent_da_mapping_s *mapping;
103 ret = sync_agent_create_mapping(&mapping);
104 if (ret != SYNC_AGENT_DA_SUCCESS) {
109 * @param[out] sync_agent_mapping sync_agent_da_mapping_s type of mapping instance newly initialied
110 * @return operation result
111 * @retval SYNC_AGENT_DA_SUCCESS success
112 * @retval error_value fail
114 sync_agent_da_return_e sync_agent_create_mapping(sync_agent_da_mapping_s ** sync_agent_mapping);
117 * @brief Add framework mapping instance into frameowrk db
121 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
122 sync_agent_da_mapping_s *mapping;
124 ret = sync_agent_create_mapping(&mapping);
125 if (ret != SYNC_AGENT_DA_SUCCESS) {
131 ret = sync_agent_add_mapping(mapping);
132 if (ret != SYNC_AGENT_DA_SUCCESS) {
137 * @param[in] sync_agent_mapping sync_agent_da_mapping_s type of mapping instance to add into framework
138 * @return operation result
139 * @retval SYNC_AGENT_DA_SUCCESS success
140 * @retval error_value fail
142 sync_agent_da_return_e sync_agent_add_mapping(sync_agent_da_mapping_s * sync_agent_mapping);
145 * @brief Delete framework mapping instance from frameowrk db
149 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
150 sync_agent_da_delete_mapping_query_s query;
152 query.option = SYNC_AGENT_DA_DELETE_MAPPING_OPTION_ACCOUNT_ID;
153 query.account_id = account_id;
155 ret = sync_agent_delete_mapping(&query);
156 if (ret != SYNC_AGENT_DA_SUCCESS) {
161 * @param[in] query sync_agent_da_delete_mapping_query_s type of query to apply to delete operation
162 * @return operation result
163 * @retval SYNC_AGENT_DA_SUCCESS success
164 * @retval error_value fail
166 sync_agent_da_return_e sync_agent_delete_mapping(sync_agent_da_delete_mapping_query_s * query);
169 * @brief Fetch framework mapping from framework db
173 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
174 sync_agent_da_get_mapping_query_s query;
175 sync_agent_da_mapping_s *mapping = NULL;
177 query.account_id = account_id;
178 query.luid = framework_id;
180 ret = sync_agent_get_mapping(&query, &mapping);
181 if (ret != SYNC_AGENT_DA_SUCCESS) {
186 * @param[in] query sync_agent_da_get_mapping_query_s type of query to apply to fetch operation
187 * @param[out] sync_agent_mapping sync_agent_da_mapping_s type of mapping instance fetched
188 * @return operation result
189 * @retval SYNC_AGENT_DA_SUCCESS success
190 * @retval error_value fail
192 sync_agent_da_return_e sync_agent_get_mapping(sync_agent_da_get_mapping_query_s * query, sync_agent_da_mapping_s ** sync_agent_mapping);
195 * @brief Fetch list of framework mapping from framework db
199 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
200 sync_agent_da_get_mapping_list_query_s query;
201 GList *mapping_list = NULL;
203 query.option = SYNC_AGENT_DA_GET_MAPPING_LIST_OPTION_ACCOUNT_ID;
204 query.account_id = account_id;
206 ret = sync_agent_get_mapping_list(&query, &mapping_list);
207 if (ret != SYNC_AGENT_DA_SUCCESS) {
212 * @param[in] query sync_agent_da_get_mapping_list_query_s type of query to apply to fetch operation
213 * @param[out] list GList type of list which will be filled with mapping instances fetched
214 * @return operation result
215 * @retval SYNC_AGENT_DA_SUCCESS success
216 * @retval error_value fail
218 sync_agent_da_return_e sync_agent_get_mapping_list(sync_agent_da_get_mapping_list_query_s * query, GList ** list);
221 * @brief Free framework mapping fetched from framework db
225 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
226 sync_agent_da_get_mapping_query_s query;
227 sync_agent_da_mapping_s *mapping = NULL;
229 query.account_id = account_id;
230 query.luid = framework_id;
232 ret = sync_agent_get_mapping(&query, &mapping);
233 if (ret != SYNC_AGENT_DA_SUCCESS) {
239 ret = sync_agent_free_mapping(mapping);
240 if (ret != SYNC_AGENT_DA_SUCCESS) {
245 * @param[in] sync_agent_mapping sync_agent_da_mapping_s type of mapping instance to free
246 * @return operation result
247 * @retval SYNC_AGENT_DA_SUCCESS success
248 * @retval error_value fail
250 sync_agent_da_return_e sync_agent_free_mapping(sync_agent_da_mapping_s * sync_agent_mapping);
253 * @brief Free framework list of mappint fetched from framework db
257 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
258 sync_agent_da_get_mapping_list_query_s query;
259 GList *mapping_list = NULL;
261 query.option = SYNC_AGENT_DA_GET_MAPPING_LIST_OPTION_ACCOUNT_ID;
262 query.account_id = account_id;
264 ret = sync_agent_get_mapping_list(&query, &mapping_list);
265 if (ret != SYNC_AGENT_DA_SUCCESS) {
271 ret = sync_agent_free_mapping_list(mapping_list);
272 if (ret != SYNC_AGENT_DA_SUCCESS) {
277 * @param[in] list GList type of list which is filled with mapping instances to free
278 * @return operation result
279 * @retval SYNC_AGENT_DA_SUCCESS success
280 * @retval error_value fail
282 sync_agent_da_return_e sync_agent_free_mapping_list(GList * list);
285 * @brief Check whether framework has mapping information related to given account id
289 int result = sync_agent_is_exist_mapping_by_account_id(account_id);
297 * @param[in] account_id accound id
298 * @return checking result
300 * @retval 0(or error value) not exist
302 int sync_agent_is_exist_mapping_by_account_id(int account_id);
310 #endif /* __cplusplus */
311 #endif /* INTERFACE_MAPPING_H_ */