/* * sync-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 DEFINITION_H_ #define DEFINITION_H_ #include #include #include "error.h" #include #include #include #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ typedef void *Content_Ptr; typedef void *Protocol_Option_Ptr; typedef unsigned int Protocol_Element; /** * @file definition.h * @brief Define structure, enum, callback function etc... */ /* common definition */ /** @addtogroup protocol_binder * @{ */ /** * Enumerations of encoding type */ typedef enum { SYNC_AGENT_PB_ENCODING_UNKNOWN = 0, /**< Unknown*/ SYNC_AGENT_PB_ENCODING_XML, /**< XML*/ SYNC_AGENT_PB_ENCODING_WBXML_10, /**< WBXML 1.0*/ SYNC_AGENT_PB_ENCODING_WBXML_11, /**< WBXML 1.1*/ SYNC_AGENT_PB_ENCODING_WBXML_12, /**< WBXML 1.2*/ SYNC_AGENT_PB_ENCODING_WBXML_13 /**< WBXML 1.3*/ } sync_agent_pb_encoding_e; /** * Enumerations of decoding type */ typedef enum { SYNC_AGENT_PB_DECODING_UNKNOWN = 0, /**< Unknown*/ SYNC_AGENT_PB_DECODING_XML, /**< XML*/ SYNC_AGENT_PB_DECODING_WBXML /**< WBXML*/ } sync_agent_pb_decoding_e; /** * Enumerations of Protocol that supports by sync_agent_pb_protocol_e binder */ typedef enum { SYNC_AGENT_PB_PROTOCOL_UNKNOWN = 0, /**< Unknown*/ SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML10, /**< SYNCML1.0*/ SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML11, /**< SYNCML1.1*/ SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12, /**< SYNCML1.2*/ SYNC_AGENT_PB_PROTOCOL_SYNCML_DEVINF10, /**< SYNCML Device Information 1.0 */ SYNC_AGENT_PB_PROTOCOL_SYNCML_DEVINF11, /**< SYNCML Device Information 1.1 */ SYNC_AGENT_PB_PROTOCOL_SYNCML_DEVINF12, /**< SYNCML Device Information 1.2 */ SYNC_AGENT_PB_PROTOCOL_SYNCML_METINF10, /**< SYNCML Meta Information 1.0 */ SYNC_AGENT_PB_PROTOCOL_SYNCML_METINF11, /**< SYNCML Meta Information 1.1 */ SYNC_AGENT_PB_PROTOCOL_SYNCML_METINF12, /**< SYNCML Meta Information 1.2 */ SYNC_AGENT_PB_PROTOCOL_SYNCML_DMDDF12, /**< SYNCML DM DDF 1.2 */ SYNC_AGENT_PB_PROTOCOL_ACTIVESYNC, /**< EAS */ SYNC_AGENT_PB_PROTOCOL_PROV10, /**< EAS Provisioning */ SYNC_AGENT_PB_PROTOCOL_MAX_COUNT /**< for counting supporting protocol */ } sync_agent_pb_protocol_e; /* protocol binder */ /** * Structure for protocol binder */ typedef struct protocol_binder_info sync_agent_pb_protocol_binder_info_s; /** * Restrict Condition Checker callback * * @param[in] enc sync_agent_pb_encoding_e value * @param[in] option Protocol_Option_Ptr * @param[in] restrict_params list of restrict parameter * @param[in] arguments list of parameter * * @return 1 on success, 0 on error * * @par Since: * * * @see * */ typedef bool(*sync_agent_restrict_condition_checker_cb) (sync_agent_pb_encoding_e enc, Protocol_Option_Ptr option, GList * restrict_params, GList * arguments); /** * Binder Object converter function * * @param[in] binder sync_agent_pb_protocol_binder_info_s pointer * @param[in] content void pointer * @param[in] wbxml_dom_node WBXMLTreeNode * * @return SYNC_AGENT_PB_RETURN_OK on success, otherwise error * * @par Since: * * * @see * */ typedef sync_agent_pb_error_e(*sync_agent_binder_object_converter_cb) (sync_agent_pb_protocol_binder_info_s * binder, Content_Ptr content, WBXMLTreeNode ** wbxml_dom_node); /* reverse protocol binder */ /*typedef struct _Reverse_binder_function_info Reverse_binder_function_info;*/ /*typedef struct _Reverse_binder_function_set Reverse_binder_function_set;*/ /** * Structure for reverse protocol binder */ typedef struct protocol_binder_reverse_info sync_agent_pb_protocol_binder_reverse_info_s; /** * Reverse Binder Object converter function * * @param[in] reverse_binder sync_agent_pb_protocol_binder_reverse_info_s pointer * @param[in] wbxml_dom_node WBXMLTreeNode * @param[in] content Content_Ptr pointer * * @return SYNC_AGENT_PB_RETURN_OK on success, otherwise error * * @par Since: * * * @see * */ typedef sync_agent_pb_error_e(*sync_agent_reverse_binder_object_converter_cb) (sync_agent_pb_protocol_binder_reverse_info_s * reverse_binder, WBXMLTreeNode * wbxml_dom_node, Content_Ptr * content); /* protocol binder & reverse protocol binder callback */ /** * Structure for Binder function set */ typedef struct protocol_binder_function_set sync_agent_pb_protocol_binder_function_set_s; /** * Structure for Binder function info */ typedef struct protocol_binder_function_info sync_agent_pb_function_info_s; struct protocol_binder_function_info { Protocol_Element protocol_element; /**< Defined element */ char *protocol_element_xml_name; /**< Xml element name */ sync_agent_binder_object_converter_cb binder_object_converter_function; /**< Callback function for object converter*/ sync_agent_reverse_binder_object_converter_cb reverse_binder_object_converter_function; /**< Callback function for reverse object converter*/ bool isTerminal; /**< Whether current node is terminal or not */ }; /** * @} */ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* DEFINITION_H_ */