Tizen 2.0 Release
[pkgs/o/oma-ds-service.git] / include / service-adapter / protocol-binder / oma_ds_protocol_binder.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  *   @oma_ds_protocol_binder.h
20  *   @version                                                                   0.1
21  *   @brief                                                                             This file is the header file of interface of protocol binder
22  */
23
24 #ifndef OMA_DS_PROTOCOL_BINDER_H_
25 #define OMA_DS_PROTOCOL_BINDER_H_
26
27 #include <sync_agent.h>
28 #include "service-adapter/protocol-binder/oma_ds_protocol_binder_definition.h"
29
30 /**
31  * @par Description: API to Initialize protocol binder function set
32  *
33  *
34  * @par Purpose:
35  * @par Typical use case:
36  * @par Method of function operation:
37  * @par Important notes:
38  * @param[in]           sync_agent_pb_protocol_binder_function_set_s structure
39  * @param[out]
40  *
41  * @return                              sync_agent_pb_error_e type
42  *
43  * @par Errors:
44  *
45  * @pre None.
46  * @post
47  * @see
48  * @remarks None.
49  *
50  * @par Sample Code:
51  * @code
52  * @endcode
53  */
54 sync_agent_pb_error_e init_oma_ds_1_2_binder_function_set(sync_agent_pb_protocol_binder_function_set_s ** binder_function_set);
55
56 /**
57  * @par Description: API to free sync_agent_pb_protocol_binder_function_set_s structure
58  *
59  *
60  * @par Purpose:
61  * @par Typical use case:
62  * @par Method of function operation:
63  * @par Important notes:
64  * @param[in]           sync_agent_pb_protocol_binder_function_set_s structure
65  * @param[out]
66  *
67  * @return
68  *
69  * @par Errors:
70  *
71  * @pre None.
72  * @post
73  * @see
74  * @remarks None.
75  *
76  * @par Sample Code:
77  * @code
78  * @endcode
79  */
80 void free_oma_ds_1_2_binder_function_set(sync_agent_pb_protocol_binder_function_set_s * binder_function_set);
81
82 /**
83  * @par Description: API to Initialize protocol binder
84  *
85  *
86  * @par Purpose:
87  * @par Typical use case:
88  * @par Method of function operation:
89  * @par Important notes:
90  * @param[in]           sync_agent_pb_protocol_binder_info_s structure
91  * @param[in]           enum type, sync_agent_pb_encoding_e(SYNC_AGENT_PB_ENCODING_XML, SYNC_AGENT_PB_ENCODING_WBXML_10, SYNC_AGENT_PB_ENCODING_WBXML_11, SYNC_AGENT_PB_ENCODING_WBXML_12, SYNC_AGENT_PB_ENCODING_WBXML_13)
92  * @param[in]           boolean type, whether encode xml header or not
93  * @param[in]           boolean type, whether use string table or not
94  * @param[in]           boolean type, whether protocol is anonymous or not
95  * @param[in]           boolean type, whether use flow mode or not
96  * @param[in]           boolean type, whether use textual public id or not
97  * @param[in]           sync_agent_pb_protocol_binder_function_set_s structure
98  * @param[out]
99  *
100  * @return                              sync_agent_pb_protocol_binder_info_s on success
101  *                                                      NULL on error
102  *
103  * @par Errors:
104  *
105  * @pre None.
106  * @post
107  * @see
108  * @remarks None.
109  *
110  * @par Sample Code:
111  * @code
112  * @endcode
113  */
114 sync_agent_pb_protocol_binder_info_s *oma_ds_1_2_binder_init(sync_agent_pb_protocol_binder_info_s * binder, sync_agent_pb_encoding_e enc, bool encode_xml_header,
115                                                              bool use_strtbl, bool produce_anonymous, bool use_flow_mode, bool text_public_id, sync_agent_pb_protocol_binder_function_set_s * binder_function_set);
116
117 /**
118  * @par Description: API to append specific element to WBXML tree
119  *
120  *
121  * @par Purpose:
122  * @par Typical use case:
123  * @par Method of function operation:
124  * @par Important notes:
125  * @param[in]           sync_agent_pb_protocol_binder_info_s structure
126  * @param[in]           enum type, protocol element
127  * @param[in]           content(structure to append)
128  * @param[out]
129  *
130  * @return                              SYNC_AGENT_PB_RETURN_OK on success
131  *                                                      others on error
132  *
133  * @par Errors:
134  *
135  * @pre None.
136  * @post
137  * @see
138  * @remarks None.
139  *
140  * @par Sample Code:
141  * @code
142  * @endcode
143  */
144 sync_agent_pb_error_e oma_ds_1_2_binder_append(sync_agent_pb_protocol_binder_info_s * binder, oma_ds_protocol_element_e protocol_element, Content_Ptr content);
145
146 /**
147  * @par Description: API to terminate sync_agent_pb_protocol_binder_info_s structure
148  *
149  *
150  * @par Purpose:
151  * @par Typical use case:
152  * @par Method of function operation:
153  * @par Important notes:
154  * @param[in]           sync_agent_pb_protocol_binder_info_s structure
155  * @param[out]
156  *
157  * @return
158  *
159  * @par Errors:
160  *
161  * @pre None.
162  * @post
163  * @see
164  * @remarks None.
165  *
166  * @par Sample Code:
167  * @code
168  * @endcode
169  */
170 void oma_ds_1_2_binder_terminate(sync_agent_pb_protocol_binder_info_s * binder);
171
172 /**
173  * @par Description: API to get stream
174  *
175  *
176  * @par Purpose:
177  * @par Typical use case:
178  * @par Method of function operation:
179  * @par Important notes:
180  * @param[in]           sync_agent_pb_protocol_binder_info_s structure
181  * @param[out]          string type, stream from WBXML tree
182  * @param[out]          unsigned int type, size of stream
183  *
184  * @return                              SYNC_AGENT_PB_RETURN_OK on success
185  *                                                      others on error
186  *
187  * @par Errors:
188  *
189  * @pre None.
190  * @post
191  * @see
192  * @remarks None.
193  *
194  * @par Sample Code:
195  * @code
196  * @endcode
197  */
198 sync_agent_pb_error_e oma_ds_1_2_binder_get_stream(sync_agent_pb_protocol_binder_info_s * binder, char **byte_stream, unsigned int *byte_stream_size);
199
200 /**
201  * @par Description: API to get stream size
202  *
203  *
204  * @par Purpose:
205  * @par Typical use case:
206  * @par Method of function operation:
207  * @par Important notes:
208  * @param[in]           sync_agent_pb_protocol_binder_info_s structure
209  * @param[out]          unsigned int type, size of stream
210  *
211  * @return                              SYNC_AGENT_PB_RETURN_OK on success
212  *                                                      others on error
213  *
214  * @par Errors:
215  *
216  * @pre None.
217  * @post
218  * @see
219  * @remarks None.
220  *
221  * @par Sample Code:
222  * @code
223  * @endcode
224  */
225 sync_agent_pb_error_e oma_ds_1_2_binder_get_stream_size(sync_agent_pb_protocol_binder_info_s * binder, unsigned int *byte_stream_size);
226
227 /**
228  * @par Description: API to get encoding type
229  *
230  *
231  * @par Purpose:
232  * @par Typical use case:
233  * @par Method of function operation:
234  * @par Important notes:
235  * @param[in]           sync_agent_pb_protocol_binder_info_s structure
236  * @param[out]          enum type, sync_agent_pb_encoding_e(SYNC_AGENT_PB_ENCODING_XML, SYNC_AGENT_PB_ENCODING_WBXML_10, SYNC_AGENT_PB_ENCODING_WBXML_11, SYNC_AGENT_PB_ENCODING_WBXML_12, SYNC_AGENT_PB_ENCODING_WBXML_13)
237  *
238  * @return                              SYNC_AGENT_PB_RETURN_OK on success
239  *                                                      others on error
240  *
241  * @par Errors:
242  *
243  * @pre None.
244  * @post
245  * @see
246  * @remarks None.
247  *
248  * @par Sample Code:
249  * @code
250  * @endcode
251  */
252 sync_agent_pb_error_e oma_ds_1_2_binder_get_encoding(sync_agent_pb_protocol_binder_info_s * binder, sync_agent_pb_encoding_e * enc);
253
254 /**
255  * @par Description: API to Initialize reverse protocol binder
256  *
257  *
258  * @par Purpose:
259  * @par Typical use case:
260  * @par Method of function operation:
261  * @par Important notes:
262  * @param[in]           string type, WBXML stream to parse
263  * @param[in]           unsigned int type, size of stream
264  * @param[in]           enum type, decoding(SYNC_AGENT_PB_DECODING_XML, SYNC_AGENT_PB_DECODING_WBXML)
265  * @param[in]           user data
266  * @param[out]          sync_agent_pb_protocol_binder_reverse_info_s structure
267  *
268  * @return                              SYNC_AGENT_PB_RETURN_OK on success
269  *                                                      others on error
270  *
271  * @par Errors:
272  *
273  * @pre None.
274  * @post
275  * @see
276  * @remarks None.
277  *
278  * @par Sample Code:
279  * @code
280  * @endcode
281  */
282 sync_agent_pb_error_e reverse_oma_ds_1_2_binder_init(char *byte_stream,
283                                                      unsigned int byte_stream_len, sync_agent_pb_decoding_e dec, sync_agent_pb_protocol_binder_function_set_s * binder_function_set, void *user_data, sync_agent_pb_protocol_binder_reverse_info_s ** binder);
284
285 /**
286  * @par Description: API to parse and get next contents
287  *
288  *
289  * @par Purpose:
290  * @par Typical use case:
291  * @par Method of function operation:
292  * @par Important notes:
293  * @param[in]           sync_agent_pb_protocol_binder_reverse_info_s structure
294  * @param[out]          protocol element
295  * @param[out]          string type, protocol element
296  * @param[out]          parsed contents(defined structure)
297  *
298  * @return                              SYNC_AGENT_PB_RETURN_OK on success
299  *                                                      others on error
300  *
301  * @par Errors:
302  *
303  * @pre None.
304  * @post
305  * @see
306  * @remarks None.
307  *
308  * @par Sample Code:
309  * @code
310  * @endcode
311  */
312 sync_agent_pb_error_e reverse_oma_ds_1_2_binder_next(sync_agent_pb_protocol_binder_reverse_info_s * binder, Protocol_Element * protocol_element, char **protocol_element_name, Content_Ptr * content);
313
314 #endif                          /* OMA_DS_PROTOCOL_BINDER_H_ */