/* * libwbxml, the WBXML Library. * Copyright (C) 2002-2005 Aymerick Jehanne * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * LGPL v2.1: http://www.gnu.org/copyleft/lesser.txt * * Contact: libwbxml@aymerick.com * Home: http://libwbxml.aymerick.com */ #if defined( WBXML_WRAPPERS ) && defined( WBXML_SUPPORT_SYNCML ) /** * @file wbxml_wrap_syncml.h * @ingroup wbxml_wrap * * @author Aymerick Jehanne * @date 05/03/08 * * @brief SyncML Wrapper */ #ifndef WBXML_WRAP_SYNCML_H #define WBXML_WRAP_SYNCML_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** @addtogroup wbxml_wrap * @{ */ /**************************************************** * SyncML Constants */ /** SyncML VerDTD : 1.0 */ #define WBXML_SYNCML_VERDTD_STR_10 "1.0" /** SyncML VerDTD : 1.1 */ #define WBXML_SYNCML_VERDTD_STR_11 "1.1" /** SyncML VerProto : 1.0 */ #define WBXML_SYNCML_VERPROTO_STR_10 "SyncML/1.0" /** SyncML VerProto : 1.1 */ #define WBXML_SYNCML_VERPROTO_STR_11 "SyncML/1.1" /**************************************************** * SyncML Enums */ /** SyncML VerDTD */ typedef enum WBXMLSyncMLVerDTD_e { WBXML_SYNCML_VERDTD_UNKNOWN = 0, /**< UNKNOWN */ WBXML_SYNCML_VERDTD_10, /**< 1.0 */ WBXML_SYNCML_VERDTD_11 /**< 1.1 */ } WBXMLSyncMLVerDTD; /** SyncML VerProto */ typedef enum WBXMLSyncMLVerProto_e { WBXML_SYNCML_VERPROTO_UNKNOWN = 0, /**< UNKNOWN */ WBXML_SYNCML_VERPROTO_10, /**< SyncML/1.0 */ WBXML_SYNCML_VERPROTO_11 /**< SyncML/1.1 */ } WBXMLSyncMLVerProto; /** SyncML Command type */ typedef enum WBXMLSyncMLCmdType_e { WBXML_SYNCML_CMD_UNKNOWN = 0, /**< UNKNOWN */ WBXML_SYNCML_CMD_ADD, /**< Add */ WBXML_SYNCML_CMD_ALERT, /**< Alert */ WBXML_SYNCML_CMD_ATOMIC, /**< Atomic */ WBXML_SYNCML_CMD_COPY, /**< Copy */ WBXML_SYNCML_CMD_DELETE, /**< Delete */ WBXML_SYNCML_CMD_EXEC, /**< Exec */ WBXML_SYNCML_CMD_GET, /**< Get */ WBXML_SYNCML_CMD_MAP, /**< Map */ WBXML_SYNCML_CMD_MOVE, /**< Move */ WBXML_SYNCML_CMD_PUT, /**< Put */ WBXML_SYNCML_CMD_REPLACE, /**< Replace */ WBXML_SYNCML_CMD_RESULTS, /**< Results */ WBXML_SYNCML_CMD_SEARCH, /**< Search */ WBXML_SYNCML_CMD_SEQUENCE, /**< Sequence */ WBXML_SYNCML_CMD_STATUS, /**< Status */ WBXML_SYNCML_CMD_SYNC /**< Sync */ } WBXMLSyncMLCmdType; /**************************************************** * SyncML Structures */ /** * @brief SyncML element */ typedef struct WBXMLSyncMLMeta_s { void *todo; /**< @todo Meta */ } WBXMLSyncMLMeta; /** * @brief SyncML element */ typedef struct WBXMLSyncMLCred_s { WBXMLSyncMLMeta *Meta; /**< Meta? */ WBXMLBuffer *Data; /**< Data */ } WBXMLSyncMLCred; /** * @brief SyncML element */ typedef struct WBXMLSyncMLChal_s { WBXMLSyncMLMeta *Meta; /**< Meta */ } WBXMLSyncMLChal; /** * @brief SyncML element */ typedef struct WBXMLSyncMLItem_s { WBXMLBuffer *Target; /**< Target? */ WBXMLBuffer *Source; /**< Source? */ WBXMLSyncMLMeta *Meta; /**< Meta? */ WBXMLBuffer *Data; /**< Data? */ WB_BOOL MoreData; /**< MoreData? */ } WBXMLSyncMLItem; /** * @brief SyncML element */ typedef struct WBXMLSyncMLAdd_s { WB_BOOL NoResp; /**< NoResp? */ WBXMLSyncMLCred *Cred; /**< Cred? */ WBXMLSyncMLMeta *Meta; /**< Meta? */ WBXMLList *items; /**< Item+ */ } WBXMLSyncMLAdd; /** * @brief SyncML element */ typedef struct WBXMLSyncMLAlert_s { WB_BOOL NoResp; /**< NoResp? */ WBXMLSyncMLCred *Cred; /**< Cred? */ WBXMLList *items; /**< Item* */ WBXMLBuffer *Data; /**< Data? */ } WBXMLSyncMLAlert; /** * @brief SyncML element */ typedef struct WBXMLSyncMLAtomic_s { WB_BOOL NoResp; /**< NoResp? */ WBXMLSyncMLMeta *Meta; /**< Meta? */ WBXMLList *commands; /**< (Add | Replace | Delete | Copy | Atomic | Map | Sequence | Sync | Get | Exec | Alert)+ */ } WBXMLSyncMLAtomic; /** * @brief SyncML element */ typedef struct WBXMLSyncMLCopy_s { WB_BOOL NoResp; /**< NoResp? */ WBXMLSyncMLCred *Cred; /**< Cred? */ WBXMLSyncMLMeta *Meta; /**< Meta? */ WBXMLList *items; /**< Item+ */ } WBXMLSyncMLCopy; /** * @brief SyncML element */ typedef struct WBXMLSyncMLDelete_s { WB_BOOL NoResp; /**< NoResp? */ WBXMLSyncMLCred *Cred; /**< Cred? */ WBXMLSyncMLMeta *Meta; /**< Meta? */ WBXMLList *items; /**< Item+ */ WB_BOOL Archives; /**< Archive? */ WB_BOOL SftDel; /**< SftDel? */ } WBXMLSyncMLDelete; /** * @brief SyncML element */ typedef struct WBXMLSyncMLExec_s { WB_BOOL NoResp; /**< NoResp? */ WBXMLSyncMLCred *Cred; /**< Cred? */ WBXMLSyncMLMeta *Meta; /**< Meta? */ WBXMLSyncMLItem Item; /**< Item */ } WBXMLSyncMLExec; /** * @brief SyncML element */ typedef struct WBXMLSyncMLGet_s { WB_BOOL NoResp; /**< NoResp? */ WBXMLSyncMLCred *Cred; /**< Cred? */ WBXMLSyncMLMeta *Meta; /**< Meta? */ WBXMLList *items; /**< Item+ */ WBXMLBuffer *Lang; /**< Lang? */ } WBXMLSyncMLGet; /** * @brief SyncML element */ typedef struct WBXMLSyncMLMap_s { WBXMLSyncMLCred *Cred; /**< Cred? */ WBXMLSyncMLMeta *Meta; /**< Meta? */ WBXMLList *maps; /**< MapItem+ (WBXMLSyncMLMapItem) */ WBXMLBuffer *Target; /**< Target */ WBXMLBuffer *Source; /**< Source */ } WBXMLSyncMLMap; /** * @brief SyncML element */ typedef struct WBXMLSyncMLMapItem_s { WBXMLBuffer *Target; /**< Target */ WBXMLBuffer *Source; /**< Source */ } WBXMLSyncMLMapItem; /** * @brief SyncML element */ typedef struct WBXMLSyncMLPut_s { WB_BOOL NoResp; /**< NoResp? */ WBXMLSyncMLCred *Cred; /**< Cred? */ WBXMLSyncMLMeta *Meta; /**< Meta? */ WBXMLList *items; /**< Item+ */ WBXMLBuffer *Lang; /**< Lang? */ } WBXMLSyncMLPut; /** * @brief SyncML element */ typedef struct WBXMLSyncMLReplace_s { WB_BOOL NoResp; /**< NoResp? */ WBXMLSyncMLCred *Cred; /**< Cred? */ WBXMLSyncMLMeta *Meta; /**< Meta? */ WBXMLList *items; /**< Item+ */ } WBXMLSyncMLReplace; /** * @brief SyncML element */ typedef struct WBXMLSyncMLResults_s { WBXMLSyncMLMeta *Meta; /**< Meta? */ WBXMLList *items; /**< Item+ */ WBXMLBuffer *TargetRef; /**< TargetRef? */ WBXMLBuffer *SourceRef; /**< SourceRef? */ WBXMLBuffer *MsgRef; /**< MsgRef? */ WBXMLBuffer *CmdRef; /**< CmdRef */ } WBXMLSyncMLResults; /** * @brief SyncML element */ typedef struct WBXMLSyncMLSearch_s { WB_BOOL NoResp; /**< NoResp? */ WB_BOOL NoResults; /**< NoResults? */ WBXMLSyncMLCred *Cred; /**< Cred? */ WBXMLBuffer *Target; /**< Target? */ WBXMLList *Source; /**< Source+ */ WBXMLBuffer *lang; /**< Lang? */ WBXMLSyncMLMeta *Meta; /**< Meta */ WBXMLBuffer *Data; /**< Data */ } WBXMLSyncMLSearch; /** * @brief SyncML element */ typedef struct WBXMLSyncMLSequence_s { WB_BOOL NoResp; /**< NoResp? */ WBXMLSyncMLMeta *Meta; /**< Meta? */ WBXMLList *commands; /**< (Add | Replace | Delete | Copy | Atomic | Map | Sync | Get | Alert | Exec)+ */ } WBXMLSyncMLSequence; /** * @brief SyncML element */ typedef struct WBXMLSyncMLStatus_s { /* */ WBXMLBuffer *MsgRef; /**< MsgRef */ WBXMLBuffer *CmdRef; /**< CmdRef */ WBXMLSyncMLCmdType Cmd; /**< Cmd */ WBXMLList *TargetRef; /**< TargetRef* */ WBXMLList *SourceRef; /**< SourceRef* */ WBXMLSyncMLCred *Cred; /**< Cred? */ WBXMLSyncMLChal *Chal; /**< Chal? */ WBXMLBuffer *Data; /**< Data */ WBXMLList *items; /**< Item* */ } WBXMLSyncMLStatus; /** * @brief SyncML element */ typedef struct WBXMLSyncMLSync_s { /* */ WB_BOOL NoResp; /**< NoResp? */ WBXMLSyncMLCred *Cred; /**< Cred? */ WBXMLBuffer *Target; /**< Target? */ WBXMLBuffer *Source; /**< Source? */ WBXMLSyncMLMeta *Meta; /**< Meta? */ WB_ULONG NumberOfChanges; /**< NumberOfChanges? */ WBXMLList *commands; /**< (Add | Atomic | Copy | Delete | Replace | Sequence)* */ } WBXMLSyncMLSync; /** * @brief SyncML command element */ typedef struct WBXMLSyncMLCommand_s { WBXMLSyncMLCmdType type; /**< Cf. WBXMLSyncMLCmdType */ WBXMLBuffer *CmdID; /**< CmdId */ union { WBXMLSyncMLAdd *Add; /**< Add */ WBXMLSyncMLAlert *Alert; /**< Alert */ WBXMLSyncMLAtomic *Atomic; /**< Atomic */ WBXMLSyncMLCopy *Copy; /**< Copy */ WBXMLSyncMLDelete *Delete; /**< Delete */ WBXMLSyncMLExec *Exec; /**< Exec */ WBXMLSyncMLGet *Get; /**< Get */ WBXMLSyncMLMap *Map; /**< Map */ WBXMLSyncMLPut *Put; /**< Put */ WBXMLSyncMLReplace *Replace; /**< Replace */ WBXMLSyncMLResults *Results; /**< Results */ WBXMLSyncMLSearch *Search; /**< Search */ WBXMLSyncMLSequence *Sequence; /**< Sequence */ WBXMLSyncMLStatus *Status; /**< Status */ WBXMLSyncMLSync *Sync; /**< Sync */ } u; } WBXMLSyncMLCommand; /** * @brief SyncML element */ typedef struct WBXMLSyncMLSyncBody_s { WBXMLList *commands; /**< (Alert | Atomic | Copy | Exec | Get | Map | Put | Results | Search | Sequence | Status | Sync | Add | Replace | Delete)+ */ WB_BOOL Final; /**< Final? */ } WBXMLSyncMLSyncBody; /** * @brief SyncML element */ typedef struct WBXMLSyncMLSyncHdr_s { WBXMLSyncMLVerDTD VerDTD; /**< VerDTD */ WBXMLSyncMLVerProto VerProto; /**< VerProto */ WBXMLBuffer *SessionID; /**< SessionID */ WBXMLBuffer *MsgID; /**< MsgID */ WBXMLBuffer *Target; /**< Target */ WBXMLBuffer *Source; /**< Source */ WBXMLBuffer *RespURI; /**< RespURI? */ WB_BOOL NoResp; /**< NoResp? */ WBXMLSyncMLCred *Cred; /**< Cred? */ WBXMLSyncMLMeta *Meta; /**< Meta? */ } WBXMLSyncMLSyncHdr; /** * @brief SyncML element */ typedef struct WBXMLSyncMLSyncML_s { WBXMLSyncMLSyncHdr *SyncHdr; /**< SyncHdr */ WBXMLSyncMLSyncBody *SyncBody; /**< SyncBody */ } WBXMLSyncMLSyncML; /**************************************************** * SyncML Structures Functions */ /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLCred *) wbxml_syncml_Cred_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Cred_destroy(WBXMLSyncMLCred *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLChal *) wbxml_syncml_Chal_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Chal_destroy(WBXMLSyncMLChal *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLItem *) wbxml_syncml_Item_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Item_destroy(WBXMLSyncMLItem *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLAdd *) wbxml_syncml_Add_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Add_destroy(WBXMLSyncMLAdd *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLAlert *) wbxml_syncml_Alert_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Alert_destroy(WBXMLSyncMLAlert *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLAtomic *) wbxml_syncml_Atomic_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Atomic_destroy(WBXMLSyncMLAtomic *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLCopy *) wbxml_syncml_Copy_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Copy_destroy(WBXMLSyncMLCopy *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLDelete *) wbxml_syncml_Delete_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Delete_destroy(WBXMLSyncMLDelete *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLExec *) wbxml_syncml_Exec_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Exec_destroy(WBXMLSyncMLExec *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLGet *) wbxml_syncml_Get_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Get_destroy(WBXMLSyncMLGet *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLMap *) wbxml_syncml_Map_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Map_destroy(WBXMLSyncMLMap *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLMapItem *) wbxml_syncml_MapItem_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_MapItem_destroy(WBXMLSyncMLMapItem *elt); /* */ /** * @brief Create a SyncML <> element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLPut *) wbxml_syncml_Put_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Put_destroy(WBXMLSyncMLPut *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLReplace *) wbxml_syncml_Replace_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Replace_destroy(WBXMLSyncMLReplace *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLResults *) wbxml_syncml_Results_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Results_destroy(WBXMLSyncMLResults *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLSearch *) wbxml_syncml_Search_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Search_destroy(WBXMLSyncMLSearch *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLSequence *) wbxml_syncml_Sequence_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Sequence_destroy(WBXMLSyncMLSequence *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLStatus *) wbxml_syncml_Status_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Status_destroy(WBXMLSyncMLStatus *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLSync *) wbxml_syncml_Sync_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_Sync_destroy(WBXMLSyncMLSync *elt); /* Command */ /** * @brief Create a SyncML Command structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLCommand *) wbxml_syncml_command_create(void); /** * @brief Destroy a SyncML Command structure * @param cmd Pointer to the Command to destroy */ WBXML_DECLARE(void) wbxml_syncml_command_destroy(WBXMLSyncMLCommand *cmd); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLSyncBody *) wbxml_syncml_SyncBody_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_SyncBody_destroy(WBXMLSyncMLSyncBody *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLSyncHdr *) wbxml_syncml_SyncHdr_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_SyncHdr_destroy(WBXMLSyncMLSyncHdr *elt); /* */ /** * @brief Create a SyncML element structure * @return Pointer to the newly created structure, or NULL if not enough memory */ WBXML_DECLARE(WBXMLSyncMLSyncML *) wbxml_syncml_SyncML_create(void); /** * @brief Destroy a SyncML element structure * @param elt Pointer to the structure to destroy */ WBXML_DECLARE(void) wbxml_syncml_SyncML_destroy(WBXMLSyncMLSyncML *elt); /**************************************************** * SyncML Building Functions */ /** * @brief Create a SyncML Header tree node * @result Return the newly created tree node, or NULL if error */ WBXML_DECLARE(WBXMLTreeNode *) wbxml_syncml_SyncHdr_build(WBXMLSyncMLSyncHdr *elt); /** @} */ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* WBXML_WRAP_SYNCML_H */ #endif /* WBXML_WRAPPERS && WBXML_SUPPORT_SYNCML */ .