7d4d5de430c1e4b757c02df11e540cac1f0f63ec
[platform/core/system/sync-agent.git] / src / framework / plugin / data_connector_plugin.h
1 /*
2  * sync-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
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
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 #ifndef DATA_CONNECTOR_PLUGIN_H_
19 #define DATA_CONNECTOR_PLUGIN_H_
20
21 #include "error.h"
22 #include "struct.h"
23 #include <glib.h>
24
25 #include "plugin/data_connector_resource.h"
26 #include "data-adapter/error.h"
27
28 /**
29  * @file data_connector_plugin.h
30  * @brief       Provides function pointer manipulate operation for data connector module
31  */
32
33 /** @addtogroup plugin
34  *      @{
35  */
36
37 /**
38  * @brief Maximum number of data-connector plugin
39  */
40 #define PLUGIN_MAX_DATA_CONNECTOR               20
41
42 /**
43  * @brief Prototype of plugin function for connecting(open) to the service
44  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
45  */
46 typedef sync_agent_da_return_e(*plugin_open_service_cb) (void);
47
48 /**
49  * @brief Prototype of plugin function for disconnecting(close) to the service
50  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
51  */
52 typedef sync_agent_da_return_e(*plugin_close_service_cb) (void);
53
54 /**
55  * @brief Prototype of plugin function for starting transaction for service storage
56  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
57  */
58 typedef sync_agent_da_return_e(*plugin_begin_transaction_cb) (void);
59
60 /**
61  * @brief Prototype of plugin function for ending transaction for service storage
62  * @param[in] is_success flag to decide commit/rollback (1:commit, 0:rollback)
63  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
64  */
65 typedef sync_agent_da_return_e(*plugin_end_transaction_cb) (int is_success);
66
67 /**
68  * @brief Prototype of plugin function for inserting item into service storage
69  * @param[in] account_id service account id
70  * @param[in] folder_id service folder id
71  * @param[in] data data to add to the service
72  * @param[in] item_id as returned by plugin_add_item_cb - success : id of the newly item added to the service, error : NULL
73  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
74  */
75 typedef sync_agent_da_return_e(*plugin_add_item_cb) (int account_id, char *folder_id, void *data, char **item_id);
76
77 /**
78  * @brief Prototype of plugin function for inserting item into service storage
79  * @param[in] account_id service account id
80  * @param[in] folder_id service folder id
81  * @param[in] data data to add to the service
82  * @param[in] item_id as returned by plugin_add_item_cb - success : id of the newly item added to the service, error : NULL
83  * @param[in] item_id_count count of item_id
84  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
85  */
86 typedef sync_agent_da_return_e(*plugin_add_bulk_item_cb) (int account_id, char *folder_id, void *data, int **item_id, int *item_id_count);
87
88 /**
89  * @brief Prototype of plugin function for updating item from service storage
90  * @param[in] account_id service account id
91  * @param[in] folder_id service folder id
92  * @param[in] item_id service item id
93  * @param[in] data data to update to the service
94  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
95  */
96 typedef sync_agent_da_return_e(*plugin_update_item_cb) (int account_id, char *folder_id, char *item_id, void *data);
97
98 /**
99  * @brief Prototype of plugin function for updating item from service storage
100  * @param[in] data data to update to the service
101  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
102  */
103 typedef sync_agent_da_return_e(*plugin_update_bulk_item_cb) (void *data);
104
105 /**
106  * @brief Prototype of plugin function for deleting item from service storage
107  * @param[in] account_id service account id
108  * @param[in] folder_id service folder id
109  * @param[in] item_id service id of item expected to be deleted
110  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
111  */
112 typedef sync_agent_da_return_e(*plugin_delete_item_cb) (int account_id, char *folder_id, char *item_id);
113
114 /**
115  * @brief Prototype of plugin function for deleting item from service storage
116  * @param[in]   item_id service id of item expected to be deleted
117  * @param[in]   count   count of service item id expected to be deleted
118  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
119  */
120 typedef sync_agent_da_return_e(*plugin_delete_bulk_item_cb) (int *item_id, int count);
121
122 /**
123  * @brief Prototype of plugin function for deleting all items from service storage
124  * @param[in] account_id service account id
125  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
126  */
127 typedef sync_agent_da_return_e(*plugin_delete_all_items_cb) (int account_id);
128
129 /**
130  * @brief Prototype of plugin function for getting item from service storage
131  * @param[in] account_id service account id
132  * @param[in] folder_id service folder id
133  * @param[in] item_id expected to get service item id
134  * @param[in] data as returned by plugin_get_item_cb - success : item info, error : NULL
135  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
136  */
137 typedef sync_agent_da_return_e(*plugin_get_item_cb) (int account_id, char *folder_id, char *item_id, void **data);
138
139 /**
140  * @brief Prototype of plugin function for inserting folder into service storage
141  * @param[in] account_id service account id
142  * @param[in] folder_name folder name
143  * @param[in] folder_type folder type
144  * @param[in] folder_id as returned by plugin_add_folder_cb - success : id of the newly folder added to the service, fail : NULL
145  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
146  */
147 typedef sync_agent_da_return_e(*plugin_add_folder_cb) (int account_id, const char *folder_name, int folder_type, char **folder_id);
148
149 /**
150  * @brief Prototype of plugin function for deleting folder from service storage
151  * @param[in] account_id service account id
152  * @param[in] folder_id service folder id
153  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
154  */
155 typedef sync_agent_da_return_e(*plugin_delete_folder_cb) (int account_id, const char *folder_id);
156
157 /**
158  * @brief Prototype of plugin function for getting folder info from service storage
159  * @param[in] account_id service account id
160  * @param[in] folder_id service folder id
161  * @param[in] folder_name as returned by plugin_get_folder_cb - success : folder name, fail : NULL
162  * @param[in] folder_type as returned by plugin_get_folder_cb - success : folder type, fail : -1
163  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
164  */
165 typedef sync_agent_da_return_e(*plugin_get_folder_cb) (int account_id, const char *folder_id, char **folder_name, int *folder_type);
166
167 /**
168  * @brief Prototype of plugin function for executing data into service
169  * @param[in] account_id service account id
170  * @param[in] execute_key execute key
171  * @param[in] execute_values execute values
172  * @param[in] result as returned by plugin_execute_cb - extension result info
173  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
174  */
175 typedef sync_agent_da_return_e(*plugin_execute_cb) (int account_id, const char *execute_key, void *execute_values, void **result);
176
177 /**
178  * @brief Prototype of plugin function for getting item used count
179  * @return current_item_count on success, negative value on error
180  */
181 typedef int (*plugin_get_used_item_count_cb) (void);
182
183 /**
184  * @brief Prototype of plugin function for getting item used count
185  * @return calendar exdate_item_count on success, negative value on error
186  */
187 typedef int (*plugin_get_deleted_exdate_item_count) (void);
188
189 /**
190  * @brief Prototype of plugin function for checking whether exdate item exist
191  * @return calendar exdate_item_count on success, negative value on error
192  */
193 typedef int (*plugin_is_exist_exdate_item) (const char *fw_parent_id, const char *child_vcalendar);
194
195 /**
196  * @brief Prototype of plugin function for updating the exdate parent item
197  * @return void
198  */
199 typedef void (*plugin_construct_exdate_parent_item) (char *parent_service_id);
200
201
202 /**
203  * @brief Prototype of plugin function for getting item used count for folder
204  * @param[in] account_id service account id
205  * @param[in] folder_id service folder id
206  * @return current_item_count on success, negative value on error
207  */
208 typedef int (*plugin_get_used_count_for_folder_cb) (int account_id, const char *folder_id);
209
210 /**
211  * @brief Prototype of plugin function for writing data store items to file
212  * @param[in] account_id service account id
213  * @param[in] file_path written file path
214  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
215  */
216 typedef sync_agent_da_return_e(*plugin_backup_service_items_to_file_cb) (int account_id, char **file_path);
217
218 /**
219  * @brief Prototype of plugin function for adding file-written item to data store
220  * @param[in] account_id service account id
221  * @param[in] file_path file path
222  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
223  */
224 typedef sync_agent_da_return_e(*plugin_restore_service_items_from_file_cb) (int account_id, const char *file_path);
225
226 /**
227  * @brief Prototype of plugin function for getting folder id list of a account
228  * @param[in] account_id service account id
229  * @param[in] folder_count as returned by plugin_get_folder_id_list_cb - success : folder count,        fail or not exist : 0
230  * @param[in] folder_type_list as returned by plugin_get_folder_id_list_cb - success : list,    fail or not exist : NULL
231  * @return folder_id_list on success, NULL on error or not exist
232  */
233 typedef char **(*plugin_get_folder_id_list_cb) (int account_id, int *folder_count, int **folder_type_list);
234
235 /**
236  * @brief Prototype of plugin function for getting all account id list that service has currently
237  * @param[in] count as returned by plugin_get_account_id_list_cb - success : count of account id,       fail or not exist : 0
238  * @return account_id_list on success, NULL on fail or not exist
239  */
240 typedef int *(*plugin_get_account_id_list_cb) (int *count);
241
242 /**
243  * @brief Prototype of plugin function for getting added item list after specific point
244  * @param[in] account_id service account id
245  * @param[in] folder_id service folder id
246  * @param[in] chage_point specific point
247  * @param[in] change_count as returned by plugin_get_changed_item_for_folder_add_cb - success : added item count, fail or not exist : NULL
248  * @return added_item_info_list (if exist) on success, NULL on error or not exist
249  */
250 typedef sync_agent_plugin_item_node_s *(*plugin_get_changed_item_for_folder_add_cb) (int account_id, const char *folder_id, int chage_point, int *change_count);
251
252 /**
253  * @brief Prototype of plugin function for getting deleted item list after specific point
254  * @param[in] account_id service account id
255  * @param[in] folder_id service folder id
256  * @param[in] chage_point specific point
257  * @param[in] change_count as returned by plugin_get_changed_item_for_folder_delete_cb - success : deleted item count, fail or not exist : NULL
258  * @return deleted_item_info_list       (if exist) on success, NULL on error or not exist
259  */
260 typedef sync_agent_plugin_item_node_s *(*plugin_get_changed_item_for_folder_delete_cb) (int account_id, const char *folder_id, int chage_point, int *change_count);
261
262 /**
263  * @brief Prototype of plugin function for getting updated item list after specific point
264  * @param[in] account_id service account id
265  * @param[in] folder_id service folder id
266  * @param[in] chage_point specific point
267  * @param[in] change_count as returned by plugin_get_changed_item_for_folder_update_cb - success : updated item count, fail or not exist : NULL
268  * @return updated_item_info_list       (if exist) on success, NULL on error or not exist
269  */
270 typedef sync_agent_plugin_item_node_s *(*plugin_get_changed_item_for_folder_update_cb) (int account_id, const char *folder_id, int chage_point, int *change_count);
271
272 /**
273  * @brief Prototype of plugin function for getting last storage change point information
274  * @return last storage changing point information on success, 0 on error
275  */
276 typedef int (*plugin_get_last_change_point_cb) (void);
277
278 /**
279  * @brief Prototype of plugin function for checking notification for the storage change
280  * @param[in] filter_flag user data
281  */
282 typedef void (*plugin_start_listening_change_noti_cb) (void *filter_flag);
283
284 /**
285  * @brief Prototype of plugin function for setting callback function to handle added item to storage
286  * @param[in] callback callback function - this function is provided from sync-agent-framework
287  */
288 typedef void (*plugin_set_callback_add_item_cb) (sync_agent_add_item_cb_plugin callback);
289
290 /**
291  * @brief Prototype of plugin function for setting callback function to handle deleted item to storage
292  * @param[in] callback callback function - this function is provided from sync-agent-framework
293  */
294 typedef void (*plugin_set_callback_delete_item_cb) (sync_agent_del_item_cb_plugin callback);
295
296 /**
297  * @brief Prototype of plugin function for setting callback function to handle updated item to storage
298  * @param[in] callback callback function - this function is provided from sync-agent-framework
299  */
300 typedef void (*plugin_set_callback_update_item_cb) (sync_agent_update_item_cb_plugin callback);
301
302 /**
303  * @brief Prototype of plugin function for setting callback function to get service account id list mapped sync-agent-framework account id
304  * @param[in] callback callback function - this function is provided from sync-agent-framework
305  */
306 typedef void (*plugin_set_callback_get_account_id_list_cb) (sync_agent_get_account_id_list_cb_plugin callback);
307
308 /**
309  * @brief Prototype of plugin function for setting callback function to handle child item delete from storage
310  * @param[in] callback callback function - this function is provided from sync-agent-framework
311  */
312 typedef void (*plugin_set_callback_delete_child_item_cb) (sync_agent_del_child_item_cb_plugin callback);
313
314
315 /********************* Get Meta Info ******************/
316
317 /**
318  * @brief Prototype of plugin function for getting max item count per folder
319  * @param[in] folder_type folder type provided plugin
320  * @return max item count on success, -1 on error
321  */
322 typedef int (*plugin_get_max_item_count_cb) (int folder_type);
323
324 /**
325  * @brief Prototype of plugin function for getting service data's available field length
326  * @param[in] field_name field_name provided data-connector plugin
327  * @param[in] child_field_name child field name provided data-connector plugin
328  * @return
329  */
330 typedef int (*plugin_get_max_field_length_cb) (int field_name, int child_field_name);
331
332 /**
333  * @brief Prototype of plugin function for getting service data's available field count
334  * @param[in] field_name field_name provided data-connector plugin
335  * @param[in] child_field_name child field name provided data-connector plugin
336  * @return
337  */
338 typedef int (*plugin_get_max_field_count_cb) (int field_name, int child_field_name);
339
340 /**
341  * @brief Prototype of plugin function for getting service data's available field value's domain
342  * @param[in] field_name field name provided data-connector plugin
343  * @param[in] child_field_name child field name provided data-connector plugin
344  * @param[in] str_val as returned by plugin_get_field_value_cb - when domain value is string
345  * @param[in] num_val1 returned by plugin_get_field_value_cb - when domain value is integer (ex minimum value)
346  * @param[in] num_val2 as returned by plugin_get_field_value_cb - when domain value is integer (ex maximum value)
347  * @return 1 on success, -1 on error
348  */
349 typedef int (*plugin_get_field_value_cb) (int field_name, int child_field_name, char **str_val, int *num_val1, int *num_val2);
350
351 /**
352  * @brief Prototype of plugin function for getting service data's available field count
353  * @param[in] feature feature provided data-connector plugin
354  * @return 1 : support, 0 : not support on success, -1 on error
355  */
356 typedef int (*plugin_get_is_support_feature_cb) (int feature);
357
358 /**
359  * @brief Prototype of plugin function for get max name length of sim contact
360  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
361  */
362 typedef int (*plugin_get_info_sim_contact_max_name_length_cb) (void);
363
364 /**
365  * @brief Prototype of plugin function for get max number length of sim contact
366  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
367  */
368 typedef int (*plugin_get_info_sim_contact_max_number_length_cb) (void);
369
370 /**
371  * @brief Prototype of plugin function for get max email length of sim contact
372  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
373  */
374 typedef int (*plugin_get_info_sim_contact_max_email_length_cb) (void);
375
376 /**
377  * @brief Prototype of plugin function for get empty count of sim contact
378  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
379  */
380 typedef int (*plugin_get_info_sim_contact_empty_count_cb) (void);
381
382 /**
383  * @brief Prototype of plugin function for get empty number count of sim contact
384  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
385  */
386 typedef int (*plugin_get_info_sim_contact_empty_number_count_cb) (void);
387
388 /**
389  * @brief Prototype of plugin function for get empty email count of sim contact
390  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
391  */
392 typedef int (*plugin_get_info_sim_contact_empty_email_count_cb) (void);
393
394 /**
395  * @brief Prototype of plugin function for get addressbook id of sim contact
396  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
397  */
398 typedef int (*plugin_get_info_sim_contact_addressbook_id_cb) (void);
399
400 /**
401  * @brief Prototype of plugin function for get item id of sim contact
402  * @param[out] item id of sim contact provided data-connector plugin
403  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
404  */
405 typedef sync_agent_da_return_e(*plugin_get_info_sim_contact_item_id_cb) (int sim_addressbook_id, GList **item_id);
406
407 /**
408  * @brief Prototype of plugin function for get data of sim contact
409  * @param[out] item id of sim contact provided data-connector plugin
410  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
411  */
412 typedef sync_agent_da_return_e(*plugin_get_info_sim_contact_item_cb) (int item_id, char **data);
413
414 /**
415  * @brief Prototype of plugin function for add sim contact
416  * @param[out] item id of sim contact provided data-connector plugin
417  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
418  */
419 typedef sync_agent_da_return_e(*plugin_add_sim_contact_item_cb) (int sim_addressbook_id, int **item_id, char *data);
420
421 /**
422  * @brief Prototype of plugin function for write sim contact
423  * @param[out] item id of sim contact provided data-connector plugin
424  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
425  */
426 typedef sync_agent_da_return_e(*plugin_write_sim_contact_item_cb) (int item_id, char *data);
427
428 /**
429  * @brief Prototype of plugin function for delete sim contact
430  * @param[out] item id of sim contact provided data-connector plugin
431  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
432  */
433 typedef sync_agent_da_return_e(*plugin_delete_sim_contact_item_cb) (int item_id);
434
435 /**
436  * @brief Prototype of plugin function for add item
437  * @return SYNC_AGENT_DA_SUCCESS on success, otherwise error
438  */
439 typedef sync_agent_da_return_e(*plugin_add_async_item_cb) (GList *data, int count);
440
441 /**
442  * @brief Structure for data-connector plugin function pointer set
443  */
444 typedef struct {
445         plugin_open_service_cb func_open_service; /**< function pointer of plugin_open_service_cb */
446         plugin_close_service_cb func_close_service; /**< function pointer of plugin_close_service_cb */
447         plugin_begin_transaction_cb func_begin_transaction; /**< function pointer of plugin_begin_transaction_cb */
448         plugin_end_transaction_cb func_end_transaction; /**< function pointer of plugin_end_transaction_cb */
449         plugin_add_item_cb func_add_item; /**< function pointer of plugin_add_item_cb */
450         plugin_add_bulk_item_cb func_add_bulk_item; /**< function pointer of plugin_add_bulk_item_cb */
451         plugin_update_item_cb func_update_item; /**< function pointer of plugin_update_item_cb */
452         plugin_update_bulk_item_cb func_update_bulk_item;       /**< function pointer of plugin_update_item_bulk_cb */
453         plugin_delete_item_cb func_delete_item; /**< function pointer of plugin_delete_item_cb */
454         plugin_delete_bulk_item_cb func_delete_bulk_item; /**< function pointer of plugin_delete_bulk_item_cb */
455         plugin_delete_all_items_cb func_delete_all_items; /**< function pointer of plugin_delete_all_items_cb */
456         plugin_get_item_cb func_get_item; /**< function pointer of plugin_get_item_cb */
457         plugin_add_folder_cb func_add_folder; /**< function pointer of plugin_add_folder_cb */
458         plugin_delete_folder_cb func_delete_folder; /**< function pointer of plugin_delete_folder_cb */
459         plugin_get_folder_cb func_get_folder; /**< function pointer of plugin_get_folder_cb */
460         plugin_execute_cb func_execute; /**< function pointer of plugin_execute_cb */
461         plugin_get_used_item_count_cb func_get_used_item_cnt; /**< function pointer of plugin_get_used_item_count_cb */
462         plugin_get_deleted_exdate_item_count func_get_deleted_exdate_item_cnt; /**< function pointer of plugin_get_deleted_exdate_item_count_cb */
463         plugin_is_exist_exdate_item func_is_exist_exdate_item; /**< function pointer of plugin_is_exist_exdate_item */
464         plugin_construct_exdate_parent_item func_construct_exdate_parent_item; /**< function pointer of plugin_construct_exdate_parent_item */
465         plugin_get_used_count_for_folder_cb func_get_used_cnt_for_folder; /**< function pointer of plugin_get_used_count_for_folder_cb */
466         plugin_backup_service_items_to_file_cb func_backup_service_items_to_file; /**< function pointer of plugin_backup_service_items_to_file_cb */
467         plugin_restore_service_items_from_file_cb func_restore_service_items_from_file; /**< function pointer of plugin_restore_service_items_from_file_cb */
468         plugin_get_folder_id_list_cb func_get_folder_id_list; /**< function pointer of plugin_get_folder_id_list_cb */
469         plugin_get_account_id_list_cb func_get_account_id_list; /**< function pointer of plugin_get_account_id_list_cb */
470         plugin_get_changed_item_for_folder_add_cb func_get_chaned_item_for_folder_add; /**< function pointer of plugin_get_changed_item_for_folder_add_cb */
471         plugin_get_changed_item_for_folder_delete_cb func_get_chaned_item_for_folder_delete; /**< function pointer of plugin_get_changed_item_for_folder_delete_cb */
472         plugin_get_changed_item_for_folder_update_cb func_get_chaned_item_for_folder_update; /**< function pointer of plugin_get_changed_item_for_folder_update_cb */
473         plugin_get_last_change_point_cb func_get_last_change_point; /**< function pointer of plugin_get_last_change_point_cb */
474         plugin_start_listening_change_noti_cb func_start_listening_change_noti; /**< function pointer of plugin_start_listening_change_noti_cb */
475         plugin_set_callback_add_item_cb func_set_callback_add_item; /**< function pointer of plugin_set_callback_add_item_cb */
476         plugin_set_callback_delete_item_cb func_set_callback_delete_item; /**< function pointer of plugin_set_callback_delete_item_cb */
477         plugin_set_callback_delete_child_item_cb func_set_callback_delete_child_item; /**< function pointer of plugin_set_callback_delete_item_cb */
478         plugin_set_callback_update_item_cb func_set_callback_update_item; /**< function pointer of plugin_set_callback_update_item_cb */
479         plugin_set_callback_get_account_id_list_cb func_set_callback_get_account_id_list; /**< function pointer of plugin_set_callback_get_account_id_list_cb */
480         plugin_get_max_item_count_cb func_get_max_item_count; /**< function pointer of plugin_get_max_item_count_cb */
481         plugin_get_max_field_length_cb func_get_max_field_length; /**< function pointer of plugin_get_max_field_length_cb */
482         plugin_get_max_field_count_cb func_get_max_field_count; /**< function pointer of plugin_get_max_field_count_cb */
483         plugin_get_field_value_cb func_get_field_value; /**< function pointer of plugin_get_field_value_cb */
484         plugin_get_is_support_feature_cb func_get_is_support_feature; /**< function pointer of plugin_get_is_support_feature_cb */
485         plugin_get_info_sim_contact_max_name_length_cb func_get_info_sim_contact_max_name_length; /**< function pointer of plugin_get_info_sim_contact_max_name_length_cb */
486         plugin_get_info_sim_contact_max_number_length_cb func_get_info_sim_contact_max_number_length; /**< function pointer of plugin_get_info_sim_contact_max_number_length_cb */
487         plugin_get_info_sim_contact_max_email_length_cb func_get_info_sim_contact_max_email_length; /**< function pointer of plugin_get_info_sim_contact_max_email_length_cb */
488         plugin_get_info_sim_contact_empty_count_cb func_get_info_sim_contact_empty_count; /**< function pointer of plugin_get_info_sim_contact_empty_count_cb */
489         plugin_get_info_sim_contact_empty_number_count_cb func_get_info_sim_contact_empty_number_count; /**< function pointer of plugin_get_info_sim_contact_empty_number_count_cb */
490         plugin_get_info_sim_contact_empty_email_count_cb func_get_info_sim_contact_empty_email_count; /**< function pointer of plugin_get_info_sim_contact_empty_email_count_cb */
491         plugin_get_info_sim_contact_addressbook_id_cb func_get_info_sim_contact_addressbook_id; /**< function pointer of plugin_get_info_sim_contact_addressbook_id_cb */
492         plugin_get_info_sim_contact_item_id_cb func_get_info_sim_contact_item_id; /**< function pointer of plugin_get_info_sim_contact_item_id_cb */
493         plugin_get_info_sim_contact_item_cb func_get_info_sim_contact_item; /**< function pointer of plugin_get_info_sim_contact_item_cb */
494         plugin_add_sim_contact_item_cb func_add_sim_contact_item; /**< function pointer of plugin_add_sim_contact_item_cb */
495         plugin_write_sim_contact_item_cb func_write_sim_contact_item; /**< function pointer of plugin_write_sim_contact_item_cb */
496         plugin_delete_sim_contact_item_cb func_delete_sim_contact_item; /**< function pointer of plugin_delete_sim_contact_item_cb */
497         plugin_add_async_item_cb func_add_async_item; /**< function pointer of plugin_add_async_item_cb */
498 } plugin_data_connector_func_set_s;
499
500 /**
501  * @brief Structure for data-connector plugin management
502  */
503 typedef struct {
504         plugin_info_s plugin_info; /**< plugin info */
505         plugin_data_connector_func_set_s func_set; /**< data-connector plugin function pointer set */
506         int data_converter_id; /**< data converter id */
507         int handle_change_noti; /**< whether to use change noti feature - described in framework initialization config file /<tagHandle-ChangeNoti> */
508         int use_main_loop; /**< whether to use main loop */
509 } plugin_data_connector_s;
510
511 /**
512  * @brief Get data-connector plugin function pointer set
513  * @param[in] plugin_handle handle of data-connector plugin (result of dlopen for data-connector plugin)
514  * @param[in] error_code as returned by plugin_get_data_connector_func_set() - plugin error
515  * @return plugin_data_connector_func_set_s instance
516  */
517 plugin_data_connector_func_set_s plugin_get_data_connector_func_set(void *plugin_handle, plugin_error_e * error_code);
518
519 /**
520  * @brief Register data-connector plugin instance to the data-connector plugin repository being maintained as a singleton
521  * @param[in] plugin plugin_data_connector_s instance
522  * @return PLUGIN_SUCCESS on success, otherwise on error
523  */
524 plugin_error_e plugin_register_plugin_data_connector(plugin_data_connector_s plugin);
525
526 /**
527  * @brief Clear data-connector plugin repository being maintained as a singleton
528  */
529 void plugin_clear_plugin_data_connector();
530
531 /**
532  * @brief Get data-connector plugin repository
533  * @param[in] count as returned by plugin_get_data_connector_plugin_repository() - the number of data-connector plugin
534  * @return data-connector plugin repository being maintained as a singleton
535  */
536 const plugin_data_connector_s *plugin_get_data_connector_plugin_repository(int *count);
537
538 /**
539  * @brief Get data-converter plugin id related with specific data-connector plugin
540  * @param[in] dc_plugin_id data-connector plugin id
541  * @return data-converter plugin id (positive value) on success, -1 on error
542  */
543 int plugin_get_data_converter_plugin_id(int dc_plugin_id);
544
545 /**
546  * @brief Get list of data-connector plugin id
547  * @param[in] count as returned by plugin_get_data_connector_plugin_id_list() - the number of data-connector plugin
548  * @return list of data-connector plugin id on success, NULL on error
549  */
550 int *plugin_get_data_connector_plugin_id_list(int *count);
551
552 /**
553  * @brief Get function pointer of plugin_open_service_cb
554  * @param[in] plugin_id data-connector plugin id
555  * @return function pointer of plugin_open_service_cb on success, NULL on error
556  */
557 plugin_open_service_cb plugin_get_function_open_service(int plugin_id);
558
559 /**
560  * @brief Get function pointer of plugin_close_service_cb
561  * @param[in] plugin_id data-connector plugin id
562  * @return function pointer of plugin_close_service_cb on success, NULL on error
563  */
564 plugin_close_service_cb plugin_get_function_close_service(int plugin_id);
565
566 /**
567  * @brief Get function pointer of plugin_begin_transaction_cb
568  * @param[in] plugin_id data-connector plugin id
569  * @return function pointer of plugin_begin_transaction_cb on success, NULL on error
570  */
571 plugin_begin_transaction_cb plugin_get_function_begin_transaction(int plugin_id);
572
573 /**
574  * @brief Get function pointer of plugin_end_transaction_cb
575  * @param[in] plugin_id data-connector plugin id
576  * @return function pointer of plugin_end_transaction_cb on success, NULL on error
577  */
578 plugin_end_transaction_cb plugin_get_function_end_transaction(int plugin_id);
579
580 /**
581  * @brief Get function pointer of plugin_add_item_cb
582  * @param[in] plugin_id data-connector plugin id
583  * @return function pointer of plugin_add_item_cb on success, NULL on error
584  */
585 plugin_add_item_cb plugin_get_function_add_item(int plugin_id);
586
587 /**
588  * @brief Get function pointer of plugin_add_bulk_item_cb
589  * @param[in] plugin_id data-connector plugin id
590  * @return function pointer of plugin_add_bulk_item_cb on success, NULL on error
591  */
592 plugin_add_bulk_item_cb plugin_get_function_add_bulk_item(int plugin_id);
593
594 /**
595  * @brief Get function pointer of plugin_update_item_cb
596  * @param[in] plugin_id data-connector plugin id
597  * @return function pointer of plugin_update_item_cb on success, NULL on error
598  */
599 plugin_update_item_cb plugin_get_function_update_item(int plugin_id);
600
601 /**
602  * @brief Get function pointer of plugin_update_bulk_item_cb
603  * @param[in] plugin_id data-connector plugin id
604  * @return function pointer of plugin_update_item_cb on success, NULL on error
605  */
606 plugin_update_bulk_item_cb plugin_get_function_update_bulk_item(int plugin_id);
607
608 /**
609  * @brief Get function pointer of plugin_delete_item_cb
610  * @param[in] plugin_id data-connector plugin id
611  * @return function pointer of plugin_delete_item_cb on success, NULL on error
612  */
613 plugin_delete_item_cb plugin_get_function_del_item(int plugin_id);
614
615 /**
616  * @brief Get function pointer of plugin_delete_bulk_item_cb
617  * @param[in] plugin_id data-connector plugin id
618  * @return function pointer of plugin_delete_bulk_item_cb on success, NULL on error
619  */
620 plugin_delete_bulk_item_cb plugin_get_function_del_bulk_item(int plugin_id);
621
622 /**
623  * @brief Get function pointer of plugin_delete_all_items_cb
624  * @param[in] plugin_id data-connector plugin id
625  * @return function pointer of plugin_delete_all_items_cb on success, NULL on error
626  */
627 plugin_delete_all_items_cb plugin_get_function_del_all_items(int plugin_id);
628
629 /**
630  * @brief Get function pointer of plugin_get_item_cb
631  * @param[in] plugin_id data-connector plugin id
632  * @return function pointer of plugin_get_item_cb on success, NULL on error
633  */
634 plugin_get_item_cb plugin_get_function_get_item(int plugin_id);
635
636 /**
637  * @brief Get function pointer of plugin_add_folder_cb
638  * @param[in] plugin_id data-connector plugin id
639  * @return function pointer of plugin_add_folder_cb on success, NULL on error
640  */
641 plugin_add_folder_cb plugin_get_function_add_folder(int plugin_id);
642
643 /**
644  * @brief Get function pointer of plugin_delete_folder_cb
645  * @param[in] plugin_id data-connector plugin id
646  * @return function pointer of plugin_delete_folder_cb on success, NULL on error
647  */
648 plugin_delete_folder_cb plugin_get_function_delete_folder(int plugin_id);
649
650 /**
651  * @brief Get function pointer of plugin_get_folder_cb
652  * @param[in] plugin_id data-connector plugin id
653  * @return function pointer of plugin_get_folder_cb on success, NULL on error
654  */
655 plugin_get_folder_cb plugin_get_function_get_folder(int plugin_id);
656
657 /**
658  * @brief Get function pointer of plugin_execute_cb
659  * @param[in] plugin_id data-connector plugin id
660  * @return function pointer of plugin_execute_cb on success, NULL on error
661  */
662 plugin_execute_cb plugin_get_function_execute(int plugin_id);
663
664 /**
665  * @brief Get function pointer of plugin_get_used_item_count_cb
666  * @param[in] plugin_id data-connector plugin id
667  * @return function pointer of plugin_get_used_item_count_cb on success, NULL on error
668  */
669 plugin_get_used_item_count_cb plugin_get_function_get_used_item_count(int plugin_id);
670
671 /**
672  * @brief Get function pointer of plugin_get_deleted_exdate_item_count_cb
673  * @param[in] plugin_id data-connector plugin id
674  * @return function pointer of plugin_get_deleted_exdate_item_count_cb on success, NULL on error
675  */
676 plugin_get_deleted_exdate_item_count plugin_get_function_get_deleted_exdate_item_count(int plugin_id);
677
678 /**
679  * @brief Get function pointer of plugin_function_is_exist_exdate_item
680  * @param[in] plugin_id data-connector plugin id
681  * @return function pointer of plugin_function_is_exist_exdate_item on success, NULL on error
682  */
683 plugin_is_exist_exdate_item plugin_function_is_exist_exdate_item(int plugin_id);
684
685 /**
686  * @brief Get function pointer of plugin_function_construct_exdate_parent_item
687  * @param[in] plugin_id data-connector plugin id
688  * @return function pointer of plugin_function_construct_exdate_parent_item on success, NULL on error
689  */
690 plugin_construct_exdate_parent_item plugin_function_construct_exdate_parent_item(int plugin_id);
691
692
693 /**
694  * @brief Get function pointer of plugin_get_used_count_for_folder_cb
695  * @param[in] plugin_id data-connector plugin id
696  * @return function pointer of plugin_get_used_count_for_folder_cb on success, NULL on error
697  */
698 plugin_get_used_count_for_folder_cb plugin_get_function_get_used_count_for_folder(int plugin_id);
699
700 /**
701  * @brief Get function pointer of plugin_get_folder_id_list_cb
702  * @param[in] plugin_id data-connector plugin id
703  * @return function pointer of plugin_get_folder_id_list_cb on success, NULL on error
704  */
705 plugin_get_folder_id_list_cb plugin_get_function_get_folder_id_list(int plugin_id);
706
707 /**
708  * @brief Get function pointer of plugin_get_account_id_list_cb
709  * @param[in] plugin_id data-connector plugin id
710  * @return function pointer of plugin_get_account_id_list_cb on success, NULL on error
711  */
712 plugin_get_account_id_list_cb plugin_get_function_get_account_id_list(int plugin_id);
713
714 /**
715  * @brief Get function pointer of plugin_backup_service_items_to_file_cb
716  * @param[in] plugin_id data-connector plugin id
717  * @return function pointer of plugin_backup_service_items_to_file_cb on success, NULL on error
718  */
719 plugin_backup_service_items_to_file_cb plugin_get_function_backup_service_items_to_file(int plugin_id);
720
721 /**
722  * @brief Get function pointer of plugin_restore_service_items_from_file_cb
723  * @param[in] plugin_id data-connector plugin id
724  * @return function pointer of plugin_restore_service_items_from_file_cb on success, NULL on error
725  */
726 plugin_restore_service_items_from_file_cb plugin_get_function_restore_service_items_from_file(int plugin_id);
727
728 /**
729  * @brief Get function pointer of plugin_get_changed_item_for_folder_add_cb
730  * @param[in] plugin_id data-connector plugin id
731  * @return function pointer of plugin_get_changed_item_for_folder_add_cb on success, NULL on error
732  */
733 plugin_get_changed_item_for_folder_add_cb plugin_get_function_get_changed_item_for_folder_add(int plugin_id);
734
735 /**
736  * @brief Get function pointer of plugin_get_changed_item_for_folder_delete_cb
737  * @param[in] plugin_id data-connector plugin id
738  * @return function pointer of plugin_get_changed_item_for_folder_delete_cb on success, NULL on error
739  */
740 plugin_get_changed_item_for_folder_delete_cb plugin_get_function_get_changed_item_for_folder_delete(int plugin_id);
741
742 /**
743  * @brief Get function pointer of plugin_get_changed_item_for_folder_update_cb
744  * @param[in] plugin_id data-connector plugin id
745  * @return function pointer of plugin_get_changed_item_for_folder_update_cb on success, NULL on error
746  */
747 plugin_get_changed_item_for_folder_update_cb plugin_get_function_get_changed_item_for_folder_update(int plugin_id);
748
749 /**
750  * @brief Get function pointer of plugin_get_last_change_point_cb
751  * @param[in] plugin_id data-connector plugin id
752  * @return function pointer of plugin_get_last_change_point_cb on success, NULL on error
753  */
754 plugin_get_last_change_point_cb plugin_get_function_get_last_change_point(int plugin_id);
755
756 /**
757  * @brief Get function pointer of plugin_start_listening_change_noti_cb
758  * @param[in] plugin_id data-connector plugin id
759  * @return function pointer of plugin_start_listening_change_noti_cb on success, NULL on error
760  */
761 plugin_start_listening_change_noti_cb plugin_get_function_start_listening_change_noti(int plugin_id);
762
763 /**
764  * @brief Get function pointer of plugin_set_callback_add_item_cb
765  * @param[in] plugin_id data-connector plugin id
766  * @return function pointer of plugin_set_callback_add_item_cb on success, NULL on error
767  */
768 plugin_set_callback_add_item_cb plugin_get_function_set_callback_add_item(int plugin_id);
769
770 /**
771  * @brief Get function pointer of plugin_set_callback_delete_item_cb
772  * @param[in] plugin_id data-connector plugin id
773  * @return function pointer of plugin_set_callback_delete_item_cb on success, NULL on error
774  */
775 plugin_set_callback_delete_item_cb plugin_get_function_set_callback_delete_item(int plugin_id);
776
777 /**
778  * @brief Get function pointer of plugin_set_callback_delete_child_item_cb
779  * @param[in] plugin_id data-connector plugin id
780  * @return function pointer of plugin_set_callback_delete_child_item_cb on success, NULL on error
781  */
782 plugin_set_callback_delete_child_item_cb plugin_get_function_set_callback_delete_child_item(int plugin_id);
783
784
785 /**
786  * @brief Get function pointer of plugin_set_callback_update_item_cb
787  * @param[in] plugin_id data-connector plugin id
788  * @return function pointer of plugin_set_callback_update_item_cb on success, NULL on error
789  */
790 plugin_set_callback_update_item_cb plugin_get_function_data_connector_set_callback_update_item(int plugin_id);
791
792 /**
793  * @brief Get function pointer of plugin_set_callback_get_account_id_list_cb
794  * @param[in] plugin_id data-connector plugin id
795  * @return function pointer of plugin_set_callback_get_account_id_list_cb on success, NULL on error
796  */
797 plugin_set_callback_get_account_id_list_cb plugin_get_function_set_callback_get_account_id_list(int plugin_id);
798
799 /**
800  * @brief Get function pointer of plugin_get_max_item_count_cb
801  * @param[in] plugin_id data-connector plugin id
802  * @return function pointer of plugin_get_max_item_count_cb on success, NULL on error
803  */
804 plugin_get_max_item_count_cb plugin_get_function_get_max_item_count(int plugin_id);
805
806 /**
807  * @brief Get function pointer of plugin_get_max_field_length_cb
808  * @param[in] plugin_id data-connector plugin id
809  * @return function pointer of plugin_get_max_field_length_cb on success, NULL on error
810  */
811 plugin_get_max_field_length_cb plugin_get_function_get_max_field_length(int plugin_id);
812
813 /**
814  * @brief Get function pointer of plugin_get_max_field_count_cb
815  * @param[in] plugin_id data-connector plugin id
816  * @return function pointer of plugin_get_max_field_count_cb on success, NULL on error
817  */
818 plugin_get_max_field_count_cb plugin_get_function_get_max_field_count(int plugin_id);
819
820 /**
821  * @brief Get function pointer of plugin_get_field_value_cb
822  * @param[in] plugin_id data-connector plugin id
823  * @return function pointer of plugin_get_field_value_cb on success, NULL on error
824  */
825 plugin_get_field_value_cb plugin_get_function_get_field_value(int plugin_id);
826
827 /**
828  * @brief Get function pointer of plugin_get_is_support_feature_cb
829  * @param[in] plugin_id data-connector plugin id
830  * @return function pointer of plugin_get_is_support_feature_cb on success, NULL on error
831  */
832 plugin_get_is_support_feature_cb plugin_get_function_get_is_support_feature(int plugin_id);
833
834 /**
835  * @brief Get function pointer of plugin_get_info_sim_contact_max_name_length_cb
836  * @param[in] plugin_id data-connector plugin id
837  * @return function pointer of plugin_get_info_sim_contact_max_name_length_cb on success, NULL on error
838  */
839 plugin_get_info_sim_contact_max_name_length_cb plugin_get_function_get_info_sim_contact_max_name_length(int plugin_id);
840
841 /**
842  * @brief Get function pointer of plugin_get_info_sim_contact_max_number_length_cb
843  * @param[in] plugin_id data-connector plugin id
844  * @return function pointer of plugin_get_info_sim_contact_max_number_length_cb on success, NULL on error
845  */
846 plugin_get_info_sim_contact_max_number_length_cb plugin_get_function_get_info_sim_contact_max_number_length(int plugin_id);
847
848 /**
849  * @brief Get function pointer of plugin_get_info_sim_contact_max_email_length_cb
850  * @param[in] plugin_id data-connector plugin id
851  * @return function pointer of plugin_get_info_sim_contact_max_email_length_cb on success, NULL on error
852  */
853 plugin_get_info_sim_contact_max_email_length_cb plugin_get_function_get_info_sim_contact_max_email_length(int plugin_id);
854
855 /**
856  * @brief Get function pointer of plugin_get_info_sim_contact_empty_count_cb
857  * @param[in] plugin_id data-connector plugin id
858  * @return function pointer of plugin_get_info_sim_contact_empty_count_cb on success, NULL on error
859  */
860 plugin_get_info_sim_contact_empty_count_cb plugin_get_function_get_info_sim_contact_empty_count(int plugin_id);
861
862 /**
863  * @brief Get function pointer of plugin_get_info_sim_contact_empty_number_count_cb
864  * @param[in] plugin_id data-connector plugin id
865  * @return function pointer of plugin_get_info_sim_contact_empty_number_count_cb on success, NULL on error
866  */
867 plugin_get_info_sim_contact_empty_number_count_cb plugin_get_function_get_info_sim_contact_empty_number_count(int plugin_id);
868
869 /**
870  * @brief Get function pointer of plugin_get_info_sim_contact_empty_email_count_cb
871  * @param[in] plugin_id data-connector plugin id
872  * @return function pointer of plugin_get_info_sim_contact_empty_email_count_cb on success, NULL on error
873  */
874 plugin_get_info_sim_contact_empty_email_count_cb plugin_get_function_get_info_sim_contact_empty_email_count(int plugin_id);
875
876 /**
877  * @brief Get function pointer of plugin_get_info_sim_contact_addressbook_id_cb
878  * @param[in] plugin_id data-connector plugin id
879  * @return function pointer of plugin_get_info_sim_contact_addressbook_id_cb on success, NULL on error
880  */
881 plugin_get_info_sim_contact_addressbook_id_cb plugin_get_function_get_info_sim_contact_addressbook_id(int plugin_id);
882
883 /**
884  * @brief Get function pointer of plugin_get_info_sim_contact_item_id_cb
885  * @param[in] plugin_id data-connector plugin id
886  * @return function pointer of plugin_get_info_sim_contact_item_id_cb on success, NULL on error
887  */
888 plugin_get_info_sim_contact_item_id_cb plugin_get_function_get_info_sim_contact_item_id(int plugin_id);
889
890 /**
891  * @brief Get function pointer of plugin_get_info_sim_contact_item_cb
892  * @param[in] plugin_id data-connector plugin id
893  * @return function pointer of plugin_get_info_sim_contact_item_cb on success, NULL on error
894  */
895 plugin_get_info_sim_contact_item_cb plugin_get_function_get_info_sim_contact_item(int plugin_id);
896
897 /**
898  * @brief Get function pointer of plugin_add_sim_contact_item_cb
899  * @param[in] plugin_id data-connector plugin id
900  * @return function pointer of plugin_add_sim_contact_item_cb on success, NULL on error
901  */
902 plugin_add_sim_contact_item_cb plugin_get_function_add_sim_contact_item(int plugin_id);
903
904 /**
905  * @brief Get function pointer of plugin_write_sim_contact_item_cb
906  * @param[in] plugin_id data-connector plugin id
907  * @return function pointer of plugin_write_sim_contact_item_cb on success, NULL on error
908  */
909 plugin_write_sim_contact_item_cb plugin_get_function_write_sim_contact_item(int plugin_id);
910
911 /**
912  * @brief Get function pointer of plugin_delete_sim_contact_item_cb
913  * @param[in] plugin_id data-connector plugin id
914  * @return function pointer of plugin_delete_sim_contact_item_cb on success, NULL on error
915  */
916 plugin_delete_sim_contact_item_cb plugin_get_function_delete_sim_contact_item(int plugin_id);
917
918 /**
919  * @brief Get function pointer of plugin_add_async_item_cb
920  * @param[in] plugin_id data-connector plugin id
921  * @return function pointer of plugin_add_async_item_cb on success, NULL on error
922  */
923 plugin_add_async_item_cb plugin_get_function_add_async_item(int plugin_id);
924
925 /**
926  *      @}
927  */
928
929 #endif                          /* DATA_CONNECTOR_PLUGIN_H_ */