ffb76dea6f83240f19c963be5ac9715dd16262bc
[platform/core/system/sync-agent.git] / include / plugin / data_connector_resource.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_RESOURCE_H_
19 #define DATA_CONNECTOR_RESOURCE_H_
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif                          /* __cplusplus */
24
25 /**
26  * @file data_connector_resource.h
27  * @brief       Item id list container & callback functions for item change notification
28  * @remarks Implementation will operate sync-agent-framework data-adapter module
29  */
30
31 /** @addtogroup plugin_dataconnector DataConnector Domain
32  * @ingroup plugin
33  *      @{
34  */
35
36 /**
37  * Structure of Item ID Node - Linked List
38  */
39         struct sync_agent_plugin_item_node_s {
40                 char *item_id;
41                        /**< item id */
42                 struct sync_agent_plugin_item_node_s *next;
43                                                     /**< next pointer */
44         };
45
46         typedef struct sync_agent_plugin_item_node_s sync_agent_plugin_item_node_s;
47
48 /**
49  * Function which is called at some plugin (calendar, contact, memo) when new item is added to the service
50  *
51  * @param[in] account_id service account id
52  * @param[in] index possible mapping one service account with multiple sync-agent-framework account, so need index of sync-agent-framework account.
53  * @param[in] item_id service item id
54  * @param[in] item_type service type - service data connector plugin's id described in sync-agent-framework config xml file
55  * @param[in] folder_id service folder id
56  * @param[in] folder_type folder type defined in data-connector plugin
57  *
58  * @return 1 on success, 0 on error
59  *
60  * @par Since:
61  *
62  *
63  * @see sync_agent_plugin_set_callback_add_item(sync_agent_add_item_cb_plugin)
64  *
65  */
66         typedef int (*sync_agent_add_item_cb_plugin) (int account_id, int index, char *item_id, int item_type, char *folder_id, int folder_type);
67
68 /**
69  * Function which is called at some plugin (calendar, contact, memo) when existing item is deleted to the service
70  *
71  * @param[in] account_id service account id
72  * @param[in] index possible mapping one service account with multiple sync-agent-framework account, so need index of sync-agent-framework account.
73  * @param[in] item_id service item id
74  * @param[in] item_type service type - service data connector plugin's id described in sync-agent-framework config xml file
75  *
76  * @return 1 on success, 0 on error
77  *
78  * @par Since:
79  *
80  *
81  * @see sync_agent_plugin_set_callback_delete_item(sync_agent_del_item_cb_plugin)
82  *
83  */
84         typedef int (*sync_agent_del_item_cb_plugin) (int account_id, int index, char *item_id, int item_type);
85
86 /**
87  * Function which is called at some plugin (calendar, contact, memo) when existing item is updated to the service
88  *
89  * @param[in] account_id service account id
90  * @param[in] index possible mapping one service account with multiple sync-agent-framework account, so need index of sync-agent-framework account.
91  * @param[in] item_id service item id
92  * @param[in] item_type service type - service data connector plugin's id described in sync-agent-framework config xml file
93  *
94  * @return 1 on success, 0 on error
95  *
96  * @par Since:
97  *
98  *
99  * @see sync_agent_plugin_set_callback_update_item(sync_agent_update_item_cb_plugin)
100  *
101  */
102         typedef int (*sync_agent_update_item_cb_plugin) (int account_id, int index, char *item_id, int item_type);
103
104 /**
105  * Function which is called at some plugin (calendar, contact, memo) when need service account id list concerned of service_type
106  *
107  * @param[in] service_type service data connector plugin's id described in sync-agent-framework config xml file
108  * @param[in] cnt as returned by sync_agent_get_account_id_list_cb_plugin() - count of account id
109  *
110  * @return account_id_list on success, NULL on error or not exist
111  *
112  * @par Since:
113  *
114  *
115  * @see sync_agent_plugin_set_callback_get_account_id_list(sync_agent_get_account_id_list_cb_plugin)
116  *
117  */
118         typedef int *(*sync_agent_get_account_id_list_cb_plugin) (int service_type, int *cnt);
119
120 /**
121  *      @}
122  */
123
124 #ifdef __cplusplus
125 }
126 #endif                          /* __cplusplus */
127 #endif                          /* DATA_CONNECTOR_RESOURCE_H_ */