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