upload tizen1.0 source
[pkgs/o/oma-ds-service.git] / include / ServiceAdapter / ProtocolBinder / oma_ds_protocol_binder.h
1 /*
2  * oma-ds-service
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: JuHak Park <juhaki.park@samsung.com>,
7  *          JuneHyuk Lee <junhyuk7.lee@samsung.com>,
8  *          SunBong Ha <sunbong.ha@samsung.com>
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */
23
24
25
26
27
28 /*
29  * For any sort of issue you concern as to this software,
30  * you may use following point of contact.
31  * All resources contributed on this software
32  * are orinigally written by S-Core Inc., a member of Samsung Group.
33  *
34  * SeongWon Shim <seongwon.shim@samsung.com>
35  */
36
37 /**
38  *   @oma_ds_protocol_binder.h
39  *   @version                                                                   0.1
40  *   @brief                                                                             This file is the header file of interface of protocol binder
41  */
42
43 #ifndef OMA_DS_PROTOCOL_BINDER_H_
44 #define OMA_DS_PROTOCOL_BINDER_H_
45
46 #include "agent-framework/NetworkAssistant/protocol_binder/protocol_binder_common.h"
47 #include "ServiceAdapter/ProtocolBinder/oma_ds_protocol_binder_definition.h"
48
49 /**
50  * @par Description: API to Initialize protocol binder function set
51  *
52  *
53  * @par Purpose:
54  * @par Typical use case:
55  * @par Method of function operation:
56  * @par Important notes:
57  * @param[in]           Binder_function_set structure
58  * @param[out]
59  *
60  * @return                              PROTOCOL_BINDER_ERROR type
61  *
62  * @par Errors:
63  *
64  * @pre None.
65  * @post
66  * @see
67  * @remarks None.
68  *
69  * @par Sample Code:
70  * @code
71  * @endcode
72  */
73 PROTOCOL_BINDER_ERROR init_oma_ds_1_2_binder_function_set(Binder_function_set **pBinder_function_set);
74
75 /**
76  * @par Description: API to free Binder_function_set structure
77  *
78  *
79  * @par Purpose:
80  * @par Typical use case:
81  * @par Method of function operation:
82  * @par Important notes:
83  * @param[in]           Binder_function_set structure
84  * @param[out]
85  *
86  * @return
87  *
88  * @par Errors:
89  *
90  * @pre None.
91  * @post
92  * @see
93  * @remarks None.
94  *
95  * @par Sample Code:
96  * @code
97  * @endcode
98  */
99 void free_oma_ds_1_2_binder_function_set(Binder_function_set *pBinder_function_set);
100
101 /**
102  * @par Description: API to Initialize protocol binder
103  *
104  *
105  * @par Purpose:
106  * @par Typical use case:
107  * @par Method of function operation:
108  * @par Important notes:
109  * @param[in]           protocol_binder structure
110  * @param[in]           enum type, Encoding(ENCODING_XML, ENCODING_WBXML_10, ENCODING_WBXML_11, ENCODING_WBXML_12, ENCODING_WBXML_13)
111  * @param[in]           boolean type, whether encode xml header or not
112  * @param[in]           boolean type, whether use string table or not
113  * @param[in]           boolean type, whether protocol is anonymous or not
114  * @param[in]           boolean type, whether use flow mode or not
115  * @param[in]           Binder_function_set structure
116  * @param[out]
117  *
118  * @return                              protocol_binder on success
119  *                                                      NULL on error
120  *
121  * @par Errors:
122  *
123  * @pre None.
124  * @post
125  * @see
126  * @remarks None.
127  *
128  * @par Sample Code:
129  * @code
130  * @endcode
131  */
132 protocol_binder *oma_ds_1_2_binder_init(protocol_binder *pBinder, Encoding enc, bool encode_xml_header,
133                                                 bool use_strtbl, bool produce_anonymous, bool use_flow_mode, Binder_function_set *pBinder_function_set);
134
135 /**
136  * @par Description: API to append specific element to WBXML tree
137  *
138  *
139  * @par Purpose:
140  * @par Typical use case:
141  * @par Method of function operation:
142  * @par Important notes:
143  * @param[in]           protocol_binder structure
144  * @param[in]           enum type, protocol element
145  * @param[in]           content(structure to append)
146  * @param[out]
147  *
148  * @return                              PROTOCOL_BINDER_OK on success
149  *                                                      others on error
150  *
151  * @par Errors:
152  *
153  * @pre None.
154  * @post
155  * @see
156  * @remarks None.
157  *
158  * @par Sample Code:
159  * @code
160  * @endcode
161  */
162 PROTOCOL_BINDER_ERROR oma_ds_1_2_binder_append(protocol_binder *pBinder, OMA_DS_Protocol_Element protocol_element, Content_Ptr pContent);
163
164
165 /**
166  * @par Description: API to terminate protocol_binder structure
167  *
168  *
169  * @par Purpose:
170  * @par Typical use case:
171  * @par Method of function operation:
172  * @par Important notes:
173  * @param[in]           protocol_binder structure
174  * @param[out]
175  *
176  * @return
177  *
178  * @par Errors:
179  *
180  * @pre None.
181  * @post
182  * @see
183  * @remarks None.
184  *
185  * @par Sample Code:
186  * @code
187  * @endcode
188  */
189 void oma_ds_1_2_binder_terminate(protocol_binder *pBinder);
190
191 /**
192  * @par Description: API to get stream
193  *
194  *
195  * @par Purpose:
196  * @par Typical use case:
197  * @par Method of function operation:
198  * @par Important notes:
199  * @param[in]           protocol_binder structure
200  * @param[out]          string type, stream from WBXML tree
201  * @param[out]          unsigned int type, size of stream
202  *
203  * @return                              PROTOCOL_BINDER_OK on success
204  *                                                      others on error
205  *
206  * @par Errors:
207  *
208  * @pre None.
209  * @post
210  * @see
211  * @remarks None.
212  *
213  * @par Sample Code:
214  * @code
215  * @endcode
216  */
217 PROTOCOL_BINDER_ERROR oma_ds_1_2_binder_get_stream(protocol_binder *pBinder,  char **byte_stream, unsigned int *byte_stream_size);
218
219 /**
220  * @par Description: API to get stream size
221  *
222  *
223  * @par Purpose:
224  * @par Typical use case:
225  * @par Method of function operation:
226  * @par Important notes:
227  * @param[in]           protocol_binder structure
228  * @param[out]          unsigned int type, size of stream
229  *
230  * @return                              PROTOCOL_BINDER_OK on success
231  *                                                      others on error
232  *
233  * @par Errors:
234  *
235  * @pre None.
236  * @post
237  * @see
238  * @remarks None.
239  *
240  * @par Sample Code:
241  * @code
242  * @endcode
243  */
244 PROTOCOL_BINDER_ERROR oma_ds_1_2_binder_get_stream_size(protocol_binder *pBinder, unsigned int *byte_stream_size);
245
246 /**
247  * @par Description: API to get encoding type
248  *
249  *
250  * @par Purpose:
251  * @par Typical use case:
252  * @par Method of function operation:
253  * @par Important notes:
254  * @param[in]           protocol_binder structure
255  * @param[out]          enum type, Encoding(ENCODING_XML, ENCODING_WBXML_10, ENCODING_WBXML_11, ENCODING_WBXML_12, ENCODING_WBXML_13)
256  *
257  * @return                              PROTOCOL_BINDER_OK on success
258  *                                                      others on error
259  *
260  * @par Errors:
261  *
262  * @pre None.
263  * @post
264  * @see
265  * @remarks None.
266  *
267  * @par Sample Code:
268  * @code
269  * @endcode
270  */
271 PROTOCOL_BINDER_ERROR oma_ds_1_2_binder_get_encoding(protocol_binder *pBinder, Encoding *enc);
272
273 /**
274  * @par Description: API to Initialize reverse protocol binder
275  *
276  *
277  * @par Purpose:
278  * @par Typical use case:
279  * @par Method of function operation:
280  * @par Important notes:
281  * @param[in]           string type, WBXML stream to parse
282  * @param[in]           unsigned int type, size of stream
283  * @param[in]           enum type, decoding(DECODING_XML, DECODING_WBXML)
284  * @param[in]           user data
285  * @param[out]          Reverse_protocol_binder structure
286  *
287  * @return                              PROTOCOL_BINDER_OK on success
288  *                                                      others on error
289  *
290  * @par Errors:
291  *
292  * @pre None.
293  * @post
294  * @see
295  * @remarks None.
296  *
297  * @par Sample Code:
298  * @code
299  * @endcode
300  */
301 PROTOCOL_BINDER_ERROR reverse_oma_ds_1_2_binder_init(char *byte_stream,
302                                                                                                         unsigned int byte_stream_len,
303                                                                                                         Decoding dec,
304                                                                                                         Binder_function_set *pBinder_function_set,
305                                                                                                         void *user_data,
306                                                                                                         Reverse_protocol_binder **ppBinder);
307
308
309 /**
310  * @par Description: API to parse and get next contents
311  *
312  *
313  * @par Purpose:
314  * @par Typical use case:
315  * @par Method of function operation:
316  * @par Important notes:
317  * @param[in]           Reverse_protocol_binder structure
318  * @param[out]          protocol element
319  * @param[out]          string type, protocol element
320  * @param[out]          parsed contents(defined structure)
321  *
322  * @return                              PROTOCOL_BINDER_OK on success
323  *                                                      others on error
324  *
325  * @par Errors:
326  *
327  * @pre None.
328  * @post
329  * @see
330  * @remarks None.
331  *
332  * @par Sample Code:
333  * @code
334  * @endcode
335  */
336 PROTOCOL_BINDER_ERROR reverse_oma_ds_1_2_binder_next(Reverse_protocol_binder *pBinder,
337                                                                                                 Protocol_Element *protocol_element,
338                                                                                                 char **protocol_element_name,
339                                                                                                 Content_Ptr *pContent);
340
341
342 #endif /* OMA_DS_PROTOCOL_BINDER_H_ */