Tizen 2.1 base
[platform/core/system/sync-agent.git] / include / protocol-binder / util.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 PROTOCOL_BINDER_UTIL_H_
19 #define PROTOCOL_BINDER_UTIL_H_
20
21 #include <stdbool.h>
22 #include "error.h"
23 #include "definition.h"
24 #include "interface.h"
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif                          /* __cplusplus */
29
30 /**
31  * @file util.h
32  * @brief Provides protocol binder utility operation
33  */
34
35 /** @addtogroup protocol_binder
36  *      @{
37  */
38
39 /* protocol binder property managing functions */
40 /**
41  * @brief Change protocol
42  * @par Useage:
43  * @code
44  *
45  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
46  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
47  *
48  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
49  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
50  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
51  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
52  *
53  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
54  *      (sync_agent_pb_function_info_s*)binder_function_info,
55  *      &pBinder_function_set);
56  * if (err != SYNC_AGENT_PB_RETURN_OK) {
57  *      ...
58  * }
59  *
60  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
61  *              false, true, false, true, true, NULL, NULL,
62  *              pBinder_function_set);
63  * if (pOutBinder == NULL) {
64  *      ...
65  * }
66  *
67  * err = sync_agent_switch_protocol(pBinder, SYNC_AGENT_PB_PROTOCOL_SYNCML_DEVINF12);
68  * if (err != SYNC_AGENT_PB_RETURN_OK) {
69  *      ...
70  * }
71  *
72  * @endcode
73  * @param[in] binder Structure(sync_agent_pb_protocol_binder_info_s)
74  * @param[in] protocol Enum value that means specific protocol
75  * @return 0 on success, otherwise a negative error value.
76  * @retval SYNC_AGENT_PB_RETURN_OK Successful
77  * @retval SYNC_AGENT_PB_RETURN_NOT_DEFINED Invalid parameter(pBinder)
78  * @retval SYNC_AGENT_PB_RETURN_INVALID_PROTOCOL Invalid parameter(protocol)
79  * @retval SYNC_AGENT_PB_RETURN_ALREADY_SWITCH_PROTOCOL Operation failed
80  * @see sync_agent_init_protocol_binder, sync_agent_undo_switch_protocol
81  */
82         sync_agent_pb_error_e sync_agent_switch_protocol(sync_agent_pb_protocol_binder_info_s * binder, sync_agent_pb_protocol_e protocol);
83
84 /**
85  * @brief Go back to previous protocol
86  * @par Useage:
87  * @code
88  *
89  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
90  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
91  *
92  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
93  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
94  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
95  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
96  *
97  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
98  *      (sync_agent_pb_function_info_s*)binder_function_info,
99  *      &pBinder_function_set);
100  * if (err != SYNC_AGENT_PB_RETURN_OK) {
101  *      ...
102  * }
103  *
104  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
105  *              false, true, false, true, true, NULL, NULL,
106  *              pBinder_function_set);
107  * if (pOutBinder == NULL) {
108  *      ...
109  * }
110  *
111  * err = sync_agent_switch_protocol(pBinder, SYNC_AGENT_PB_PROTOCOL_SYNCML_DEVINF12);
112  * if (err != SYNC_AGENT_PB_RETURN_OK) {
113  *      ...
114  * }
115  *
116  *
117  * err = sync_agent_undo_switch_protocol(pBinder);
118  * if (err != SYNC_AGENT_PB_RETURN_OK) {
119  *      ...
120  * }
121  *
122  * @endcode
123  * @param[in] binder Structure(sync_agent_pb_protocol_binder_info_s)
124  * @return 0 on success, otherwise a negative error value.
125  * @retval SYNC_AGENT_PB_RETURN_OK Successful
126  * @retval SYNC_AGENT_PB_RETURN_NOT_DEFINED Invalid parameter(pBinder)
127  * @retval SYNC_AGENT_PB_RETURN_HAS_NO_UNDO_SWITCH_PROTOCOL Operation failed
128  * @see sync_agent_switch_protocol
129  */
130         sync_agent_pb_error_e sync_agent_undo_switch_protocol(sync_agent_pb_protocol_binder_info_s * binder);
131
132 /* wbxml dom tree building functions */
133 /**
134  * @brief Create WBXMLTree using information in sync_agent_pb_protocol_binder_info_s structure
135  * @par Useage:
136  * @code
137  *
138  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
139  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
140  *
141  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
142  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
143  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
144  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
145  *
146  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
147  *      (sync_agent_pb_function_info_s*)binder_function_info,
148  *      &pBinder_function_set);
149  * if (err != SYNC_AGENT_PB_RETURN_OK) {
150  *      ...
151  * }
152  *
153  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
154  *              false, true, false, true, true, NULL, NULL,
155  *              pBinder_function_set);
156  * if (pOutBinder == NULL) {
157  *      ...
158  * }
159  *
160  * WBXMLTree *tree = sync_agent_create_wbxml_tree(pBinder);
161  * if (tree == NULL) {
162  *      ...
163  * }
164  *
165  *      ...
166  *
167  * @endcode
168  * @param[in] binder Structure(sync_agent_pb_protocol_binder_info_s)
169  * @return WBXMLTree on success, NULL on fail
170  * @see sync_agent_init_protocol_binder
171  */
172         WBXMLTree *sync_agent_create_wbxml_tree(const sync_agent_pb_protocol_binder_info_s * binder);
173
174 /**
175  * @brief Add WBXMLTree to WBXMLTreeNode as a subree
176  * @par Useage:
177  * @code
178  *
179  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
180  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
181  *
182  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
183  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
184  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
185  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
186  *
187  * char *element_name = "header";
188  *
189  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
190  *      (sync_agent_pb_function_info_s*)binder_function_info,
191  *      &pBinder_function_set);
192  * if (err != SYNC_AGENT_PB_RETURN_OK) {
193  *      ...
194  * }
195  *
196  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
197  *              false, true, false, true, true, NULL, NULL,
198  *              pBinder_function_set);
199  * if (pOutBinder == NULL) {
200  *      ...
201  * }
202  *
203  * WBXMLTreeNode *header_node = sync_agent_create_node(pBinder, element_name);
204  * if (header_node == NULL) {
205  *      err = SYNC_AGENT_PB_RETURN_OUT_OF_MEMORY;
206  *      goto error;
207  * }
208  *
209  * WBXMLTree *tree = sync_agent_create_wbxml_tree(pBinder);
210  * if (tree == NULL) {
211  *      ...
212  * }
213  *
214  *
215  * err = sync_agent_add_wbxml_tree_to_wbxml_node(header_node, tree);
216  * if (err != SYNC_AGENT_PB_RETURN_OK) {
217  *      ...
218  * }
219  *
220  *      ...
221  *
222  * @endcode
223  * @param[in] parent_node WBXMLTreeNode
224  * @param[in] tree WBXMLTree
225  * @return 0 on success, otherwise a negative error value.
226  * @retval SYNC_AGENT_PB_RETURN_OK Successful
227  * @retval SYNC_AGENT_PB_RETURN_INVALID_INPUT_PARAMETER Invalid parameter(parent_node, tree)
228  * @retval SYNC_AGENT_PB_RETURN_OUT_OF_MEMORY Out of memory
229  * @see sync_agent_init_protocol_binder, sync_agent_create_node, sync_agent_create_wbxml_tree
230  */
231         sync_agent_pb_error_e sync_agent_add_wbxml_tree_to_wbxml_node(WBXMLTreeNode * parent_node, WBXMLTree * tree);
232
233 /**
234  * @brief Set root node of WBXMLTree
235  * @par Useage:
236  * @code
237  *
238  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
239  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
240  *
241  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
242  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
243  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
244  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
245  *
246  * char *element_name = "header";
247  *
248  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
249  *      (sync_agent_pb_function_info_s*)binder_function_info,
250  *      &pBinder_function_set);
251  * if (err != SYNC_AGENT_PB_RETURN_OK) {
252  *      ...
253  * }
254  *
255  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
256  *              false, true, false, true, true, NULL, NULL,
257  *              pBinder_function_set);
258  * if (pOutBinder == NULL) {
259  *      ...
260  * }
261  *
262  * WBXMLTreeNode *header_node = sync_agent_create_node(pBinder, element_name);
263  * if (header_node == NULL) {
264  *      err = SYNC_AGENT_PB_RETURN_OUT_OF_MEMORY;
265  *      goto error;
266  * }
267  *
268  * WBXMLTree *root_tree = sync_agent_create_wbxml_tree(pBinder);
269  * if (tree == NULL) {
270  *      ...
271  * }
272  *
273  *
274  * err = sync_agent_set_wbxml_tree_root(root_tree, header_node);
275  * if (err != SYNC_AGENT_PB_RETURN_OK) {
276  *      ...
277  * }
278  *
279  *      ...
280  *
281  * @endcode
282  * @param[in] tree WBXMLTree
283  * @param[in] node WBXMLTreeNode
284  * @return 0 on success, otherwise a negative error value.
285  * @retval SYNC_AGENT_PB_RETURN_OK Successful
286  * @retval SYNC_AGENT_PB_RETURN_INVALID_INPUT_PARAMETER Invalid parameter(parent_node, tree)
287  * @retval SYNC_AGENT_PB_RETURN_TREE_ALREADY_HAS_ROOT
288  * @see sync_agent_init_protocol_binder, sync_agent_create_wbxml_tree
289  */
290         sync_agent_pb_error_e sync_agent_set_wbxml_tree_root(WBXMLTree * tree, WBXMLTreeNode * node);
291
292 /**
293  * @brief Create WBXMLTreeNode using XML element name
294  * @par Useage:
295  * @code
296  *
297  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
298  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
299  *
300  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
301  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
302  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
303  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
304  *
305  * char *element_name = "header";
306  *
307  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
308  *      (sync_agent_pb_function_info_s*)binder_function_info,
309  *      &pBinder_function_set);
310  * if (err != SYNC_AGENT_PB_RETURN_OK) {
311  *      ...
312  * }
313  *
314  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
315  *              false, true, false, true, true, NULL, NULL,
316  *              pBinder_function_set);
317  * if (pOutBinder == NULL) {
318  *      ...
319  * }
320  *
321  * WBXMLTreeNode *header_node = sync_agent_create_node(pBinder, element_name);
322  * if (header_node == NULL) {
323  *      ...
324  * }
325  *
326  * @endcode
327  * @param[in] binder sync_agent_pb_protocol_binder_info_s
328  * @param[in] xml_name XML element name
329  * @return WBXMLTreeNode on success, NULL on fail
330  * @see sync_agent_init_protocol_binder, sync_agent_destroy_wbxml_node
331  */
332         WBXMLTreeNode *sync_agent_create_node(const sync_agent_pb_protocol_binder_info_s * binder, const char *xml_name);
333
334 /**
335  * @brief Create WBXMLTreeNode using XML element name and XML name space
336  * @par Useage:
337  * @code
338  *
339  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
340  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
341  *
342  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
343  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
344  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
345  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
346  *
347  * char *element_name = "header";
348  * char *name_space = "name_space";
349  *
350  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
351  *      (sync_agent_pb_function_info_s*)binder_function_info,
352  *      &pBinder_function_set);
353  * if (err != SYNC_AGENT_PB_RETURN_OK) {
354  *      ...
355  * }
356  *
357  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
358  *              false, true, false, true, true, NULL, NULL,
359  *              pBinder_function_set);
360  * if (pOutBinder == NULL) {
361  *      ...
362  * }
363  *
364  * WBXMLTreeNode *header_node = sync_agent_create_node_with_namespace(pBinder, element_name, name_space);
365  * if (header_node == NULL) {
366  *      ...
367  * }
368  *
369  * @endcode
370  * @param[in] binder sync_agent_pb_protocol_binder_info_s
371  * @param[in] xml_name XML element name
372  * @param[in] name_space XML name space
373  * @return WBXMLTreeNode on success, NULL on fail
374  * @see sync_agent_init_protocol_binder, sync_agent_destroy_wbxml_node
375  */
376         WBXMLTreeNode *sync_agent_create_node_with_namespace(const sync_agent_pb_protocol_binder_info_s * binder, const char *xml_name, const char *name_space);
377
378 /**
379  * @brief Create WBXMLTreeNode using XML element name with text content
380  * @par Useage:
381  * @code
382  *
383  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
384  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
385  *
386  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
387  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
388  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
389  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
390  *
391  * char *element_name = "header";
392  * char *text_data = "data";
393  * unsigned int text_len = strlen(text_data);;
394  *
395  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
396  *      (sync_agent_pb_function_info_s*)binder_function_info,
397  *      &pBinder_function_set);
398  * if (err != SYNC_AGENT_PB_RETURN_OK) {
399  *      ...
400  * }
401  *
402  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
403  *              false, true, false, true, true, NULL, NULL,
404  *              pBinder_function_set);
405  * if (pOutBinder == NULL) {
406  *      ...
407  * }
408  *
409  * WBXMLTreeNode *header_node = sync_agent_create_text_node(pBinder, element_name, text_data, text_len);
410  * if (header_node == NULL) {
411  *      ...
412  * }
413  *
414  * @endcode
415  * @param[in] binder sync_agent_pb_protocol_binder_info_s
416  * @param[in] xml_name XML element name
417  * @param[in] text Content
418  * @param[in] text_len Length of Content
419  * @return WBXMLTreeNode on success, NULL on fail
420  * @see sync_agent_init_protocol_binder, sync_agent_destroy_wbxml_node
421  */
422         WBXMLTreeNode *sync_agent_create_text_node(const sync_agent_pb_protocol_binder_info_s * binder, const char *xml_name, const char *text, unsigned int text_len);
423
424 /**
425  * @brief Create WBXMLTreeNode using XML element name and XML name space with text content
426  * @par Useage:
427  * @code
428  *
429  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
430  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
431  *
432  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
433  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
434  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
435  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
436  *
437  * char *element_name = "header";
438  * char *name_space = "name_space";
439  * char *text_data = "data";
440  * unsigned int text_len = strlen(text_data);
441  *
442  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
443  *      (sync_agent_pb_function_info_s*)binder_function_info,
444  *      &pBinder_function_set);
445  * if (err != SYNC_AGENT_PB_RETURN_OK) {
446  *      ...
447  * }
448  *
449  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
450  *              false, true, false, true, true, NULL, NULL,
451  *              pBinder_function_set);
452  * if (pOutBinder == NULL) {
453  *      ...
454  * }
455  *
456  * WBXMLTreeNode *header_node = sync_agent_create_text_node_with_namespace(pBinder, element_name, name_space, text_data, text_len);
457  * if (header_node == NULL) {
458  *      ...
459  * }
460  *
461  * @endcode
462  * @param[in] binder sync_agent_pb_protocol_binder_info_s
463  * @param[in] xml_name XML element name
464  * @param[in] name_space XML name space
465  * @param[in] text Content
466  * @param[in] text_len Length of Content
467  * @return WBXMLTreeNode on success, NULL on fail
468  * @see sync_agent_init_protocol_binder, sync_agent_destroy_wbxml_node
469  */
470         WBXMLTreeNode *sync_agent_create_text_node_with_namespace(const sync_agent_pb_protocol_binder_info_s * binder, const char *xml_name, const char *name_space, const char *text, unsigned int text_len);
471
472 /**
473  * @brief Create WBXMLTreeNode using XML element name with cdata content
474  * @par Useage:
475  * @code
476  *
477  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
478  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
479  *
480  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
481  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
482  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
483  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
484  *
485  * char *element_name = "header";
486  * char *name_space = "name_space";
487  * char *cdata = "data";
488  * unsigned int cdata_len = strlen(cdata);
489  *
490  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
491  *      (sync_agent_pb_function_info_s*)binder_function_info,
492  *      &pBinder_function_set);
493  * if (err != SYNC_AGENT_PB_RETURN_OK) {
494  *      ...
495  * }
496  *
497  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
498  *              false, true, false, true, true, NULL, NULL,
499  *              pBinder_function_set);
500  * if (pOutBinder == NULL) {
501  *      ...
502  * }
503  *
504  * WBXMLTreeNode *header_node = sync_agent_create_cdata_node(pBinder, element_name, name_space, cdata, cdata_len);
505  * if (header_node == NULL) {
506  *      ...
507  * }
508  *
509  * @endcode
510  * @param[in] binder sync_agent_pb_protocol_binder_info_s
511  * @param[in] xml_name XML element name
512  * @param[in] text Content
513  * @param[in] text_len Length of Content
514  * @return WBXMLTreeNode on success, NULL on fail
515  * @see sync_agent_init_protocol_binder, sync_agent_destroy_wbxml_node
516  */
517         WBXMLTreeNode *sync_agent_create_cdata_node(const sync_agent_pb_protocol_binder_info_s * binder, const char *xml_name, const char *text, unsigned int text_len);
518
519 /**
520  * @brief Create WBXMLTreeNode using XML element name, and add WBXMLTreeNode to parent node as a child node
521  * @par Useage:
522  * @code
523  *
524  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
525  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
526  *
527  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
528  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
529  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
530  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
531  *
532  * char *element_name = "header";
533  * char *child_element_name = "child";
534  *
535  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
536  *      (sync_agent_pb_function_info_s*)binder_function_info,
537  *      &pBinder_function_set);
538  * if (err != SYNC_AGENT_PB_RETURN_OK) {
539  *      ...
540  * }
541  *
542  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
543  *              false, true, false, true, true, NULL, NULL,
544  *              pBinder_function_set);
545  * if (pOutBinder == NULL) {
546  *      ...
547  * }
548  *
549  * WBXMLTreeNode *header_node = sync_agent_create_node(pBinder, element_name);
550  * if (header_node == NULL) {
551  *      ...
552  * }
553  *
554  * WBXMLTreeNode *child_node = sync_agent_add_child_node(pBinder, header_node, child_element_name);
555  * if (child_node == NULL) {
556  *      ...
557  * }
558  *
559  * @endcode
560  * @param[in] binder sync_agent_pb_protocol_binder_info_s
561  * @param[in] parent_node Parent node
562  * @param[in] xml_name XML element name
563  * @return WBXMLTreeNode on success, NULL on fail
564  * @see sync_agent_init_protocol_binder, sync_agent_destroy_wbxml_node
565  */
566         WBXMLTreeNode *sync_agent_add_child_node(const sync_agent_pb_protocol_binder_info_s * binder, WBXMLTreeNode * parent_node, const char *xml_name);
567
568 /**
569  * @brief Create WBXMLTreeNode using XML element name and XML name space, and add WBXMLTreeNode to parent node as a child node
570  * @par Useage:
571  * @code
572  *
573  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
574  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
575  *
576  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
577  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
578  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
579  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
580  *
581  * char *element_name = "header";
582  * char *child_element_name = "child";
583  * char *child_namespace = "child_namespace";
584  *
585  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
586  *      (sync_agent_pb_function_info_s*)binder_function_info,
587  *      &pBinder_function_set);
588  * if (err != SYNC_AGENT_PB_RETURN_OK) {
589  *      ...
590  * }
591  *
592  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
593  *              false, true, false, true, true, NULL, NULL,
594  *              pBinder_function_set);
595  * if (pOutBinder == NULL) {
596  *      ...
597  * }
598  *
599  * WBXMLTreeNode *header_node = sync_agent_create_node(pBinder, element_name);
600  * if (header_node == NULL) {
601  *      ...
602  * }
603  *
604  * WBXMLTreeNode *child_node = sync_agent_add_child_node_with_namespace(pBinder, header_node, child_element_name, child_namespace);
605  * if (child_node == NULL) {
606  *      ...
607  * }
608  *
609  * @endcode
610  * @param[in] binder sync_agent_pb_protocol_binder_info_s
611  * @param[in] parent_node Parent node
612  * @param[in] xml_name XML element name
613  * @param[in] name_space XML name space
614  * @return WBXMLTreeNode on success, NULL on fail
615  * @see sync_agent_init_protocol_binder, sync_agent_destroy_wbxml_node
616  */
617         WBXMLTreeNode *sync_agent_add_child_node_with_namespace(const sync_agent_pb_protocol_binder_info_s * binder, WBXMLTreeNode * parent_node, const char *xml_name, const char *name_space);
618
619 /**
620  * @brief Create WBXMLTreeNode using XML element name with text content, and add WBXMLTreeNode to parent node as a child node
621  * @par Useage:
622  * @code
623  *
624  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
625  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
626  *
627  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
628  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
629  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
630  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
631  *
632  * char *element_name = "header";
633  * char *child_element_name = "child";
634  * char *child_data = "child_data";
635  * unsigned int child_data_len = strlen(child_data);
636  *
637  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
638  *      (sync_agent_pb_function_info_s*)binder_function_info,
639  *      &pBinder_function_set);
640  * if (err != SYNC_AGENT_PB_RETURN_OK) {
641  *      ...
642  * }
643  *
644  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
645  *              false, true, false, true, true, NULL, NULL,
646  *              pBinder_function_set);
647  * if (pOutBinder == NULL) {
648  *      ...
649  * }
650  *
651  * WBXMLTreeNode *header_node = sync_agent_create_node(pBinder, element_name);
652  * if (header_node == NULL) {
653  *      ...
654  * }
655  *
656  * WBXMLTreeNode *child_node = sync_agent_add_child_text_node(pBinder, header_node, child_element_name, child_data, child_data_len);
657  * if (child_node == NULL) {
658  *      ...
659  * }
660  *
661  * @endcode
662  * @param[in] binder sync_agent_pb_protocol_binder_info_s
663  * @param[in] parent_node Parent node
664  * @param[in] xml_name XML element name
665  * @param[in] text Content
666  * @param[in] text_len Length of Content
667  * @return WBXMLTreeNode on success, NULL on fail
668  * @see sync_agent_init_protocol_binder, sync_agent_destroy_wbxml_node
669  */
670         WBXMLTreeNode *sync_agent_add_child_text_node(const sync_agent_pb_protocol_binder_info_s * binder, WBXMLTreeNode * parent_node, const char *xml_name, const char *text, unsigned int text_len);
671
672 /**
673  * @brief Create WBXMLTreeNode using XML element name and XML name space with text content, and add WBXMLTreeNode to parent node as a child node
674  * @par Useage:
675  * @code
676  *
677  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
678  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
679  *
680  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
681  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
682  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
683  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
684  *
685  * char *element_name = "header";
686  * char *child_element_name = "child";
687  * char *child_namespace = "child_namespace";
688  * char *child_data = "child_data";
689  * unsigned int child_data_len = strlen(child_data);
690  *
691  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
692  *      (sync_agent_pb_function_info_s*)binder_function_info,
693  *      &pBinder_function_set);
694  * if (err != SYNC_AGENT_PB_RETURN_OK) {
695  *      ...
696  * }
697  *
698  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
699  *              false, true, false, true, true, NULL, NULL,
700  *              pBinder_function_set);
701  * if (pOutBinder == NULL) {
702  *      ...
703  * }
704  *
705  * WBXMLTreeNode *header_node = sync_agent_create_node(pBinder, element_name);
706  * if (header_node == NULL) {
707  *      ...
708  * }
709  *
710  * WBXMLTreeNode *child_node = sync_agent_add_child_text_node_with_namespace(pBinder, header_node, child_element_name, child_namespace, child_data, child_data_len);
711  * if (child_node == NULL) {
712  *      ...
713  * }
714  *
715  * @endcode
716  * @param[in] binder sync_agent_pb_protocol_binder_info_s
717  * @param[in] parent_node Parent node
718  * @param[in] xml_name XML element name
719  * @param[in] name_space XML name space
720  * @param[in] text Content
721  * @param[in] text_len Length of Content
722  * @return WBXMLTreeNode on success, NULL on fail
723  * @see sync_agent_init_protocol_binder, sync_agent_destroy_wbxml_node
724  */
725         WBXMLTreeNode *sync_agent_add_child_text_node_with_namespace(const sync_agent_pb_protocol_binder_info_s * binder, WBXMLTreeNode * parent_node, const char *xml_name, const char *name_space, const char *text, unsigned int text_len);
726
727 /**
728  * @brief Create WBXMLTreeNode using XML element name with cdata content, and add WBXMLTreeNode to parent node as a child node
729  * @par Useage:
730  * @code
731  *
732  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
733  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
734  *
735  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
736  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
737  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
738  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
739  *
740  * char *element_name = "header";
741  * char *child_element_name = "child";
742  * char *child_cdata = "child_cdata";
743  * unsigned int child_cdata_len = strlen(child_cdata);
744  *
745  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
746  *      (sync_agent_pb_function_info_s*)binder_function_info,
747  *      &pBinder_function_set);
748  * if (err != SYNC_AGENT_PB_RETURN_OK) {
749  *      ...
750  * }
751  *
752  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
753  *              false, true, false, true, true, NULL, NULL,
754  *              pBinder_function_set);
755  * if (pOutBinder == NULL) {
756  *      ...
757  * }
758  *
759  * WBXMLTreeNode *header_node = sync_agent_create_node(pBinder, element_name);
760  * if (header_node == NULL) {
761  *      ...
762  * }
763  *
764  * WBXMLTreeNode *child_node = sync_agent_add_child_cdata_node(pBinder, header_node, child_element_name, child_cdata, child_cdata_len);
765  * if (child_node == NULL) {
766  *      ...
767  * }
768  *
769  * @endcode
770  * @param[in] binder sync_agent_pb_protocol_binder_info_s
771  * @param[in] parent_node Parent node
772  * @param[in] xml_name XML element name
773  * @param[in] text Content
774  * @param[in] text_len Length of Content
775  * @return WBXMLTreeNode on success, NULL on fail
776  * @see sync_agent_init_protocol_binder, sync_agent_destroy_wbxml_node
777  */
778         WBXMLTreeNode *sync_agent_add_child_cdata_node(const sync_agent_pb_protocol_binder_info_s * binder, WBXMLTreeNode * parent_node, const char *xml_name, const char *text, unsigned int text_len);
779
780 /**
781  * @brief Create WBXMLTreeNode using XML element name with int content, and add WBXMLTreeNode to parent node as a child node
782  * @par Useage:
783  * @code
784  *
785  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
786  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
787  *
788  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
789  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
790  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
791  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
792  *
793  * char *element_name = "header";
794  * char *child_element_name = "child";
795  * int data = 10;
796  *
797  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
798  *      (sync_agent_pb_function_info_s*)binder_function_info,
799  *      &pBinder_function_set);
800  * if (err != SYNC_AGENT_PB_RETURN_OK) {
801  *      ...
802  * }
803  *
804  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
805  *              false, true, false, true, true, NULL, NULL,
806  *              pBinder_function_set);
807  * if (pOutBinder == NULL) {
808  *      ...
809  * }
810  *
811  * WBXMLTreeNode *header_node = sync_agent_create_node(pBinder, element_name);
812  * if (header_node == NULL) {
813  *      ...
814  * }
815  *
816  * WBXMLTreeNode *child_node = sync_agent_add_child_cdata_node(pBinder, header_node, child_element_name, data);
817  * if (child_node == NULL) {
818  *      ...
819  * }
820  *
821  * @endcode
822  * @param[in] binder sync_agent_pb_protocol_binder_info_s
823  * @param[in] parent_node Parent node
824  * @param[in] xml_name XML element name
825  * @param[in] num Content
826  * @return WBXMLTreeNode on success, NULL on fail
827  * @see sync_agent_init_protocol_binder, sync_agent_destroy_wbxml_node
828  */
829         WBXMLTreeNode *sync_agent_add_child_int_node(const sync_agent_pb_protocol_binder_info_s * binder, WBXMLTreeNode * parent_node, const char *xml_name, const int num);
830
831 /**
832  * @brief Create WBXMLTreeNode using XML element name with int content, and add WBXMLTreeNode to parent node as a child node
833  * @par Useage:
834  * @code
835  *
836  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
837  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
838  *
839  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
840  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
841  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
842  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
843  *
844  * char *element_name = "header";
845  * char *child_element_name = "child";
846  * char *child_namespace = "child_namespace";
847  * int data = 10;
848  *
849  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
850  *      (sync_agent_pb_function_info_s*)binder_function_info,
851  *      &pBinder_function_set);
852  * if (err != SYNC_AGENT_PB_RETURN_OK) {
853  *      ...
854  * }
855  *
856  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
857  *              false, true, false, true, true, NULL, NULL,
858  *              pBinder_function_set);
859  * if (pOutBinder == NULL) {
860  *      ...
861  * }
862  *
863  * WBXMLTreeNode *header_node = sync_agent_create_node(pBinder, element_name);
864  * if (header_node == NULL) {
865  *      ...
866  * }
867  *
868  * WBXMLTreeNode *child_node = sync_agent_add_child_cdata_node(pBinder, header_node, child_element_name, child_namespace, data);
869  * if (child_node == NULL) {
870  *      ...
871  * }
872  *
873  * @endcode
874  * @param[in] binder sync_agent_pb_protocol_binder_info_s
875  * @param[in] parent_node Parent node
876  * @param[in] xml_name XML element name
877  * @param[in] name_space XML name space
878  * @param[in] num Content
879  * @return WBXMLTreeNode on success, NULL on fail
880  * @see sync_agent_init_protocol_binder, sync_agent_destroy_wbxml_node
881  */
882         WBXMLTreeNode *sync_agent_add_child_int_node_with_namespace(const sync_agent_pb_protocol_binder_info_s * binder, WBXMLTreeNode * parent_node, const char *xml_name, const char *name_space, const int num);
883
884 /* wbxml dom tree getter functions */
885
886 /**
887  * @brief Get XML element name from WBXMLTreeNode
888  * @par Useage:
889  * @code
890  *
891  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
892  * WBXMLTreeNode node  = NULL;
893  * char *element_xml_name = NULL;
894  *
895  *      ...
896  *
897  * err = sync_agent_get_name_from_element_node(node, &element_xml_name);
898  * if (err != SYNC_AGENT_PB_RETURN_OK) {
899  *      ...
900  * }
901  *
902  *
903  * @endcode
904  * @param[in] element_node WBXMLTreeNode
905  * @param[out] element_xml_name XML element name
906  * @return 0 on success, otherwise a negative error value.
907  * @retval SYNC_AGENT_PB_RETURN_OK Successful
908  * @retval SYNC_AGENT_PB_RETURN_TREE_NODE_IS_NOT_ELEMENT_NODE Invalid parameter(element_node)
909  */
910         sync_agent_pb_error_e sync_agent_get_name_from_element_node(const WBXMLTreeNode * element_node, char **element_xml_name);
911
912 /**
913  * @brief Get XML name space from WBXMLTreeNode
914  * @par Useage:
915  * @code
916  *
917  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
918  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
919  * WBXMLTreeNode node  = NULL;
920  * char *name_space = NULL;
921  *
922  *      ...
923  *
924  * err = sync_agent_get_namespace_from_element_node(pBinder, node, &name_space);
925  * if (err != SYNC_AGENT_PB_RETURN_OK) {
926  *      ...
927  * }
928  *
929  *
930  * @endcode
931  * @param[in] binder sync_agent_pb_protocol_binder_reverse_info_s
932  * @param[in] element_node WBXMLTreeNode
933  * @param[out] name_space XML name space
934  * @return 0 on success, otherwise a negative error value.
935  * @retval SYNC_AGENT_PB_RETURN_OK Successful
936  * @retval SYNC_AGENT_PB_RETURN_TREE_NODE_IS_NOT_ELEMENT_NODE Invalid parameter(element_node)
937  */
938         sync_agent_pb_error_e sync_agent_get_namespace_from_element_node(const sync_agent_pb_protocol_binder_reverse_info_s * binder, const WBXMLTreeNode * element_node, char **name_space);
939
940 /**
941  * @brief Get pointer of text content from WBXMLTreeNode
942  * @par Useage:
943  * @code
944  *
945  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
946  * WBXMLTreeNode node  = NULL;
947  * char *text = NULL;
948  *
949  *      ...
950  *
951  * err = sync_agent_get_text_from_node(node, &text);
952  * if (err != SYNC_AGENT_PB_RETURN_OK) {
953  *      ...
954  * }
955  *
956  *
957  * @endcode
958  * @param[in] element_node WBXMLTreeNode
959  * @param[out] text_pointer Pointer of text content
960  * @return 0 on success, otherwise a negative error value.
961  * @retval SYNC_AGENT_PB_RETURN_OK Successful
962  */
963         sync_agent_pb_error_e sync_agent_get_text_from_node(WBXMLTreeNode * element_node, char **text_pointer);
964
965 /**
966  * @brief Get pointer of binary content from WBXMLTreeNode
967  * @par Useage:
968  * @code
969  *
970  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
971  * WBXMLTreeNode node  = NULL;
972  * char *binary = NULL;
973  * unsigned int binary_size = 0;
974  *
975  *      ...
976  *
977  * err = sync_agent_get_text_from_node(node, &binary, &binary_size);
978  * if (err != SYNC_AGENT_PB_RETURN_OK) {
979  *      ...
980  * }
981  *
982  *
983  * @endcode
984  * @param[in] element_node WBXMLTreeNode
985  * @param[out] binary_pointer Pointer of binary content
986  * @param[out] binary_size Size of binary content
987  * @return 0 on success, otherwise a negative error value.
988  * @retval SYNC_AGENT_PB_RETURN_OK Successful
989  * @retval SYNC_AGENT_PB_RETURN_UTIL_NO_BINARY_VALUE Invalid parameter(element_node)
990  */
991         sync_agent_pb_error_e sync_agent_get_binary_from_node(WBXMLTreeNode * element_node, char **binary_pointer, unsigned int *binary_size);
992
993 /**
994  * @brief Get int content from WBXMLTreeNode
995  * @par Useage:
996  * @code
997  *
998  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
999  * WBXMLTreeNode node  = NULL;
1000  * int value = 0;
1001  *
1002  *      ...
1003  *
1004  * err = sync_agent_get_int_from_node(node, &value);
1005  * if (err != SYNC_AGENT_PB_RETURN_OK) {
1006  *      ...
1007  * }
1008  *
1009  *
1010  * @endcode
1011  * @param[in] element_node WBXMLTreeNode
1012  * @param[out] value Int content
1013  * @return 0 on success, otherwise a negative error value.
1014  * @retval SYNC_AGENT_PB_RETURN_OK Successful
1015  * @retval SYNC_AGENT_PB_RETURN_UTIL_NO_INT_VALUE Invalid parameter(element_node)
1016  */
1017         sync_agent_pb_error_e sync_agent_get_int_from_node(WBXMLTreeNode * element_node, int *value);
1018
1019 /**
1020  * @brief Get pointer of text content from WBXMLTreeNode(cdata node)
1021  * @par Useage:
1022  * @code
1023  *
1024  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
1025  * WBXMLTreeNode node  = NULL;
1026  * char *text = 0;
1027  *
1028  *      ...
1029  *
1030  * err = sync_agent_get_text_from_cdata_node(node, &text);
1031  * if (err != SYNC_AGENT_PB_RETURN_OK) {
1032  *      ...
1033  * }
1034  *
1035  *
1036  * @endcode
1037  * @param[in] element_node WBXMLTreeNode
1038  * @param[out] text_pointer Pointer of text content
1039  * @return 0 on success, otherwise a negative error value.
1040  * @retval SYNC_AGENT_PB_RETURN_OK Successful
1041  */
1042         sync_agent_pb_error_e sync_agent_get_text_from_cdata_node(WBXMLTreeNode * element_node, char **text_pointer);
1043
1044 /**
1045  * @brief Destroy WBXMLTreeNode
1046  * @par Useage:
1047  * @code
1048  *
1049  * sync_agent_pb_error_e err = SYNC_AGENT_PB_RETURN_OK;
1050  * sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
1051  *
1052  * sync_agent_pb_protocol_binder_info_s *pOutBinder = NULL;
1053  * sync_agent_pb_protocol_binder_info_s *pBinder = NULL;
1054  * sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12;
1055  * sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_WBXML_13;
1056  *
1057  * char *element_name = "header";
1058  *
1059  * err = sync_agent_init_binder_function_set(sizeof(binder_function_info)/sizeof(sync_agent_pb_function_info_s),
1060  *      (sync_agent_pb_function_info_s*)binder_function_info,
1061  *      &pBinder_function_set);
1062  * if (err != SYNC_AGENT_PB_RETURN_OK) {
1063  *      ...
1064  * }
1065  *
1066  * pOutBinder = sync_agent_init_protocol_binder(pBinder, protocol, NULL, encoding,
1067  *              false, true, false, true, true, NULL, NULL,
1068  *              pBinder_function_set);
1069  * if (pOutBinder == NULL) {
1070  *      ...
1071  * }
1072  *
1073  * WBXMLTreeNode *header_node = sync_agent_create_node(pBinder, element_name);
1074  * if (header_node == NULL) {
1075  *      ...
1076  * }
1077  *
1078  *      ...
1079  *
1080  * err = sync_agent_destroy_wbxml_node(header_node);
1081  * if (err != SYNC_AGENT_PB_RETURN_OK) {
1082  *      ...
1083  * }
1084  *
1085  *
1086  * @endcode
1087  * @param[in] node WBXMLTreeNode
1088  * @return 0 on success, otherwise a negative error value
1089  * @retval SYNC_AGENT_PB_RETURN_OK Successful
1090  * @see sync_agent_create_node, sync_agent_create_node_with_namespace, sync_agent_create_text_node, sync_agent_create_text_node_with_namespace, sync_agent_create_cdata_node, sync_agent_add_child_node, sync_agent_add_child_node_with_namespace, sync_agent_add_child_text_node, sync_agent_add_child_text_node_with_namespace, sync_agent_add_child_cdata_node, sync_agent_add_child_int_node, sync_agent_add_child_int_node_with_namespace
1091  */
1092         sync_agent_pb_error_e sync_agent_destroy_wbxml_node(WBXMLTreeNode * node);
1093
1094 /**
1095  *      @}
1096  */
1097
1098 #ifdef __cplusplus
1099 }
1100 #endif                          /* __cplusplus */
1101 #endif                          /* PROTOCOL_BINDER_UTIL_H_ */