3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef OMA_DS_PROTOCOL_BINDER_H_
19 #define OMA_DS_PROTOCOL_BINDER_H_
22 #include <sync_agent.h>
25 #include "serviceadapter/protocolbinder/syncml_def.h"
28 * @par Description: API to Initialize protocol binder function set
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
38 * @return sync_agent_pb_error_e type
51 sync_agent_pb_error_e init_syncml_binder_function_set(sync_agent_pb_protocol_binder_function_set_s ** pBinder_function_set);
54 * @par Description: API to free sync_agent_pb_protocol_binder_function_set_s structure
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
77 void free_syncml_binder_function_set(sync_agent_pb_protocol_binder_function_set_s * pBinder_function_set);
80 * @par Description: API to Initialize protocol binder
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
97 * @return sync_agent_pb_protocol_binder_info_s on success
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);
114 * @par Description: API to append specific element to WBXML tree
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)
126 * @return SYNC_AGENT_PB_RETURN_OK on success
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);
143 * @par Description: API to terminate sync_agent_pb_protocol_binder_info_s structure
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
166 void syncml_binder_terminate(sync_agent_pb_protocol_binder_info_s * pBinder);
169 * @par Description: API to get stream
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
180 * @return SYNC_AGENT_PB_RETURN_OK on success
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);
197 * @par Description: API to get stream size
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
207 * @return SYNC_AGENT_PB_RETURN_OK on success
221 sync_agent_pb_error_e syncml_binder_get_stream_size(sync_agent_pb_protocol_binder_info_s * pBinder, unsigned int *byte_stream_size);
224 * @par Description: API to get encoding type
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)
234 * @return SYNC_AGENT_PB_RETURN_OK on success
248 sync_agent_pb_error_e syncml_binder_get_encoding(sync_agent_pb_protocol_binder_info_s * pBinder, sync_agent_pb_encoding_e * enc);
251 * @par Description: API to Initialize reverse protocol binder
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
264 * @return SYNC_AGENT_PB_RETURN_OK on success
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);
282 * @par Description: API to parse and get next contents
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)
294 * @return SYNC_AGENT_PB_RETURN_OK on success
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);
310 #endif /* OMA_DS_PROTOCOL_BINDER_H_ */