diff options
author | HyungKyu Song <hk76.song@samsung.com> | 2013-02-16 00:55:29 +0900 |
---|---|---|
committer | HyungKyu Song <hk76.song@samsung.com> | 2013-02-16 00:55:29 +0900 |
commit | 4043c48868b1eafa7701ac19b4f93bc90ce79c99 (patch) | |
tree | 6f3bda67c8725cb999c8fe93c4c3846c83074be8 /include/serviceadapter/protocolbinder | |
parent | 2505051c83d63da1cac1e0ca958574cf98e164d9 (diff) | |
download | oma-dm-agent-4043c48868b1eafa7701ac19b4f93bc90ce79c99.tar.gz oma-dm-agent-4043c48868b1eafa7701ac19b4f93bc90ce79c99.tar.bz2 oma-dm-agent-4043c48868b1eafa7701ac19b4f93bc90ce79c99.zip |
Diffstat (limited to 'include/serviceadapter/protocolbinder')
-rwxr-xr-x | include/serviceadapter/protocolbinder/syncml_def.h | 153 | ||||
-rwxr-xr-x | include/serviceadapter/protocolbinder/syncml_protocol_binder.h | 310 |
2 files changed, 463 insertions, 0 deletions
diff --git a/include/serviceadapter/protocolbinder/syncml_def.h b/include/serviceadapter/protocolbinder/syncml_def.h new file mode 100755 index 0000000..195d1a4 --- /dev/null +++ b/include/serviceadapter/protocolbinder/syncml_def.h @@ -0,0 +1,153 @@ +/* + * oma-dm-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SYNCML_DEFIINE_H_ +#define SYNCML_DEFIINE_H_ + +/* + * Common Use Elements + */ +#define ELEMENT_CHAL "Chal" +#define ELEMENT_CMD "Cmd" +#define ELEMENT_CMDID "CmdID" +#define ELEMENT_CMDREF "CmdRef" +#define ELEMENT_CRED "Cred" +#define ELEMENT_FINAL "Final" +#define ELEMENT_LOCNAME "LocName" +#define ELEMENT_LOCURI "LocURI" +#define ELEMENT_MOREDATA "MoreData" +#define ELEMENT_MSGID "MsgID" +#define ELEMENT_MSGREF "MsgRef" +#define ELEMENT_RESPURI "RespURI" +#define ELEMENT_SESSIONID "SessionID" +#define ELEMENT_SOURCE "Source" +#define ELEMENT_SOURCEREF "SourceRef" +#define ELEMENT_TARGET "Target" +#define ELEMENT_TARGETREF "TargetRef" +#define ELEMENT_VERDTD "VerDTD" +#define ELEMENT_VERPROTO "VerProto" +/* + * Msg Container Elements + */ +#define ELEMENT_SYNCML "SyncML" +#define ELEMENT_SYNCHDR "SyncHdr" +#define ELEMENT_SYNCBODY "SyncBody" +/* + * Data Description Elements + */ +#define ELEMENT_DATA "Data" +#define ELEMENT_ITEM "Item" +#define ELEMENT_META "Meta" +#define ELEMENT_CORRELATOR "Correlator" +/* + * Meta Infomation Elements + */ +#define ELEMENT_EMI "EMI" +#define ELEMENT_FORMAT "Format" +#define ELEMENT_MAXMSGSIZE "MaxMsgSize" +#define ELEMENT_MAXOBJSIZE "MaxObjSize" +#define ELEMENT_METAINF "MetaInf" +#define ELEMENT_NEXTNONCE "NextNonce" +#define ELEMENT_SIZE "Size" +#define ELEMENT_TYPE "Type" +/* + * Protocol Mangement Elements + */ +#define ELEMENT_STATUS "Status" +/* + * Protocol Command Elements + */ +#define ELEMENT_ADD "Add" +#define ELEMENT_ATOMIC "Atomic" +#define ELEMENT_COPY "Copy" +#define ELEMENT_DELETE "Delete" +#define ELEMENT_EXEC "Exec" +#define ELEMENT_GET "Get" +#define ELEMENT_REPLACE "Replace" +#define ELEMENT_SEQUENCE "Sequence" +#define ELEMENT_ALERT "Alert" +#define ELEMENT_RESULTS "Results" +/* + * VERDTD + * VERProto + */ +#define ELEMENT_VERDTD_10 "1.0" +#define ELEMENT_VERDTD_11 "1.1" +#define ELEMENT_VERDTD_12 "1.2" +#define ELEMENT_VERPROTO_10 "DM/1.0" +#define ELEMENT_VERPROTO_11 "DM/1.1" +#define ELEMENT_VERPROTO_12 "DM/1.2" +/* + *Authentication + */ +#define ELEMENT_AUTH_BASIC "syncml:auth-basic" +#define ELEMENT_AUTH_MD5 "syncml:auth-md5" +#define ELEMENT_AUTH_HMAC "syncml:auth-MAC" +#define ELEMENT_FORMAT_BASE64 "b64" +/* + * will delete + */ +#define ELEMENT_NUMBEROFCHANGES "NumberOfChanges" +#define ELEMENT_LAST "Last" +#define ELEMENT_NEXT "Next" + +#define ELEMENT_B64 "b64" +#define ELEMENT_BIN "bin" +#define ELEMENT_BOOL "bool" +#define ELEMENT_CHR "chr" +#define ELEMENT_INT "int" +#define ELEMENT_NULL "null" +#define ELEMENT_XML "xml" +#define ELEMENT_DATE "date" +#define ELEMENT_TIME "time" +#define ELEMENT_FLOAT "float" +#define ELEMENT_NODE "node" + +#define ELEMENT_TEXT_PLAIN "text/plain" + +typedef enum { + PE_UNDEF = 0, + PE_ERROR = 1, + PE_ADD = 2, + PE_ALERT = 3, + PE_ATOMIC_START = 4, + PE_ATOMIC_END = 5, + PE_COPY = 6, + PE_DELETE = 7, + PE_EXEC = 8, + PE_GET = 9, + PE_RESULTS_END = 10, + PE_RESULTS_START = 11, + PE_SEARCH = 12, + PE_SEQUENCE_START = 13, + PE_SEQUENCE_END = 14, + PE_STATUS = 15, + PE_SYNC_START = 16, + PE_SYNC_END = 17, + PE_REPLACE = 18, + PE_HEADER = 19, + PE_GENERIC = 20, + PE_FINAL = 21, + PE_SYNCML_START = 22, + PE_SYNCML_END = 23, + PE_BODY_START = 24, + PE_BODY_END = 25, + PE_SEQUENCE = 26, + PE_ATOMIC = 27 +} OMA_DM_Protocol_Element; + +#endif /* SYNCML_DEFIINE_H_ */ diff --git a/include/serviceadapter/protocolbinder/syncml_protocol_binder.h b/include/serviceadapter/protocolbinder/syncml_protocol_binder.h new file mode 100755 index 0000000..22d4471 --- /dev/null +++ b/include/serviceadapter/protocolbinder/syncml_protocol_binder.h @@ -0,0 +1,310 @@ +/* + * oma-dm-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OMA_DS_PROTOCOL_BINDER_H_ +#define OMA_DS_PROTOCOL_BINDER_H_ + +/*sync-agent*/ +#include <sync_agent.h> + +/*dm-agent*/ +#include "serviceadapter/protocolbinder/syncml_def.h" + +/** + * @par Description: API to Initialize protocol binder function set + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_function_set_s structure + * @param[out] + * + * @return sync_agent_pb_error_e type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e init_syncml_binder_function_set(sync_agent_pb_protocol_binder_function_set_s ** pBinder_function_set); + +/** + * @par Description: API to free sync_agent_pb_protocol_binder_function_set_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_function_set_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_syncml_binder_function_set(sync_agent_pb_protocol_binder_function_set_s * pBinder_function_set); + +/** + * @par Description: API to Initialize protocol binder + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @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) + * @param[in] boolean type, whether encode xml header or not + * @param[in] boolean type, whether use string table or not + * @param[in] boolean type, whether protocol is anonymous or not + * @param[in] boolean type, whether use flow mode or not + * @param[in] boolean type, whether use textual public id or not + * @param[in] sync_agent_pb_protocol_binder_function_set_s structure + * @param[out] + * + * @return sync_agent_pb_protocol_binder_info_s on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +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); + +/** + * @par Description: API to append specific element to WBXML tree + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[in] enum type, protocol element + * @param[in] content(structure to append) + * @param[out] + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +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); + +/** + * @par Description: API to terminate sync_agent_pb_protocol_binder_info_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void syncml_binder_terminate(sync_agent_pb_protocol_binder_info_s * pBinder); + +/** + * @par Description: API to get stream + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[out] string type, stream from WBXML tree + * @param[out] unsigned int type, size of stream + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +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); + +/** + * @par Description: API to get stream size + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[out] unsigned int type, size of stream + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e syncml_binder_get_stream_size(sync_agent_pb_protocol_binder_info_s * pBinder, unsigned int *byte_stream_size); + +/** + * @par Description: API to get encoding type + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @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) + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e syncml_binder_get_encoding(sync_agent_pb_protocol_binder_info_s * pBinder, sync_agent_pb_encoding_e * enc); + +/** + * @par Description: API to Initialize reverse protocol binder + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, WBXML stream to parse + * @param[in] unsigned int type, size of stream + * @param[in] enum type, decoding(SYNC_AGENT_PB_DECODING_XML, SYNC_AGENT_PB_DECODING_WBXML) + * @param[in] user data + * @param[out] sync_agent_pb_protocol_binder_reverse_info_s structure + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e reverse_syncml_binder_init(char *byte_stream, + 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); + +/** + * @par Description: API to parse and get next contents + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_reverse_info_s structure + * @param[out] protocol element + * @param[out] string type, protocol element + * @param[out] parsed contents(defined structure) + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +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); + +#endif /* OMA_DS_PROTOCOL_BINDER_H_ */ |