Tizen 2.0 Release
[pkgs/o/oma-ds-service.git] / include / service-adapter / sa_common_interface.h
1 /*
2  * oma-ds-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 /**
19  *   @SA_Common_Interface.h
20  *   @version                                                                   0.1
21  *   @brief                                                                             This file is the header file of interface of SA
22  *                                                                                                      called by SE
23  */
24
25 #ifndef SA_COMMON_INTERFACE_H_
26 #define SA_COMMON_INTERFACE_H_
27
28 /**
29  * @par Description: API to process pre-action that has to be befor sync service
30  *
31  *  Exchage Pkg1 and Pkg2 with server
32  *  Get Device Information
33  *
34  * @par Purpose:
35  * @par Typical use case:
36  * @par Method of function operation:
37  * @par Important notes:
38  * @param[in]           int  type, transport Type(obex, FW_HTTP ...)
39  * @param[in]           int type, account id
40  * @param[in]           string type, session id
41  * @param[in]           int type, whether server is fmm server for calllog or not
42  * @param[out]          pre_sync_return_obj_s structure(result from pkg2)
43  *
44  * @return                      common_error_type_e enum value
45  *
46  * @par Errors:
47  *
48  * @pre None.
49  * @post
50  * @see
51  * @remarks None.
52  *
53  * @par Sample Code:
54  * @code
55  * @endcode
56  */
57 int pre_sync(int transport_type, int account_id, char *session_id, int server_flag, void **pre_sync_return_obj);
58
59 /**
60  * @par Description: API to generate protocol specific msg
61  *
62  *  Generate MSg which be considered maxMsgSize and maxObjSize
63  *
64  * @par Purpose:
65  * @par Typical use case:
66  * @par Method of function operation:
67  * @par Important notes:
68  * @param[in]           sync_obj_s structure
69  * @param[in]           int type, whether server is fmm server for calllog or not
70  * @param[out]          msg
71  * @param[out]          msg size
72  *
73  * @return                      common_error_type_e enum value
74  *
75  * @par Errors:
76  *
77  * @pre None.
78  * @post
79  * @see
80  * @remarks None.
81  *
82  * @par Sample Code:
83  * @code
84  * @endcode
85  */
86 int generate_msg(void **sync_obj, int server_flag, char **msg, unsigned int *msg_size);
87
88 /**
89  * @par Description: API to exchange protocol specific msg with server
90  *
91  *  Exchange protocol specific msg(request and response) using  header binding information with server
92  *
93  * @par Purpose:
94  * @par Typical use case:
95  * @par Method of function operation:
96  * @par Important notes:
97  * @param[in]           int type, transport protocol type(http, obex etc)
98  * @param[in]           string type, msg to send
99  * @param[in]           unsigned int type, msg size
100  * @param[out]          string type, receive msg
101  * @param[out]          unsigned int type, receive msg size
102  *
103  * @return                      common_error_type_e enum value
104  *
105  * @par Errors:
106  *
107  * @pre None.
108  * @post
109  * @see
110  * @remarks None.
111  *
112  * @par Sample Code:
113  * @code
114  * @endcode
115  */
116 int exchange_msg(int transport_type, char *send_msg, unsigned int send_msg_length, char **recv_msg, unsigned int *recv_msg_length);
117
118 /**
119  * @par Description: API to process response msg from server
120  *
121  *  Process response msg from server and convert to obj that return to Service Engine
122  *
123  * @par Purpose:
124  * @par Typical use case:
125  * @par Method of function operation:
126  * @par Important notes:
127  * @param[in]           string type, recive msg from server
128  * @param[in]           unsigned int type, receive msg size
129  * @param[in]           int type, whether or not to end in pkg4
130  * @param[out]          sync_return_obj_s structure
131  * @param[out]          int type, flag for finsih sync session
132  *
133  * @return                      common_error_type_e enum value
134  *
135  * @par Errors:
136  *
137  * @pre None.
138  * @post
139  * @see
140  * @remarks None.
141  *
142  * @par Sample Code:
143  * @code
144  * @endcode
145  */
146 int process_recv_msg(char *recv_msg, unsigned int recv_msg_length, int only_from_client, void **sync_return_obj, int *is_finish);
147
148 /**
149  * @par Description: API to free session_s structure and close connection
150  *
151  *  This API for case that error or cancel occur in ServiceEngine so need to clean up resource which using in ServiceAdapter
152  *
153  * @par Purpose:
154  * @par Typical use case:
155  * @par Method of function operation:
156  * @par Important notes:
157  * @param[in]
158  * @param[out]
159  *
160  * @return
161  *
162  * @par Errors:
163  *
164  * @pre None.
165  * @post
166  * @see
167  * @remarks None.
168  *
169  * @par Sample Code:
170  * @code
171  * @endcode
172  */
173 void clean_up_sa();
174
175 /**
176  * @par Description: API to process auto configure function
177  *
178  *
179  * @par Purpose:
180  * @par Typical use case:
181  * @par Method of function operation:
182  * @par Important notes:
183  * @param[in]           string type, server ip
184  * @param[in]           string type, id
185  * @param[in]           string type, password
186  * @param[out]          GList type, list of auto configure results
187  *
188  * @return                              common_error_type_e enum value
189  *
190  * @par Errors:
191  *
192  * @pre None.
193  * @post
194  * @see
195  * @remarks None.
196  *
197  * @par Sample Code:
198  * @code
199  * @endcode
200  */
201 int auto_configure(char *addr, char *id, char *password, GList ** congifure);
202
203 /**
204  * @par Description: API to check cancel status
205  *
206  *              Cancel flag is set and if engine is going to process pkg 5 & 6
207  *              keep going until finish sync session
208  *
209  *
210  * @par Purpose:
211  * @par Typical use case:
212  * @par Method of function operation:
213  * @par Important notes:
214  *
215  * @return                              1 means Do cancel
216  *                                                      0 means Do not cancel
217  *
218  * @par Errors:
219  *
220  * @pre None.
221  * @post
222  * @see
223  * @remarks None.
224  *
225  * @par Sample Code:
226  * @code
227  * @endcode
228  */
229 int check_cancel_status();
230
231 /**
232  * @par Description: API to suspend current sync session
233  *
234  *              Send alert 224 to server and status if there are
235  *
236  *
237  * @par Purpose:
238  * @par Typical use case:
239  * @par Method of function operation:
240  * @par Important notes:
241  * @param[in]           int  type, transport Type(obex, FW_HTTP ...)
242  * @param[in]           int type, account id
243  *
244  * @return                              common_error_type_e enum value
245  *
246  * @par Errors:
247  *
248  * @pre None.
249  * @post
250  * @see
251  * @remarks None.
252  *
253  * @par Sample Code:
254  * @code
255  * @endcode
256  */
257 int suspend_sync(int transport_type, int account_id, int server_flag);
258
259 /**
260  * @par Description: API to cancel connection during sync session
261  *
262  *
263  *
264  * @par Purpose:
265  * @par Typical use case:
266  * @par Method of function operation:
267  * @par Important notes:
268  * @param[in]           int  type, transport Type(obex, FW_HTTP ...)
269  *
270  * @return                              common_error_type_e enum value
271  *
272  * @par Errors:
273  *
274  * @pre None.
275  * @post
276  * @see
277  * @remarks None.
278  *
279  * @par Sample Code:
280  * @code
281  * @endcode
282  */
283 int cancel_connection_sync_request(int transport_type);
284
285 #endif                          /* SA_COMMON_INTERFACE_H_ */