| opensync.h | | opensync.h | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef HAVE_OPENSYNC_H | | #ifndef HAVE_OPENSYNC_H | |
| #define HAVE_OPENSYNC_H | | #define HAVE_OPENSYNC_H | |
| | | | |
| #include <sys/types.h> | | #include <sys/types.h> | |
| #include <time.h> | | #include <time.h> | |
| #include <fcntl.h> | | #include <fcntl.h> | |
|
| | | #include <stdio.h> | |
| #include <stdlib.h> | | #include <stdlib.h> | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| | | | |
| #define OPENSYNC_BEGIN_DECLS extern "C" { | | #define OPENSYNC_BEGIN_DECLS extern "C" { | |
| #define OPENSYNC_END_DECLS } | | #define OPENSYNC_END_DECLS } | |
| | | | |
| #else | | #else | |
| | | | |
| #define OPENSYNC_BEGIN_DECLS | | #define OPENSYNC_BEGIN_DECLS | |
| | | | |
| skipping to change at line 59 | | skipping to change at line 60 | |
| #define OSYNC_EXPORT __attribute__ ((visibility("default"))) | | #define OSYNC_EXPORT __attribute__ ((visibility("default"))) | |
| | | | |
| #elif __sun | | #elif __sun | |
| #include <unistd.h> | | #include <unistd.h> | |
| #define OSYNC_EXPORT __global | | #define OSYNC_EXPORT __global | |
| | | | |
| #else | | #else | |
| #define OSYNC_EXPORT | | #define OSYNC_EXPORT | |
| #endif | | #endif | |
| | | | |
|
| | | /* Some symbols are only exported in the opensync */ | |
| | | /* testing library */ | |
| | | /* opensync_testing_EXPORTS is defined from CMAKE */ | |
| | | /* when the build target is the testing library */ | |
| | | #ifdef opensync_testing_EXPORTS | |
| | | #define OSYNC_TEST_EXPORT OSYNC_EXPORT | |
| | | #else | |
| | | #define OSYNC_TEST_EXPORT | |
| | | #endif | |
| | | | |
| OPENSYNC_BEGIN_DECLS | | OPENSYNC_BEGIN_DECLS | |
| | | | |
|
| | | /** | |
| | | * @defgroup OSyncPrivate OpenSync Private API | |
| | | * @defgroup OSyncPublic OpenSync Public API | |
| | | */ | |
| | | | |
| /************************************************************** | | /************************************************************** | |
| * Versions | | * Versions | |
| *************************************************************/ | | *************************************************************/ | |
| | | | |
| #define OSYNC_GROUP_MAJOR_VERSION 1 | | #define OSYNC_GROUP_MAJOR_VERSION 1 | |
| #define OSYNC_GROUP_MINOR_VERSION 0 | | #define OSYNC_GROUP_MINOR_VERSION 0 | |
| | | | |
| #define OSYNC_MEMBER_MAJOR_VERSION 1 | | #define OSYNC_MEMBER_MAJOR_VERSION 1 | |
| #define OSYNC_MEMBER_MINOR_VERSION 0 | | #define OSYNC_MEMBER_MINOR_VERSION 0 | |
| | | | |
| #define OSYNC_PLUGIN_MAJOR_VERSION 1 | | #define OSYNC_PLUGIN_MAJOR_VERSION 1 | |
| #define OSYNC_PLUGIN_MINOR_VERSION 0 | | #define OSYNC_PLUGIN_MINOR_VERSION 0 | |
| | | | |
|
| | | #define OSYNC_CAPS_MAJOR_VERSION 1 | |
| | | #define OSYNC_CAPS_MINOR_VERSION 0 | |
| | | | |
| /************************************************************** | | /************************************************************** | |
| * Defines | | * Defines | |
| *************************************************************/ | | *************************************************************/ | |
| #ifndef TRUE | | #ifndef TRUE | |
| #define TRUE 1 | | #define TRUE 1 | |
| #endif | | #endif | |
| | | | |
| #ifndef FALSE | | #ifndef FALSE | |
| #define FALSE 0 | | #define FALSE 0 | |
| #endif | | #endif | |
| | | | |
|
| | | #define __NULLSTR(x) x ? x : "(NULL)" | |
| | | | |
| #ifndef NDEBUG | | #ifndef NDEBUG | |
| #define osync_assert(x) if (!(x)) { fprintf(stderr, "%s:%i:E:%s: Assertion
\"" #x "\" failed\n", __FILE__, __LINE__, __func__); abort();} | | #define osync_assert(x) if (!(x)) { fprintf(stderr, "%s:%i:E:%s: Assertion
\"" #x "\" failed\n", __FILE__, __LINE__, __func__); abort();} | |
| #define osync_assert_msg(x, msg) if (!(x)) { fprintf(stderr, "%s:%i:E:%s: %
s\n", __FILE__, __LINE__, __func__, msg); abort();} | | #define osync_assert_msg(x, msg) if (!(x)) { fprintf(stderr, "%s:%i:E:%s: %
s\n", __FILE__, __LINE__, __func__, msg); abort();} | |
|
| #define segfault_me char **blablabla = NULL; *blablabla = "test"; | | | |
| #else | | #else | |
| #define osync_assert(x) | | #define osync_assert(x) | |
| #define osync_assert_msg(x, msg) | | #define osync_assert_msg(x, msg) | |
|
| #define segfault_me | | | |
| #endif | | #endif | |
| | | | |
|
| | | #define osync_return_if_fail(condition) do { \ | |
| | | if (!(condition)) { \ | |
| | | return; \ | |
| | | } } while (0) | |
| | | | |
| | | #define osync_return_val_if_fail(condition, val) do { \ | |
| | | if (!(condition)) { \ | |
| | | return (val); \ | |
| | | } } while (0) | |
| | | | |
| | | #define osync_return_if_fail_and_set_error(condition, error, errortype, for | |
| | | mat, ...) do { \ | |
| | | if (!(condition)) { | |
| | | \ | |
| | | osync_error_set(error, errortype, format,## __VA_ARGS__, NULL ); | |
| | | \ | |
| | | return; | |
| | | \ | |
| | | } } while(0) | |
| | | | |
| | | #define osync_return_val_if_fail_and_set_error(condition, val, error, error | |
| | | type, format, ...) do { \ | |
| | | if (!(condition)) { | |
| | | \ | |
| | | osync_error_set(error, errortype, format,## __VA_ARGS__, NULL ); | |
| | | \ | |
| | | return (val); | |
| | | \ | |
| | | } } while(0) | |
| | | | |
| | | typedef int osync_bool; | |
| | | | |
| /************************************************************** | | /************************************************************** | |
| * Enums | | * Enums | |
| *************************************************************/ | | *************************************************************/ | |
| | | | |
| typedef enum { | | typedef enum { | |
| OSYNC_START_TYPE_UNKNOWN, | | OSYNC_START_TYPE_UNKNOWN, | |
| OSYNC_START_TYPE_PROCESS, | | OSYNC_START_TYPE_PROCESS, | |
| OSYNC_START_TYPE_THREAD, | | OSYNC_START_TYPE_THREAD, | |
| OSYNC_START_TYPE_EXTERNAL | | OSYNC_START_TYPE_EXTERNAL | |
| } OSyncStartType; | | } OSyncStartType; | |
| | | | |
| skipping to change at line 140 | | skipping to change at line 183 | |
| /** Object is deleted */ | | /** Object is deleted */ | |
| OSYNC_CHANGE_TYPE_DELETED = 3, | | OSYNC_CHANGE_TYPE_DELETED = 3, | |
| /** Object has been modified */ | | /** Object has been modified */ | |
| OSYNC_CHANGE_TYPE_MODIFIED = 4 | | OSYNC_CHANGE_TYPE_MODIFIED = 4 | |
| } OSyncChangeType; | | } OSyncChangeType; | |
| | | | |
| /************************************************************** | | /************************************************************** | |
| * Structs | | * Structs | |
| *************************************************************/ | | *************************************************************/ | |
| | | | |
|
| /* Data Component */ | | /* Archive component */ | |
| | | typedef struct OSyncArchive OSyncArchive; | |
| | | | |
| | | /* Data component */ | |
| typedef struct OSyncData OSyncData; | | typedef struct OSyncData OSyncData; | |
| typedef struct OSyncChange OSyncChange; | | typedef struct OSyncChange OSyncChange; | |
| | | | |
|
| /* Format Component */ | | /* Database component */ | |
| | | typedef struct OSyncDB OSyncDB; | |
| | | | |
| | | /* Format component */ | |
| typedef struct OSyncFormatEnv OSyncFormatEnv; | | typedef struct OSyncFormatEnv OSyncFormatEnv; | |
| typedef struct OSyncObjFormat OSyncObjFormat; | | typedef struct OSyncObjFormat OSyncObjFormat; | |
| typedef struct OSyncFormatConverterPath OSyncFormatConverterPath; | | typedef struct OSyncFormatConverterPath OSyncFormatConverterPath; | |
| typedef struct OSyncFormatConverter OSyncFormatConverter; | | typedef struct OSyncFormatConverter OSyncFormatConverter; | |
|
| typedef struct OSyncFilter OSyncFilter; | | | |
| typedef struct OSyncObjFormatSink OSyncObjFormatSink; | | typedef struct OSyncObjFormatSink OSyncObjFormatSink; | |
|
| | | typedef struct OSyncMerger OSyncMerger; | |
| | | typedef struct OSyncCapsConverter OSyncCapsConverter; | |
| | | | |
| /* Plugin component */ | | /* Plugin component */ | |
|
| | | typedef struct OSyncContext OSyncContext; | |
| typedef struct OSyncPlugin OSyncPlugin; | | typedef struct OSyncPlugin OSyncPlugin; | |
| typedef struct OSyncPluginInfo OSyncPluginInfo; | | typedef struct OSyncPluginInfo OSyncPluginInfo; | |
| typedef struct OSyncPluginEnv OSyncPluginEnv; | | typedef struct OSyncPluginEnv OSyncPluginEnv; | |
|
| typedef struct OSyncModule OSyncModule; | | | |
| typedef struct OSyncObjTypeSink OSyncObjTypeSink; | | typedef struct OSyncObjTypeSink OSyncObjTypeSink; | |
| typedef struct OSyncPluginConfig OSyncPluginConfig; | | typedef struct OSyncPluginConfig OSyncPluginConfig; | |
| typedef struct OSyncPluginAuthentication OSyncPluginAuthentication; | | typedef struct OSyncPluginAuthentication OSyncPluginAuthentication; | |
| typedef struct OSyncPluginAdvancedOption OSyncPluginAdvancedOption; | | typedef struct OSyncPluginAdvancedOption OSyncPluginAdvancedOption; | |
| typedef struct OSyncPluginAdvancedOptionParameter OSyncPluginAdvancedOption
Parameter; | | typedef struct OSyncPluginAdvancedOptionParameter OSyncPluginAdvancedOption
Parameter; | |
| typedef struct OSyncPluginConnection OSyncPluginConnection; | | typedef struct OSyncPluginConnection OSyncPluginConnection; | |
| typedef struct OSyncPluginLocalization OSyncPluginLocalization; | | typedef struct OSyncPluginLocalization OSyncPluginLocalization; | |
| typedef struct OSyncPluginResource OSyncPluginResource; | | typedef struct OSyncPluginResource OSyncPluginResource; | |
| | | | |
| /* Engine component */ | | /* Engine component */ | |
| typedef struct OSyncEngine OSyncEngine; | | typedef struct OSyncEngine OSyncEngine; | |
| typedef struct OSyncObjEngine OSyncObjEngine; | | typedef struct OSyncObjEngine OSyncObjEngine; | |
|
| | | typedef struct OSyncSinkEngine OSyncSinkEngine; | |
| | | typedef struct OSyncMappingEntryEngine OSyncMappingEntryEngine; | |
| | | typedef struct OSyncMappingEngine OSyncMappingEngine; | |
| | | | |
| | | typedef struct OSyncEngineMemberUpdate OSyncEngineMemberUpdate; | |
| | | typedef struct OSyncEngineChangeUpdate OSyncEngineChangeUpdate; | |
| | | typedef struct OSyncEngineMappingUpdate OSyncEngineMappingUpdate; | |
| | | typedef struct OSyncEngineUpdate OSyncEngineUpdate; | |
| | | | |
| | | /* Client component */ | |
| typedef struct OSyncClient OSyncClient; | | typedef struct OSyncClient OSyncClient; | |
| typedef struct OSyncClientProxy OSyncClientProxy; | | typedef struct OSyncClientProxy OSyncClientProxy; | |
| | | | |
| /* Mapping component */ | | /* Mapping component */ | |
| typedef struct OSyncMapping OSyncMapping; | | typedef struct OSyncMapping OSyncMapping; | |
| typedef struct OSyncMappingTable OSyncMappingTable; | | typedef struct OSyncMappingTable OSyncMappingTable; | |
|
| typedef struct OSyncMappingView OSyncMappingView; | | | |
| typedef struct OSyncMappingEntry OSyncMappingEntry; | | typedef struct OSyncMappingEntry OSyncMappingEntry; | |
| | | | |
|
| | | /* Module component */ | |
| | | typedef struct OSyncModule OSyncModule; | |
| | | | |
| /* Helper component */ | | /* Helper component */ | |
|
| typedef struct OSyncAnchorDB OSyncAnchorDB; | | typedef struct OSyncSinkStateDB OSyncSinkStateDB; | |
| | | typedef struct OSyncHashTable OSyncHashTable; | |
| | | | |
| | | /* IPC component */ | |
| | | typedef struct OSyncMessage OSyncMessage; | |
| | | typedef struct OSyncQueue OSyncQueue; | |
| | | | |
| /* Group component */ | | /* Group component */ | |
| typedef struct OSyncGroup OSyncGroup; | | typedef struct OSyncGroup OSyncGroup; | |
| typedef struct OSyncGroupEnv OSyncGroupEnv; | | typedef struct OSyncGroupEnv OSyncGroupEnv; | |
| typedef struct OSyncMember OSyncMember; | | typedef struct OSyncMember OSyncMember; | |
| | | | |
|
| /* Merger component */ | | /* Capabilities component */ | |
| typedef struct OSyncArchive OSyncArchive; | | | |
| typedef struct OSyncCapabilities OSyncCapabilities; | | typedef struct OSyncCapabilities OSyncCapabilities; | |
| typedef struct OSyncCapability OSyncCapability; | | typedef struct OSyncCapability OSyncCapability; | |
|
| | | typedef struct OSyncCapabilityParameter OSyncCapabilityParameter; | |
| | | typedef struct OSyncCapabilitiesObjType OSyncCapabilitiesObjType; | |
| | | | |
| | | /* XMLFormat component */ | |
| typedef struct OSyncXMLFormat OSyncXMLFormat; | | typedef struct OSyncXMLFormat OSyncXMLFormat; | |
| typedef struct OSyncXMLFormatSchema OSyncXMLFormatSchema; | | typedef struct OSyncXMLFormatSchema OSyncXMLFormatSchema; | |
| typedef struct OSyncXMLField OSyncXMLField; | | typedef struct OSyncXMLField OSyncXMLField; | |
| typedef struct OSyncXMLFieldList OSyncXMLFieldList; | | typedef struct OSyncXMLFieldList OSyncXMLFieldList; | |
|
| typedef struct OSyncMerger OSyncMerger; | | | |
| typedef struct OSyncVersion OSyncVersion; | | | |
| | | | |
|
| | | /* Common component */ | |
| typedef struct OSyncError OSyncError; | | typedef struct OSyncError OSyncError; | |
|
| typedef struct OSyncUserInfo OSyncUserInfo; | | typedef struct OSyncMarshal OSyncMarshal; | |
| typedef struct OSyncContext OSyncContext; | | | |
| typedef struct OSyncHashTable OSyncHashTable; | | /* Version component */ | |
| typedef struct OSyncFormatProperty OSyncFormatProperty; | | typedef struct OSyncVersion OSyncVersion; | |
| typedef struct OSyncCustomFilter OSyncCustomFilter; | | | |
| typedef struct OSyncMessage OSyncMessage; | | /*! @brief Returns the version of opensync | |
| typedef struct OSyncQueue OSyncQueue; | | * | |
| typedef struct OSyncDB OSyncDB; | | * Returns a string identifying the major and minor version | |
| typedef int osync_bool; | | * of opensync (something like "0.11") | |
| | | * | |
| | | * @returns String with version | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT const char *osync_get_version(void); | |
| | | | |
| OPENSYNC_END_DECLS | | OPENSYNC_END_DECLS | |
| | | | |
|
| #include "opensync-support.h" | | #include "opensync/opensync-common.h" | |
| #include "opensync-error.h" | | #include "opensync/opensync-debug.h" | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 24 change blocks. |
| 23 lines changed or deleted | | 105 lines changed or added | |
|
| opensync_capability.h | | opensync_capability.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| * Author: Daniel Friedrich <daniel.friedrich@opensync.org> | | * Author: Daniel Friedrich <daniel.friedrich@opensync.org> | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef OPENSYNC_CAPABILITY_H_ | | #ifndef OPENSYNC_CAPABILITY_H_ | |
| #define OPENSYNC_CAPABILITY_H_ | | #define OPENSYNC_CAPABILITY_H_ | |
| | | | |
|
| OSYNC_EXPORT OSyncCapability *osync_capability_new(OSyncCapabilities *capab | | /** | |
| ilities, const char *objtype, const char *name, OSyncError **error); | | * @defgroup OSyncCapabilityAPI OpenSync Capability | |
| | | * @ingroup OSyncCapabilities | |
| | | * @brief The public part of the OSyncCapability | |
| | | * | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| | | /** @brief Capability value types | |
| | | * | |
| | | **/ | |
| | | typedef enum { | |
| | | /** None */ | |
| | | OSYNC_CAPABILITY_TYPE_NONE = 0, | |
| | | /** bool */ | |
| | | OSYNC_CAPABILITY_TYPE_BOOL, | |
| | | /** char */ | |
| | | OSYNC_CAPABILITY_TYPE_CHAR, | |
| | | /** double */ | |
| | | OSYNC_CAPABILITY_TYPE_DOUBLE, | |
| | | /** int */ | |
| | | OSYNC_CAPABILITY_TYPE_INT, | |
| | | /** long */ | |
| | | OSYNC_CAPABILITY_TYPE_LONG, | |
| | | /** long long */ | |
| | | OSYNC_CAPABILITY_TYPE_LONGLONG, | |
| | | /** unsigned int */ | |
| | | OSYNC_CAPABILITY_TYPE_UINT, | |
| | | /** unsigned long */ | |
| | | OSYNC_CAPABILITY_TYPE_ULONG, | |
| | | /** unsigned long long */ | |
| | | OSYNC_CAPABILITY_TYPE_ULONGLONG, | |
| | | /** String (char *) */ | |
| | | OSYNC_CAPABILITY_TYPE_STRING | |
| | | } OSyncCapabilityType; | |
| | | | |
|
| | | /** | |
| | | * @brief Creates a new capability object which will be added to the end of | |
| | | capabilities of the capabilities object. | |
| | | * The returned object will be freed with the capabilities object. | |
| | | * @param capobjtype The pointer to a capabilities objtype object | |
| | | * @param error The error which will hold the info in case of an error | |
| | | * @return The pointer to the newly allocated capability object or NULL in | |
| | | case of error | |
| | | */ | |
| | | OSYNC_EXPORT OSyncCapability *osync_capability_new(OSyncCapabilitiesObjType | |
| | | * capobjtype, OSyncError **error); | |
| | | | |
| | | OSYNC_EXPORT OSyncCapability *osync_capability_ref(OSyncCapability *capabil | |
| | | ity); | |
| | | OSYNC_EXPORT void osync_capability_unref(OSyncCapability *capability); | |
| | | | |
| | | /** | |
| | | * @brief Get the name of the capability | |
| | | * @param capability The pointer to a capability object | |
| | | * @return The name of the capability | |
| | | */ | |
| OSYNC_EXPORT const char *osync_capability_get_name(OSyncCapability *capabil
ity); | | OSYNC_EXPORT const char *osync_capability_get_name(OSyncCapability *capabil
ity); | |
|
| OSYNC_EXPORT OSyncCapability *osync_capability_get_next(OSyncCapability *ca
pability); | | | |
| | | | |
|
| OSYNC_EXPORT osync_bool osync_capability_has_key(OSyncCapability *capabilit | | /** | |
| y); | | * @brief Set the name of the capability | |
| OSYNC_EXPORT int osync_capability_get_key_count(OSyncCapability *capability | | * @param capability The pointer to a capability object | |
| ); | | * @param name The name of the capability to set | |
| OSYNC_EXPORT const char *osync_capability_get_nth_key(OSyncCapability *capa | | */ | |
| bility, int nth); | | OSYNC_EXPORT void osync_capability_set_name(OSyncCapability *capability, co | |
| OSYNC_EXPORT void osync_capability_add_key(OSyncCapability *capabilitiy, co | | nst char *name); | |
| nst char *name); | | | |
| | | /** | |
| | | * @brief Get the display name of the capability | |
| | | * @param capability The pointer to a capability object | |
| | | * @return The display name of the capability | |
| | | */ | |
| | | OSYNC_EXPORT const char *osync_capability_get_displayname(OSyncCapability * | |
| | | capability); | |
| | | | |
| | | /** | |
| | | * @brief Set the display name of the capability | |
| | | * @param capability The pointer to a capability object | |
| | | * @param displayname The displayname of the capability to set | |
| | | */ | |
| | | OSYNC_EXPORT void osync_capability_set_displayname(OSyncCapability *capabil | |
| | | ity, const char *displayname); | |
| | | | |
| | | /** | |
| | | * @brief Get max occurs of the capability | |
| | | * @param capability The pointer to a capability object | |
| | | * @return The number of max occurs of the capability | |
| | | */ | |
| | | OSYNC_EXPORT unsigned int osync_capability_get_maxoccurs(OSyncCapability *c | |
| | | apability); | |
| | | | |
| | | /** | |
| | | * @brief Set max occurs of the capability | |
| | | * @param capability The pointer to a capability object | |
| | | * @param maxoccurs The number of max occurs of the capability object | |
| | | */ | |
| | | OSYNC_EXPORT void osync_capability_set_maxoccurs(OSyncCapability *capabilit | |
| | | y, unsigned int maxoccurs); | |
| | | | |
| | | /** | |
| | | * @brief Get max length/size of the capability value | |
| | | * @param capability The pointer to a capability object | |
| | | * @return The max length/size of the capability value | |
| | | */ | |
| | | OSYNC_EXPORT unsigned int osync_capability_get_max(OSyncCapability *capabil | |
| | | ity); | |
| | | | |
| | | /** | |
| | | * @brief Set the max length/size of the capability value | |
| | | * @param capability The pointer to a capability object | |
| | | * @param max The max lenth/size of the capability value | |
| | | */ | |
| | | OSYNC_EXPORT void osync_capability_set_max(OSyncCapability *capability, uns | |
| | | igned int max); | |
| | | | |
| | | /** | |
| | | * @brief Get min length/size of the capability value | |
| | | * @param capability The pointer to a capability object | |
| | | * @return The min length/size of the capability value | |
| | | */ | |
| | | OSYNC_EXPORT unsigned int osync_capability_get_min(OSyncCapability *capabil | |
| | | ity); | |
| | | | |
| | | /** | |
| | | * @brief Set the min length/size of the capability value | |
| | | * @param capability The pointer to a capability object | |
| | | * @param min The min lenth/size of the capability value | |
| | | */ | |
| | | OSYNC_EXPORT void osync_capability_set_min(OSyncCapability *capability, uns | |
| | | igned int min); | |
| | | | |
| | | /** | |
| | | * @brief Get capability parameter of this capability object | |
| | | * @param capability The pointer to a capability object | |
| | | * @return Pointer to the capability parameter of this capability object | |
| | | */ | |
| | | OSYNC_EXPORT OSyncCapabilityParameter *osync_capability_get_parameter(OSync | |
| | | Capability *capability); | |
| | | | |
| | | /** | |
| | | * @brief Set the capability parameter of the capability object | |
| | | * @param capability The pointer to a capability object | |
| | | * @param parameter the parameter to set for the capability object | |
| | | */ | |
| | | OSYNC_EXPORT void osync_capability_set_parameter(OSyncCapability *capabilit | |
| | | y, OSyncCapabilityParameter *parameter); | |
| | | | |
| | | /** | |
| | | * @brief Get capability type of this capability object | |
| | | * @param capability The pointer to a capability object | |
| | | * @return Type of this capability | |
| | | */ | |
| | | OSYNC_EXPORT OSyncCapabilityType osync_capability_get_type(OSyncCapability | |
| | | *capability); | |
| | | | |
| | | /** | |
| | | * @brief Set capability type for capability object | |
| | | * @param capability The pointer to a capability object | |
| | | * @param type The type to set for the capability object | |
| | | */ | |
| | | OSYNC_EXPORT void osync_capability_set_type(OSyncCapability *capability, OS | |
| | | yncCapabilityType type); | |
| | | | |
| | | /** | |
| | | * @brief Get valenum of this capability objects. Contains possible value o | |
| | | f | |
| | | * this capability object | |
| | | * | |
| | | * @param capability The pointer to a capability object | |
| | | * @return Returns OSyncList with strings (const char*) with possible value | |
| | | s | |
| | | * of this capability object | |
| | | */ | |
| | | OSYNC_EXPORT OSyncList *osync_capability_get_valenums(OSyncCapability *capa | |
| | | bility); /* const char* list */ | |
| | | | |
| | | /** TODO Doxygen */ | |
| | | OSYNC_EXPORT OSyncList *osync_capability_get_childs(OSyncCapability *capabi | |
| | | lity); /* OSyncCapability* list */ | |
| | | OSYNC_EXPORT void osync_capability_add_child(OSyncCapability *capability, O | |
| | | SyncCapability *child); | |
| | | OSYNC_EXPORT OSyncCapability *osync_capability_new_child(OSyncCapability *p | |
| | | arent, OSyncError **error); | |
| | | | |
| | | /*@}*/ | |
| | | | |
| #endif /*OPENSYNC_CAPABILITY_H_*/ | | #endif /*OPENSYNC_CAPABILITY_H_*/ | |
| | | | |
End of changes. 4 change blocks. |
| 11 lines changed or deleted | | 182 lines changed or added | |
|
| opensync_change.h | | opensync_change.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENSYNC_CHANGE_H_ | | #ifndef _OPENSYNC_CHANGE_H_ | |
| #define _OPENSYNC_CHANGE_H_ | | #define _OPENSYNC_CHANGE_H_ | |
| | | | |
|
| | | /** | |
| | | * @defgroup OSyncChangeAPI OpenSync Change | |
| | | * @ingroup OSyncData | |
| | | * @brief Handles change objects | |
| | | * | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| | | /*! @brief Create a new change object | |
| | | * | |
| | | * @param error An error struct | |
| | | * @returns The new change object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncChange *osync_change_new(OSyncError **error); | | OSYNC_EXPORT OSyncChange *osync_change_new(OSyncError **error); | |
|
| | | | |
| | | /*! @brief Increase the reference count on a change object | |
| | | * | |
| | | * @param change The change object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncChange *osync_change_ref(OSyncChange *change); | | OSYNC_EXPORT OSyncChange *osync_change_ref(OSyncChange *change); | |
|
| OSYNC_EXPORT void osync_change_unref(OSyncChange *change); | | | |
| | | | |
|
| OSYNC_EXPORT OSyncChange *osync_change_clone(OSyncChange *source, OSyncErro | | /*! @brief Decrease the reference count on a change object | |
| r **error); | | * | |
| | | * @param change The change object | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT void osync_change_unref(OSyncChange *change); | |
| | | | |
|
| | | /*! @brief Sets the hash of a change that is used to decide whether a chang | |
| | | e is new, modified etc. | |
| | | * | |
| | | * @param change The change | |
| | | * @param hash The hash to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_change_set_hash(OSyncChange *change, const char *ha
sh); | | OSYNC_EXPORT void osync_change_set_hash(OSyncChange *change, const char *ha
sh); | |
|
| | | | |
| | | /*! @brief Gets the hash of a change | |
| | | * | |
| | | * @param change The change | |
| | | * @returns The hash | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_change_get_hash(OSyncChange *change); | | OSYNC_EXPORT const char *osync_change_get_hash(OSyncChange *change); | |
| | | | |
|
| | | /*! @brief Sets the uid of a change | |
| | | * | |
| | | * @param change The change | |
| | | * @param uid The uid to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_change_set_uid(OSyncChange *change, const char *uid
); | | OSYNC_EXPORT void osync_change_set_uid(OSyncChange *change, const char *uid
); | |
|
| | | | |
| | | /*! @brief Gets the uid of a change | |
| | | * | |
| | | * @param change The change | |
| | | * @returns The uid | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_change_get_uid(OSyncChange *change); | | OSYNC_EXPORT const char *osync_change_get_uid(OSyncChange *change); | |
| | | | |
|
| | | /*! @brief Gets the changetype of a change | |
| | | * | |
| | | * If change is NULL or changetype not set, then OSYNC_CHANGE_TYPE_UNKNOWN | |
| | | get | |
| | | * returned. | |
| | | * | |
| | | * @param change The change | |
| | | * @returns The changetype | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncChangeType osync_change_get_changetype(OSyncChange *chang
e); | | OSYNC_EXPORT OSyncChangeType osync_change_get_changetype(OSyncChange *chang
e); | |
|
| | | | |
| | | /*! @brief Sets the changetype of a change | |
| | | * | |
| | | * @param change The change | |
| | | * @param type The changetype to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_change_set_changetype(OSyncChange *change, OSyncCha
ngeType type); | | OSYNC_EXPORT void osync_change_set_changetype(OSyncChange *change, OSyncCha
ngeType type); | |
| | | | |
|
| | | /*! @brief Sets the data of a change | |
| | | * | |
| | | * @param change The change | |
| | | * @param data the data object to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_change_set_data(OSyncChange *change, OSyncData *dat
a); | | OSYNC_EXPORT void osync_change_set_data(OSyncChange *change, OSyncData *dat
a); | |
|
| OSYNC_EXPORT OSyncData *osync_change_get_data(OSyncChange *change); | | | |
| | | | |
|
| OSYNC_EXPORT OSyncConvCmpResult osync_change_compare(OSyncChange *leftchang | | /*! @brief Gets the data from a change object | |
| e, OSyncChange *rightchange); | | * | |
| OSYNC_EXPORT osync_bool osync_change_duplicate(OSyncChange *change, osync_b | | * @param change The change | |
| ool *dirty, OSyncError **error); | | * @returns the data object | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT OSyncData *osync_change_get_data(OSyncChange *change); | |
| | | | |
|
| | | /*! @brief Gets the object format of a change | |
| | | * | |
| | | * @param change The change | |
| | | * @returns The object format | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncObjFormat *osync_change_get_objformat(OSyncChange *change
); | | OSYNC_EXPORT OSyncObjFormat *osync_change_get_objformat(OSyncChange *change
); | |
|
| | | | |
| | | /*! @brief Gets the object type of a change | |
| | | * | |
| | | * @param change The change | |
| | | * @returns The name of the object type | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_change_get_objtype(OSyncChange *change); | | OSYNC_EXPORT const char *osync_change_get_objtype(OSyncChange *change); | |
|
| | | | |
| | | /*! @brief Sets the object type of a change | |
| | | * | |
| | | * @param change The change | |
| | | * @param objtype The name of the object type to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_change_set_objtype(OSyncChange *change, const char
*objtype); | | OSYNC_EXPORT void osync_change_set_objtype(OSyncChange *change, const char
*objtype); | |
| | | | |
|
| | | /*! @brief Compares two changes | |
| | | * | |
| | | * Compares the two given changes and returns: | |
| | | * OSYNC_CONV_DATA_MISMATCH if they are not the same | |
| | | * OSYNC_CONV_DATA_SIMILAR if the are not the same but look similar | |
| | | * OSYNC_CONV_DATA_SAME if they are exactly the same | |
| | | * OSYNC_CONV_DATA_UNKNOWN if the reuslt is uknown, there was a error | |
| | | * This function does also compare changetypes etc unlike | |
| | | * osync_data_compare() | |
| | | * | |
| | | * @param leftchange The left change to compare | |
| | | * @param rightchange The right change to compare | |
| | | * @param error An error struct | |
| | | * @returns The result of the comparison | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT OSyncConvCmpResult osync_change_compare(OSyncChange *leftchang | |
| | | e, OSyncChange *rightchange, OSyncError **error); | |
| | | | |
| | | /*@}*/ | |
| | | | |
| #endif /*_OPENSYNC_CHANGE_H_*/ | | #endif /*_OPENSYNC_CHANGE_H_*/ | |
| | | | |
End of changes. 17 change blocks. |
| 8 lines changed or deleted | | 124 lines changed or added | |
|
| opensync_converter.h | | opensync_converter.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENSYNC_CONVERTER_H_ | | #ifndef _OPENSYNC_CONVERTER_H_ | |
| #define _OPENSYNC_CONVERTER_H_ | | #define _OPENSYNC_CONVERTER_H_ | |
| | | | |
|
| | | /** | |
| | | * @defgroup OSyncConverterAPI OpenSync Converter | |
| | | * @ingroup OSyncFormat | |
| | | * @brief Functions for creating and managing object format converters | |
| | | * | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| | | /** Type of the converter */ | |
| typedef enum { | | typedef enum { | |
| /** Simple converter */ | | /** Simple converter */ | |
| OSYNC_CONVERTER_CONV = 1, | | OSYNC_CONVERTER_CONV = 1, | |
| /** Encapsulator */ | | /** Encapsulator */ | |
| OSYNC_CONVERTER_ENCAP = 2, | | OSYNC_CONVERTER_ENCAP = 2, | |
| /** Desencapsulator */ | | /** Desencapsulator */ | |
| OSYNC_CONVERTER_DECAP = 3, | | OSYNC_CONVERTER_DECAP = 3, | |
| /** Detector */ | | /** Detector */ | |
| OSYNC_CONVERTER_DETECTOR = 4 | | OSYNC_CONVERTER_DETECTOR = 4 | |
| } OSyncConverterType; | | } OSyncConverterType; | |
| | | | |
| typedef osync_bool (* OSyncFormatDetectFunc) (const char *data, int size, v
oid *userdata); | | typedef osync_bool (* OSyncFormatDetectFunc) (const char *data, int size, v
oid *userdata); | |
| typedef osync_bool (* OSyncFormatConvertFunc) (char *input, unsigned int in
psize, char **output, unsigned int *outpsize, osync_bool *free_input, const
char *config, void *userdata, OSyncError **error); | | typedef osync_bool (* OSyncFormatConvertFunc) (char *input, unsigned int in
psize, char **output, unsigned int *outpsize, osync_bool *free_input, const
char *config, void *userdata, OSyncError **error); | |
| typedef void * (* OSyncFormatConverterInitializeFunc) (const char *config,
OSyncError **error); | | typedef void * (* OSyncFormatConverterInitializeFunc) (const char *config,
OSyncError **error); | |
|
| typedef void (* OSyncFormatConverterFinalizeFunc) (void *userdata); | | typedef osync_bool (* OSyncFormatConverterFinalizeFunc) (void *userdata, OS
yncError **error); | |
| | | | |
|
| | | /** | |
| | | * @brief Creates a new converter | |
| | | * @param type the type of converter | |
| | | * @param sourceformat the source format for the converter | |
| | | * @param targetformat the target format for the converter | |
| | | * @param convert_func the converter function | |
| | | * @param error Pointer to an error struct | |
| | | * @returns The pointer to the newly allocated converter or NULL in case of | |
| | | error | |
| | | */ | |
| OSYNC_EXPORT OSyncFormatConverter *osync_converter_new(OSyncConverterType t
ype, OSyncObjFormat *sourceformat, OSyncObjFormat *targetformat, OSyncForma
tConvertFunc convert_func, OSyncError **error); | | OSYNC_EXPORT OSyncFormatConverter *osync_converter_new(OSyncConverterType t
ype, OSyncObjFormat *sourceformat, OSyncObjFormat *targetformat, OSyncForma
tConvertFunc convert_func, OSyncError **error); | |
|
| | | | |
| | | /** | |
| | | * @brief Creates a new detector | |
| | | * | |
| | | * @param sourceformat the source format for the converter | |
| | | * @param targetformat the target format for the converter | |
| | | * @param detect_func the detection function | |
| | | * @param error Pointer to an error struct | |
| | | * @returns The pointer to the newly allocated detector or NULL in case of | |
| | | error | |
| | | */ | |
| OSYNC_EXPORT OSyncFormatConverter *osync_converter_new_detector(OSyncObjFor
mat *sourceformat, OSyncObjFormat *targetformat, OSyncFormatDetectFunc dete
ct_func, OSyncError **error); | | OSYNC_EXPORT OSyncFormatConverter *osync_converter_new_detector(OSyncObjFor
mat *sourceformat, OSyncObjFormat *targetformat, OSyncFormatDetectFunc dete
ct_func, OSyncError **error); | |
|
| | | | |
| | | /** @brief Increase the reference count on a converter | |
| | | * | |
| | | * @param converter Pointer to the converter | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncFormatConverter *osync_converter_ref(OSyncFormatConverter
*converter); | | OSYNC_EXPORT OSyncFormatConverter *osync_converter_ref(OSyncFormatConverter
*converter); | |
|
| | | | |
| | | /** @brief Decrease the reference count on a converter | |
| | | * | |
| | | * @param converter Pointer to the converter | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_converter_unref(OSyncFormatConverter *converter); | | OSYNC_EXPORT void osync_converter_unref(OSyncFormatConverter *converter); | |
| | | | |
|
| | | /** | |
| | | * @brief Returns the source format of a converter | |
| | | * @param converter Pointer to the converter | |
| | | * @returns The source format of the specified converter | |
| | | */ | |
| OSYNC_EXPORT OSyncObjFormat *osync_converter_get_sourceformat(OSyncFormatCo
nverter *converter); | | OSYNC_EXPORT OSyncObjFormat *osync_converter_get_sourceformat(OSyncFormatCo
nverter *converter); | |
|
| | | | |
| | | /** | |
| | | * @brief Returns the target format of a converter | |
| | | * @param converter Pointer to the converter | |
| | | * @returns The target format of the specified converter | |
| | | */ | |
| OSYNC_EXPORT OSyncObjFormat *osync_converter_get_targetformat(OSyncFormatCo
nverter *converter); | | OSYNC_EXPORT OSyncObjFormat *osync_converter_get_targetformat(OSyncFormatCo
nverter *converter); | |
|
| | | | |
| | | /** | |
| | | * @brief Returns the type of a converter | |
| | | * @param converter Pointer to the converter | |
| | | * @returns The type of the specified converter | |
| | | */ | |
| OSYNC_EXPORT OSyncConverterType osync_converter_get_type(OSyncFormatConvert
er *converter); | | OSYNC_EXPORT OSyncConverterType osync_converter_get_type(OSyncFormatConvert
er *converter); | |
| | | | |
|
| | | /** | |
| | | * @brief Detects the Object Format of passed OSyncData | |
| | | * @param converter Pointer to the converter | |
| | | * @param data Pointer to OSyncData object which should be detected | |
| | | * @returns The detected Object Format or NULL | |
| | | */ | |
| OSYNC_EXPORT OSyncObjFormat *osync_converter_detect(OSyncFormatConverter *c
onverter, OSyncData *data); | | OSYNC_EXPORT OSyncObjFormat *osync_converter_detect(OSyncFormatConverter *c
onverter, OSyncData *data); | |
|
| | | | |
| | | /** | |
| | | * @brief Invokes converter for OSyncData object with passed format convert | |
| | | er configuration | |
| | | * | |
| | | * @param converter Pointer to the converter | |
| | | * @param data Pointer to OSyncData object which should be detected | |
| | | * @param config Format converter configuration | |
| | | * @param error Pointer to an error struct | |
| | | * @returns TRUE on successful conversion, FALSE on error | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_converter_invoke(OSyncFormatConverter *conver
ter, OSyncData *data, const char *config, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_converter_invoke(OSyncFormatConverter *conver
ter, OSyncData *data, const char *config, OSyncError **error); | |
|
| | | | |
| | | /** | |
| | | * @brief Checks if the Format Converter fits the Object Format of OSyncDat | |
| | | a object | |
| | | * @param converter Pointer to the converter | |
| | | * @param data Pointer to OSyncData object which should be converted | |
| | | * @returns TRUE if Object Format matches the Converter source format, FALS | |
| | | E otherwise | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_converter_matches(OSyncFormatConverter *conve
rter, OSyncData *data); | | OSYNC_EXPORT osync_bool osync_converter_matches(OSyncFormatConverter *conve
rter, OSyncData *data); | |
| | | | |
|
| | | /** | |
| | | * @brief Creates a new converter path | |
| | | * @param error Pointer to an error struct | |
| | | * @returns The pointer to the newly allocated converter path or NULL in ca | |
| | | se of error | |
| | | */ | |
| OSYNC_EXPORT OSyncFormatConverterPath *osync_converter_path_new(OSyncError
**error); | | OSYNC_EXPORT OSyncFormatConverterPath *osync_converter_path_new(OSyncError
**error); | |
|
| | | | |
| | | /** @brief Increase the reference count on a converter path | |
| | | * | |
| | | * @param path Pointer to the converter path | |
| | | * @returns Pointer of converter path object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncFormatConverterPath *osync_converter_path_ref(OSyncFormat
ConverterPath *path); | | OSYNC_EXPORT OSyncFormatConverterPath *osync_converter_path_ref(OSyncFormat
ConverterPath *path); | |
|
| | | | |
| | | /** @brief Decrease the reference count on a converter path | |
| | | * | |
| | | * @param path Pointer to the converter path | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_converter_path_unref(OSyncFormatConverterPath *path
); | | OSYNC_EXPORT void osync_converter_path_unref(OSyncFormatConverterPath *path
); | |
| | | | |
|
| | | /** @brief Add a converter to a converter path | |
| | | * @param path Pointer to the converter path | |
| | | * @param edge Pointer to the converter to add | |
| | | */ | |
| OSYNC_EXPORT void osync_converter_path_add_edge(OSyncFormatConverterPath *p
ath, OSyncFormatConverter *edge); | | OSYNC_EXPORT void osync_converter_path_add_edge(OSyncFormatConverterPath *p
ath, OSyncFormatConverter *edge); | |
|
| OSYNC_EXPORT unsigned int osync_converter_path_num_edges(OSyncFormatConvert | | | |
| erPath *path); | | /** @brief Returns configuration for converter path | |
| OSYNC_EXPORT OSyncFormatConverter *osync_converter_path_nth_edge(OSyncForma | | * @param path Pointer to the converter path | |
| tConverterPath *path, unsigned int nth); | | * @returns The converter path configuration | |
| | | */ | |
| OSYNC_EXPORT const char *osync_converter_path_get_config(OSyncFormatConvert
erPath *path); | | OSYNC_EXPORT const char *osync_converter_path_get_config(OSyncFormatConvert
erPath *path); | |
|
| | | | |
| | | /** @brief Sets the configuration for converter path | |
| | | * @param path Pointer to the converter path | |
| | | * @param config The converter path configuration | |
| | | */ | |
| OSYNC_EXPORT void osync_converter_path_set_config(OSyncFormatConverterPath
*path, const char *config); | | OSYNC_EXPORT void osync_converter_path_set_config(OSyncFormatConverterPath
*path, const char *config); | |
| | | | |
|
| | | /** | |
| | | * @brief Sets the initialize function of a converter | |
| | | * @param converter Pointer to the converter | |
| | | * @param initialize_func Pointer to the initialize function | |
| | | */ | |
| OSYNC_EXPORT void osync_converter_set_initialize_func(OSyncFormatConverter
*converter, OSyncFormatConverterInitializeFunc initialize_func); | | OSYNC_EXPORT void osync_converter_set_initialize_func(OSyncFormatConverter
*converter, OSyncFormatConverterInitializeFunc initialize_func); | |
|
| | | | |
| | | /** | |
| | | * @brief Sets the finalize function of a converter | |
| | | * @param converter Pointer to the converter | |
| | | * @param finalize_func Pointer to the finalize function | |
| | | */ | |
| OSYNC_EXPORT void osync_converter_set_finalize_func(OSyncFormatConverter *c
onverter, OSyncFormatConverterFinalizeFunc finalize_func); | | OSYNC_EXPORT void osync_converter_set_finalize_func(OSyncFormatConverter *c
onverter, OSyncFormatConverterFinalizeFunc finalize_func); | |
|
| | | | |
| | | /** | |
| | | * @brief Invokes initialize function of a converter | |
| | | * | |
| | | * @param converter Pointer to the converter which should be initialized | |
| | | * @param config configuration | |
| | | * @param error Pointer to an error struct | |
| | | * | |
| | | * @todo config is not used currently. Should be used in the future to pass | |
| | | a directory for xml format schema location | |
| | | */ | |
| OSYNC_EXPORT void osync_converter_initialize(OSyncFormatConverter *converte
r, const char *config, OSyncError **error); | | OSYNC_EXPORT void osync_converter_initialize(OSyncFormatConverter *converte
r, const char *config, OSyncError **error); | |
|
| OSYNC_EXPORT void osync_converter_finalize(OSyncFormatConverter *converter) | | | |
| ; | | /** | |
| | | * @brief Invokes finalize function of a converter | |
| | | * | |
| | | * @param converter Pointer to the converter which should be finalized | |
| | | * @param error Pointer to an error struct | |
| | | * @return TRUE on success, FALSE otherwise | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_converter_finalize(OSyncFormatConverter *conv | |
| | | erter, OSyncError **error); | |
| | | | |
| | | /** | |
| | | * @brief Returns a OSyncList of the format converters in this path | |
| | | * @param path Pointer to the OSyncFormatConverterPath | |
| | | * @return a shallow copy of the OSyncFormatConverter in the conversion pat | |
| | | h | |
| | | */ | |
| | | OSYNC_EXPORT OSyncList *osync_converter_path_get_edges(OSyncFormatConverter | |
| | | Path *path); | |
| | | | |
| | | /*@}*/ | |
| | | | |
| #endif //_OPENSYNC_CONVERTER_H_ | | #endif //_OPENSYNC_CONVERTER_H_ | |
| | | | |
End of changes. 22 change blocks. |
| 7 lines changed or deleted | | 162 lines changed or added | |
|
| opensync_data.h | | opensync_data.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENSYNC_DATA_H_ | | #ifndef _OPENSYNC_DATA_H_ | |
| #define _OPENSYNC_DATA_H_ | | #define _OPENSYNC_DATA_H_ | |
| | | | |
|
| | | /** | |
| | | * @defgroup OSyncData OpenSync Data Module | |
| | | * @ingroup OSyncPublic | |
| | | * @defgroup OSyncDataAPI OpenSync Data | |
| | | * @ingroup OSyncData | |
| | | * @brief Handles data within changes | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| | | /** @brief Create a new data object | |
| | | * | |
| | | * @param data Character buffer containing the data | |
| | | * @param size The size of the data contained in the buffer | |
| | | * @param format The object format of the data | |
| | | * @param error An error struct | |
| | | * @return The new data object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncData *osync_data_new(char *data, unsigned int size, OSync
ObjFormat *format, OSyncError **error); | | OSYNC_EXPORT OSyncData *osync_data_new(char *data, unsigned int size, OSync
ObjFormat *format, OSyncError **error); | |
|
| | | | |
| | | /** @brief Increase the reference count on a data object | |
| | | * | |
| | | * @param data The data object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncData *osync_data_ref(OSyncData *data); | | OSYNC_EXPORT OSyncData *osync_data_ref(OSyncData *data); | |
|
| | | | |
| | | /** @brief Decrease the reference count on a data object | |
| | | * | |
| | | * @param data The data object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_data_unref(OSyncData *data); | | OSYNC_EXPORT void osync_data_unref(OSyncData *data); | |
| | | | |
|
| | | /** @brief Get the object format from a data object | |
| | | * | |
| | | * @param data The data object | |
| | | * @return the object format of the data object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncObjFormat *osync_data_get_objformat(OSyncData *data); | | OSYNC_EXPORT OSyncObjFormat *osync_data_get_objformat(OSyncData *data); | |
|
| | | | |
| | | /** @brief Set the object format on a data object | |
| | | * | |
| | | * @param data The data object | |
| | | * @param objformat The object format to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_data_set_objformat(OSyncData *data, OSyncObjFormat
*objformat); | | OSYNC_EXPORT void osync_data_set_objformat(OSyncData *data, OSyncObjFormat
*objformat); | |
|
| | | | |
| | | /** @brief Get the object type from a data object | |
| | | * | |
| | | * @param data The data object | |
| | | * @return the name of the object type of the data object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_data_get_objtype(OSyncData *data); | | OSYNC_EXPORT const char *osync_data_get_objtype(OSyncData *data); | |
|
| | | | |
| | | /** @brief Set the object type of a data object | |
| | | * | |
| | | * @param data The data object | |
| | | * @param objtype The name of the object type to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_data_set_objtype(OSyncData *data, const char *objty
pe); | | OSYNC_EXPORT void osync_data_set_objtype(OSyncData *data, const char *objty
pe); | |
| | | | |
|
| | | /** @brief Get the data from a data object | |
| | | * | |
| | | * @param data The data object | |
| | | * @param buffer Pointer to a char * that will be set to point to the data | |
| | | if specified. Do not free this buffer. | |
| | | * @param size Pointer to an integer variable that will be set to the size | |
| | | of the data if specified | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_data_get_data(OSyncData *data, char **buffer, unsig
ned int *size); | | OSYNC_EXPORT void osync_data_get_data(OSyncData *data, char **buffer, unsig
ned int *size); | |
|
| OSYNC_EXPORT void osync_data_steal_data(OSyncData *data, char **buffer, uns | | | |
| igned int *size); | | /** @brief Set the data of a data object | |
| | | * | |
| | | * @param data The data object | |
| | | * @param buffer The data as a character array. Freeing this buffer will be | |
| | | handled by the data object. | |
| | | * @param size The size of the data contained in the buffer | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_data_set_data(OSyncData *data, char *buffer, unsign
ed int size); | | OSYNC_EXPORT void osync_data_set_data(OSyncData *data, char *buffer, unsign
ed int size); | |
|
| | | | |
| | | /** @brief Check if the data object has data stored | |
| | | * | |
| | | * @param data The data object | |
| | | * @return TRUE if the data object has data, FALSE otherwise | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_data_has_data(OSyncData *data); | | OSYNC_EXPORT osync_bool osync_data_has_data(OSyncData *data); | |
| | | | |
|
| | | /** @brief Returns a string describing a data object | |
| | | * | |
| | | * Some formats cannot be printed directly. To be able to print these | |
| | | * objects they should specify a print function. | |
| | | * | |
| | | * @param data The data to get printable | |
| | | * @param error An error struct | |
| | | * @return A string describing the object which must be freed by the caller | |
| | | with osync_free(). | |
| | | * NULL on an error. | |
| | | */ | |
| | | OSYNC_EXPORT char *osync_data_get_printable(OSyncData *data, OSyncError **e | |
| | | rror); | |
| | | | |
| | | /** @brief Clone a data object | |
| | | * | |
| | | * @param data The data object to clone | |
| | | * @param error An error struct | |
| | | * @return a copy of the specified data object, or NULL if an error occurre | |
| | | d | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncData *osync_data_clone(OSyncData *data, OSyncError **erro
r); | | OSYNC_EXPORT OSyncData *osync_data_clone(OSyncData *data, OSyncError **erro
r); | |
|
| OSYNC_EXPORT OSyncConvCmpResult osync_data_compare(OSyncData *leftdata, OSy
ncData *rightdata); | | | |
| | | | |
|
| OSYNC_EXPORT char *osync_data_get_printable(OSyncData *data); | | /** @brief Returns the revision of the object | |
| | | * | |
| | | * @param data The change to get the revision from | |
| | | * @param error An error struct | |
| | | * @return The revision of the object in seconds since the epoch in zulu ti | |
| | | me | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT time_t osync_data_get_revision(OSyncData *data, OSyncError **e
rror); | | OSYNC_EXPORT time_t osync_data_get_revision(OSyncData *data, OSyncError **e
rror); | |
|
| | | /*@}*/ | |
| | | | |
|
| #endif //_OPENSYNC_DATA_H_ | | #endif /* _OPENSYNC_DATA_H_ */ | |
| | | | |
End of changes. 15 change blocks. |
| 4 lines changed or deleted | | 113 lines changed or added | |
|
| opensync_engine.h | | opensync_engine.h | |
| /* | | /* | |
| * libopensync - A synchronization engine for the opensync framework | | * libopensync - A synchronization engine for the opensync framework | |
| * Copyright (C) 2004-2005 Armin Bauer <armin.bauer@opensync.org> | | * Copyright (C) 2004-2005 Armin Bauer <armin.bauer@opensync.org> | |
|
| * Copyright (C) 2007 Daniel Gollub <dgollub@suse.de> | | * Copyright (C) 2007 Daniel Gollub <gollub@b1-systems.de> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * 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, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Lesser General Public License for more details. | | * Lesser General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef OPENSYNC_ENGINE_H_ | | #ifndef OPENSYNC_ENGINE_H_ | |
| #define OPENSYNC_ENGINE_H_ | | #define OPENSYNC_ENGINE_H_ | |
| | | | |
|
| | | /** | |
| | | * @defgroup OSyncEngine OpenSync Engine Module | |
| | | * @ingroup OSyncPublic | |
| | | * @defgroup OSyncEngineAPI OpenSync Engine | |
| | | * @ingroup OSyncEngine | |
| | | * @brief Interface to start and control a synchronization | |
| | | * | |
| | | * The OpenSync Engine provide the interfaces to start a synchronization an | |
| | | d | |
| | | * to control various synchronization options. A synchronization process ca | |
| | | n | |
| | | * be started in a synchronous (blocking) and asynchronous way. | |
| | | * | |
| | | * Callback interfaces allow to dynamically influence the synchronization p | |
| | | rocess. | |
| | | * e.g. conflict callback, ... | |
| | | * | |
| | | * Other callbacks give frequent updates of the synchronization process, as | |
| | | well | |
| | | * as error message. | |
| | | * | |
| | | */ | |
| | | | |
| | | /*@{*/ | |
| | | | |
| | | /** | |
| | | * @brief Engine Commands | |
| | | **/ | |
| | | | |
| typedef enum { | | typedef enum { | |
|
| | | /** Initiate connect phase */ | |
| OSYNC_ENGINE_COMMAND_CONNECT = 1, | | OSYNC_ENGINE_COMMAND_CONNECT = 1, | |
|
| OSYNC_ENGINE_COMMAND_READ = 2, | | /** Finalize connect phase */ | |
| OSYNC_ENGINE_COMMAND_WRITE = 3, | | OSYNC_ENGINE_COMMAND_CONNECT_DONE, | |
| OSYNC_ENGINE_COMMAND_SYNC_DONE = 4, | | /** Read/Get latest changes or all records, depending on synchroniza | |
| OSYNC_ENGINE_COMMAND_DISCONNECT = 5, | | tion type */ | |
| OSYNC_ENGINE_COMMAND_SOLVE = 6, | | OSYNC_ENGINE_COMMAND_READ, | |
| OSYNC_ENGINE_COMMAND_DISCOVER = 7, | | /** Write/Commit changes */ | |
| OSYNC_ENGINE_COMMAND_ABORT = 8 | | OSYNC_ENGINE_COMMAND_WRITE, | |
| | | /** Finalize this synchronization */ | |
| | | OSYNC_ENGINE_COMMAND_SYNC_DONE, | |
| | | /* Disconnect */ | |
| | | OSYNC_ENGINE_COMMAND_DISCONNECT, | |
| | | /* Solve conflict(s) */ | |
| | | OSYNC_ENGINE_COMMAND_SOLVE, | |
| | | /* Discover resources and capabilities */ | |
| | | OSYNC_ENGINE_COMMAND_DISCOVER, | |
| | | /* Abort the currently running synchronization process */ | |
| | | OSYNC_ENGINE_COMMAND_ABORT, | |
| | | /* Map all reported changes */ | |
| | | OSYNC_ENGINE_COMMAND_MAP, | |
| | | /* Multiply all reported changes to all peers */ | |
| | | OSYNC_ENGINE_COMMAND_MULTIPLY, | |
| | | /* Check if all conflicts got solved */ | |
| | | OSYNC_ENGINE_COMMAND_END_CONFLICTS, | |
| | | /* Prepare write to peers */ | |
| | | OSYNC_ENGINE_COMMAND_PREPARE_WRITE, | |
| | | /* Prepare mapping of changes */ | |
| | | OSYNC_ENGINE_COMMAND_PREPARE_MAP | |
| } OSyncEngineCmd; | | } OSyncEngineCmd; | |
| | | | |
|
| | | /** | |
| | | * @brief Engine Status | |
| | | **/ | |
| typedef enum { | | typedef enum { | |
|
| | | /** Uninitialized */ | |
| OSYNC_ENGINE_STATE_UNINITIALIZED, | | OSYNC_ENGINE_STATE_UNINITIALIZED, | |
|
| | | /** Start Initialization **/ | |
| | | OSYNC_ENGINE_STATE_START_INIT, | |
| | | /** Initialized */ | |
| OSYNC_ENGINE_STATE_INITIALIZED, | | OSYNC_ENGINE_STATE_INITIALIZED, | |
|
| | | /** Waiting for synchronization request by a peer */ | |
| OSYNC_ENGINE_STATE_WAITING, | | OSYNC_ENGINE_STATE_WAITING, | |
|
| | | /** Connecting the peers */ | |
| OSYNC_ENGINE_STATE_CONNECTING, | | OSYNC_ENGINE_STATE_CONNECTING, | |
|
| | | /** Reading latest changes or all records, depending on synchronizat
ion type */ | |
| OSYNC_ENGINE_STATE_READING, | | OSYNC_ENGINE_STATE_READING, | |
|
| | | /** Writing changes to peers */ | |
| OSYNC_ENGINE_STATE_WRITING, | | OSYNC_ENGINE_STATE_WRITING, | |
|
| OSYNC_ENGINE_STATE_DISCONNECTING | | /** Disconnecting the peers */ | |
| | | OSYNC_ENGINE_STATE_DISCONNECTING, | |
| | | /** Creating mapping between the different reported records */ | |
| | | OSYNC_ENGINE_STATE_MAPPING, | |
| | | /** Multiplying all reported changes to all peers */ | |
| | | OSYNC_ENGINE_STATE_MULTIPLYING, | |
| | | /** Solving conflicts */ | |
| | | OSYNC_ENGINE_STATE_SOLVING | |
| } OSyncEngineState; | | } OSyncEngineState; | |
| | | | |
|
| | | /** | |
| | | * @brief Completed Engine Event | |
| | | **/ | |
| typedef enum { | | typedef enum { | |
|
| | | /** Initial connection phase of all peers are done */ | |
| OSYNC_ENGINE_EVENT_CONNECTED = 1, | | OSYNC_ENGINE_EVENT_CONNECTED = 1, | |
|
| OSYNC_ENGINE_EVENT_ERROR = 2, | | /** Connection phase to all all peers is completed */ | |
| OSYNC_ENGINE_EVENT_READ = 3, | | OSYNC_ENGINE_EVENT_CONNECT_DONE, | |
| OSYNC_ENGINE_EVENT_WRITTEN = 4, | | /** Error */ | |
| OSYNC_ENGINE_EVENT_SYNC_DONE = 5, | | OSYNC_ENGINE_EVENT_ERROR, | |
| OSYNC_ENGINE_EVENT_DISCONNECTED = 6, | | /** Read latest changes or all records, depending on synchronization | |
| OSYNC_ENGINE_EVENT_SUCCESSFUL = 7, | | type */ | |
| OSYNC_ENGINE_EVENT_END_CONFLICTS = 8, | | OSYNC_ENGINE_EVENT_READ, | |
| OSYNC_ENGINE_EVENT_PREV_UNCLEAN = 9 | | /** All changes got written */ | |
| | | OSYNC_ENGINE_EVENT_WRITTEN, | |
| | | /** Synchronization process got finalized */ | |
| | | OSYNC_ENGINE_EVENT_SYNC_DONE, | |
| | | /** All peers got disconnected */ | |
| | | OSYNC_ENGINE_EVENT_DISCONNECTED, | |
| | | /** Synchronization process was successful */ | |
| | | OSYNC_ENGINE_EVENT_SUCCESSFUL, | |
| | | /** All conflicts got solved */ | |
| | | OSYNC_ENGINE_EVENT_END_CONFLICTS, | |
| | | /** Previous synchronization process was unclean */ | |
| | | OSYNC_ENGINE_EVENT_PREV_UNCLEAN, | |
| | | /** All reported records got mapped */ | |
| | | OSYNC_ENGINE_EVENT_MAPPED, | |
| | | /** Multiplying of all reported changes is completed */ | |
| | | OSYNC_ENGINE_EVENT_MULTIPLIED, | |
| | | /** Engine completed with preparing a write */ | |
| | | OSYNC_ENGINE_EVENT_PREPARED_WRITE, | |
| | | /** Engine completed with preparing for the mapping */ | |
| | | OSYNC_ENGINE_EVENT_PREPARED_MAP | |
| } OSyncEngineEvent; | | } OSyncEngineEvent; | |
| | | | |
| typedef enum { | | typedef enum { | |
|
| OSYNC_CLIENT_EVENT_CONNECTED = 1, | | OSYNC_ENGINE_MEMBER_EVENT_CONNECTED = 1, | |
| OSYNC_CLIENT_EVENT_ERROR = 2, | | OSYNC_ENGINE_MEMBER_EVENT_CONNECT_DONE, | |
| OSYNC_CLIENT_EVENT_READ = 3, | | OSYNC_ENGINE_MEMBER_EVENT_ERROR, | |
| OSYNC_CLIENT_EVENT_WRITTEN = 4, | | OSYNC_ENGINE_MEMBER_EVENT_READ, | |
| OSYNC_CLIENT_EVENT_SYNC_DONE = 5, | | OSYNC_ENGINE_MEMBER_EVENT_WRITTEN, | |
| OSYNC_CLIENT_EVENT_DISCONNECTED = 6, | | OSYNC_ENGINE_MEMBER_EVENT_SYNC_DONE, | |
| OSYNC_CLIENT_EVENT_DISCOVERED = 7 | | OSYNC_ENGINE_MEMBER_EVENT_DISCONNECTED, | |
| } OSyncMemberEvent; | | OSYNC_ENGINE_MEMBER_EVENT_DISCOVERED | |
| | | } OSyncEngineMemberEvent; | |
| | | | |
| typedef enum { | | typedef enum { | |
|
| OSYNC_CHANGE_EVENT_READ = 1, | | OSYNC_ENGINE_CHANGE_EVENT_READ = 1, | |
| OSYNC_CHANGE_EVENT_WRITTEN = 2, | | OSYNC_ENGINE_CHANGE_EVENT_WRITTEN, | |
| OSYNC_CHANGE_EVENT_ERROR = 3 | | OSYNC_ENGINE_CHANGE_EVENT_ERROR | |
| } OSyncChangeEvent; | | } OSyncEngineChangeEvent; | |
| | | | |
| typedef enum { | | typedef enum { | |
|
| OSYNC_MAPPING_EVENT_SOLVED = 1, | | OSYNC_ENGINE_MAPPING_EVENT_SOLVED = 1, | |
| //OSYNC_MAPPING_EVENT_WRITTEN = 2, | | OSYNC_ENGINE_MAPPING_EVENT_ERROR | |
| OSYNC_MAPPING_EVENT_ERROR = 3 | | } OSyncEngineMappingEvent; | |
| } OSyncMappingEvent; | | | |
| | | | |
| /*! @brief Struct for the member status callback | | | |
| * @ingroup OSEnginePublic | | | |
| */ | | | |
| typedef struct OSyncMemberUpdate { | | | |
| /** The type of the status update */ | | | |
| OSyncMemberEvent type; | | | |
| char *objtype; | | | |
| /** The member for which the status update is */ | | | |
| OSyncMember *member; | | | |
| /** If the status was a error, this error will be set */ | | | |
| OSyncError *error; | | | |
| } OSyncMemberUpdate; | | | |
| | | | |
| /*! @brief Struct for the change status callback | | | |
| * @ingroup OSEnginePublic | | | |
| */ | | | |
| typedef struct OSyncChangeUpdate { | | | |
| /** The type of the status update */ | | | |
| OSyncChangeEvent type; | | | |
| /** The change for which the status update is */ | | | |
| OSyncChange *change; | | | |
| /** The id of the member which sent this change */ | | | |
| OSyncMember *member; | | | |
| /** The id of the mapping to which this change belongs if any */ | | | |
| int mapping_id; | | | |
| /** If the status was a error, this error will be set */ | | | |
| OSyncError *error; | | | |
| } OSyncChangeUpdate; | | | |
| | | | |
| /*! @brief Struct for the mapping status callback | | | |
| * @ingroup OSEnginePublic | | | |
| */ | | | |
| typedef struct OSyncMappingUpdate { | | | |
| /** The type of the status update */ | | | |
| OSyncMappingEvent type; | | | |
| /** If the mapping was already solved, this will have the id if the | | | |
| winning entry */ | | | |
| long long int winner; | | | |
| /** The mapping for which the status update is */ | | | |
| OSyncMapping *mapping; | | | |
| /** If the status was a error, this error will be set */ | | | |
| OSyncError *error; | | | |
| } OSyncMappingUpdate; | | | |
| | | | |
|
| /*! @brief Struct for the engine status callback | | /** @brief This will create a new engine for the given group | |
| * @ingroup OSEnginePublic | | * | |
| | | * This will create a new engine for the given group | |
| | | * | |
| | | * @param group A pointer to the group, for which you want to create a new | |
| | | engine | |
| | | * @param error A pointer to a error struct | |
| | | * @returns Pointer to a newly allocated OSyncEngine on success, NULL other | |
| | | wise | |
| | | * | |
| */ | | */ | |
|
| typedef struct OSyncEngineUpdate { | | | |
| /** The type of the status update */ | | | |
| OSyncEngineEvent type; | | | |
| /** If the status was a error, this error will be set */ | | | |
| OSyncError *error; | | | |
| } OSyncEngineUpdate; | | | |
| | | | |
| OSYNC_EXPORT OSyncEngine *osync_engine_new(OSyncGroup *group, OSyncError **
error); | | OSYNC_EXPORT OSyncEngine *osync_engine_new(OSyncGroup *group, OSyncError **
error); | |
| OSYNC_EXPORT OSyncEngine *osync_engine_ref(OSyncEngine *engine); | | OSYNC_EXPORT OSyncEngine *osync_engine_ref(OSyncEngine *engine); | |
| OSYNC_EXPORT void osync_engine_unref(OSyncEngine *engine); | | OSYNC_EXPORT void osync_engine_unref(OSyncEngine *engine); | |
| | | | |
|
| OSYNC_EXPORT void osync_engine_set_plugindir(OSyncEngine *engine, const cha | | | |
| r *dir); | | | |
| OSYNC_EXPORT void osync_engine_set_formatdir(OSyncEngine *engine, const cha | | | |
| r *dir); | | | |
| | | | |
| OSYNC_EXPORT OSyncGroup *osync_engine_get_group(OSyncEngine *engine); | | | |
| OSYNC_EXPORT OSyncArchive *osync_engine_get_archive(OSyncEngine *engine); | | | |
| | | | |
| OSYNC_EXPORT osync_bool osync_engine_initialize(OSyncEngine *engine, OSyncE
rror **error); | | OSYNC_EXPORT osync_bool osync_engine_initialize(OSyncEngine *engine, OSyncE
rror **error); | |
| OSYNC_EXPORT osync_bool osync_engine_finalize(OSyncEngine *engine, OSyncErr
or **error); | | OSYNC_EXPORT osync_bool osync_engine_finalize(OSyncEngine *engine, OSyncErr
or **error); | |
| | | | |
|
| | | /** @brief Starts to synchronize the given OSyncEngine | |
| | | * | |
| | | * This function synchronizes a given engine. The Engine has to be created | |
| | | * from a OSyncGroup before by using osync_engine_new(). This function will | |
| | | not block | |
| | | * | |
| | | * @param engine A pointer to the engine, which will be used to sync | |
| | | * @param error A pointer to a error struct | |
| | | * @returns TRUE on success, FALSE otherwise. Check the error on FALSE. Not | |
| | | e that this just says if the sync has been started successfully, not if the | |
| | | sync itself was successful | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_engine_synchronize(OSyncEngine *engine, OSync
Error **error); | | OSYNC_EXPORT osync_bool osync_engine_synchronize(OSyncEngine *engine, OSync
Error **error); | |
|
| | | | |
| | | /** @brief This function will synchronize once and block until the sync has | |
| | | finished | |
| | | * | |
| | | * This can be used to sync a group and wait for the synchronization end. D | |
| | | O NOT USE | |
| | | * osync_engine_wait_sync_end for this as this might introduce a race condi | |
| | | tion. | |
| | | * | |
| | | * @param engine A pointer to the engine, which to sync and wait for the sy | |
| | | nc end | |
| | | * @param error A pointer to an error struct | |
| | | * @returns TRUE on success, FALSE otherwise. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_engine_synchronize_and_block(OSyncEngine *eng
ine, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_engine_synchronize_and_block(OSyncEngine *eng
ine, OSyncError **error); | |
|
| | | | |
| | | /** @brief This function will block until a synchronization has ended | |
| | | * | |
| | | * This can be used to wait until the synchronization has ended. Note that | |
| | | this function will always | |
| | | * block until 1 sync has ended. It can be used before the sync has started | |
| | | , to wait for one auto-sync | |
| | | * to end | |
| | | * | |
| | | * @param engine A pointer to the engine, for which to wait for the sync en | |
| | | d | |
| | | * @param error Return location for the error if the sync was not successfu | |
| | | l | |
| | | * @returns TRUE on success, FALSE otherwise. | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_engine_wait_sync_end(OSyncEngine *engine, OSy
ncError **error); | | OSYNC_EXPORT osync_bool osync_engine_wait_sync_end(OSyncEngine *engine, OSy
ncError **error); | |
| | | | |
|
| | | /** @brief This function will discover the capabilities of a member | |
| | | * | |
| | | * This function discover a member of a given engine. The Engine has to be | |
| | | created | |
| | | * from a OSyncGroup before by using osync_engine_new(). This function will | |
| | | not block | |
| | | * The Engine MUST NOT be initialized by osync_engine_initilize(), but MUST | |
| | | finalized with | |
| | | * osync_engine_finalize(). | |
| | | * | |
| | | * FIXME: Automatically finalize the engine after discovery of member is fi | |
| | | nished. This | |
| | | * is needed by the frontend to allow easy use of non-blocking disco | |
| | | very. | |
| | | * | |
| | | * @param engine A pointer to the engine, which to discover the member and | |
| | | wait for the discover end | |
| | | * @param member A pointer to the member, which to discover | |
| | | * @param error A pointer to a error struct | |
| | | * @returns TRUE on success, FALSE otherwise. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_engine_discover(OSyncEngine *engine, OSyncMem
ber *member, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_engine_discover(OSyncEngine *engine, OSyncMem
ber *member, OSyncError **error); | |
|
| | | | |
| | | /** @brief This function will discover the member and block until the disco | |
| | | very has finished | |
| | | * | |
| | | * This can be used to discover a member and wait for the discovery end. | |
| | | * The engine MUST NOT be initialized or finalized. | |
| | | * | |
| | | * @param engine A pointer to the engine, which to discover the member and | |
| | | wait for the discover end | |
| | | * @param member A pointer to the member, which to discover | |
| | | * @param error A pointer to a error struct | |
| | | * @returns TRUE on success, FALSE otherwise. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_engine_discover_and_block(OSyncEngine *engine
, OSyncMember *member, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_engine_discover_and_block(OSyncEngine *engine
, OSyncMember *member, OSyncError **error); | |
| | | | |
|
| //OSYNC_EXPORT void osync_engine_pause(OSyncEngine *engine); | | /** @brief Aborts running synchronization | |
| | | * | |
| | | * This is aborting the current synchronization while flushing the pending | |
| | | * commands in the engine command queue and pushing the abort command on th | |
| | | is | |
| | | * queue. The abort command will send the disconnect command to the client/ | |
| | | plugins. | |
| | | * This could be also used within a conflict handler function which aborts | |
| | | the | |
| | | * synchronization instead of resolving the conflicts. | |
| | | * | |
| | | * This will also turn in the engine into error condition. | |
| | | * osync_error_has_error() will return TRUE once the abort got requested. | |
| | | * | |
| | | * FIXME: Currently aborting of the current synchronization is not yet perf | |
| | | ect! It | |
| | | * will not preempt already running commands. | |
| | | * | |
| | | * TODO: Review XMPM Benq patches for abort hander. Is sigaction really san | |
| | | e way | |
| | | * to abort? It's very important that the plugins get called with the | |
| | | disconnect | |
| | | * functions, since plugins/devices rely on clean termination of conn | |
| | | ections. | |
| | | * | |
| | | * TODO: Introduce plugin abort function for protocol specific abort implem | |
| | | entations | |
| | | * (SyncML?, OBEX-based?, ...?) | |
| | | * | |
| | | * @param engine A pointer to the engine with a running synchronization whi | |
| | | ch gets aborted. | |
| | | * @param error A pointer to a error struct | |
| | | * @returns TRUE on success, FALSE otherwise. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_engine_abort(OSyncEngine *engine, OSyncError
**error); | | OSYNC_EXPORT osync_bool osync_engine_abort(OSyncEngine *engine, OSyncError
**error); | |
| | | | |
|
| //OSYNC_EXPORT void osync_engine_one_iteration(OSyncEngine *engine); | | /** @brief Continue a halted/paused synchronization process. | |
| //OSYNC_EXPORT void osync_engine_flag_manual(OSyncEngine *engine); | | * | |
| | | * @param engine A pointer to the engine with a running synchronization whi | |
| typedef struct OSyncMappingEngine OSyncMappingEngine; | | ch got paused/halted. | |
| | | * @param error A pointer to a error struct | |
| | | * @returns TRUE on success, FALSE otherwise. | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_engine_continue(OSyncEngine *engine, OSyncErr | |
| | | or **error); | |
| | | | |
|
| //typedef void *(* osync_message_cb) (OSyncEngine *, OSyncClient *, const c
har *, void *, void *); | | | |
| typedef void (* osync_conflict_cb) (OSyncEngine *, OSyncMappingEngine *, vo
id *); | | typedef void (* osync_conflict_cb) (OSyncEngine *, OSyncMappingEngine *, vo
id *); | |
|
| typedef void (* osync_status_change_cb) (OSyncChangeUpdate *, void *); | | typedef void (* osync_multiply_cb) (OSyncEngine *, void *); | |
| typedef void (* osync_status_mapping_cb) (OSyncMappingUpdate *, void *); | | | |
| typedef void (* osync_status_member_cb) (OSyncMemberUpdate *, void *); | | typedef void (* osync_status_change_cb) (OSyncEngineChangeUpdate *, void *) | |
| | | ; | |
| | | OSYNC_EXPORT OSyncError *osync_engine_change_update_get_error(OSyncEngineCh | |
| | | angeUpdate *update); | |
| | | OSYNC_EXPORT OSyncEngineChangeEvent osync_engine_change_update_get_event(OS | |
| | | yncEngineChangeUpdate *update); | |
| | | OSYNC_EXPORT OSyncMember *osync_engine_change_update_get_member(OSyncEngine | |
| | | ChangeUpdate *update); | |
| | | OSYNC_EXPORT OSyncChange *osync_engine_change_update_get_change(OSyncEngine | |
| | | ChangeUpdate *update); | |
| | | | |
| | | typedef void (* osync_status_member_cb) (OSyncEngineMemberUpdate *, void *) | |
| | | ; | |
| | | OSYNC_EXPORT OSyncError *osync_engine_member_update_get_error(OSyncEngineMe | |
| | | mberUpdate *update); | |
| | | OSYNC_EXPORT OSyncEngineMemberEvent osync_engine_member_update_get_event(OS | |
| | | yncEngineMemberUpdate *update); | |
| | | OSYNC_EXPORT OSyncMember *osync_engine_member_update_get_member(OSyncEngine | |
| | | MemberUpdate *update); | |
| | | OSYNC_EXPORT const char *osync_engine_member_update_get_objtype(OSyncEngine | |
| | | MemberUpdate *update); | |
| | | | |
| | | typedef void (* osync_status_mapping_cb) (OSyncEngineMappingUpdate *, void | |
| | | *); | |
| | | OSYNC_EXPORT OSyncError *osync_engine_mapping_update_get_error(OSyncEngineM | |
| | | appingUpdate *update); | |
| | | OSYNC_EXPORT OSyncEngineMappingEvent osync_engine_mapping_update_get_event( | |
| | | OSyncEngineMappingUpdate *update); | |
| | | | |
| typedef void (* osync_status_engine_cb) (OSyncEngineUpdate *, void *); | | typedef void (* osync_status_engine_cb) (OSyncEngineUpdate *, void *); | |
|
| | | OSYNC_EXPORT OSyncError *osync_engine_update_get_error(OSyncEngineUpdate *u | |
| | | pdate); | |
| | | OSYNC_EXPORT OSyncEngineEvent osync_engine_update_get_event(OSyncEngineUpda | |
| | | te *update); | |
| | | | |
|
| /* OSYNC_EXPORT void osync_engine_set_message_callback(OSyncEngine *engine, | | /** @brief This will set the conflict handler for the given engine | |
| osync_message_cb callback, void *user_data);*/ | | * | |
| | | * The conflict handler will be called every time a conflict occurs | |
| | | * | |
| | | * @param engine A pointer to the engine, for which to set the callback | |
| | | * @param callback A pointer to a function which will receive the conflict | |
| | | * @param user_data Pointer to some data that will get passed to the callba | |
| | | ck function as the last argument | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_engine_set_conflict_callback(OSyncEngine *engine, o
sync_conflict_cb callback, void *user_data); | | OSYNC_EXPORT void osync_engine_set_conflict_callback(OSyncEngine *engine, o
sync_conflict_cb callback, void *user_data); | |
|
| | | | |
| | | /** @brief This will set the multiply handler for the given engine | |
| | | * | |
| | | * The multiply handler will be called after the engine multiplied all chan | |
| | | ges. | |
| | | * Intention is to summaries the ongoing synchronization process (e.g. What | |
| | | is going to change). | |
| | | * If callback is set, then the syncrhonization process is blocked until th | |
| | | e callback returned. | |
| | | * Callback gets directly called before writing changes to the peers (and b | |
| | | efore preparing for | |
| | | * writing). | |
| | | * | |
| | | * It's possible to abort the synchronization with osync_engine_abort() wit | |
| | | hin this callback. | |
| | | * | |
| | | * @param engine A pointer to the engine, for which to set the callback | |
| | | * @param callback A pointer to a function which will receive multiply summ | |
| | | ary | |
| | | * @param user_data Pointer to some data that will get passed to the callba | |
| | | ck function as the last argument | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT void osync_engine_set_multiply_callback(OSyncEngine *engine, o | |
| | | sync_multiply_cb callback, void *user_data); | |
| | | | |
| | | /** @brief This will set the change status handler for the given engine | |
| | | * | |
| | | * The change status handler will be called every time a new change is rece | |
| | | ived, written etc | |
| | | * | |
| | | * @param engine A pointer to the engine, for which to set the callback | |
| | | * @param callback A pointer to a function which will receive the change st | |
| | | atus | |
| | | * @param user_data Pointer to some data that will get passed to the status | |
| | | function as the last argument | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_engine_set_changestatus_callback(OSyncEngine *engin
e, osync_status_change_cb callback, void *user_data); | | OSYNC_EXPORT void osync_engine_set_changestatus_callback(OSyncEngine *engin
e, osync_status_change_cb callback, void *user_data); | |
|
| | | | |
| | | /** @brief This will set the mapping status handler for the given engine | |
| | | * | |
| | | * The mapping status handler will be called every time a mapping is update | |
| | | d | |
| | | * | |
| | | * @param engine A pointer to the engine, for which to set the callback | |
| | | * @param callback A pointer to a function which will receive the mapping s | |
| | | tatus | |
| | | * @param user_data Pointer to some data that will get passed to the status | |
| | | function as the last argument | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_engine_set_mappingstatus_callback(OSyncEngine *engi
ne, osync_status_mapping_cb callback, void *user_data); | | OSYNC_EXPORT void osync_engine_set_mappingstatus_callback(OSyncEngine *engi
ne, osync_status_mapping_cb callback, void *user_data); | |
|
| OSYNC_EXPORT void osync_engine_set_enginestatus_callback(OSyncEngine *engin | | | |
| e, osync_status_engine_cb callback, void *user_data); | | | |
| OSYNC_EXPORT void osync_engine_set_memberstatus_callback(OSyncEngine *engin | | | |
| e, osync_status_member_cb callback, void *user_data); | | | |
| | | | |
|
| OSYNC_EXPORT void osync_engine_event(OSyncEngine *engine, OSyncEngineEvent | | /** @brief This will set the engine status handler for the given engine | |
| event); | | * | |
| OSYNC_EXPORT osync_bool osync_engine_check_get_changes(OSyncEngine *engine) | | * The engine status handler will be called every time the engine is update | |
| ; | | d (started, stopped etc) | |
| | | * | |
| | | * @param engine A pointer to the engine, for which to set the callback | |
| | | * @param callback A pointer to a function which will receive the engine st | |
| | | atus | |
| | | * @param user_data Pointer to some data that will get passed to the status | |
| | | function as the last argument | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT void osync_engine_set_enginestatus_callback(OSyncEngine *engin | |
| | | e, osync_status_engine_cb callback, void *user_data); | |
| | | | |
|
| OSYNC_EXPORT int osync_engine_num_proxies(OSyncEngine *engine); | | /** @brief This will set the member status handler for the given engine | |
| OSYNC_EXPORT OSyncClientProxy *osync_engine_nth_proxy(OSyncEngine *engine, | | * | |
| int nth); | | * The member status handler will be called every time a member is updated | |
| OSYNC_EXPORT OSyncClientProxy *osync_engine_find_proxy(OSyncEngine *engine, | | (connects, disconnects etc) | |
| OSyncMember *member); | | * | |
| | | * @param engine A pointer to the engine, for which to set the callback | |
| | | * @param callback A pointer to a function which will receive the member st | |
| | | atus | |
| | | * @param user_data Pointer to some data that will get passed to the status | |
| | | function as the last argument | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT void osync_engine_set_memberstatus_callback(OSyncEngine *engin | |
| | | e, osync_status_member_cb callback, void *user_data); | |
| | | | |
|
| OSYNC_EXPORT int osync_engine_num_objengine(OSyncEngine *engine); | | /** @brief Find the Object Engine for a certain Object Type. | |
| OSYNC_EXPORT OSyncObjEngine *osync_engine_nth_objengine(OSyncEngine *engine | | * | |
| , int nth); | | * @param engine A pointer to the engine | |
| | | * @param objtype The string of an Object Type to look for | |
| | | * @returns Pointer of the found OSyncObjEngine, otherwise NULL | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncObjEngine *osync_engine_find_objengine(OSyncEngine *engin
e, const char *objtype); | | OSYNC_EXPORT OSyncObjEngine *osync_engine_find_objengine(OSyncEngine *engin
e, const char *objtype); | |
| | | | |
| OSYNC_EXPORT osync_bool osync_engine_mapping_solve(OSyncEngine *engine, OSy
ncMappingEngine *mapping_engine, OSyncChange *change, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_engine_mapping_solve(OSyncEngine *engine, OSy
ncMappingEngine *mapping_engine, OSyncChange *change, OSyncError **error); | |
| OSYNC_EXPORT osync_bool osync_engine_mapping_duplicate(OSyncEngine *engine,
OSyncMappingEngine *mapping_engine, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_engine_mapping_duplicate(OSyncEngine *engine,
OSyncMappingEngine *mapping_engine, OSyncError **error); | |
| OSYNC_EXPORT osync_bool osync_engine_mapping_ignore_conflict(OSyncEngine *e
ngine, OSyncMappingEngine *mapping_engine, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_engine_mapping_ignore_conflict(OSyncEngine *e
ngine, OSyncMappingEngine *mapping_engine, OSyncError **error); | |
| OSYNC_EXPORT osync_bool osync_engine_mapping_use_latest(OSyncEngine *engine
, OSyncMappingEngine *mapping_engine, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_engine_mapping_use_latest(OSyncEngine *engine
, OSyncMappingEngine *mapping_engine, OSyncError **error); | |
| | | | |
|
| | | /** @brief Repairs engine from failed synchronization processes. | |
| | | * | |
| | | * This needs to get called to repair every failed synchronization process, | |
| | | * when same engine should get used. (Without initalizing a new engine). | |
| | | * | |
| | | * @param engine A pointer to an already initialized but with an error affe | |
| | | cted engine | |
| | | * @param error A pointer to an empty error struct | |
| | | * @returns TRUE if repair process was succesful, FALSE otherwise. | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_engine_repair(OSyncEngine *engine, OSyncError | |
| | | **error); | |
| | | | |
| | | /** | |
| | | * @brief Returns the list of ObjEngines | |
| | | * | |
| | | * Please be aware that the returned list has to be freed with | |
| | | * osync_list_free. If it isn't freed there will be a memory leak. | |
| | | * | |
| | | * @param engine A Pointer to an OSyncEngine | |
| | | * @return a shellow copy of the internal list | |
| | | */ | |
| | | OSYNC_EXPORT OSyncList *osync_engine_get_objengines(OSyncEngine *engine); | |
| | | | |
| | | /*@}*/ | |
| | | | |
| #endif /*OPENSYNC_ENGINE_H_*/ | | #endif /*OPENSYNC_ENGINE_H_*/ | |
| | | | |
End of changes. 39 change blocks. |
| 121 lines changed or deleted | | 416 lines changed or added | |
|
| opensync_format_env.h | | opensync_format_env.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENSYNC_FORMAT_ENV_H_ | | #ifndef _OPENSYNC_FORMAT_ENV_H_ | |
| #define _OPENSYNC_FORMAT_ENV_H_ | | #define _OPENSYNC_FORMAT_ENV_H_ | |
| | | | |
|
| #include <opensync/opensync_list.h> | | /** | |
| | | * @defgroup OSyncPublic OpenSync Public API | |
| | | * @brief The public API of opensync | |
| | | * | |
| | | * This gives you an insight in the public API of opensync. | |
| | | * | |
| | | */ | |
| | | | |
|
| | | /** | |
| | | * @defgroup OSyncFormatEnvAPI OpenSync Format Environment | |
| | | * @ingroup OSyncFormat | |
| | | * @brief The public API of the OpenSync Format Environment | |
| | | * | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| | | /** @brief This will create a new OpenSync Format Environment | |
| | | * | |
| | | * The format environment will hold all information about format plugins. | |
| | | * | |
| | | * @returns A pointer to a newly allocated format environment. NULL on erro | |
| | | r. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncFormatEnv *osync_format_env_new(OSyncError **error); | | OSYNC_EXPORT OSyncFormatEnv *osync_format_env_new(OSyncError **error); | |
|
| OSYNC_EXPORT void osync_format_env_free(OSyncFormatEnv *env); | | | |
| | | /*! @brief Increases the reference counton an opensync plugin environment | |
| | | * | |
| | | * When storing a reference to an OSyncFormatEnv the reference count must b | |
| | | e | |
| | | * manually incremented. When the reference is no longer needed it should | |
| | | * be removed with osync_plugin_env_unref | |
| | | * | |
| | | * @param env Pointer to the environment to reference | |
| | | * @returns The environment passed in | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT OSyncFormatEnv *osync_format_env_ref(OSyncFormatEnv *env); | |
| | | | |
| | | /** @brief Decreases the reference count on an OSyncFormatEnv | |
| | | * | |
| | | * Decrements the reference count on an osync format environment. If | |
| | | * the reference count reaches zero the environment is freed and all | |
| | | * resources are unreferenced | |
| | | * | |
| | | * @param env Pointer to the environment | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT void osync_format_env_unref(OSyncFormatEnv *env); | |
| | | | |
| | | /** @brief Loads all format and conversion plugins | |
| | | * | |
| | | * This command will load all plugins for the conversion system. | |
| | | * If you dont change the path before it will load the plugins | |
| | | * from the default location | |
| | | * | |
| | | * @param env The format environment | |
| | | * @param path The path to load from or NULL if to load from default path | |
| | | * @param error The location to return a error to | |
| | | * @returns TRUE if successful, FALSE otherwise | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_format_env_load_plugins(OSyncFormatEnv *env,
const char *path, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_format_env_load_plugins(OSyncFormatEnv *env,
const char *path, OSyncError **error); | |
| | | | |
|
| OSYNC_EXPORT void osync_format_env_register_objformat(OSyncFormatEnv *env, | | /** @brief Register Object Format to the Format Environment | |
| OSyncObjFormat *format); | | * | |
| | | * @param env Pointer to the environment | |
| | | * @param format Pointer ot the Object Format which sould be registred | |
| | | * @param error The location to return a error to | |
| | | * @returns TRUE if successful, FALSE otherwise | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_format_env_register_objformat(OSyncFormatEnv | |
| | | *env, OSyncObjFormat *format, OSyncError **error); | |
| | | | |
| | | /** @brief Finds the object format with the given name | |
| | | * | |
| | | * @param env Pointer to the environment | |
| | | * @param name Name of the format type to find | |
| | | * @returns The object format, or NULL if not found | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncObjFormat *osync_format_env_find_objformat(OSyncFormatEnv
*env, const char *name); | | OSYNC_EXPORT OSyncObjFormat *osync_format_env_find_objformat(OSyncFormatEnv
*env, const char *name); | |
|
| OSYNC_EXPORT int osync_format_env_num_objformats(OSyncFormatEnv *env); | | | |
| OSYNC_EXPORT OSyncObjFormat *osync_format_env_nth_objformat(OSyncFormatEnv | | | |
| *env, int nth); | | | |
| | | | |
|
| OSYNC_EXPORT void osync_format_env_register_converter(OSyncFormatEnv *env, | | /** | |
| OSyncFormatConverter *converter); | | * @brief Return a OSyncList of all formats which are store inside this for | |
| | | mat environment | |
| | | * | |
| | | * Please be aware that the returned list has to be freed with | |
| | | * osync_list_free. If it isn't freed there will be a memory leak. | |
| | | * | |
| | | * @param A pointer to a OSyncFormatEnv | |
| | | * @return a shallow copy of all OSyncObjFormats stored in the format env | |
| | | */ | |
| | | OSYNC_EXPORT OSyncList *osync_format_env_get_objformats(OSyncFormatEnv *env | |
| | | ); | |
| | | | |
| | | /** @brief Registers Format Converter or Detector to Format Environment | |
| | | * | |
| | | * @param env The format environment | |
| | | * @param converter Pointer of the Format Converter or Detector | |
| | | * @param error An OSyncError | |
| | | * @returns TRUE on success, or FALSE | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_format_env_register_converter(OSyncFormatEnv | |
| | | *env, OSyncFormatConverter *converter, OSyncError **error); | |
| | | | |
| | | /** @brief Finds first converter with the given source and target format | |
| | | * | |
| | | * @param env Pointer to the environment | |
| | | * @param sourceformat The source format | |
| | | * @param targetformat The target format | |
| | | * @returns The converter, or NULL if not found | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncFormatConverter *osync_format_env_find_converter(OSyncFor
matEnv *env, OSyncObjFormat *sourceformat, OSyncObjFormat *targetformat); | | OSYNC_EXPORT OSyncFormatConverter *osync_format_env_find_converter(OSyncFor
matEnv *env, OSyncObjFormat *sourceformat, OSyncObjFormat *targetformat); | |
|
| | | | |
| | | /** @brief Returns a list of all converters with the given source and targe | |
| | | t format | |
| | | * | |
| | | * The returned list must be freed with osync_list_free(). The ref count o | |
| | | n each | |
| | | * OSyncFormatConverter is not increased. | |
| | | * | |
| | | * @param env Pointer to the environment | |
| | | * @param sourceformat The source format | |
| | | * @param targetformat The target format | |
| | | * @returns List of OSyncFormatConverter, or NULL if none found | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncList *osync_format_env_find_converters(OSyncFormatEnv *en
v, OSyncObjFormat *sourceformat, OSyncObjFormat *targetformat); | | OSYNC_EXPORT OSyncList *osync_format_env_find_converters(OSyncFormatEnv *en
v, OSyncObjFormat *sourceformat, OSyncObjFormat *targetformat); | |
|
| OSYNC_EXPORT int osync_format_env_num_converters(OSyncFormatEnv *env); | | | |
| OSYNC_EXPORT OSyncFormatConverter *osync_format_env_nth_converter(OSyncForm | | | |
| atEnv *env, int nth); | | | |
| | | | |
|
| OSYNC_EXPORT void osync_format_env_register_filter(OSyncFormatEnv *env, OSy | | /** @brief Registers Capabilities Converter to Format Environment | |
| ncCustomFilter *filter); | | * | |
| OSYNC_EXPORT int osync_format_env_num_filters(OSyncFormatEnv *env); | | * @param env The format environment | |
| OSYNC_EXPORT OSyncCustomFilter *osync_format_env_nth_filter(OSyncFormatEnv | | * @param converter Pointer of the Capabilities Converter | |
| *env, int nth); | | * @param error The location to return a error to | |
| | | * @returns TRUE if successful, FALSE otherwise | |
| | | | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_format_env_register_caps_converter(OSyncForma | |
| | | tEnv *env, OSyncCapsConverter *converter, OSyncError **error); | |
| | | | |
| | | /** @brief Finds first capabilities converter with the given source and tar | |
| | | get capsformat | |
| | | * | |
| | | * @param env Pointer to the environment | |
| | | * @param sourceformat The source format | |
| | | * @param targetformat The target format | |
| | | * @returns The converter, or NULL if not found | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT OSyncCapsConverter *osync_format_env_find_caps_converter(OSync | |
| | | FormatEnv *env, const char *sourcecapsformat, const char *targetcapsformat) | |
| | | ; | |
| | | | |
| | | /** @brief Returns a list of all capabilities converters with the given sou | |
| | | rce and target format | |
| | | * | |
| | | * The returned list must be freed with osync_list_free(). The ref count o | |
| | | n each | |
| | | * OSyncCapsConverter is not increased. | |
| | | * | |
| | | * @param env Pointer to the environment | |
| | | * @param sourceformat The source capabilities format | |
| | | * @param targetformat The target capabilities format | |
| | | * @returns List of OSyncCapsConverter, or NULL if none found | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT OSyncList *osync_format_env_find_caps_converters(OSyncFormatEn | |
| | | v *env, const char *sourcecapsformat, const char *targetcapsformat); | |
| | | | |
|
| | | /** | |
| | | * @brief Return a OSyncList of all converters which are store in this form | |
| | | at environment | |
| | | * | |
| | | * Please be aware that the returned list has to be freed with | |
| | | * osync_list_free. If it isn't freed there will be a memory leak. | |
| | | * | |
| | | * @param A pointer to a OSyncFormatEnv | |
| | | * @return a shallow copy of all OSyncFormatConverters stored in the format | |
| | | env | |
| | | */ | |
| | | OSYNC_EXPORT OSyncList *osync_format_env_get_converters(OSyncFormatEnv *env | |
| | | ); | |
| | | | |
| | | /** @brief Tries to detect the format of the given data object | |
| | | * | |
| | | * This will try to detect the format of the specified data object | |
| | | * and return it, but not set it. | |
| | | * | |
| | | * @param env The conversion environment to use | |
| | | * @param data The data object to detect | |
| | | * @returns The format on success, NULL otherwise | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncObjFormat *osync_format_env_detect_objformat(OSyncFormatE
nv *env, OSyncData *data); | | OSYNC_EXPORT OSyncObjFormat *osync_format_env_detect_objformat(OSyncFormatE
nv *env, OSyncData *data); | |
|
| OSYNC_EXPORT OSyncObjFormat *osync_format_env_detect_objformat_full(OSyncFo
rmatEnv *env, OSyncData *input, OSyncError **error); | | | |
| | | | |
|
| | | /** @brief Tries to detect the encapsulated format of the given data object | |
| | | * | |
| | | * This will try to detect the encapsulated format of the specified data ob | |
| | | ject | |
| | | * and return it, but not set it. It will try to deencapsulate it, detect i | |
| | | t, | |
| | | * deencapuslate it again etc until it cannot deencapsulate further. | |
| | | * | |
| | | * @param env The conversion environment to use | |
| | | * @param input The data object to detect | |
| | | * @param detected_format Reference to OSyncObjFormat which get set with de | |
| | | tected format, if any got detected | |
| | | * @param error The error-return location, get set on any error | |
| | | * @returns TRUE when format detection successfully completed, FALSE on any | |
| | | error. | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_format_env_detect_objformat_full(OSyncFormatE | |
| | | nv *env, OSyncData *input, OSyncObjFormat **detected_format, OSyncError **e | |
| | | rror); | |
| | | | |
| | | /** @brief Convert a data object using a specific conversion path | |
| | | * | |
| | | * This will convert the specified data object using the specified format | |
| | | * conversion path if possible. | |
| | | * | |
| | | * @param env The conversion environment to use | |
| | | * @param path The conversion path to follow | |
| | | * @param data The data object to convert | |
| | | * @param error The error-return location | |
| | | * @returns TRUE on success, FALSE otherwise | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_format_env_convert(OSyncFormatEnv *env, OSync
FormatConverterPath *path, OSyncData *data, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_format_env_convert(OSyncFormatEnv *env, OSync
FormatConverterPath *path, OSyncData *data, OSyncError **error); | |
| | | | |
|
| | | /** @brief Find a conversion path between two formats | |
| | | * | |
| | | * This will find a conversion path between two object formats | |
| | | * if possible. | |
| | | * | |
| | | * @param env The conversion environment to use | |
| | | * @param sourceformat The source format to be converted from | |
| | | * @param targetformat The target format to be converted to | |
| | | * @param error The error-return location | |
| | | * @returns The appropriate conversion path, or NULL if an error occurred. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncFormatConverterPath *osync_format_env_find_path(OSyncForm
atEnv *env, OSyncObjFormat *sourceformat, OSyncObjFormat *targetformat, OSy
ncError **error); | | OSYNC_EXPORT OSyncFormatConverterPath *osync_format_env_find_path(OSyncForm
atEnv *env, OSyncObjFormat *sourceformat, OSyncObjFormat *targetformat, OSy
ncError **error); | |
|
| | | | |
| | | /** @brief Find a conversion path from one format to one of a list of forma | |
| | | ts | |
| | | * | |
| | | * @param env The conversion environment to use | |
| | | * @param sourceformat The source format to be converted from | |
| | | * @param targets List of possible Object Format Sinks | |
| | | * @param error The error-return location | |
| | | * @returns The appropriate conversion path, or NULL if an error occurred. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncFormatConverterPath *osync_format_env_find_path_formats(O
SyncFormatEnv *env, OSyncObjFormat *sourceformat, OSyncList *targets, OSync
Error **error); | | OSYNC_EXPORT OSyncFormatConverterPath *osync_format_env_find_path_formats(O
SyncFormatEnv *env, OSyncObjFormat *sourceformat, OSyncList *targets, OSync
Error **error); | |
| | | | |
|
| | | /** @brief Find a conversion path from the source format to a specific form | |
| | | at with help of detectors. | |
| | | * | |
| | | * This will find a conversion path between two object formats | |
| | | * if possible. | |
| | | * | |
| | | * @param env The format environment to use | |
| | | * @param sourcedata The OSyncData object which should be converted and the | |
| | | detectors will run on | |
| | | * @param targetformat The target format to be converted to | |
| | | * @param preferred_format Format that should be preferred to build the con | |
| | | version path | |
| | | * @param error The error-return location | |
| | | * @return The appropriate conversion path, or NULL if an error occurred. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncFormatConverterPath *osync_format_env_find_path_with_dete
ctors(OSyncFormatEnv *env, OSyncData *sourcedata, OSyncObjFormat *targetfor
mat, const char *preferred_format, OSyncError **error); | | OSYNC_EXPORT OSyncFormatConverterPath *osync_format_env_find_path_with_dete
ctors(OSyncFormatEnv *env, OSyncData *sourcedata, OSyncObjFormat *targetfor
mat, const char *preferred_format, OSyncError **error); | |
|
| | | | |
| | | /** @brief Find a conversion path from one format to one of a list of forma | |
| | | ts with the help of detectors | |
| | | * | |
| | | * @param env The format environment to use | |
| | | * @param sourcedata The OSyncData object which should be converted and the | |
| | | detectors will run on | |
| | | * @param targets List of possible Object Format Sinks | |
| | | * @param preferred_format Format that should be preferred to build the con | |
| | | version path | |
| | | * @param error The error-return location | |
| | | * @returns The appropriate conversion path, or NULL if an error occurred. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncFormatConverterPath *osync_format_env_find_path_formats_w
ith_detectors(OSyncFormatEnv *env, OSyncData *sourcedata, OSyncList *target
s, const char *preferred_format, OSyncError **error); | | OSYNC_EXPORT OSyncFormatConverterPath *osync_format_env_find_path_formats_w
ith_detectors(OSyncFormatEnv *env, OSyncData *sourcedata, OSyncList *target
s, const char *preferred_format, OSyncError **error); | |
| | | | |
|
| #endif //_OPENSYNC_FORMAT_ENV_H_ | | /** @brief Registers Merger to Format Environment | |
| | | * | |
| | | * @param env The format environment | |
| | | * @param merger Pointer of the merger | |
| | | * @param error The location to return a error to | |
| | | * @returns TRUE if successful, FALSE otherwise | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_format_env_register_merger(OSyncFormatEnv *en | |
| | | v, OSyncMerger *merger, OSyncError **error); | |
| | | | |
| | | OSYNC_EXPORT OSyncMerger *osync_format_env_find_merger(OSyncFormatEnv *env, | |
| | | const char *objformat, const char *capsformat); | |
| | | | |
| | | /*@}*/ | |
| | | | |
| | | #endif /* _OPENSYNC_FORMAT_ENV_H_ */ | |
| | | | |
End of changes. 17 change blocks. |
| 18 lines changed or deleted | | 272 lines changed or added | |
|
| opensync_group.h | | opensync_group.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENSYNC_GROUP_H_ | | #ifndef _OPENSYNC_GROUP_H_ | |
| #define _OPENSYNC_GROUP_H_ | | #define _OPENSYNC_GROUP_H_ | |
| | | | |
|
| /*! @ingroup OSyncGroupAPI | | /** | |
| * @brief The lock state of a group | | * @defgroup OSyncGroup OpenSync Group Module | |
| | | * @ingroup OSyncPublic | |
| | | * @defgroup OSyncGroupAPI OpenSync Group | |
| | | * @ingroup OSyncGroup | |
| | | * @brief A groups represent several device or application that should be s | |
| | | ynchronized | |
| | | * | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| | | /** @brief The lock state of a group | |
| */ | | */ | |
| typedef enum { | | typedef enum { | |
| OSYNC_LOCK_OK, | | OSYNC_LOCK_OK, | |
| OSYNC_LOCKED, | | OSYNC_LOCKED, | |
| OSYNC_LOCK_STALE | | OSYNC_LOCK_STALE | |
| } OSyncLockState; | | } OSyncLockState; | |
| | | | |
| typedef enum { | | typedef enum { | |
| OSYNC_CONFLICT_RESOLUTION_UNKNOWN, | | OSYNC_CONFLICT_RESOLUTION_UNKNOWN, | |
| OSYNC_CONFLICT_RESOLUTION_DUPLICATE, | | OSYNC_CONFLICT_RESOLUTION_DUPLICATE, | |
| OSYNC_CONFLICT_RESOLUTION_IGNORE, | | OSYNC_CONFLICT_RESOLUTION_IGNORE, | |
| OSYNC_CONFLICT_RESOLUTION_NEWER, | | OSYNC_CONFLICT_RESOLUTION_NEWER, | |
| OSYNC_CONFLICT_RESOLUTION_SELECT | | OSYNC_CONFLICT_RESOLUTION_SELECT | |
| } OSyncConflictResolution; | | } OSyncConflictResolution; | |
| | | | |
|
| | | /** @brief Creates a new group for the given environment | |
| | | * | |
| | | * Creates a newly allocated group | |
| | | * | |
| | | * @param error Pointer to an error struct | |
| | | * @returns Pointer to a new group | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncGroup *osync_group_new(OSyncError **error); | | OSYNC_EXPORT OSyncGroup *osync_group_new(OSyncError **error); | |
|
| | | | |
| | | /** @brief Increase the reference count of the group | |
| | | * | |
| | | * @param group The group | |
| | | * @returns The referenced group pointer | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncGroup *osync_group_ref(OSyncGroup *group); | | OSYNC_EXPORT OSyncGroup *osync_group_ref(OSyncGroup *group); | |
|
| | | | |
| | | /** @brief Decrease the reference count of the group | |
| | | * | |
| | | * @param group The group | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_group_unref(OSyncGroup *group); | | OSYNC_EXPORT void osync_group_unref(OSyncGroup *group); | |
| | | | |
|
| OSYNC_EXPORT OSyncLockState osync_group_lock(OSyncGroup *group); | | /** @brief Locks a group | |
| | | * | |
| | | * Tries to acquire a lock for the given group. | |
| | | * | |
| | | * If the lock was successfully acquired, OSYNC_LOCK_OK will | |
| | | * be returned. | |
| | | * | |
| | | * If the lock was acquired, but a old lock file was detected, | |
| | | * OSYNC_LOCK_STALE will be returned. Use this to detect if the | |
| | | * last sync of this group was successful, or if this something crashed. | |
| | | * If you get this answer you should perform a slow-sync | |
| | | * | |
| | | * If the group is locked, OSYNC_LOCKED is returned | |
| | | * | |
| | | * @param group The group | |
| | | * @param error Pointer to an OSyncError struct | |
| | | * @returns if the lockfile was acquired | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT OSyncLockState osync_group_lock(OSyncGroup *group, OSyncError | |
| | | **error); | |
| | | | |
| | | /** @brief Unlocks a group | |
| | | * | |
| | | * @param group The group to unlock | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_group_unlock(OSyncGroup *group); | | OSYNC_EXPORT void osync_group_unlock(OSyncGroup *group); | |
| | | | |
|
| | | /** @brief Sets the name for the group | |
| | | * | |
| | | * Sets the name for a group | |
| | | * | |
| | | * @param group The group | |
| | | * @param name The name to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_group_set_name(OSyncGroup *group, const char *name)
; | | OSYNC_EXPORT void osync_group_set_name(OSyncGroup *group, const char *name)
; | |
|
| | | | |
| | | /** @brief Returns the name of a group | |
| | | * | |
| | | * Returns the name of a group | |
| | | * | |
| | | * @param group The group | |
| | | * @returns Name of the group | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_group_get_name(OSyncGroup *group); | | OSYNC_EXPORT const char *osync_group_get_name(OSyncGroup *group); | |
| | | | |
|
| | | /** @brief Saves the group to disc | |
| | | * | |
| | | * Saves the group to disc possibly creating the configdirectory | |
| | | * | |
| | | * @param group The group | |
| | | * @param error Pointer to an error struct | |
| | | * @returns TRUE on success, FALSE otherwise | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_group_save(OSyncGroup *group, OSyncError **er
ror); | | OSYNC_EXPORT osync_bool osync_group_save(OSyncGroup *group, OSyncError **er
ror); | |
|
| | | | |
| | | /** @brief Deletes a group from disc | |
| | | * | |
| | | * Deletes to group directories | |
| | | * | |
| | | * @param group The group | |
| | | * @param error Pointer to an error struct | |
| | | * @returns TRUE on success, FALSE otherwise | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_group_delete(OSyncGroup *group, OSyncError **
error); | | OSYNC_EXPORT osync_bool osync_group_delete(OSyncGroup *group, OSyncError **
error); | |
|
| | | | |
| | | /** @brief Reset all databases of a group (anchor, hashtable and archive) | |
| | | * | |
| | | * @param group The group | |
| | | * @param error Pointer to an error struct | |
| | | * @returns TRUE on success, FALSE otherwise | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_group_reset(OSyncGroup *group, OSyncError **e
rror); | | OSYNC_EXPORT osync_bool osync_group_reset(OSyncGroup *group, OSyncError **e
rror); | |
|
| | | | |
| | | /** @brief Loads a group from a directory | |
| | | * | |
| | | * Loads a group from a directory | |
| | | * | |
| | | * @param group The group object to load into | |
| | | * @param path The path to the config directory of the group | |
| | | * @param error Pointer to an error struct | |
| | | * @returns TRUE on success, FALSE otherwise | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_group_load(OSyncGroup *group, const char *pat
h, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_group_load(OSyncGroup *group, const char *pat
h, OSyncError **error); | |
| | | | |
|
| | | /** @brief Appends a member to the group | |
| | | * | |
| | | * Appends a member to the group | |
| | | * | |
| | | * @param group The group to which to append | |
| | | * @param member The member to append | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_group_add_member(OSyncGroup *group, OSyncMember *me
mber); | | OSYNC_EXPORT void osync_group_add_member(OSyncGroup *group, OSyncMember *me
mber); | |
|
| | | | |
| | | /** @brief Removes a member from the group | |
| | | * | |
| | | * @param group The group from which to remove | |
| | | * @param member The member to remove | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_group_remove_member(OSyncGroup *group, OSyncMember
*member); | | OSYNC_EXPORT void osync_group_remove_member(OSyncGroup *group, OSyncMember
*member); | |
|
| OSYNC_EXPORT OSyncMember *osync_group_find_member(OSyncGroup *group, int id | | | |
| ); | | | |
| OSYNC_EXPORT OSyncMember *osync_group_nth_member(OSyncGroup *group, int nth | | | |
| ); | | | |
| OSYNC_EXPORT int osync_group_num_members(OSyncGroup *group); | | | |
| | | | |
|
| | | /** @brief Searches for a member by its id | |
| | | * | |
| | | * @param group The group in which to search | |
| | | * @param id The id of the member | |
| | | * @returns The member, or NULL if not found | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT OSyncMember *osync_group_find_member(OSyncGroup *group, long l | |
| | | ong int id); | |
| | | | |
| | | /** | |
| | | * @brief Returns a OSyncList that contains the OSyncMembers of this group | |
| | | * | |
| | | * Please be aware that the returned list has to be freed with | |
| | | * osync_list_free. If it isn't freed there will be a memory leak. | |
| | | * | |
| | | * @param group A pointer to a OSyncGroup | |
| | | * @return A shallow copy of the internal list of OSyncMembers | |
| | | */ | |
| | | OSYNC_EXPORT OSyncList *osync_group_get_members(OSyncGroup *group); | |
| | | | |
| | | /** @brief Returns the configdir for the group | |
| | | * | |
| | | * Returns the configdir for the group | |
| | | * | |
| | | * @param group The group | |
| | | * @returns String with the path of the config directory | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_group_get_configdir(OSyncGroup *group); | | OSYNC_EXPORT const char *osync_group_get_configdir(OSyncGroup *group); | |
|
| | | | |
| | | /** @brief Sets the configdir of the group | |
| | | * | |
| | | * @param group The group | |
| | | * @param directory The new configdir | |
| | | * @returns String with the path of the config directory | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_group_set_configdir(OSyncGroup *group, const char *
directory); | | OSYNC_EXPORT void osync_group_set_configdir(OSyncGroup *group, const char *
directory); | |
| | | | |
|
| OSYNC_EXPORT int osync_group_num_objtypes(OSyncGroup *group); | | /** | |
| OSYNC_EXPORT const char *osync_group_nth_objtype(OSyncGroup *group, int nth | | * @brief Returns a OSyncList that contains the objtype of this group | |
| ); | | * | |
| | | * Please be aware that the returned list has to be freed with | |
| | | * osync_list_free. If it isn't freed there will be a memory leak. | |
| | | * | |
| | | * @param group A pointer to a OSyncGroup | |
| | | * @return A shallow copy of the internal list of objtypes (const char*) | |
| | | */ | |
| | | OSYNC_EXPORT OSyncList *osync_group_get_objtypes(OSyncGroup *group); | |
| | | | |
| | | /** @brief Change the status of an object type in the group. | |
| | | * | |
| | | * @param group The group | |
| | | * @param objtype Name of the object type | |
| | | * @param enabled The status of the object type to set. TRUE enable, FALSE | |
| | | disable objtype. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_group_set_objtype_enabled(OSyncGroup *group, const
char *objtype, osync_bool enabled); | | OSYNC_EXPORT void osync_group_set_objtype_enabled(OSyncGroup *group, const
char *objtype, osync_bool enabled); | |
|
| OSYNC_EXPORT int osync_group_objtype_enabled(OSyncGroup *group, const char
*objtype); | | | |
| | | | |
|
| OSYNC_EXPORT void osync_group_add_filter(OSyncGroup *group, OSyncFilter *fi | | /** @brief Get the status of an object type in the group | |
| lter); | | * | |
| OSYNC_EXPORT void osync_group_remove_filter(OSyncGroup *group, OSyncFilter | | * @param group The group | |
| *filter); | | * @param objtype The name of the object type | |
| OSYNC_EXPORT int osync_group_num_filters(OSyncGroup *group); | | * @returns TRUE if object type is enabled in this group, otherwise FALSE | |
| OSYNC_EXPORT OSyncFilter *osync_group_nth_filter(OSyncGroup *group, int nth | | * | |
| ); | | */ | |
| | | OSYNC_EXPORT osync_bool osync_group_objtype_enabled(OSyncGroup *group, cons | |
| | | t char *objtype); | |
| | | | |
|
| OSYNC_EXPORT void osync_group_set_last_synchronization(OSyncGroup *group, t | | /** @brief Gets the last synchronization date from this group | |
| ime_t last_sync); | | * | |
| | | * The information will available on the group after osync_group_load() | |
| | | * | |
| | | * @param group The group | |
| | | * @return The synchronization info | |
| | | */ | |
| OSYNC_EXPORT time_t osync_group_get_last_synchronization(OSyncGroup *group)
; | | OSYNC_EXPORT time_t osync_group_get_last_synchronization(OSyncGroup *group)
; | |
| | | | |
|
| OSYNC_EXPORT void osync_group_set_conflict_resolution(OSyncGroup *group, OS | | /** @brief Set fixed conflict resolution for the group for all appearing co | |
| yncConflictResolution res, int num); | | nflicts | |
| OSYNC_EXPORT void osync_group_get_conflict_resolution(OSyncGroup *group, OS | | * | |
| yncConflictResolution *res, int *num); | | * @param group The group | |
| | | * @param res The conflict resolution | |
| | | * @param winner The Member ID which solves the conflict (winner) | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT void osync_group_set_conflict_resolution(OSyncGroup *group, OS | |
| | | yncConflictResolution res, long long int winner); | |
| | | | |
| | | /** @brief Get fixed conflict resolution for the group for all appearing co | |
| | | nflicts | |
| | | * | |
| | | * @param group The group | |
| | | * @param res Pointer to set conflict resolution value | |
| | | * @param winner Pointer to set Member ID value which solves the conflict ( | |
| | | winner) | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT void osync_group_get_conflict_resolution(OSyncGroup *group, OS | |
| | | yncConflictResolution *res, long long int *winner); | |
| | | | |
|
| | | /** @brief Get group configured status of merger use. | |
| | | * | |
| | | * @param group The group | |
| | | * @return TRUE if merger is enabled. FALSE if merger is disabled. | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_group_get_merger_enabled(OSyncGroup *group); | | OSYNC_EXPORT osync_bool osync_group_get_merger_enabled(OSyncGroup *group); | |
|
| OSYNC_EXPORT void osync_group_set_merger_enabled(OSyncGroup *group, osync_b
ool enable_merger); | | | |
| | | | |
|
| | | /** @brief Configure status of merger use. | |
| | | * | |
| | | * @param group The group | |
| | | * @param merger_enabled TRUE enables the merger. FALSE disables the merger | |
| | | . | |
| | | */ | |
| | | OSYNC_EXPORT void osync_group_set_merger_enabled(OSyncGroup *group, osync_b | |
| | | ool merger_enabled); | |
| | | | |
| | | /** @brief Get group configured status of converter use. | |
| | | * | |
| | | * @param group The group | |
| | | * @return TRUE if converter is enabled. FALSE if converter is disabled. | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_group_get_converter_enabled(OSyncGroup *group
); | | OSYNC_EXPORT osync_bool osync_group_get_converter_enabled(OSyncGroup *group
); | |
|
| OSYNC_EXPORT void osync_group_set_converter_enabled(OSyncGroup *group, osyn
c_bool enable_converter); | | | |
| | | | |
|
| | | /** @brief Configure status of converter use. | |
| | | * | |
| | | * @param group The group | |
| | | * @param converter_enabled TRUE enables the converter. FALSE disables the | |
| | | converter. | |
| | | */ | |
| | | OSYNC_EXPORT void osync_group_set_converter_enabled(OSyncGroup *group, osyn | |
| | | c_bool converter_enabled); | |
| | | | |
| | | /** @brief Check if group configuration is up to date. | |
| | | * | |
| | | * @param group The group | |
| | | * @returns TRUE if the group configuration is up to date, FALSE otherwise. | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_group_is_uptodate(OSyncGroup *group); | | OSYNC_EXPORT osync_bool osync_group_is_uptodate(OSyncGroup *group); | |
| | | | |
|
| | | /*@}*/ | |
| | | | |
| #endif /* _OPENSYNC_GROUP_H_ */ | | #endif /* _OPENSYNC_GROUP_H_ */ | |
| | | | |
End of changes. 27 change blocks. |
| 27 lines changed or deleted | | 259 lines changed or added | |
|
| opensync_hashtable.h | | opensync_hashtable.h | |
| /* | | /* | |
| * libopensync - A synchronization framework | | * libopensync - A synchronization framework | |
| * Copyright (C) 2004-2005 Armin Bauer <armin.bauer@opensync.org> | | * Copyright (C) 2004-2005 Armin Bauer <armin.bauer@opensync.org> | |
|
| * Copyright (C) 2008 Daniel Gollub <dgollub@suse.de> | | * Copyright (C) 2008 Daniel Gollub <gollub@b1-systems.de> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * 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, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Lesser General Public License for more details. | | * Lesser General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef OPENSYNC_HASHTABLE_H_ | | #ifndef OPENSYNC_HASHTABLE_H_ | |
| #define OPENSYNC_HASHTABLE_H_ | | #define OPENSYNC_HASHTABLE_H_ | |
| | | | |
|
| #include <opensync/opensync_list.h> | | | |
| | | | |
| typedef void (*OSyncHashtableForEach) (const char *uid, const char *hash, v
oid *user_data); | | typedef void (*OSyncHashtableForEach) (const char *uid, const char *hash, v
oid *user_data); | |
| | | | |
|
| OSYNC_EXPORT OSyncHashTable *osync_hashtable_new(const char *path, const ch | | /** | |
| ar *objtype, OSyncError **error); | | * @defgroup OSyncHashtableAPI OpenSync Hashtables | |
| | | * @ingroup OSyncHelper | |
| OSYNC_EXPORT OSyncHashTable *osync_hashtable_ref(OSyncHashTable *table); | | * @brief A Hashtable can be used to detect changes | |
| OSYNC_EXPORT void osync_hashtable_unref(OSyncHashTable *table); | | * | |
| | | * Hashtables can be used to detect changes since the last invocation. They | |
| OSYNC_EXPORT osync_bool osync_hashtable_load(OSyncHashTable *table, OSyncEr | | do this | |
| ror **error); | | * by keeping track of all reported uids and the hashes of the objects. | |
| OSYNC_EXPORT osync_bool osync_hashtable_save(OSyncHashTable *table, OSyncEr | | * | |
| ror **error); | | * A hash is a string that changes when an object is updated or when the co | |
| | | ntent of | |
| | | * the object changes. So hashes can either be a real hash like an MD5, or | |
| | | something | |
| | | * like a timestamp. The only important thing is that the hash changes when | |
| | | the item | |
| | | * gets updated. | |
| | | * | |
| | | * The hashtable is created from a .db file using the osync_hashtable_new() | |
| | | function. | |
| | | * | |
| | | * With osync_hashtable_load() the pertinent database gets read and loads a | |
| | | ll hashtable | |
| | | * entries into memory. | |
| | | * | |
| | | * Now you can query and alter the hashtable in memory. You can ask if a it | |
| | | em has changed | |
| | | * by doing: | |
| | | * | |
| | | * - osync_hashtable_get_changetype() | |
| | | * To get the changetype of a certain OSyncChange object. Don't forget to | |
| | | update the hash for | |
| | | * the change in advance. Update your OSyncChange with this detect change | |
| | | type with | |
| | | * osync_change_set_changetype() | |
| | | * | |
| | | * - osync_hashtable_update_change() | |
| | | * When the changetype got updated for the OSyncChange object, update the | |
| | | hash entry with | |
| | | * calling osync_hashtable_update_change(). Call this function even if th | |
| | | e entry has changetype | |
| | | * unmodified. Otherwise the hashtable will report this entry later as de | |
| | | leted. | |
| | | * | |
| | | * - osync_hashtable_get_deleted() | |
| | | * Once all available changes got reported call osync_hashtable_get_delet | |
| | | ed() to get an OSyncList | |
| | | * of changes which got deleted since last sync. Entries get determined a | |
| | | s deleted if they | |
| | | * got not reported as osync_hashtable_update_change(), independent of th | |
| | | e changetype. | |
| | | * | |
| | | * - osync_hashtable_save() | |
| | | * For performance reason the hashtable in memory got only stored persist | |
| | | ence with calling | |
| | | * osync_hashtable_save(). Call this function everytime when the synchron | |
| | | ization finished. | |
| | | * This is usually inside the sync_done() function. | |
| | | * | |
| | | * After you are finished using the hashtable, call: | |
| | | * - osync_hashtable_unref() | |
| | | * | |
| | | * The hashtable works like this: | |
| | | * | |
| | | * First the items are reported with a certain uid or hash. If the uid does | |
| | | not yet | |
| | | * exist in the database it is reported as ADDED. If the uid exists and the | |
| | | hash is different | |
| | | * it is reported as MODIFIED. If the uid exists but the hash is the same i | |
| | | t means that the | |
| | | * object is UNMODIFIED. | |
| | | * | |
| | | * To be able to report deleted objects the hashtables keeps track of the u | |
| | | ids you reported. | |
| | | * After you are done with asking the hashtable for changes you can ask it | |
| | | for deleted objects. | |
| | | * All items that are in the hashtable but where not reported by you have t | |
| | | o be DELETED. | |
| | | * | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
|
| | | /** @brief Prepares the hashtable for a slowsync and flush the entire hasht | |
| | | able | |
| | | * | |
| | | * This function should be called to prepare the hashtable for a slowsync. | |
| | | * The entire database, which stores the values of the hashtable beyond the | |
| | | * synchronization, will be flushed. | |
| | | * | |
| | | * @param table The hashtable | |
| | | * @param error An error struct | |
| | | * @returns TRUE on success, or FALSE if an error occurred. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_hashtable_slowsync(OSyncHashTable *table, OSy
ncError **error); | | OSYNC_EXPORT osync_bool osync_hashtable_slowsync(OSyncHashTable *table, OSy
ncError **error); | |
| | | | |
|
| OSYNC_EXPORT unsigned int osync_hashtable_num_entries(OSyncHashTable *table | | /** @brief Call a function over all of the entries | |
| ); | | * | |
| | | * @param table The hashtable to operate on | |
| | | * @param func The function to call for each entry | |
| | | * @param user_data Pointer to custom data to send to the function | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_hashtable_foreach(OSyncHashTable *table, OSyncHasht
ableForEach func, void *user_data); | | OSYNC_EXPORT void osync_hashtable_foreach(OSyncHashTable *table, OSyncHasht
ableForEach func, void *user_data); | |
| | | | |
|
| | | /** @brief Update an entry from a change | |
| | | * | |
| | | * Updates the entry in the hashtable. Use this even if the change entry | |
| | | * is unmodified! Usually this function get called in get_changes(). In som | |
| | | e | |
| | | * rare cases this get even called inside of the commit() plugin functions, | |
| | | * to update the UID inside the hashtable of a changed entry. | |
| | | * | |
| | | * @param table The hashtable | |
| | | * @param change The change object for the entry | |
| | | */ | |
| OSYNC_EXPORT void osync_hashtable_update_change(OSyncHashTable *table, OSyn
cChange *change); | | OSYNC_EXPORT void osync_hashtable_update_change(OSyncHashTable *table, OSyn
cChange *change); | |
| | | | |
|
| //OSYNC_EXPORT void osync_hashtable_report(OSyncHashTable *table, OSyncChan | | /** @brief Get a list of uids which are marked as deleted | |
| ge *change); | | * | |
| //OSYNC_EXPORT void osync_hashtable_reset_reports(OSyncHashTable *table); | | * @param table The hashtable | |
| | | * @returns OSyncList containing UIDs of deleted entries. Caller is respons | |
| | | ible for freeing the ist, | |
| | | * not the content, with osync_list_free() . | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncList *osync_hashtable_get_deleted(OSyncHashTable *table); | | OSYNC_EXPORT OSyncList *osync_hashtable_get_deleted(OSyncHashTable *table); | |
|
| | | | |
| | | /** @brief Gets the changetype for the given OSyncChange object, by compari | |
| | | ng the hashes | |
| | | * of the hashtable and OSyncChange object. | |
| | | * | |
| | | * This function does not report the change so if you only use this functio | |
| | | n then | |
| | | * the object will get reported as deleted! Please use osync_hashtable_upda | |
| | | te_change() for reporting | |
| | | * a change. | |
| | | * | |
| | | * @param table The hashtable | |
| | | * @param change The change object for the entry | |
| | | * @returns The changetype | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncChangeType osync_hashtable_get_changetype(OSyncHashTable
*table, OSyncChange *change); | | OSYNC_EXPORT OSyncChangeType osync_hashtable_get_changetype(OSyncHashTable
*table, OSyncChange *change); | |
|
| | | | |
| | | /** @brief Get the hash of an entry | |
| | | * | |
| | | * @param table The hashtable | |
| | | * @param uid the uid of the entry to find | |
| | | * @returns the hash for the entry, or NULL if not found | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_hashtable_get_hash(OSyncHashTable *table, co
nst char *uid); | | OSYNC_EXPORT const char *osync_hashtable_get_hash(OSyncHashTable *table, co
nst char *uid); | |
| | | | |
|
| | | /*@}*/ | |
| | | | |
| #endif /* OPENSYNC_HASHTABLE_H_ */ | | #endif /* OPENSYNC_HASHTABLE_H_ */ | |
| | | | |
End of changes. 10 change blocks. |
| 19 lines changed or deleted | | 145 lines changed or added | |
|
| opensync_member.h | | opensync_member.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENSYNC_MEMBER_H_ | | #ifndef _OPENSYNC_MEMBER_H_ | |
| #define _OPENSYNC_MEMBER_H_ | | #define _OPENSYNC_MEMBER_H_ | |
| | | | |
|
| #include <opensync/opensync_list.h> | | /** | |
| | | * @defgroup OSyncMemberAPI OpenSync Member | |
| | | * @ingroup OSyncGroup | |
| | | * @brief Used to manipulate members, which represent one device or applica | |
| | | tion in a group | |
| | | * | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
|
| | | /** @brief Creates a new member for a group | |
| | | * | |
| | | * @param error Pointer to a error-struct | |
| | | * @returns A newly allocated member | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncMember *osync_member_new(OSyncError **error); | | OSYNC_EXPORT OSyncMember *osync_member_new(OSyncError **error); | |
|
| | | | |
| | | /** @brief Increase the reference count of the member | |
| | | * | |
| | | * @param member The member | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncMember *osync_member_ref(OSyncMember *member); | | OSYNC_EXPORT OSyncMember *osync_member_ref(OSyncMember *member); | |
|
| | | | |
| | | /** @brief Decrease the reference count of the member | |
| | | * | |
| | | * @param member The member | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_member_unref(OSyncMember *member); | | OSYNC_EXPORT void osync_member_unref(OSyncMember *member); | |
| | | | |
|
| | | /** @brief Returns the name of the default plugin of the member | |
| | | * | |
| | | * @param member The member | |
| | | * @returns The name of the plugin | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_member_get_pluginname(OSyncMember *member); | | OSYNC_EXPORT const char *osync_member_get_pluginname(OSyncMember *member); | |
|
| | | | |
| | | /** @brief Sets the name of the default plugin of a member | |
| | | * | |
| | | * @param member The member | |
| | | * @param pluginname The name of the default plugin | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_member_set_pluginname(OSyncMember *member, const ch
ar *pluginname); | | OSYNC_EXPORT void osync_member_set_pluginname(OSyncMember *member, const ch
ar *pluginname); | |
| | | | |
|
| | | /** @brief Returns the inidividual name of the member | |
| | | * | |
| | | * @param member The member | |
| | | * @returns The name of the plugin | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_member_get_name(OSyncMember *member); | | OSYNC_EXPORT const char *osync_member_get_name(OSyncMember *member); | |
|
| | | | |
| | | /** @brief Sets an individual name of the member | |
| | | * | |
| | | * @param member The member | |
| | | * @param name The individual name of the member | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_member_set_name(OSyncMember *member, const char *na
me); | | OSYNC_EXPORT void osync_member_set_name(OSyncMember *member, const char *na
me); | |
| | | | |
|
| | | /** @brief Returns the configuration directory where this member is stored | |
| | | * | |
| | | * @param member The member | |
| | | * @returns The configuration directory | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_member_get_configdir(OSyncMember *member); | | OSYNC_EXPORT const char *osync_member_get_configdir(OSyncMember *member); | |
|
| | | | |
| | | /** @brief Sets the directory where a member is supposed to be stored | |
| | | * | |
| | | * @param member The member | |
| | | * @param configdir The name of the directory | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_member_set_configdir(OSyncMember *member, const cha
r *configdir); | | OSYNC_EXPORT void osync_member_set_configdir(OSyncMember *member, const cha
r *configdir); | |
| | | | |
|
| | | /** @brief Checks if Member has configuration | |
| | | * | |
| | | * @param member The member | |
| | | * @returns TURE if member has configuration, FALSE otherwise | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_member_has_config(OSyncMember *member); | | OSYNC_EXPORT osync_bool osync_member_has_config(OSyncMember *member); | |
|
| | | | |
| | | /** @brief Gets the configuration data of this member | |
| | | * | |
| | | * The config file is read in this order: | |
| | | * - If there is a configuration in memory that is not yet saved | |
| | | * this is returned | |
| | | * - If there is a config file in the member directory this is read | |
| | | * and returned | |
| | | * - Otherwise the default config file is loaded from one the opensync | |
| | | * directories | |
| | | * | |
| | | * @param member The member | |
| | | * @param error Pointer to a error | |
| | | * @returns The member configuration of the plugin default configuration if | |
| | | the member isn't configuered already | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginConfig *osync_member_get_config_or_default(OSyncMem
ber *member, OSyncError **error); | | OSYNC_EXPORT OSyncPluginConfig *osync_member_get_config_or_default(OSyncMem
ber *member, OSyncError **error); | |
|
| | | | |
| | | /** @brief Gets the configuration data of this member | |
| | | * | |
| | | * The config file is read in this order: | |
| | | * - If there is a configuration in memory that is not yet saved | |
| | | * this is returned | |
| | | * - If there is a config file in the member directory this is read | |
| | | * and returned | |
| | | * - Otherwise the default config file is loaded from one the opensync | |
| | | * directories (but only if the plugin specified that it can use the defaul | |
| | | t | |
| | | * configuration) | |
| | | * | |
| | | * @param member The member | |
| | | * @param error Pointer to a error | |
| | | * @returns Member configuration | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginConfig *osync_member_get_config(OSyncMember *member
, OSyncError **error); | | OSYNC_EXPORT OSyncPluginConfig *osync_member_get_config(OSyncMember *member
, OSyncError **error); | |
|
| | | | |
| | | /** @brief Sets the config data for a member | |
| | | * | |
| | | * Note that this does not save the config data | |
| | | * | |
| | | * @param member The member | |
| | | * @param config The new config data | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_member_set_config(OSyncMember *member, OSyncPluginC
onfig *config); | | OSYNC_EXPORT void osync_member_set_config(OSyncMember *member, OSyncPluginC
onfig *config); | |
| | | | |
|
| | | /** @brief Loads a member from a directory where it has been saved | |
| | | * | |
| | | * @param member The Member pointer of the member which gets loaded | |
| | | * @param path The path of the member | |
| | | * @param error Pointer to a error | |
| | | * @returns TRUE on success, FALSE if error | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_member_load(OSyncMember *member, const char *
path, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_member_load(OSyncMember *member, const char *
path, OSyncError **error); | |
|
| | | | |
| | | /** @brief Saves a member to it config directory | |
| | | * | |
| | | * @param member The member to save | |
| | | * @param error Pointer to a error | |
| | | * @returns TRUE if the member was saved successfully, FALSE otherwise | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_member_save(OSyncMember *member, OSyncError *
*error); | | OSYNC_EXPORT osync_bool osync_member_save(OSyncMember *member, OSyncError *
*error); | |
|
| | | | |
| | | /** @brief Delete a member | |
| | | * | |
| | | * @param member The member to delete | |
| | | * @param error Pointer to a error | |
| | | * @returns TRUE if the member was deleted successfully, FALSE otherwise | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_member_delete(OSyncMember *member, OSyncError
**error); | | OSYNC_EXPORT osync_bool osync_member_delete(OSyncMember *member, OSyncError
**error); | |
| | | | |
|
| | | /** @brief Gets the unique id of a member | |
| | | * | |
| | | * @param member The member | |
| | | * @returns The id of the member thats unique in its group | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT long long int osync_member_get_id(OSyncMember *member); | | OSYNC_EXPORT long long int osync_member_get_id(OSyncMember *member); | |
| | | | |
|
| OSYNC_EXPORT int osync_member_num_objtypes(OSyncMember *member); | | /** | |
| OSYNC_EXPORT const char *osync_member_nth_objtype(OSyncMember *member, int | | * @brief Returns a OSyncList that contains the objtypes of this member | |
| nth); | | * | |
| | | * Please be aware that the returned list has to be freed with | |
| | | * osync_list_free. If it isn't freed there will be a memory leak. | |
| | | * | |
| | | * @param member A pointer to a OSyncMember | |
| | | * @return A shallow copy of the internal list of objtypes (const char*) | |
| | | */ | |
| | | OSYNC_EXPORT OSyncList *osync_member_get_objtypes(OSyncMember *member); | |
| | | | |
|
| | | /** @brief Add an OSyncObjTypeSink object to the member list of supported o | |
| | | bject types of this member | |
| | | * | |
| | | * @param member The member pointer | |
| | | * @param sink The OSyncObjTypeSink object to add | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_member_add_objtype_sink(OSyncMember *member, OSyncO
bjTypeSink *sink); | | OSYNC_EXPORT void osync_member_add_objtype_sink(OSyncMember *member, OSyncO
bjTypeSink *sink); | |
|
| | | | |
| | | /** @brief Find the object type sink (OSyncObjTypeSink) for the given objec | |
| | | t type of | |
| | | * a certain member. | |
| | | * | |
| | | * @param member The member pointer | |
| | | * @param objtype The searched object type | |
| | | * @returns OSyncObjTypeSink pointer if object type sink is avaliable, othe | |
| | | rwise NULL | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncObjTypeSink *osync_member_find_objtype_sink(OSyncMember *
member, const char *objtype); | | OSYNC_EXPORT OSyncObjTypeSink *osync_member_find_objtype_sink(OSyncMember *
member, const char *objtype); | |
| | | | |
|
| | | /** @brief Returns if a certain object type is enabled on this member | |
| | | * | |
| | | * @param member The member | |
| | | * @param objtype The name of the object type to check | |
| | | * @returns TRUE if the object type is enabled, FALSE otherwise | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_member_objtype_enabled(OSyncMember *member, c
onst char *objtype); | | OSYNC_EXPORT osync_bool osync_member_objtype_enabled(OSyncMember *member, c
onst char *objtype); | |
|
| | | | |
| | | /** @brief Enables or disables a object type on a member | |
| | | * | |
| | | * @param member The member | |
| | | * @param objtype The name of the object type to change | |
| | | * @param enabled Set to TRUE if you want to sync the object type, FALSE ot | |
| | | herwise | |
| | | * | |
| | | * Note: this function should be called only after sink information for the | |
| | | member | |
| | | * is available (osync_member_require_sink_info()) | |
| | | * | |
| | | * @todo Change function interface to not require the plugin to be instance | |
| | | d manually. | |
| | | * See comments on osync_group_set_objtype_enabled() | |
| | | */ | |
| OSYNC_EXPORT void osync_member_set_objtype_enabled(OSyncMember *member, con
st char *objtype, osync_bool enabled); | | OSYNC_EXPORT void osync_member_set_objtype_enabled(OSyncMember *member, con
st char *objtype, osync_bool enabled); | |
| | | | |
|
| | | /** @brief List of all available object formats for a specifc object type o | |
| | | f this member | |
| | | * | |
| | | * Please be aware that the returned list has to be freed with | |
| | | * osync_list_free. If it isn't freed there will be a memory leak. | |
| | | * | |
| | | * @param member The member pointer | |
| | | * @param objtype The searched object type | |
| | | * @param error Pointer to an error | |
| | | * @return List of all object formats of a specific object type of the memb | |
| | | er | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const OSyncList *osync_member_get_objformats(OSyncMember *memb
er, const char *objtype, OSyncError **error); | | OSYNC_EXPORT const OSyncList *osync_member_get_objformats(OSyncMember *memb
er, const char *objtype, OSyncError **error); | |
|
| OSYNC_EXPORT void osync_member_add_objformat(OSyncMember *member, const cha | | | |
| r *objtype, const char *format); | | | |
| OSYNC_EXPORT void osync_member_add_objformat_with_config(OSyncMember *membe | | | |
| r, const char *objtype, const char *format, const char *format_config); | | | |
| | | | |
|
| | | /** @brief Add a specifc Object Format to member | |
| | | * | |
| | | * @param member The member pointer | |
| | | * @param objtype The searched object type | |
| | | * @param format The name of the Object Format | |
| | | * @param error An OSyncError struct | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT void osync_member_add_objformat(OSyncMember *member, const cha | |
| | | r *objtype, const char *format, OSyncError **error); | |
| | | | |
| | | /** @brief Add a specifc Object Format with a conversion path config to mem | |
| | | ber | |
| | | * | |
| | | * @param member The member pointer | |
| | | * @param objtype The searched object type | |
| | | * @param format The name of the Object Format | |
| | | * @param format_config The Object Format specific configuration | |
| | | * @param error An OSyncError struct | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT void osync_member_add_objformat_with_config(OSyncMember *membe | |
| | | r, const char *objtype, const char *format, const char *format_config, OSyn | |
| | | cError **error); | |
| | | | |
| | | /** @brief Get the capabilities of the member | |
| | | * | |
| | | * @param member The member | |
| | | * @returns The capabilities of this member, NULL if no capabilities are se | |
| | | t | |
| | | */ | |
| OSYNC_EXPORT OSyncCapabilities *osync_member_get_capabilities(OSyncMember *
member); | | OSYNC_EXPORT OSyncCapabilities *osync_member_get_capabilities(OSyncMember *
member); | |
|
| OSYNC_EXPORT osync_bool osync_member_set_capabilities(OSyncMember *member,
OSyncCapabilities *capabilities, OSyncError **error); | | | |
| | | | |
|
| OSYNC_EXPORT OSyncMerger *osync_member_get_merger(OSyncMember *member); | | /** @brief Set the capabilities of the member | |
| | | * | |
| | | * @param member The member | |
| | | * @param capabilities The capabilities | |
| | | * @param error Pointer to a error | |
| | | * @returns TRUE if the capabilities got set successfully, otherwise FALSE | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_member_set_capabilities(OSyncMember *member, | |
| | | OSyncCapabilities *capabilities, OSyncError **error); | |
| | | | |
|
| | | /** @brief Remove all object types from member. | |
| | | * | |
| | | * @param member The member | |
| | | * | |
| | | * Note: this function should be called to flush the member before discover | |
| | | ing. | |
| | | * To detect if something isn't supported anymore. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_member_flush_objtypes(OSyncMember *member); | | OSYNC_EXPORT void osync_member_flush_objtypes(OSyncMember *member); | |
| | | | |
|
| | | /** @brief Get the main sink of member. | |
| | | * | |
| | | * @param member The member | |
| | | * @returns OSyncObjTypeSink pointer of the main sink. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncObjTypeSink *osync_member_get_main_sink(OSyncMember *memb
er); | | OSYNC_EXPORT OSyncObjTypeSink *osync_member_get_main_sink(OSyncMember *memb
er); | |
| | | | |
|
| | | /** @brief Checks if the member configuration is up to date. | |
| | | * | |
| | | * @param member The member | |
| | | * @returns TRUE if member configuration is up to date. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_member_config_is_uptodate(OSyncMember *member
); | | OSYNC_EXPORT osync_bool osync_member_config_is_uptodate(OSyncMember *member
); | |
|
| | | | |
| | | /** @brief Checks if the plugin configuration is up to date. | |
| | | * | |
| | | * @param member The member | |
| | | * @returns TRUE if plugin configuration is up to date. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_member_plugin_is_uptodate(OSyncMember *member
); | | OSYNC_EXPORT osync_bool osync_member_plugin_is_uptodate(OSyncMember *member
); | |
| | | | |
|
| | | /*@}*/ | |
| | | | |
| #endif /* _OPENSYNC_MEMBER_H_ */ | | #endif /* _OPENSYNC_MEMBER_H_ */ | |
| | | | |
End of changes. 33 change blocks. |
| 10 lines changed or deleted | | 278 lines changed or added | |
|
| opensync_objformat.h | | opensync_objformat.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENSYNC_OBJFORMAT_H_ | | #ifndef _OPENSYNC_OBJFORMAT_H_ | |
| #define _OPENSYNC_OBJFORMAT_H_ | | #define _OPENSYNC_OBJFORMAT_H_ | |
| | | | |
|
| typedef OSyncConvCmpResult (* OSyncFormatCompareFunc) (const char *leftdata | | /** | |
| , unsigned int leftsize, const char *rightdata, unsigned int rightsize); | | * @defgroup OSyncFormat OpenSync Format Module | |
| typedef osync_bool (* OSyncFormatCopyFunc) (const char *input, unsigned int | | * @ingroup OSyncPublic | |
| inpsize, char **output, unsigned int *outpsize, OSyncError **error); | | * @defgroup OSyncObjFormatAPI OpenSync Object Format | |
| typedef osync_bool (* OSyncFormatDuplicateFunc) (const char *uid, const cha | | * @ingroup OSyncFormat | |
| r *input, unsigned int insize, char **newuid, char **output, unsigned int * | | * @brief Functions for handling object formats | |
| outsize, osync_bool *dirty, OSyncError **error); | | */ | |
| typedef void (* OSyncFormatCreateFunc) (char **data, unsigned int *size); | | /*@{*/ | |
| typedef void (* OSyncFormatDestroyFunc) (char *data, unsigned int size); | | | |
| typedef char *(* OSyncFormatPrintFunc) (const char *data, unsigned int size | | typedef void * (* OSyncFormatInitializeFunc) (OSyncError **error); | |
| ); | | typedef osync_bool (* OSyncFormatFinalizeFunc) (void *user_data, OSyncError | |
| typedef time_t (* OSyncFormatRevisionFunc) (const char *data, unsigned int | | **error); | |
| size, OSyncError **error); | | | |
| typedef osync_bool (* OSyncFormatMarshalFunc) (const char *input, unsigned | | typedef OSyncConvCmpResult (* OSyncFormatCompareFunc) (const char *leftdata | |
| int inpsize, OSyncMessage *message, OSyncError **error); | | , unsigned int leftsize, const char *rightdata, unsigned int rightsize, voi | |
| typedef osync_bool (* OSyncFormatDemarshalFunc) (OSyncMessage *message, cha | | d *user_data, OSyncError **error); | |
| r **output, unsigned int *outpsize, OSyncError **error); | | typedef osync_bool (* OSyncFormatCopyFunc) (const char *input, unsigned int | |
| | | inpsize, char **output, unsigned int *outpsize, void *user_data, OSyncErro | |
| | | r **error); | |
| | | typedef osync_bool (* OSyncFormatDuplicateFunc) (const char *uid, const cha | |
| | | r *input, unsigned int insize, char **newuid, char **output, unsigned int * | |
| | | outsize, osync_bool *dirty, void *user_data, OSyncError **error); | |
| | | typedef osync_bool (* OSyncFormatCreateFunc) (char **data, unsigned int *si | |
| | | ze, void *user_data, OSyncError **error); | |
| | | typedef osync_bool (* OSyncFormatDestroyFunc) (char *data, unsigned int siz | |
| | | e, void *user_data, OSyncError **error); | |
| | | typedef char *(* OSyncFormatPrintFunc) (const char *data, unsigned int size | |
| | | , void *user_data, OSyncError **error); | |
| | | typedef time_t (* OSyncFormatRevisionFunc) (const char *data, unsigned int | |
| | | size, void *user_data, OSyncError **error); | |
| | | typedef osync_bool (* OSyncFormatMarshalFunc) (const char *input, unsigned | |
| | | int inpsize, OSyncMarshal *marshal, void *user_data, OSyncError **error); | |
| | | typedef osync_bool (* OSyncFormatDemarshalFunc) (OSyncMarshal *marshal, cha | |
| | | r **output, unsigned int *outpsize, void *user_data, OSyncError **error); | |
| | | typedef osync_bool (* OSyncFormatValidateFunc) (const char *data, unsigned | |
| | | int size, void *user_data, OSyncError **error); | |
| | | | |
|
| | | /** | |
| | | * @brief Creates a new object format | |
| | | * @param name the name of the object format | |
| | | * @param objtype_name the name of the object type | |
| | | * @param error Pointer to an error struct | |
| | | * @return The pointer to the newly allocated object format or NULL in case | |
| | | of error | |
| | | */ | |
| OSYNC_EXPORT OSyncObjFormat *osync_objformat_new(const char *name, const ch
ar *objtype_name, OSyncError **error); | | OSYNC_EXPORT OSyncObjFormat *osync_objformat_new(const char *name, const ch
ar *objtype_name, OSyncError **error); | |
|
| | | | |
| | | /*! @brief Increase the reference count on an object format | |
| | | * | |
| | | * @param format Pointer to the object format | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncObjFormat *osync_objformat_ref(OSyncObjFormat *format); | | OSYNC_EXPORT OSyncObjFormat *osync_objformat_ref(OSyncObjFormat *format); | |
|
| | | | |
| | | /*! @brief Decrease the reference count on an object format | |
| | | * | |
| | | * @param format Pointer to the object format | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_objformat_unref(OSyncObjFormat *format); | | OSYNC_EXPORT void osync_objformat_unref(OSyncObjFormat *format); | |
| | | | |
|
| | | /** | |
| | | * @brief Returns the name of an object format | |
| | | * @param format Pointer to the object format | |
| | | * @return The name of the specified object format | |
| | | */ | |
| OSYNC_EXPORT const char *osync_objformat_get_name(OSyncObjFormat *format); | | OSYNC_EXPORT const char *osync_objformat_get_name(OSyncObjFormat *format); | |
|
| | | | |
| | | /** | |
| | | * @brief Returns the object type of an object format | |
| | | * @param format Pointer to the object format | |
| | | * @return The name of the specified object format's object type | |
| | | */ | |
| OSYNC_EXPORT const char *osync_objformat_get_objtype(OSyncObjFormat *format
); | | OSYNC_EXPORT const char *osync_objformat_get_objtype(OSyncObjFormat *format
); | |
| | | | |
|
| | | /** | |
| | | * @brief Returns revision of the supplied data in specified format | |
| | | * | |
| | | * @param format Pointer to the object format | |
| | | * @param data Pointer to the object to get the revision | |
| | | * @param size Size in bytes of the object specified by the data parameter | |
| | | * @param error Pointer to an error struct | |
| | | * @returns Revision of the specified object in seconds since 1970, -1 on e | |
| | | rror | |
| | | */ | |
| | | OSYNC_EXPORT time_t osync_objformat_get_revision(OSyncObjFormat *format, co | |
| | | nst char *data, unsigned int size, OSyncError **error); | |
| | | | |
| | | /** | |
| | | * @brief Sets the optional initialize function for an object format | |
| | | * | |
| | | * The initialize function can be used to allocate internal structures or o | |
| | | ther | |
| | | * required data, which get passed as void pointer to each object format pl | |
| | | ugin | |
| | | * call. | |
| | | * | |
| | | * This option set require that also a finalize function get set. | |
| | | * | |
| | | * @param format Pointer to the object format | |
| | | * @param initialize_func The initialize function to use | |
| | | */ | |
| | | OSYNC_EXPORT void osync_objformat_set_initialize_func(OSyncObjFormat *forma | |
| | | t, OSyncFormatInitializeFunc initialize_func); | |
| | | | |
| | | /** | |
| | | * @brief Sets the optional finalize function for an object format | |
| | | * | |
| | | * The finalize function has to be use to release memory which got allocate | |
| | | d | |
| | | * with the object format initialize function. | |
| | | * | |
| | | * @param format Pointer to the object format | |
| | | * @param finalize_func The finalize function to use | |
| | | */ | |
| | | OSYNC_EXPORT void osync_objformat_set_finalize_func(OSyncObjFormat *format, | |
| | | OSyncFormatFinalizeFunc finalize_func); | |
| | | | |
| | | /** | |
| | | * @brief Sets the optional compare function for an object format | |
| | | * | |
| | | * The compare function can be used to compare two objects in your object | |
| | | * format. This is optional - if you prefer, you can instead provide a | |
| | | * conversion to and from the xml format and let all the comparison be done | |
| | | * there. | |
| | | * | |
| | | * @param format Pointer to the object format | |
| | | * @param cmp_func The compare function to use | |
| | | */ | |
| OSYNC_EXPORT void osync_objformat_set_compare_func(OSyncObjFormat *format,
OSyncFormatCompareFunc cmp_func); | | OSYNC_EXPORT void osync_objformat_set_compare_func(OSyncObjFormat *format,
OSyncFormatCompareFunc cmp_func); | |
|
| | | | |
| | | /** | |
| | | * @brief Sets the destroy function for an object format | |
| | | * | |
| | | * The destroy function is used to free data structures allocated by your f | |
| | | ormat. | |
| | | * | |
| | | * @param format Pointer to the object format | |
| | | * @param destroy_func The destroy function to use | |
| | | */ | |
| OSYNC_EXPORT void osync_objformat_set_destroy_func(OSyncObjFormat *format,
OSyncFormatDestroyFunc destroy_func); | | OSYNC_EXPORT void osync_objformat_set_destroy_func(OSyncObjFormat *format,
OSyncFormatDestroyFunc destroy_func); | |
|
| | | | |
| | | /** | |
| | | * @brief Set copy function for the specified format | |
| | | * @param format Pointer to the object format | |
| | | * @param copy_func Copy function to set | |
| | | */ | |
| OSYNC_EXPORT void osync_objformat_set_copy_func(OSyncObjFormat *format, OSy
ncFormatCopyFunc copy_func); | | OSYNC_EXPORT void osync_objformat_set_copy_func(OSyncObjFormat *format, OSy
ncFormatCopyFunc copy_func); | |
|
| | | | |
| | | /** | |
| | | * @brief Sets the duplicate function for an object format | |
| | | * | |
| | | * The duplicate function can be used to duplicate an object in your format | |
| | | . | |
| | | * Duplication does not mean to make two objects out of one, but to change | |
| | | * the uid of the object in such a way that it differs from the original ui | |
| | | d. | |
| | | * | |
| | | * Most formats will never need this. | |
| | | * | |
| | | * @param format Pointer to the object format | |
| | | * @param dupe_func The duplicate function to use | |
| | | */ | |
| OSYNC_EXPORT void osync_objformat_set_duplicate_func(OSyncObjFormat *format
, OSyncFormatDuplicateFunc dupe_func); | | OSYNC_EXPORT void osync_objformat_set_duplicate_func(OSyncObjFormat *format
, OSyncFormatDuplicateFunc dupe_func); | |
|
| | | | |
| | | /** | |
| | | * @brief Set object creation function of the specified format | |
| | | * | |
| | | * @param format Pointer to the object format | |
| | | * @param create_func Create function | |
| | | */ | |
| OSYNC_EXPORT void osync_objformat_set_create_func(OSyncObjFormat *format, O
SyncFormatCreateFunc create_func); | | OSYNC_EXPORT void osync_objformat_set_create_func(OSyncObjFormat *format, O
SyncFormatCreateFunc create_func); | |
|
| | | | |
| | | /** | |
| | | * @brief Sets the print function for an object format | |
| | | * | |
| | | * If your format is not in a human readable format already, you should set | |
| | | * the print function to a function that returns a human readable string | |
| | | * describing the object as closely as possible. This information will be | |
| | | * used by the user to decide which object to pick when there is a conflict | |
| | | . | |
| | | * | |
| | | * The print_func returns a humand readable string (with terminating \0) an | |
| | | d | |
| | | * memory must be allocated with osync_try_malloc0(), osync_strdup*(). | |
| | | * | |
| | | * @param format Pointer to the object format | |
| | | * @param print_func The print function to use | |
| | | */ | |
| OSYNC_EXPORT void osync_objformat_set_print_func(OSyncObjFormat *format, OS
yncFormatPrintFunc print_func); | | OSYNC_EXPORT void osync_objformat_set_print_func(OSyncObjFormat *format, OS
yncFormatPrintFunc print_func); | |
|
| | | | |
| | | /** | |
| | | * @brief Sets the revision function for an object format | |
| | | * | |
| | | * @param format Pointer to the object format | |
| | | * @param revision_func The revision function to set | |
| | | */ | |
| OSYNC_EXPORT void osync_objformat_set_revision_func(OSyncObjFormat *format,
OSyncFormatRevisionFunc revision_func); | | OSYNC_EXPORT void osync_objformat_set_revision_func(OSyncObjFormat *format,
OSyncFormatRevisionFunc revision_func); | |
|
| | | | |
| | | /** | |
| | | * @brief Sets the marshal function for an object format | |
| | | * | |
| | | * @param format Pointer to the object format | |
| | | * @param marshal_func The marshal function to set | |
| | | */ | |
| OSYNC_EXPORT void osync_objformat_set_marshal_func(OSyncObjFormat *format,
OSyncFormatMarshalFunc marshal_func); | | OSYNC_EXPORT void osync_objformat_set_marshal_func(OSyncObjFormat *format,
OSyncFormatMarshalFunc marshal_func); | |
|
| OSYNC_EXPORT void osync_objformat_set_demarshal_func(OSyncObjFormat *format
, OSyncFormatDemarshalFunc marshal_func); | | | |
| | | | |
|
| OSYNC_EXPORT OSyncConvCmpResult osync_objformat_compare(OSyncObjFormat *for | | /** | |
| mat, const char *leftdata, unsigned int leftsize, const char *rightdata, un | | * @brief Sets the demarshal function for an object format | |
| signed int rightsize); | | * | |
| osync_bool osync_objformat_duplicate(OSyncObjFormat *format, const char *ui | | * @param format Pointer to the object format | |
| d, const char *input, unsigned int insize, char **newuid, char **output, un | | * @param demarshal_func The demarshal function to set | |
| signed int *outsize, osync_bool *dirty, OSyncError **error); | | */ | |
| OSYNC_EXPORT void osync_objformat_create(OSyncObjFormat *format, char **dat | | OSYNC_EXPORT void osync_objformat_set_demarshal_func(OSyncObjFormat *format | |
| a, unsigned int *size); | | , OSyncFormatDemarshalFunc demarshal_func); | |
| OSYNC_EXPORT char *osync_objformat_print(OSyncObjFormat *format, const char | | | |
| *data, unsigned int size); | | | |
| OSYNC_EXPORT time_t osync_objformat_get_revision(OSyncObjFormat *format, co | | | |
| nst char *data, unsigned int size, OSyncError **error); | | | |
| OSYNC_EXPORT void osync_objformat_destroy(OSyncObjFormat *format, char *dat | | | |
| a, unsigned int size); | | | |
| OSYNC_EXPORT osync_bool osync_objformat_copy(OSyncObjFormat *format, const | | | |
| char *indata, unsigned int insize, char **outdata, unsigned int *outsize, O | | | |
| SyncError **error); | | | |
| OSYNC_EXPORT osync_bool osync_objformat_is_equal(OSyncObjFormat *leftformat | | | |
| , OSyncObjFormat *rightformat); | | | |
| | | | |
|
| OSYNC_EXPORT osync_bool osync_objformat_must_marshal(OSyncObjFormat *format | | /** | |
| ); | | * @brief Sets the optional validation function for an object format | |
| OSYNC_EXPORT osync_bool osync_objformat_marshal(OSyncObjFormat *format, con | | * | |
| st char *input, unsigned int inpsize, OSyncMessage *message, OSyncError **e | | * The validation function can be used to validate data for the specific | |
| rror); | | * format. This is optional. The validation should be fast, since once this | |
| OSYNC_EXPORT osync_bool osync_objformat_demarshal(OSyncObjFormat *format, O | | * function is registered this get called during conversion for every chang | |
| SyncMessage *message, char **output, unsigned int *outpsize, OSyncError **e | | e. | |
| rror); | | * | |
| | | * @param format Pointer to the object format | |
| | | * @param validate_func The validation function to use | |
| | | */ | |
| | | OSYNC_EXPORT void osync_objformat_set_validate_func(OSyncObjFormat *format, | |
| | | OSyncFormatValidateFunc validate_func); | |
| | | | |
|
| #endif //_OPENSYNC_OBJFORMAT_H_ | | /** | |
| | | * @brief Prints the specified object | |
| | | * | |
| | | * Uses the object format's print function if set, otherwise the object's | |
| | | * data will be returned as a string. | |
| | | * | |
| | | * @param format Pointer to the object format | |
| | | * @param data Pointer to the object to destroy | |
| | | * @param size Size in bytes of the object specified by the data parameter | |
| | | * @param error Pointer to an error struct | |
| | | * @returns Human readable string of the specified object. Caller is respon | |
| | | sible for freeing the string with osync_free(). | |
| | | * Or NULL if size is 0 or data NULL. | |
| | | */ | |
| | | OSYNC_EXPORT char *osync_objformat_print(OSyncObjFormat *format, const char | |
| | | *data, unsigned int size, OSyncError **error); | |
| | | | |
| | | /*@}*/ | |
| | | | |
| | | #endif /* _OPENSYNC_OBJFORMAT_H_ */ | |
| | | | |
End of changes. 18 change blocks. |
| 45 lines changed or deleted | | 211 lines changed or added | |
|
| opensync_plugin.h | | opensync_plugin.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENSYNC_PLUGIN_H_ | | #ifndef _OPENSYNC_PLUGIN_H_ | |
| #define _OPENSYNC_PLUGIN_H_ | | #define _OPENSYNC_PLUGIN_H_ | |
| | | | |
|
| typedef void * (* initialize_fn) (OSyncPlugin *, OSyncPluginInfo *, OSyncEr | | /** | |
| ror **); | | * @defgroup OSyncPlugin OpenSync Plugin Module | |
| typedef void (* finalize_fn) (void *); | | * @ingroup OSyncPublic | |
| typedef osync_bool (* discover_fn) (void *, OSyncPluginInfo *, OSyncError * | | * @defgroup OSyncPluginAPI OpenSync Plugin | |
| *); | | * @ingroup OSyncPlugin | |
| typedef osync_bool (* usable_fn) (OSyncError **); | | * @brief The public part of the OSyncPlugin | |
| | | * | |
| | | * Functions to register and manage plugins | |
| | | */ | |
| | | | |
|
| /*! @brief Gives information about wether the plugin | | /*@{*/ | |
| * has to be configured or not | | | |
| | | /** | |
| | | * @brief Prototype of the plugin initialize function | |
| * | | * | |
|
| * @ingroup OSyncPluginAPI | | * In this function a plugin should initialize and allocate | |
| | | * all plugin specific data which is required in the other plugin | |
| | | * functions. This data could be e.g. connections, directories, ... | |
| | | * @param plugin | |
| | | * @param info the OSyncPluginInfo | |
| | | * @param error An OSyncError struct that should be used to set an error | |
| | | * @return The plugin specific data that is passed to the other plugin func | |
| | | tions | |
| | | */ | |
| | | typedef void * (* initialize_fn) (OSyncPlugin *plugin, OSyncPluginInfo *inf | |
| | | o, OSyncError **error); | |
| | | | |
| | | /** | |
| | | * @brief Prototype of the plugin finalize function | |
| | | * | |
| | | * This plugin function is called to give a plugin the possibility | |
| | | * to free all allocated data. | |
| | | * @param plugin_data Plugin specific data that was returned by the initial | |
| | | ize function | |
| | | */ | |
| | | typedef void (* finalize_fn) (void * plugin_data); | |
| | | | |
| | | /** | |
| | | * @brief Prototype of the plugin discovery function | |
| | | * | |
| | | * TODO Add detailed description | |
| | | * @param info the OSyncPluginInfo | |
| | | * @param plugin_data Plugin specific data that was returned in the plugin | |
| | | initialize function | |
| | | * @param error An OSyncError struct that should be used to set an error | |
| | | * @return TRUE if discovery was successful | |
| | | */ | |
| | | typedef osync_bool (* discover_fn) (OSyncPluginInfo *info, void * plugin_da | |
| | | ta, OSyncError **error); | |
| | | | |
| | | /** @brief Gives information about wether the plugin | |
| | | * has to be configured or not | |
| **/ | | **/ | |
| typedef enum { | | typedef enum { | |
| /** Plugin has no configuration options */ | | /** Plugin has no configuration options */ | |
| OSYNC_PLUGIN_NO_CONFIGURATION = 0, | | OSYNC_PLUGIN_NO_CONFIGURATION = 0, | |
| /** Plugin can be configured, but will accept the default config in
the initialize function */ | | /** Plugin can be configured, but will accept the default config in
the initialize function */ | |
| OSYNC_PLUGIN_OPTIONAL_CONFIGURATION = 1, | | OSYNC_PLUGIN_OPTIONAL_CONFIGURATION = 1, | |
| /** Plugin must be configured to run correctly */ | | /** Plugin must be configured to run correctly */ | |
| OSYNC_PLUGIN_NEEDS_CONFIGURATION = 2 | | OSYNC_PLUGIN_NEEDS_CONFIGURATION = 2 | |
| } OSyncConfigurationType; | | } OSyncConfigurationType; | |
| | | | |
|
| | | /** @brief Registers a new plugin | |
| | | * | |
| | | * This function creates a new OSyncPlugin object, that | |
| | | * can be used to register a new plugin dynamically. This | |
| | | * can be used by a module to register multiple plugins, | |
| | | * instead of using the get_info() function which allows | |
| | | * registering only one plugin. | |
| | | * | |
| | | * @param error Pointer to an error struct | |
| | | * @returns the newly registered plugin | |
| | | */ | |
| OSYNC_EXPORT OSyncPlugin *osync_plugin_new(OSyncError **error); | | OSYNC_EXPORT OSyncPlugin *osync_plugin_new(OSyncError **error); | |
|
| | | | |
| | | /** @brief Decrease the reference count on a plugin | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_unref(OSyncPlugin *plugin); | | OSYNC_EXPORT void osync_plugin_unref(OSyncPlugin *plugin); | |
|
| | | | |
| | | /** @brief Increase the reference count on a plugin | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPlugin *osync_plugin_ref(OSyncPlugin *plugin); | | OSYNC_EXPORT OSyncPlugin *osync_plugin_ref(OSyncPlugin *plugin); | |
| | | | |
|
| | | /** @brief Returns the name of a plugin | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @returns Name of the plugin | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_get_name(OSyncPlugin *plugin); | | OSYNC_EXPORT const char *osync_plugin_get_name(OSyncPlugin *plugin); | |
|
| | | | |
| | | /** @brief Sets the name of a plugin | |
| | | * | |
| | | | |
| | | * This name is mostly used for internal configuration and isn't visible to | |
| | | the | |
| | | * user (at least not in rich OpenSync frontends). The name should be less | |
| | | then | |
| | | * 15 characters and should be one word (no spaces). | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @param name the name to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_set_name(OSyncPlugin *plugin, const char *na
me); | | OSYNC_EXPORT void osync_plugin_set_name(OSyncPlugin *plugin, const char *na
me); | |
| | | | |
|
| | | /** @brief Returns the long name of a plugin | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @returns Long name of the plugin | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_get_longname(OSyncPlugin *plugin); | | OSYNC_EXPORT const char *osync_plugin_get_longname(OSyncPlugin *plugin); | |
|
| | | | |
| | | /** @brief Sets the long name of a plugin | |
| | | * | |
| | | * The longname of the plugin is the name visible to a regular user to choo | |
| | | se the | |
| | | * correct plugin from a list of available plugins. Use the description fie | |
| | | ld to | |
| | | * describe the plugin in more detail. Don't include the term "Plugin" in t | |
| | | he | |
| | | * longname. Example: "Palm Device" | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @param longname the long name to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_set_longname(OSyncPlugin *plugin, const char
*longname); | | OSYNC_EXPORT void osync_plugin_set_longname(OSyncPlugin *plugin, const char
*longname); | |
| | | | |
|
| | | /** @brief Returns whether or not the plugin requires configuration | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @returns The configuration requirement type of the plugin | |
| | | */ | |
| OSYNC_EXPORT OSyncConfigurationType osync_plugin_get_config_type(OSyncPlugi
n *plugin); | | OSYNC_EXPORT OSyncConfigurationType osync_plugin_get_config_type(OSyncPlugi
n *plugin); | |
|
| | | | |
| | | /** @brief Sets whether or not the plugin requires configuration | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @param type The configuration requirement type of the plugin | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_set_config_type(OSyncPlugin *plugin, OSyncCo
nfigurationType type); | | OSYNC_EXPORT void osync_plugin_set_config_type(OSyncPlugin *plugin, OSyncCo
nfigurationType type); | |
| | | | |
|
| | | /** @brief Returns start type of plugin | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @returns The start type of the plugin | |
| | | */ | |
| OSYNC_EXPORT OSyncStartType osync_plugin_get_start_type(OSyncPlugin *plugin
); | | OSYNC_EXPORT OSyncStartType osync_plugin_get_start_type(OSyncPlugin *plugin
); | |
|
| | | | |
| | | /** @brief Sets the start type of the plugin | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @param type The start type of the plugin | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_set_start_type(OSyncPlugin *plugin, OSyncSta
rtType type); | | OSYNC_EXPORT void osync_plugin_set_start_type(OSyncPlugin *plugin, OSyncSta
rtType type); | |
| | | | |
|
| | | /** @brief Returns the description of a plugin | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @returns Description of the plugin | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_get_description(OSyncPlugin *plugin); | | OSYNC_EXPORT const char *osync_plugin_get_description(OSyncPlugin *plugin); | |
|
| | | | |
| | | /** @brief Sets the description of a plugin | |
| | | * | |
| | | * The description should help the user to choose the correct plugin if the | |
| | | re | |
| | | * are several plugins with similar names. The description should probably | |
| | | be no | |
| | | * more than 200 characters. The term "Plugin" might confuse regular user, | |
| | | * avoid it. | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @param description the description to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_set_description(OSyncPlugin *plugin, const c
har *description); | | OSYNC_EXPORT void osync_plugin_set_description(OSyncPlugin *plugin, const c
har *description); | |
| | | | |
|
| | | /** @brief Sets the initialize function for a plugin | |
| | | * | |
| | | * The initialize function of a plugin sets up sinks for the plugin as well | |
| | | * as other plugin-wide structures. | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @param init The initialize function for the plugin | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_set_initialize(OSyncPlugin *plugin, initiali
ze_fn init); | | OSYNC_EXPORT void osync_plugin_set_initialize(OSyncPlugin *plugin, initiali
ze_fn init); | |
|
| | | | |
| | | /** @brief Sets the finalize function for a plugin | |
| | | * | |
| | | * The finalize function of a plugin frees any plugin-wide structures | |
| | | * that were created in the initialize function. | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @param fin The finalize function for the plugin | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_set_finalize(OSyncPlugin *plugin, finalize_f
n fin); | | OSYNC_EXPORT void osync_plugin_set_finalize(OSyncPlugin *plugin, finalize_f
n fin); | |
|
| | | | |
| | | /** @brief Sets the optional discover function for a plugin | |
| | | * | |
| | | * The discover function of a plugin can be used to specify which | |
| | | * of the sinks in the plugin are currently available, and to declare | |
| | | * the compatible device versions for the plugin. It can also | |
| | | * be used to set the plugin's capabilities. | |
| | | * | |
| | | * The discover function is optional. | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @param discover The discover function for the plugin | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_set_discover(OSyncPlugin *plugin, discover_f
n discover); | | OSYNC_EXPORT void osync_plugin_set_discover(OSyncPlugin *plugin, discover_f
n discover); | |
| | | | |
|
| | | /** @brief Returns the plugin_info data, set by the plugin | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @returns The void pointer set on plugin->info.plugin_data | |
| | | */ | |
| OSYNC_EXPORT void *osync_plugin_get_data(OSyncPlugin *plugin); | | OSYNC_EXPORT void *osync_plugin_get_data(OSyncPlugin *plugin); | |
|
| OSYNC_EXPORT void osync_plugin_set_data(OSyncPlugin *plugin, void *data); | | | |
| | | | |
|
| OSYNC_EXPORT void *osync_plugin_initialize(OSyncPlugin *plugin, OSyncPlugin | | /** @brief Set the plugin_info data for the plugin object | |
| Info *info, OSyncError **error); | | * | |
| OSYNC_EXPORT void osync_plugin_finalize(OSyncPlugin *plugin, void *data); | | * @param plugin Pointer to the plugin | |
| OSYNC_EXPORT osync_bool osync_plugin_discover(OSyncPlugin *plugin, void *da | | * @param data Pointer to data which should get set | |
| ta, OSyncPluginInfo *info, OSyncError **error); | | */ | |
| OSYNC_EXPORT osync_bool osync_plugin_is_usable(OSyncPlugin *plugin, OSyncEr | | OSYNC_EXPORT void osync_plugin_set_data(OSyncPlugin *plugin, void *data); | |
| ror **error); | | | |
| | | | |
|
| OSYNC_EXPORT unsigned int osync_plugin_get_discover_timeout(OSyncPlugin *pl | | /** @brief Set timeout interval for plugin discovery | |
| ugin); | | * | |
| | | * @param plugin The plugin to check | |
| | | * @param timeout Timeout value | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_set_discover_timeout(OSyncPlugin *plugin, un
signed int timeout); | | OSYNC_EXPORT void osync_plugin_set_discover_timeout(OSyncPlugin *plugin, un
signed int timeout); | |
| | | | |
|
| OSYNC_EXPORT unsigned int osync_plugin_get_initialize_timeout(OSyncPlugin * | | /** @brief Set timeout interval for plugin initialization | |
| plugin); | | * | |
| | | * @param plugin The plugin to check | |
| | | * @param timeout Timeout value | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_set_initialize_timeout(OSyncPlugin *plugin,
unsigned int timeout); | | OSYNC_EXPORT void osync_plugin_set_initialize_timeout(OSyncPlugin *plugin,
unsigned int timeout); | |
| | | | |
|
| OSYNC_EXPORT unsigned int osync_plugin_get_finalize_timeout(OSyncPlugin *pl | | /** @brief Set timeout interval for plugin finalization | |
| ugin); | | * | |
| | | * @param plugin The plugin to check | |
| | | * @param timeout Timeout value | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_set_finalize_timeout(OSyncPlugin *plugin, un
signed int timeout); | | OSYNC_EXPORT void osync_plugin_set_finalize_timeout(OSyncPlugin *plugin, un
signed int timeout); | |
| | | | |
|
| OSYNC_EXPORT unsigned int osync_plugin_get_useable_timeout(OSyncPlugin *plu | | /** @brief Initialize a Plugin | |
| gin); | | * | |
| OSYNC_EXPORT void osync_plugin_set_useable_timeout(OSyncPlugin *plugin, uns | | * @param plugin Pointer to the plugin | |
| igned int timeout); | | * @param plugin_data Pointer to store the data that is returned by the plu | |
| | | gin | |
| | | * @param info Pointer to OSyncPluginInfo which describes the plugin | |
| | | * @param error Pointer to error-struct | |
| | | * @return TREU if successful, FALSE otherwise | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_plugin_initialize(OSyncPlugin *plugin, void * | |
| | | *plugin_data, OSyncPluginInfo *info, OSyncError **error); | |
| | | | |
|
| #endif //_OPENSYNC_PLUGIN_H_ | | /** @brief Finalize a Plugin | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @param data Pointer to userdata which got returned by plugin initialize | |
| | | function | |
| | | */ | |
| | | OSYNC_EXPORT void osync_plugin_finalize(OSyncPlugin *plugin, void *data); | |
| | | | |
| | | /** @brief Call plugin discovery | |
| | | * | |
| | | * @param plugin Pointer to the plugin | |
| | | * @param data Pointer to userdata which got returned by plugin initialize | |
| | | function | |
| | | * @param info Pointer to OSyncPluginInfo which describes the plugin | |
| | | * @param error Pointer to error-struct | |
| | | * @return TRUE on success, FALSE otherwise | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_plugin_discover(OSyncPlugin *plugin, void *da | |
| | | ta, OSyncPluginInfo *info, OSyncError **error); | |
| | | | |
| | | /*@}*/ | |
| | | | |
| | | #endif /* OPENSYNC_PLUGIN_H_ */ | |
| | | | |
End of changes. 27 change blocks. |
| 27 lines changed or deleted | | 226 lines changed or added | |
|
| opensync_plugin_advancedoptions.h | | opensync_plugin_advancedoptions.h | |
| /* | | /* | |
| * libopensync - A synchronization framework | | * libopensync - A synchronization framework | |
|
| * Copyright (C) 2008 Daniel Gollub <dgollub@suse.de> | | * Copyright (C) 2008 Daniel Gollub <gollub@b1-systems.de> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * 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, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Lesser General Public License for more details. | | * Lesser General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENSYNC_PLUGIN_ADVANCEDOPTIONS_H_ | | #ifndef _OPENSYNC_PLUGIN_ADVANCEDOPTIONS_H_ | |
| #define _OPENSYNC_PLUGIN_ADVANCEDOPTIONS_H_ | | #define _OPENSYNC_PLUGIN_ADVANCEDOPTIONS_H_ | |
| | | | |
|
| | | /** | |
| | | * @defgroup OSyncPluginConfigAdvancedOptionsAPI OpenSync Plugin Config Adv | |
| | | anced Options | |
| | | * @ingroup OSyncPlugin | |
| | | * @brief Functions to get and set a plugin's custom configuration options | |
| | | * | |
| | | * The AdvancedOptions system allows plugins to store custom (plugin-specif | |
| | | ic) | |
| | | * configuration settings in a self-describing manner, so that configuratio | |
| | | n | |
| | | * frontends can create corresponding user interfaces on the fly. | |
| | | * | |
| | | * If desired, AdvancedOptions can also have parameters (sub-options) each | |
| | | * with their own type, name, etc. | |
| | | * | |
| | | */ | |
| | | | |
| | | /*@{*/ | |
| | | | |
| | | /** @brief Advanced option value types | |
| | | * | |
| | | **/ | |
| typedef enum { | | typedef enum { | |
|
| OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_NONE = 0, | | /** None */ | |
| OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_BOOL, | | OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_NONE = 0, | |
| OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_CHAR, | | /** bool */ | |
| OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_DOUBLE, | | OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_BOOL, | |
| OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_INT, | | /** char */ | |
| OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_LONG, | | OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_CHAR, | |
| OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_LONGLONG, | | /** double */ | |
| OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_UINT, | | OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_DOUBLE, | |
| OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_ULONG, | | /** int */ | |
| OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_ULONGLONG, | | OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_INT, | |
| OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_STRING | | /** long */ | |
| | | OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_LONG, | |
| | | /** long long */ | |
| | | OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_LONGLONG, | |
| | | /** unsigned int */ | |
| | | OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_UINT, | |
| | | /** unsigned long */ | |
| | | OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_ULONG, | |
| | | /** unsigned long long */ | |
| | | OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_ULONGLONG, | |
| | | /** String (char *) */ | |
| | | OSYNC_PLUGIN_ADVANCEDOPTION_TYPE_STRING | |
| } OSyncPluginAdvancedOptionType; | | } OSyncPluginAdvancedOptionType; | |
| | | | |
|
| /* TODO: hide form public API? */ | | | |
| OSYNC_EXPORT OSyncPluginAdvancedOptionType osync_plugin_advancedoption_type | | | |
| _string_to_val(const char *typestr); | | | |
| | | | |
| /* OSyncPluginAdvancedOption */ | | /* OSyncPluginAdvancedOption */ | |
|
| | | /** @brief Create a new OSyncPluginAdvancedOption object | |
| | | * | |
| | | * @param error Pointer to an error struct | |
| | | * @returns the newly created object, or NULL in case of an error. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginAdvancedOption *osync_plugin_advancedoption_new(OSy
ncError **error); | | OSYNC_EXPORT OSyncPluginAdvancedOption *osync_plugin_advancedoption_new(OSy
ncError **error); | |
|
| | | | |
| | | /** @brief Decrease the reference count on an OSyncPluginAdvancedOption obj | |
| | | ect | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_unref(OSyncPluginAdvancedOpti
on *option); | | OSYNC_EXPORT void osync_plugin_advancedoption_unref(OSyncPluginAdvancedOpti
on *option); | |
|
| | | | |
| | | /** @brief Increase the reference count on an OSyncPluginAdvancedOption obj | |
| | | ect | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @returns The OSyncPluginAdvancedOption object passed in | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginAdvancedOption *osync_plugin_advancedoption_ref(OSy
ncPluginAdvancedOption *option); | | OSYNC_EXPORT OSyncPluginAdvancedOption *osync_plugin_advancedoption_ref(OSy
ncPluginAdvancedOption *option); | |
| | | | |
|
| | | /** @brief Get a list of the parameters in an option | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @returns the list of parameters | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncList *osync_plugin_advancedoption_get_parameters(OSyncPlu
ginAdvancedOption *option); | | OSYNC_EXPORT OSyncList *osync_plugin_advancedoption_get_parameters(OSyncPlu
ginAdvancedOption *option); | |
|
| | | | |
| | | /** @brief Add a parameter to an option | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @param param the parameter to add | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_add_parameter(OSyncPluginAdva
ncedOption *option, OSyncPluginAdvancedOptionParameter *param); | | OSYNC_EXPORT void osync_plugin_advancedoption_add_parameter(OSyncPluginAdva
ncedOption *option, OSyncPluginAdvancedOptionParameter *param); | |
|
| | | | |
| | | /** @brief Remove a parameter from an option | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @param param the parameter to remove | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_remove_parameter(OSyncPluginA
dvancedOption *option, OSyncPluginAdvancedOptionParameter *param); | | OSYNC_EXPORT void osync_plugin_advancedoption_remove_parameter(OSyncPluginA
dvancedOption *option, OSyncPluginAdvancedOptionParameter *param); | |
| | | | |
|
| OSYNC_EXPORT unsigned int osync_plugin_advancedoption_get_maxsize(OSyncPlug | | /** @brief Get the maximum value/length of an option | |
| inAdvancedOption *option); | | * | |
| OSYNC_EXPORT void osync_plugin_advancedoption_set_maxsize(OSyncPluginAdvanc | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| edOption *option, unsigned int maxsize); | | * @returns the maximum value/length of the option | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT unsigned int osync_plugin_advancedoption_get_max(OSyncPluginAd | |
| | | vancedOption *option); | |
| | | | |
|
| OSYNC_EXPORT unsigned int osync_plugin_advancedoption_get_minsize(OSyncPlug | | /** @brief Set the maximum value/length of an option | |
| inAdvancedOption *option); | | * | |
| OSYNC_EXPORT void osync_plugin_advancedoption_set_minsize(OSyncPluginAdvanc | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| edOption *option, unsigned int minsize); | | * @param max the maximum value/length to set | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT void osync_plugin_advancedoption_set_max(OSyncPluginAdvancedOp | |
| | | tion *option, unsigned int max); | |
| | | | |
| | | /** @brief Get the minimum value/length of an option | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @returns the minimum value/length of the option | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT unsigned int osync_plugin_advancedoption_get_min(OSyncPluginAd | |
| | | vancedOption *option); | |
| | | | |
| | | /** @brief Set the minimum value/length of an option | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @param min the minimum value/length to set | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT void osync_plugin_advancedoption_set_min(OSyncPluginAdvancedOp | |
| | | tion *option, unsigned int min); | |
| | | | |
| OSYNC_EXPORT unsigned int osync_plugin_advancedoption_get_maxoccurs(OSyncPl
uginAdvancedOption *option); | | OSYNC_EXPORT unsigned int osync_plugin_advancedoption_get_maxoccurs(OSyncPl
uginAdvancedOption *option); | |
| OSYNC_EXPORT void osync_plugin_advancedoption_set_maxoccurs(OSyncPluginAdva
ncedOption *option, unsigned int maxoccurs); | | OSYNC_EXPORT void osync_plugin_advancedoption_set_maxoccurs(OSyncPluginAdva
ncedOption *option, unsigned int maxoccurs); | |
| | | | |
|
| | | /** @brief Get the display name of an option | |
| | | * | |
| | | * The display name is intended to be shown in the configuration user inter | |
| | | face for the option. | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @returns the display name of the option | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_advancedoption_get_displayname(OSyncP
luginAdvancedOption *option); | | OSYNC_EXPORT const char *osync_plugin_advancedoption_get_displayname(OSyncP
luginAdvancedOption *option); | |
|
| | | | |
| | | /** @brief Set the display name of an option | |
| | | * | |
| | | * The display name is intended to be shown in the configuration user inter | |
| | | face for the option. | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @param displayname the display name to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_set_displayname(OSyncPluginAd
vancedOption *option, const char *displayname); | | OSYNC_EXPORT void osync_plugin_advancedoption_set_displayname(OSyncPluginAd
vancedOption *option, const char *displayname); | |
| | | | |
|
| | | /** @brief Get the name of an option | |
| | | * | |
| | | * This name is intended as an internal identifier for the option. It shoul | |
| | | d not be shown in the user interface. | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @returns the name of the option | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_advancedoption_get_name(OSyncPluginAd
vancedOption *option); | | OSYNC_EXPORT const char *osync_plugin_advancedoption_get_name(OSyncPluginAd
vancedOption *option); | |
|
| | | | |
| | | /** @brief Set the name of an option | |
| | | * | |
| | | * This name is intended as an internal identifier for the option. It shoul | |
| | | d not be shown in the user interface. | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @param name the name to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_set_name(OSyncPluginAdvancedO
ption *option, const char *name); | | OSYNC_EXPORT void osync_plugin_advancedoption_set_name(OSyncPluginAdvancedO
ption *option, const char *name); | |
| | | | |
|
| | | /** @brief Get the value type of an option | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @returns the value type of the option | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginAdvancedOptionType osync_plugin_advancedoption_get_
type(OSyncPluginAdvancedOption *option); | | OSYNC_EXPORT OSyncPluginAdvancedOptionType osync_plugin_advancedoption_get_
type(OSyncPluginAdvancedOption *option); | |
|
| | | | |
| | | /** @brief Get the value type of an option (as text) | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @returns a string representing the value type of the option | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_advancedoption_get_type_string(OSyncP
luginAdvancedOption *option); | | OSYNC_EXPORT const char *osync_plugin_advancedoption_get_type_string(OSyncP
luginAdvancedOption *option); | |
|
| | | | |
| | | /** @brief Set the value type of an option | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @param type the value type to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_set_type(OSyncPluginAdvancedO
ption *option, OSyncPluginAdvancedOptionType type); | | OSYNC_EXPORT void osync_plugin_advancedoption_set_type(OSyncPluginAdvancedO
ption *option, OSyncPluginAdvancedOptionType type); | |
| | | | |
|
| | | /** @brief Get a list of the enumerated values of an option | |
| | | * | |
| | | * For options which accept only a set list of possible values (i.e. an enu | |
| | | meration) this function | |
| | | * returns a list of the possible values. | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @returns the list of enumerated values | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncList *osync_plugin_advancedoption_get_valenums(OSyncPlugi
nAdvancedOption *option); | | OSYNC_EXPORT OSyncList *osync_plugin_advancedoption_get_valenums(OSyncPlugi
nAdvancedOption *option); | |
|
| | | | |
| | | /** @brief Add an enumerated value to an option | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @param value the value to add to the enumeration | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_add_valenum(OSyncPluginAdvanc
edOption *option, const char *value); | | OSYNC_EXPORT void osync_plugin_advancedoption_add_valenum(OSyncPluginAdvanc
edOption *option, const char *value); | |
|
| | | | |
| | | /** @brief Remove an enumerated value from an option | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @param value the value to remove from the enumeration | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_remove_valenum(OSyncPluginAdv
ancedOption *option, const char *value); | | OSYNC_EXPORT void osync_plugin_advancedoption_remove_valenum(OSyncPluginAdv
ancedOption *option, const char *value); | |
| | | | |
|
| | | /** @brief Set the value of an option | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @param value the value to set (as a null-terminated string) | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_set_value(OSyncPluginAdvanced
Option *option, const char *value); | | OSYNC_EXPORT void osync_plugin_advancedoption_set_value(OSyncPluginAdvanced
Option *option, const char *value); | |
|
| | | | |
| | | /** @brief Get the value of an option | |
| | | * | |
| | | * @param option Pointer to the OSyncPluginAdvancedOption object | |
| | | * @returns the value of the option (as a null-terminated string) | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_advancedoption_get_value(OSyncPluginA
dvancedOption *option); | | OSYNC_EXPORT const char *osync_plugin_advancedoption_get_value(OSyncPluginA
dvancedOption *option); | |
| | | | |
| /* OSyncPluginAdvancedOptionParameter */ | | /* OSyncPluginAdvancedOptionParameter */ | |
|
| | | /** @brief Create a new OSyncPluginAdvancedOptionParameter object | |
| | | * | |
| | | * @param error Pointer to an error struct | |
| | | * @returns the newly created object, or NULL in case of an error. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginAdvancedOptionParameter *osync_plugin_advancedoptio
n_param_new(OSyncError **error); | | OSYNC_EXPORT OSyncPluginAdvancedOptionParameter *osync_plugin_advancedoptio
n_param_new(OSyncError **error); | |
|
| | | | |
| | | /** @brief Decrease the reference count on an OSyncPluginAdvancedOptionPara | |
| | | meter object | |
| | | * | |
| | | * @param param Pointer to the OSyncPluginAdvancedOptionParameter object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_param_unref(OSyncPluginAdvanc
edOptionParameter *param); | | OSYNC_EXPORT void osync_plugin_advancedoption_param_unref(OSyncPluginAdvanc
edOptionParameter *param); | |
|
| | | | |
| | | /** @brief Increase the reference count on an OSyncPluginAdvancedOptionPara | |
| | | meter object | |
| | | * | |
| | | * @param param Pointer to the OSyncPluginAdvancedOptionParameter object | |
| | | * @returns The OSyncPluginAdvancedOptionParameter object passed in | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginAdvancedOptionParameter *osync_plugin_advancedoptio
n_param_ref(OSyncPluginAdvancedOptionParameter *param); | | OSYNC_EXPORT OSyncPluginAdvancedOptionParameter *osync_plugin_advancedoptio
n_param_ref(OSyncPluginAdvancedOptionParameter *param); | |
| | | | |
|
| | | /** @brief Get the display name of a parameter | |
| | | * | |
| | | * The display name is intended to be shown in the configuration user inter | |
| | | face for the parameter. | |
| | | * | |
| | | * @param param Pointer to the OSyncPluginAdvancedOptionParameter object | |
| | | * @returns the display name of the parameter | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_advancedoption_param_get_displayname(
OSyncPluginAdvancedOptionParameter *param); | | OSYNC_EXPORT const char *osync_plugin_advancedoption_param_get_displayname(
OSyncPluginAdvancedOptionParameter *param); | |
|
| | | | |
| | | /** @brief Set the display name of a parameter | |
| | | * | |
| | | * The display name is intended to be shown in the configuration user inter | |
| | | face for the parameter. | |
| | | * | |
| | | * @param param Pointer to the OSyncPluginAdvancedOptionParameter object | |
| | | * @param displayname the display name to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_param_set_displayname(OSyncPl
uginAdvancedOptionParameter *param, const char *displayname); | | OSYNC_EXPORT void osync_plugin_advancedoption_param_set_displayname(OSyncPl
uginAdvancedOptionParameter *param, const char *displayname); | |
| | | | |
|
| | | /** @brief Get the name of a parameter | |
| | | * | |
| | | * This name is intended as an internal identifier for the parameter. It sh | |
| | | ould not be shown in the user interface. | |
| | | * | |
| | | * @param param Pointer to the OSyncPluginAdvancedOptionParameter object | |
| | | * @returns the name of the parameter | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_advancedoption_param_get_name(OSyncPl
uginAdvancedOptionParameter *param); | | OSYNC_EXPORT const char *osync_plugin_advancedoption_param_get_name(OSyncPl
uginAdvancedOptionParameter *param); | |
|
| | | | |
| | | /** @brief Set the name of a parameter | |
| | | * | |
| | | * This name is intended as an internal identifier for the parameter. It sh | |
| | | ould not be shown in the user interface. | |
| | | * | |
| | | * @param param Pointer to the OSyncPluginAdvancedOptionParameter object | |
| | | * @param name the name to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_param_set_name(OSyncPluginAdv
ancedOptionParameter *param, const char *name); | | OSYNC_EXPORT void osync_plugin_advancedoption_param_set_name(OSyncPluginAdv
ancedOptionParameter *param, const char *name); | |
| | | | |
|
| | | /** @brief Get the value type of a parameter | |
| | | * | |
| | | * @param param Pointer to the OSyncPluginAdvancedOptionParameter object | |
| | | * @returns the value type of the parameter | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginAdvancedOptionType osync_plugin_advancedoption_para
m_get_type(OSyncPluginAdvancedOptionParameter *param); | | OSYNC_EXPORT OSyncPluginAdvancedOptionType osync_plugin_advancedoption_para
m_get_type(OSyncPluginAdvancedOptionParameter *param); | |
|
| | | | |
| | | /** @brief Get the value type of a parameter (as text) | |
| | | * | |
| | | * @param param Pointer to the OSyncPluginAdvancedOptionParameter object | |
| | | * @returns a string representing the value type of the parameter | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_advancedoption_param_get_type_string(
OSyncPluginAdvancedOptionParameter *param); | | OSYNC_EXPORT const char *osync_plugin_advancedoption_param_get_type_string(
OSyncPluginAdvancedOptionParameter *param); | |
|
| | | | |
| | | /** @brief Set the value type of a parameter | |
| | | * | |
| | | * @param param Pointer to the OSyncPluginAdvancedOptionParameter object | |
| | | * @param type the value type to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_param_set_type(OSyncPluginAdv
ancedOptionParameter *param, OSyncPluginAdvancedOptionType type); | | OSYNC_EXPORT void osync_plugin_advancedoption_param_set_type(OSyncPluginAdv
ancedOptionParameter *param, OSyncPluginAdvancedOptionType type); | |
| | | | |
|
| | | /** @brief Get a list of the enumerated values of a parameter | |
| | | * | |
| | | * For parameters which accept only a set list of possible values (i.e. an | |
| | | enumeration) this function | |
| | | * returns a list of the possible values. | |
| | | * | |
| | | * @param param Pointer to the OSyncPluginAdvancedOptionParameter object | |
| | | * @returns the list of enumerated values | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncList *osync_plugin_advancedoption_param_get_valenums(OSyn
cPluginAdvancedOptionParameter *param); | | OSYNC_EXPORT OSyncList *osync_plugin_advancedoption_param_get_valenums(OSyn
cPluginAdvancedOptionParameter *param); | |
|
| | | | |
| | | /** @brief Add an enumerated value to a parameter | |
| | | * | |
| | | * @param param Pointer to the OSyncPluginAdvancedOptionParameter object | |
| | | * @param value the value to add to the enumeration | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_param_add_valenum(OSyncPlugin
AdvancedOptionParameter *param, const char *value); | | OSYNC_EXPORT void osync_plugin_advancedoption_param_add_valenum(OSyncPlugin
AdvancedOptionParameter *param, const char *value); | |
|
| | | | |
| | | /** @brief Remove an enumerated value from a parameter | |
| | | * | |
| | | * @param param Pointer to the OSyncPluginAdvancedOptionParameter object | |
| | | * @param value the value to remove from the enumeration | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_param_remove_valenum(OSyncPlu
ginAdvancedOptionParameter *param, const char *value); | | OSYNC_EXPORT void osync_plugin_advancedoption_param_remove_valenum(OSyncPlu
ginAdvancedOptionParameter *param, const char *value); | |
| | | | |
|
| | | /** @brief Set the value of a parameter | |
| | | * | |
| | | * @param param Pointer to the OSyncPluginAdvancedOptionParameter object | |
| | | * @param value the value to set (as a null-terminated string) | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_advancedoption_param_set_value(OSyncPluginAd
vancedOptionParameter *param, const char *value); | | OSYNC_EXPORT void osync_plugin_advancedoption_param_set_value(OSyncPluginAd
vancedOptionParameter *param, const char *value); | |
|
| | | | |
| | | /** @brief Get the value of a parameter | |
| | | * | |
| | | * @param param Pointer to the OSyncPluginAdvancedOptionParameter object | |
| | | * @returns the value of the option (as a null-terminated string) | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_advancedoption_param_get_value(OSyncP
luginAdvancedOptionParameter *param); | | OSYNC_EXPORT const char *osync_plugin_advancedoption_param_get_value(OSyncP
luginAdvancedOptionParameter *param); | |
| | | | |
|
| | | /*@}*/ | |
| | | | |
| #endif /*_OPENSYNC_PLUGIN_ADVANCEDOPTIONS_H_*/ | | #endif /*_OPENSYNC_PLUGIN_ADVANCEDOPTIONS_H_*/ | |
| | | | |
End of changes. 40 change blocks. |
| 24 lines changed or deleted | | 333 lines changed or added | |
|
| opensync_plugin_authentication.h | | opensync_plugin_authentication.h | |
| /* | | /* | |
| * libopensync - A synchronization framework | | * libopensync - A synchronization framework | |
|
| * Copyright (C) 2008 Daniel Gollub <dgollub@suse.de> | | * Copyright (C) 2008 Daniel Gollub <gollub@b1-systems.de> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * 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, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Lesser General Public License for more details. | | * Lesser General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENSYNC_PLUGIN_AUTHENTICATON_H_ | | #ifndef _OPENSYNC_PLUGIN_AUTHENTICATON_H_ | |
| #define _OPENSYNC_PLUGIN_AUTHENTICATON_H_ | | #define _OPENSYNC_PLUGIN_AUTHENTICATON_H_ | |
| | | | |
|
| | | /** | |
| | | * @defgroup OSyncPluginAuthAPI OpenSync Plugin Authentication | |
| | | * @ingroup OSyncPlugin | |
| | | * @brief Functions for configuring plugin authentication | |
| | | * | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| | | /** @brief Types of authentication options supported by a plugin | |
| | | * | |
| | | **/ | |
| typedef enum { | | typedef enum { | |
|
| | | /** Authentication includes username */ | |
| OSYNC_PLUGIN_AUTHENTICATION_USERNAME = (1 << 0), | | OSYNC_PLUGIN_AUTHENTICATION_USERNAME = (1 << 0), | |
|
| | | /** Authentication includes password */ | |
| OSYNC_PLUGIN_AUTHENTICATION_PASSWORD = (1 << 1), | | OSYNC_PLUGIN_AUTHENTICATION_PASSWORD = (1 << 1), | |
|
| | | /** Authentication includes a reference to a password db entry */ | |
| OSYNC_PLUGIN_AUTHENTICATION_REFERENCE = (1 << 2), | | OSYNC_PLUGIN_AUTHENTICATION_REFERENCE = (1 << 2), | |
| } OSyncPluginAuthenticationOptionSupportedFlag; | | } OSyncPluginAuthenticationOptionSupportedFlag; | |
| | | | |
|
| | | /** @brief Set of OSyncPluginAuthenticationOptionSupportedFlags | |
| | | * | |
| | | **/ | |
| typedef unsigned int OSyncPluginAuthenticationOptionSupportedFlags; | | typedef unsigned int OSyncPluginAuthenticationOptionSupportedFlags; | |
| | | | |
|
| | | /** @brief Create a new OSyncPluginAuthentication object | |
| | | * | |
| | | * @param error Pointer to an error struct | |
| | | * @returns the newly created object, or NULL in case of an error. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginAuthentication *osync_plugin_authentication_new(OSy
ncError **error); | | OSYNC_EXPORT OSyncPluginAuthentication *osync_plugin_authentication_new(OSy
ncError **error); | |
|
| | | | |
| | | /** @brief Decrease the reference count on an OSyncPluginAuthentication obj | |
| | | ect | |
| | | * | |
| | | * @param auth Pointer to the OSyncPluginAuthentication object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_authentication_unref(OSyncPluginAuthenticati
on *auth); | | OSYNC_EXPORT void osync_plugin_authentication_unref(OSyncPluginAuthenticati
on *auth); | |
|
| | | | |
| | | /** @brief Increase the reference count on an OSyncPluginAuthentication obj | |
| | | ect | |
| | | * | |
| | | * @param auth Pointer to the OSyncPluginAuthentication object | |
| | | * @returns The OSyncPluginAuthentication object passed in | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginAuthentication *osync_plugin_authentication_ref(OSy
ncPluginAuthentication *auth); | | OSYNC_EXPORT OSyncPluginAuthentication *osync_plugin_authentication_ref(OSy
ncPluginAuthentication *auth); | |
| | | | |
|
| | | /** @brief Determine if an authentication option is supported by a plugin | |
| | | * | |
| | | * @param auth Pointer to the OSyncPluginAuthentication object | |
| | | * @param flag Authentication option to check | |
| | | * @returns TRUE if the specified option is supported, FALSE otherwise. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_plugin_authentication_option_is_supported(OSy
ncPluginAuthentication *auth, OSyncPluginAuthenticationOptionSupportedFlag
flag); | | OSYNC_EXPORT osync_bool osync_plugin_authentication_option_is_supported(OSy
ncPluginAuthentication *auth, OSyncPluginAuthenticationOptionSupportedFlag
flag); | |
|
| | | | |
| | | /** @brief Set the authentication options supported by a plugin | |
| | | * | |
| | | * @param auth Pointer to the OSyncPluginAuthentication object | |
| | | * @param flags Authentication option to check | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_authentication_option_set_supported(OSyncPlu
ginAuthentication *auth, OSyncPluginAuthenticationOptionSupportedFlags flag
s); | | OSYNC_EXPORT void osync_plugin_authentication_option_set_supported(OSyncPlu
ginAuthentication *auth, OSyncPluginAuthenticationOptionSupportedFlags flag
s); | |
| | | | |
|
| | | /** @brief Get the authentication username | |
| | | * | |
| | | * @param auth Pointer to the OSyncPluginAuthentication object | |
| | | * @returns the username or NULL if not set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_authentication_get_username(OSyncPlug
inAuthentication *auth); | | OSYNC_EXPORT const char *osync_plugin_authentication_get_username(OSyncPlug
inAuthentication *auth); | |
|
| | | | |
| | | /** @brief Set the authentication username | |
| | | * | |
| | | * @param auth Pointer to the OSyncPluginAuthentication object | |
| | | * @param username the username to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_authentication_set_username(OSyncPluginAuthe
ntication *auth, const char *username); | | OSYNC_EXPORT void osync_plugin_authentication_set_username(OSyncPluginAuthe
ntication *auth, const char *username); | |
| | | | |
|
| | | /** @brief Get the authentication password | |
| | | * | |
| | | * @param auth Pointer to the OSyncPluginAuthentication object | |
| | | * @returns the username or NULL if not set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_authentication_get_password(OSyncPlug
inAuthentication *auth); | | OSYNC_EXPORT const char *osync_plugin_authentication_get_password(OSyncPlug
inAuthentication *auth); | |
|
| | | | |
| | | /** @brief Set the authentication password | |
| | | * | |
| | | * WARNING: This password will be stored in plain text in the plugin config | |
| | | uration file. In | |
| | | * future versions of OpenSync, interfaces should be available to password | |
| | | databases | |
| | | * (KWallet, Gnome-keyring etc.), and once they are available you should us | |
| | | e them instead. | |
| | | * Until then, you should warn users of your plugin that the password is st | |
| | | ored unencrypted. | |
| | | * | |
| | | * @param auth Pointer to the OSyncPluginAuthentication object | |
| | | * @param password the password to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_authentication_set_password(OSyncPluginAuthe
ntication *auth, const char *password); | | OSYNC_EXPORT void osync_plugin_authentication_set_password(OSyncPluginAuthe
ntication *auth, const char *password); | |
| | | | |
|
| | | /** @brief Get the authentication reference. | |
| | | * | |
| | | * This reference is intended to be a key used to look up the password usin | |
| | | g some kind of | |
| | | * password storage system, such as KDE's KWallet or Gnome-keyring. As this | |
| | | is not yet | |
| | | * fully implemented this interface may be subject to change in future vers | |
| | | ions of OpenSync. | |
| | | * | |
| | | * @param auth Pointer to the OSyncPluginAuthentication object | |
| | | * @returns the reference or NULL if not set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_authentication_get_reference(OSyncPlu
ginAuthentication *auth); | | OSYNC_EXPORT const char *osync_plugin_authentication_get_reference(OSyncPlu
ginAuthentication *auth); | |
|
| | | | |
| | | /** @brief Set the authentication reference | |
| | | * | |
| | | * This reference is intended to be a key used to look up the password usin | |
| | | g some kind of | |
| | | * password storage system, such as KDE's KWallet or Gnome-keyring. As this | |
| | | is not yet | |
| | | * fully implemented this interface may be subject to change in future vers | |
| | | ions of OpenSync. | |
| | | * | |
| | | * @param auth Pointer to the OSyncPluginAuthentication object | |
| | | * @param reference the reference to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_authentication_set_reference(OSyncPluginAuth
entication *auth, const char *reference); | | OSYNC_EXPORT void osync_plugin_authentication_set_reference(OSyncPluginAuth
entication *auth, const char *reference); | |
| | | | |
|
| | | /*@}*/ | |
| | | | |
| #endif /*_OPENSYNC_PLUGIN_AUTHENTICATON_H_*/ | | #endif /*_OPENSYNC_PLUGIN_AUTHENTICATON_H_*/ | |
| | | | |
End of changes. 18 change blocks. |
| 1 lines changed or deleted | | 117 lines changed or added | |
|
| opensync_plugin_config.h | | opensync_plugin_config.h | |
| /* | | /* | |
| * libopensync - A synchronization framework | | * libopensync - A synchronization framework | |
|
| * Copyright (C) 2008 Daniel Gollub <dgollub@suse.de> | | * Copyright (C) 2008 Daniel Gollub <gollub@b1-systems.de> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * 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, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Lesser General Public License for more details. | | * Lesser General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENSYNC_PLUGIN_CONFIG_H_ | | #ifndef _OPENSYNC_PLUGIN_CONFIG_H_ | |
| #define _OPENSYNC_PLUGIN_CONFIG_H_ | | #define _OPENSYNC_PLUGIN_CONFIG_H_ | |
| | | | |
|
| #include <opensync/opensync_list.h> | | /** \todo Review open OSyncPluginConfig documentation */ | |
| | | | |
| | | /** | |
| | | * @defgroup OSyncPluginConfigAPI OpenSync Plugin Config | |
| | | * @ingroup OSyncPlugin | |
| | | * @brief Functions to get and set a plugin's configuration | |
| | | * | |
| | | */ | |
| | | | |
|
| | | /*@{*/ | |
| | | | |
| | | /** @brief Flags specifying the elements supported by a plugin config | |
| | | * | |
| | | * @param error Pointer to and error struct | |
| | | * @returns the newly registered plugin config object | |
| | | */ | |
| typedef enum { | | typedef enum { | |
|
| | | /** Advanced options */ | |
| OPENSYNC_PLUGIN_CONFIG_ADVANCEDOPTION = (1 << 0), | | OPENSYNC_PLUGIN_CONFIG_ADVANCEDOPTION = (1 << 0), | |
|
| | | /** Authentication options */ | |
| OPENSYNC_PLUGIN_CONFIG_AUTHENTICATION = (1 << 1), | | OPENSYNC_PLUGIN_CONFIG_AUTHENTICATION = (1 << 1), | |
|
| | | /** Localization options */ | |
| OPENSYNC_PLUGIN_CONFIG_LOCALIZATION = (1 << 2), | | OPENSYNC_PLUGIN_CONFIG_LOCALIZATION = (1 << 2), | |
|
| | | /** Resources */ | |
| OPENSYNC_PLUGIN_CONFIG_RESOURCES = (1 << 3), | | OPENSYNC_PLUGIN_CONFIG_RESOURCES = (1 << 3), | |
|
| | | /** Connection options */ | |
| OPENSYNC_PLUGIN_CONFIG_CONNECTION = (1 << 4) | | OPENSYNC_PLUGIN_CONFIG_CONNECTION = (1 << 4) | |
| } OSyncPluginConfigSupportedFlag; | | } OSyncPluginConfigSupportedFlag; | |
| | | | |
|
| | | /** @brief Set of OSyncPluginConfigSupportedFlags | |
| | | * | |
| | | **/ | |
| typedef unsigned int OSyncPluginConfigSupportedFlags; | | typedef unsigned int OSyncPluginConfigSupportedFlags; | |
| | | | |
|
| | | /** @brief Create a new plugin config object | |
| | | * | |
| | | * @param error Pointer to and error struct | |
| | | * @returns the newly registered plugin config object | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginConfig *osync_plugin_config_new(OSyncError **error)
; | | OSYNC_EXPORT OSyncPluginConfig *osync_plugin_config_new(OSyncError **error)
; | |
|
| | | | |
| | | /** @brief Decrease the reference count on a plugin config object | |
| | | * | |
| | | * @param config Pointer to the plugin config object | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_config_unref(OSyncPluginConfig *config); | | OSYNC_EXPORT void osync_plugin_config_unref(OSyncPluginConfig *config); | |
|
| | | | |
| | | /** @brief Increase the reference count on a plugin config object | |
| | | * | |
| | | * @param config Pointer to the plugin config object | |
| | | * @returns the passed plugin config | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginConfig *osync_plugin_config_ref(OSyncPluginConfig *
config); | | OSYNC_EXPORT OSyncPluginConfig *osync_plugin_config_ref(OSyncPluginConfig *
config); | |
| | | | |
|
| OSYNC_EXPORT osync_bool osync_plugin_config_file_load(OSyncPluginConfig *co | | /** @brief Load a plugin config file | |
| nfig, const char *path, const char *schemadir, OSyncError **error); | | * | |
| | | * @param config Contents of config file as OsyncPluginConfig object | |
| | | * @param path Path to file to load | |
| | | * @param error Pointer to error struct | |
| | | * @return True on success, False on failure - error will contain details | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_plugin_config_file_load(OSyncPluginConfig *co | |
| | | nfig, const char *path, OSyncError **error); | |
| | | | |
| | | /** @brief Save a plugin config to a file | |
| | | * | |
| | | * @param config Plugin config to save | |
| | | * @param path Path to save file | |
| | | * @param error Pointer to error struct that will contain details in case o | |
| | | f failure | |
| | | * @returns True on success, False on failure - error will contain details | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_plugin_config_file_save(OSyncPluginConfig *co
nfig, const char *path, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_plugin_config_file_save(OSyncPluginConfig *co
nfig, const char *path, OSyncError **error); | |
| | | | |
|
| | | /** @brief Check if a config element is supported by a config | |
| | | * | |
| | | * @param config Plugin config to check | |
| | | * @param flag The type of configuration element to check | |
| | | * @returns True if element is supported, False otherwise | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_plugin_config_is_supported(OSyncPluginConfig
*config, OSyncPluginConfigSupportedFlag flag); | | OSYNC_EXPORT osync_bool osync_plugin_config_is_supported(OSyncPluginConfig
*config, OSyncPluginConfigSupportedFlag flag); | |
|
| | | | |
| | | /** @brief Sets the passed config element flags as supported by the config | |
| | | * | |
| | | * @param config An OsyncPluginConfig to modify | |
| | | * @param flags An OSyncPluginConfigSupportedFlags to set the flags to (mer | |
| | | ge or overwrite??) | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_config_set_supported(OSyncPluginConfig *conf
ig, OSyncPluginConfigSupportedFlags flags); | | OSYNC_EXPORT void osync_plugin_config_set_supported(OSyncPluginConfig *conf
ig, OSyncPluginConfigSupportedFlags flags); | |
| | | | |
| /* Advanced Options */ | | /* Advanced Options */ | |
|
| | | /** @brief Get the advanced options from a config | |
| | | * | |
| | | * @param config An OSyncPluginConfig to get the advanced options from | |
| | | * @returns An OSyncList of OSyncPluginAdvancedOption s | |
| | | */ | |
| OSYNC_EXPORT OSyncList *osync_plugin_config_get_advancedoptions(OSyncPlugin
Config *config); | | OSYNC_EXPORT OSyncList *osync_plugin_config_get_advancedoptions(OSyncPlugin
Config *config); | |
|
| OSYNC_EXPORT OSyncPluginAdvancedOption *osync_plugin_config_get_advancedopt | | | |
| ion_value_by_name(OSyncPluginConfig *config, const char *name); | | /**@brief Get an advanced option from the config by name | |
| | | * | |
| | | * @param config An OSyncPluginConfig to search | |
| | | * @param name The name of the advanced option to get | |
| | | * @returns The value associated with the first OSyncPluginAdvancedOption w | |
| | | ith the given name or NULL if not found | |
| | | */ | |
| | | OSYNC_EXPORT const char *osync_plugin_config_get_advancedoption_value_by_na | |
| | | me(OSyncPluginConfig *config, const char *name); | |
| | | | |
| | | /**@brief Add an advanced option to a config | |
| | | * | |
| | | * @param config The config to add the option to | |
| | | * @param option the advanced option to add | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_config_add_advancedoption(OSyncPluginConfig
*config, OSyncPluginAdvancedOption *option); | | OSYNC_EXPORT void osync_plugin_config_add_advancedoption(OSyncPluginConfig
*config, OSyncPluginAdvancedOption *option); | |
|
| | | | |
| | | /**@brief Remove an advanced option from a config | |
| | | * | |
| | | * @param config An OSyncPluginConfig to remove from | |
| | | * @param option The advanced option to be removed | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_config_remove_advancedoption(OSyncPluginConf
ig *config, OSyncPluginAdvancedOption *option); | | OSYNC_EXPORT void osync_plugin_config_remove_advancedoption(OSyncPluginConf
ig *config, OSyncPluginAdvancedOption *option); | |
| | | | |
| /* Authentication */ | | /* Authentication */ | |
|
| | | /**@brief Get the authentication settings from a config | |
| | | * | |
| | | * @param config An OSyncPluginConfig | |
| | | * @returns an OSyncPluginAuthentication with the details ?? or NULL if no | |
| | | authentication configured | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginAuthentication *osync_plugin_config_get_authenticat
ion(OSyncPluginConfig *config); | | OSYNC_EXPORT OSyncPluginAuthentication *osync_plugin_config_get_authenticat
ion(OSyncPluginConfig *config); | |
|
| | | | |
| | | /**@brief Set the authentication configuration | |
| | | * | |
| | | * @param config An OSyncPluginConfig | |
| | | * @param authentication The new authentication settings as an OSyncPluginA | |
| | | uthentication | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_config_set_authentication(OSyncPluginConfig
*config, OSyncPluginAuthentication *authentication); | | OSYNC_EXPORT void osync_plugin_config_set_authentication(OSyncPluginConfig
*config, OSyncPluginAuthentication *authentication); | |
| | | | |
| /* Localization */ | | /* Localization */ | |
|
| | | /**@brief Get the localization settings | |
| | | * | |
| | | * @param config An OSyncPluginConfig | |
| | | * @returns the localization settings as an OSyncPluginLocalization | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginLocalization *osync_plugin_config_get_localization(
OSyncPluginConfig *config); | | OSYNC_EXPORT OSyncPluginLocalization *osync_plugin_config_get_localization(
OSyncPluginConfig *config); | |
|
| | | | |
| | | /**@brief Set the localization settings | |
| | | * | |
| | | * @param config An OSyncPluginConfig | |
| | | * @param localization An OSyncPluginLocalization containing the new locali | |
| | | zation settings | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_config_set_localization(OSyncPluginConfig *c
onfig, OSyncPluginLocalization *localization); | | OSYNC_EXPORT void osync_plugin_config_set_localization(OSyncPluginConfig *c
onfig, OSyncPluginLocalization *localization); | |
| | | | |
| /* Resources */ | | /* Resources */ | |
|
| OSYNC_EXPORT OSyncList *osync_plugin_config_get_resources(OSyncPluginConfig | | /**@brief Get the configured resources | |
| *plugin); | | * | |
| | | * @param config An OSyncPluginConfig | |
| | | * @returns a list of OSyncPluginResource | |
| | | */ | |
| | | OSYNC_EXPORT OSyncList *osync_plugin_config_get_resources(OSyncPluginConfig | |
| | | *config); | |
| | | | |
| | | /**@brief Find the active resource by object type | |
| | | * | |
| | | * @param config An OSyncPluginConfig | |
| | | * @param objtype the object type to find the active resource for | |
| | | * @returns the active resource or NULL if none was found | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginResource *osync_plugin_config_find_active_resource(
OSyncPluginConfig *config, const char *objtype); | | OSYNC_EXPORT OSyncPluginResource *osync_plugin_config_find_active_resource(
OSyncPluginConfig *config, const char *objtype); | |
|
| OSYNC_EXPORT void osync_plugin_config_add_resource(OSyncPluginConfig *plugi | | | |
| n, OSyncPluginResource *resource); | | /**@brief Add a resource to a config | |
| OSYNC_EXPORT void osync_plugin_config_remove_resource(OSyncPluginConfig *pl | | * | |
| ugin, OSyncPluginResource *resource); | | * @param config An OSyncPluginConfig to add to | |
| OSYNC_EXPORT void osync_plugin_config_flush_resources(OSyncPluginConfig *pl | | * @param resource An OSyncPluginResource to add to the config | |
| ugin); | | */ | |
| | | OSYNC_EXPORT void osync_plugin_config_add_resource(OSyncPluginConfig *confi | |
| | | g, OSyncPluginResource *resource); | |
| | | | |
| | | /**@brief Remove a resource from a config | |
| | | * | |
| | | * @param config An OSyncPluginConfig to remove from | |
| | | * @param resource The OSyncPluginResource to remove | |
| | | */ | |
| | | OSYNC_EXPORT void osync_plugin_config_remove_resource(OSyncPluginConfig *co | |
| | | nfig, OSyncPluginResource *resource); | |
| | | | |
| | | OSYNC_EXPORT void osync_plugin_config_flush_resources(OSyncPluginConfig *co | |
| | | nfig); | |
| | | | |
| /* Connection */ | | /* Connection */ | |
|
| | | /**@brief Get the connection settings from a config | |
| | | * | |
| | | * @param config An OSyncPluginConfig | |
| | | * @returns the connection settings as an OSyncPluginConnection | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginConnection *osync_plugin_config_get_connection(OSyn
cPluginConfig *config); | | OSYNC_EXPORT OSyncPluginConnection *osync_plugin_config_get_connection(OSyn
cPluginConfig *config); | |
|
| | | | |
| | | /**@brief Set the connection settings in a config | |
| | | * | |
| | | * @param config An OSyncPluginConfig | |
| | | * @param connection the connection settings as an OSyncPluginConnection | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_config_set_connection(OSyncPluginConfig *con
fig, OSyncPluginConnection *connection); | | OSYNC_EXPORT void osync_plugin_config_set_connection(OSyncPluginConfig *con
fig, OSyncPluginConnection *connection); | |
| | | | |
|
| | | /*@}*/ | |
| | | | |
| #endif /*_OPENSYNC_PLUGIN_CONFIG_H_*/ | | #endif /*_OPENSYNC_PLUGIN_CONFIG_H_*/ | |
| | | | |
End of changes. 27 change blocks. |
| 14 lines changed or deleted | | 169 lines changed or added | |
|
| opensync_plugin_connection.h | | opensync_plugin_connection.h | |
| /* | | /* | |
| * libopensync - A synchronization framework | | * libopensync - A synchronization framework | |
|
| * Copyright (C) 2008 Daniel Gollub <dgollub@suse.de> | | * Copyright (C) 2008 Daniel Gollub <gollub@b1-systems.de> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * 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, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Lesser General Public License for more details. | | * Lesser General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENSYNC_PLUGIN_CONNECTION_H_ | | #ifndef _OPENSYNC_PLUGIN_CONNECTION_H_ | |
| #define _OPENSYNC_PLUGIN_CONNECTION_H_ | | #define _OPENSYNC_PLUGIN_CONNECTION_H_ | |
| | | | |
|
| /*! @brief Gives information about the current connection type | | /** | |
| | | * @defgroup OSyncPluginConnectionAPI OpenSync Plugin Connection Options | |
| | | * @ingroup OSyncPlugin | |
| | | * @brief Functions to get and set a plugin's connection options | |
| | | * | |
| | | */ | |
| | | | |
| | | /*@{*/ | |
| | | | |
| | | /** @brief Connection type support flags | |
| * | | * | |
|
| * @ingroup OSyncPluginConnectionAPI | | | |
| **/ | | **/ | |
| typedef enum { | | typedef enum { | |
| /** Unknown */ | | /** Unknown */ | |
|
| OSYNC_PLUGIN_CONNECTION_UNKNOWN = 0, | | OSYNC_PLUGIN_CONNECTION_UNKNOWN = 0, | |
| /** Bluetooth */ | | /** Bluetooth */ | |
| OSYNC_PLUGIN_CONNECTION_BLUETOOTH = (1 << 0), | | OSYNC_PLUGIN_CONNECTION_BLUETOOTH = (1 << 0), | |
| /** USB */ | | /** USB */ | |
| OSYNC_PLUGIN_CONNECTION_USB = (1 << 1), | | OSYNC_PLUGIN_CONNECTION_USB = (1 << 1), | |
| /** Network */ | | /** Network */ | |
|
| OSYNC_PLUGIN_CONNECTION_NETWORK = (1 << 2), | | OSYNC_PLUGIN_CONNECTION_NETWORK = (1 << 2), | |
| /** Serial */ | | /** Serial */ | |
|
| OSYNC_PLUGIN_CONNECTION_SERIAL = (1 << 3), | | OSYNC_PLUGIN_CONNECTION_SERIAL = (1 << 3), | |
| /** IrDA */ | | /** IrDA */ | |
| OSYNC_PLUGIN_CONNECTION_IRDA = (1 << 4) | | OSYNC_PLUGIN_CONNECTION_IRDA = (1 << 4) | |
| } OSyncPluginConnectionType; | | } OSyncPluginConnectionType; | |
| | | | |
|
| | | /** @brief Connection type | |
| | | * | |
| | | */ | |
| typedef OSyncPluginConnectionType OSyncPluginConnectionSupportedFlag; | | typedef OSyncPluginConnectionType OSyncPluginConnectionSupportedFlag; | |
|
| | | | |
| | | /** @brief Set of OSyncPluginConnectionType values | |
| | | * | |
| | | */ | |
| typedef unsigned int OSyncPluginConnectionSupportedFlags; | | typedef unsigned int OSyncPluginConnectionSupportedFlags; | |
| | | | |
|
| | | /** @brief Connection option support flags | |
| | | * | |
| | | */ | |
| typedef enum { | | typedef enum { | |
|
| /* Bluetooth */ | | /** Bluetooth (MAC) address */ | |
| OSYNC_PLUGIN_CONNECTION_BLUETOOTH_ADDRESS = (1 << 0), | | OSYNC_PLUGIN_CONNECTION_BLUETOOTH_ADDRESS = (1 << 0), | |
|
| | | /** Bluetooth RFCOMM channel */ | |
| OSYNC_PLUGIN_CONNECTION_BLUETOOTH_RFCOMM = (1 << 1), | | OSYNC_PLUGIN_CONNECTION_BLUETOOTH_RFCOMM = (1 << 1), | |
|
| | | /** Bluetooth SDP UUID */ | |
| OSYNC_PLUGIN_CONNECTION_BLUETOOTH_SDPUUID = (1 << 2), | | OSYNC_PLUGIN_CONNECTION_BLUETOOTH_SDPUUID = (1 << 2), | |
|
| /* USB */ | | /** USB Vendor ID */ | |
| OSYNC_PLUGIN_CONNECTION_USB_VENDORID = (1 << 3), | | OSYNC_PLUGIN_CONNECTION_USB_VENDORID = (1 << 3), | |
|
| | | /** USB Product ID */ | |
| OSYNC_PLUGIN_CONNECTION_USB_PRODUCTID = (1 << 4), | | OSYNC_PLUGIN_CONNECTION_USB_PRODUCTID = (1 << 4), | |
|
| | | /** USB interface ??? */ | |
| OSYNC_PLUGIN_CONNECTION_USB_INTERFACE = (1 << 5), | | OSYNC_PLUGIN_CONNECTION_USB_INTERFACE = (1 << 5), | |
|
| /* Network */ | | /** Network address (IP/hostname) */ | |
| OSYNC_PLUGIN_CONNECTION_NETWORK_ADDRESS = (1 << 6), | | OSYNC_PLUGIN_CONNECTION_NETWORK_ADDRESS = (1 << 6), | |
| | | /** Network port */ | |
| OSYNC_PLUGIN_CONNECTION_NETWORK_PORT = (1 << 7), | | OSYNC_PLUGIN_CONNECTION_NETWORK_PORT = (1 << 7), | |
|
| | | /** Network protocol */ | |
| OSYNC_PLUGIN_CONNECTION_NETWORK_PROTOCOL = (1 << 8), | | OSYNC_PLUGIN_CONNECTION_NETWORK_PROTOCOL = (1 << 8), | |
|
| | | /** Network DNS-SD service type */ | |
| OSYNC_PLUGIN_CONNECTION_NETWORK_DNSSD = (1 << 9), | | OSYNC_PLUGIN_CONNECTION_NETWORK_DNSSD = (1 << 9), | |
|
| /* Serial */ | | /** Serial port speed (bps) eg. 115200 */ | |
| OSYNC_PLUGIN_CONNECTION_SERIAL_SPEED = (1 << 10), | | OSYNC_PLUGIN_CONNECTION_SERIAL_SPEED = (1 << 10), | |
|
| | | /** Serial device node (e.g. /dev/ttyS0, /dev/ttyUSB0, ...) */ | |
| OSYNC_PLUGIN_CONNECTION_SERIAL_DEVICENODE = (1 << 11), | | OSYNC_PLUGIN_CONNECTION_SERIAL_DEVICENODE = (1 << 11), | |
|
| /* IrDA */ | | /** IrDA Identifier (Service) String */ | |
| OSYNC_PLUGIN_CONNECTION_IRDA_SERVICE = (1 << 12) | | OSYNC_PLUGIN_CONNECTION_IRDA_SERVICE = (1 << 12) | |
| } OSyncPluginConnectionOptionSupportedFlag; | | } OSyncPluginConnectionOptionSupportedFlag; | |
| | | | |
|
| | | /** @brief Set of OSyncPluginConnectionOptionSupportedFlag values | |
| | | * | |
| | | */ | |
| typedef unsigned int OSyncPluginConnectionOptionSupportedFlags; | | typedef unsigned int OSyncPluginConnectionOptionSupportedFlags; | |
| | | | |
|
| | | /** @brief Create a new OSyncPluginConnection object | |
| | | * | |
| | | * @param error Pointer to an error struct | |
| | | * @returns the newly created object, or NULL in case of an error. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginConnection *osync_plugin_connection_new(OSyncError
**error); | | OSYNC_EXPORT OSyncPluginConnection *osync_plugin_connection_new(OSyncError
**error); | |
|
| | | | |
| | | /** @brief Decrease the reference count on an OSyncPluginConnection object | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_unref(OSyncPluginConnection *conn
ection); | | OSYNC_EXPORT void osync_plugin_connection_unref(OSyncPluginConnection *conn
ection); | |
|
| | | | |
| | | /** @brief Increase the reference count on an OSyncPluginConnection object | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The OSyncPluginConnection object passed in | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginConnection *osync_plugin_connection_ref(OSyncPlugin
Connection *connection); | | OSYNC_EXPORT OSyncPluginConnection *osync_plugin_connection_ref(OSyncPlugin
Connection *connection); | |
| | | | |
|
| | | /** @brief Get the type of a connection | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The connection type | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginConnectionType osync_plugin_connection_get_type(OSy
ncPluginConnection *connection); | | OSYNC_EXPORT OSyncPluginConnectionType osync_plugin_connection_get_type(OSy
ncPluginConnection *connection); | |
|
| | | | |
| | | /** @brief Set the type of a connection | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param type The connection type to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_set_type(OSyncPluginConnection *c
onnection, OSyncPluginConnectionType type); | | OSYNC_EXPORT void osync_plugin_connection_set_type(OSyncPluginConnection *c
onnection, OSyncPluginConnectionType type); | |
| | | | |
|
| | | /** @brief Check if a type of connection is supported | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param flag The connection type to check | |
| | | * @returns true if the connection type is supported, false otherwise. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_plugin_connection_is_supported(OSyncPluginCon
nection *connection, OSyncPluginConnectionSupportedFlag flag); | | OSYNC_EXPORT osync_bool osync_plugin_connection_is_supported(OSyncPluginCon
nection *connection, OSyncPluginConnectionSupportedFlag flag); | |
|
| | | | |
| | | /** @brief Set the types of a connection that are supported | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param flags The set of connection types to set as supported | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_set_supported(OSyncPluginConnecti
on *connection, OSyncPluginConnectionSupportedFlags flags); | | OSYNC_EXPORT void osync_plugin_connection_set_supported(OSyncPluginConnecti
on *connection, OSyncPluginConnectionSupportedFlags flags); | |
| | | | |
|
| | | /** @brief Check if a connection option is supported | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param flag The connection option to check | |
| | | * @returns true if the connection option is supported, false otherwise. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_plugin_connection_option_is_supported(OSyncPl
uginConnection *connection, OSyncPluginConnectionOptionSupportedFlag flag); | | OSYNC_EXPORT osync_bool osync_plugin_connection_option_is_supported(OSyncPl
uginConnection *connection, OSyncPluginConnectionOptionSupportedFlag flag); | |
|
| | | | |
| | | /** @brief Set the connection options that are supported | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param flags The set of connection options to set as supported | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_option_set_supported(OSyncPluginC
onnection *connection, OSyncPluginConnectionOptionSupportedFlags flags); | | OSYNC_EXPORT void osync_plugin_connection_option_set_supported(OSyncPluginC
onnection *connection, OSyncPluginConnectionOptionSupportedFlags flags); | |
| | | | |
| /* Bluetooth */ | | /* Bluetooth */ | |
|
| | | | |
| | | /** @brief Get the Bluetooth address | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The bluetooth address or NULL if not set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_connection_bt_get_addr(OSyncPluginCon
nection *connection); | | OSYNC_EXPORT const char *osync_plugin_connection_bt_get_addr(OSyncPluginCon
nection *connection); | |
|
| | | | |
| | | /** @brief Set the Bluetooth address | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param address The bluetooth address to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_bt_set_addr(OSyncPluginConnection
*connection, const char *address); | | OSYNC_EXPORT void osync_plugin_connection_bt_set_addr(OSyncPluginConnection
*connection, const char *address); | |
| | | | |
|
| | | /** @brief Get the Bluetooth RFCOMM channel | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The RFCOMM channel | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT unsigned int osync_plugin_connection_bt_get_channel(OSyncPlugi
nConnection *connection); | | OSYNC_EXPORT unsigned int osync_plugin_connection_bt_get_channel(OSyncPlugi
nConnection *connection); | |
|
| | | | |
| | | /** @brief Set the Bluetooth RFCOMM channel | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param channel The RFCOMM channel to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_bt_set_channel(OSyncPluginConnect
ion *connection, unsigned int channel); | | OSYNC_EXPORT void osync_plugin_connection_bt_set_channel(OSyncPluginConnect
ion *connection, unsigned int channel); | |
| | | | |
|
| | | /** @brief Get the Bluetooth SDP UUID | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The SDP UUID or NULL if not set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_connection_bt_get_sdpuuid(OSyncPlugin
Connection *connection); | | OSYNC_EXPORT const char *osync_plugin_connection_bt_get_sdpuuid(OSyncPlugin
Connection *connection); | |
|
| | | | |
| | | /** @brief Set the Bluetooth SDP UUID | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param sdpuuid The SDP UUID to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_bt_set_sdpuuid(OSyncPluginConnect
ion *connection, const char *sdpuuid); | | OSYNC_EXPORT void osync_plugin_connection_bt_set_sdpuuid(OSyncPluginConnect
ion *connection, const char *sdpuuid); | |
| | | | |
| /* USB */ | | /* USB */ | |
|
| | | | |
| | | /** @brief Get the USB vendor ID | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The USB vendor ID | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_connection_usb_get_vendorid(OSyncPlug
inConnection *connection); | | OSYNC_EXPORT const char *osync_plugin_connection_usb_get_vendorid(OSyncPlug
inConnection *connection); | |
|
| | | | |
| | | /** @brief Set the USB vendor ID | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param vendorid The USB vendor ID to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_usb_set_vendorid(OSyncPluginConne
ction *connection, const char *vendorid); | | OSYNC_EXPORT void osync_plugin_connection_usb_set_vendorid(OSyncPluginConne
ction *connection, const char *vendorid); | |
| | | | |
|
| | | /** @brief Get the USB product ID | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The USB product ID | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_connection_usb_get_productid(OSyncPlu
ginConnection *connection); | | OSYNC_EXPORT const char *osync_plugin_connection_usb_get_productid(OSyncPlu
ginConnection *connection); | |
|
| | | | |
| | | /** @brief Set the USB product ID | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param productid The USB product ID to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_usb_set_productid(OSyncPluginConn
ection *connection, const char *productid); | | OSYNC_EXPORT void osync_plugin_connection_usb_set_productid(OSyncPluginConn
ection *connection, const char *productid); | |
| | | | |
|
| | | /** @brief Get the USB interface number | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The USB interface number | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT unsigned int osync_plugin_connection_usb_get_interface(OSyncPl
uginConnection *connection); | | OSYNC_EXPORT unsigned int osync_plugin_connection_usb_get_interface(OSyncPl
uginConnection *connection); | |
|
| OSYNC_EXPORT void osync_plugin_connection_usb_set_interface(OSyncPluginConn | | | |
| ection *connection, unsigned int interface); | | /** @brief Set the USB interface number | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param interf The USB interface number to set | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT void osync_plugin_connection_usb_set_interface(OSyncPluginConn | |
| | | ection *connection, unsigned int interf); | |
| | | | |
| /* Network */ | | /* Network */ | |
|
| | | | |
| | | /** @brief Get the network address (IP address or hostname) | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The network address | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_connection_net_get_address(OSyncPlugi
nConnection *connection); | | OSYNC_EXPORT const char *osync_plugin_connection_net_get_address(OSyncPlugi
nConnection *connection); | |
|
| | | | |
| | | /** @brief Set the network address (IP address or hostname) | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param address The network address to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_net_set_address(OSyncPluginConnec
tion *connection, const char *address); | | OSYNC_EXPORT void osync_plugin_connection_net_set_address(OSyncPluginConnec
tion *connection, const char *address); | |
| | | | |
|
| | | /** @brief Get the network port | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The network port | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT unsigned int osync_plugin_connection_net_get_port(OSyncPluginC
onnection *connection); | | OSYNC_EXPORT unsigned int osync_plugin_connection_net_get_port(OSyncPluginC
onnection *connection); | |
|
| | | | |
| | | /** @brief Set the network port | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param port The network port to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_net_set_port(OSyncPluginConnectio
n *connection, unsigned int port); | | OSYNC_EXPORT void osync_plugin_connection_net_set_port(OSyncPluginConnectio
n *connection, unsigned int port); | |
| | | | |
|
| | | /** @brief Get the network protocol | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The network protocol | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_connection_net_get_protocol(OSyncPlug
inConnection *connection); | | OSYNC_EXPORT const char *osync_plugin_connection_net_get_protocol(OSyncPlug
inConnection *connection); | |
|
| | | | |
| | | /** @brief Set the network protocol | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param protocol The network protocol to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_net_set_protocol(OSyncPluginConne
ction *connection, const char *protocol); | | OSYNC_EXPORT void osync_plugin_connection_net_set_protocol(OSyncPluginConne
ction *connection, const char *protocol); | |
| | | | |
|
| | | /** @brief Get the network DNS-SD service type | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The DNS-SD service type or NULL if not set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_connection_net_get_dnssd(OSyncPluginC
onnection *connection); | | OSYNC_EXPORT const char *osync_plugin_connection_net_get_dnssd(OSyncPluginC
onnection *connection); | |
|
| | | | |
| | | /** @brief Set the network DNS-SD service type | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param dnssd The DNS-SD service type to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_net_set_dnssd(OSyncPluginConnecti
on *connection, const char *dnssd); | | OSYNC_EXPORT void osync_plugin_connection_net_set_dnssd(OSyncPluginConnecti
on *connection, const char *dnssd); | |
| | | | |
| /* Serial */ | | /* Serial */ | |
|
| | | | |
| | | /** @brief Get the serial port speed | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The serial port speed, in bps | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT unsigned int osync_plugin_connection_serial_get_speed(OSyncPlu
ginConnection *connection); | | OSYNC_EXPORT unsigned int osync_plugin_connection_serial_get_speed(OSyncPlu
ginConnection *connection); | |
|
| | | | |
| | | /** @brief Set the serial port speed | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param speed The serial port speed to set, in bps | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_serial_set_speed(OSyncPluginConne
ction *connection, unsigned int speed); | | OSYNC_EXPORT void osync_plugin_connection_serial_set_speed(OSyncPluginConne
ction *connection, unsigned int speed); | |
| | | | |
|
| | | /** @brief Get the serial port device | |
| | | * | |
| | | * The serial port device node, eg. /dev/ttyS0, /dev/ttyUSB0 etc. | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The serial port device node | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_connection_serial_get_devicenode(OSyn
cPluginConnection *connection); | | OSYNC_EXPORT const char *osync_plugin_connection_serial_get_devicenode(OSyn
cPluginConnection *connection); | |
|
| | | | |
| | | /** @brief Set the serial port device | |
| | | * | |
| | | * The serial port device node, eg. /dev/ttyS0, /dev/ttyUSB0 etc. | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param devicenode The serial port device node to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_serial_set_devicenode(OSyncPlugin
Connection *connection, const char *devicenode); | | OSYNC_EXPORT void osync_plugin_connection_serial_set_devicenode(OSyncPlugin
Connection *connection, const char *devicenode); | |
| | | | |
| /* IrDA */ | | /* IrDA */ | |
|
| | | | |
| | | /** @brief Get the IrDA identifier (service) string | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @returns The IrDA service string | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_connection_irda_get_service(OSyncPlug
inConnection *connection); | | OSYNC_EXPORT const char *osync_plugin_connection_irda_get_service(OSyncPlug
inConnection *connection); | |
|
| | | | |
| | | /** @brief Set the IrDA identifier (service) string | |
| | | * | |
| | | * @param connection Pointer to the OSyncPluginConnection object | |
| | | * @param irdaservice The IrDA service string to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_connection_irda_set_service(OSyncPluginConne
ction *connection, const char *irdaservice); | | OSYNC_EXPORT void osync_plugin_connection_irda_set_service(OSyncPluginConne
ction *connection, const char *irdaservice); | |
| | | | |
|
| | | /*@}*/ | |
| | | | |
| #endif /*_OPENSYNC_PLUGIN_CONNECTION_H_*/ | | #endif /*_OPENSYNC_PLUGIN_CONNECTION_H_*/ | |
| | | | |
End of changes. 58 change blocks. |
| 14 lines changed or deleted | | 283 lines changed or added | |
|
| opensync_plugin_info.h | | opensync_plugin_info.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef OPENSYNC_PLUGIN_INFO_H_ | | #ifndef OPENSYNC_PLUGIN_INFO_H_ | |
| #define OPENSYNC_PLUGIN_INFO_H_ | | #define OPENSYNC_PLUGIN_INFO_H_ | |
| | | | |
|
| | | /** | |
| | | * @defgroup OSyncPluginInfoAPI OpenSync Plugin Info | |
| | | * @ingroup OSyncPlugin | |
| | | * @brief Functions to get and set information about a plugin | |
| | | * | |
| | | */ | |
| | | | |
| | | /*@{*/ | |
| | | | |
| | | /** @brief Create a new plugin info object | |
| | | * | |
| | | * @param error Pointer to an error struct | |
| | | * @returns the newly registered plugin info object | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginInfo *osync_plugin_info_new(OSyncError **error); | | OSYNC_EXPORT OSyncPluginInfo *osync_plugin_info_new(OSyncError **error); | |
|
| | | | |
| | | /** @brief Increase the reference count on a plugin info object | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginInfo *osync_plugin_info_ref(OSyncPluginInfo *info); | | OSYNC_EXPORT OSyncPluginInfo *osync_plugin_info_ref(OSyncPluginInfo *info); | |
|
| | | | |
| | | /** @brief Decrease the reference count on a plugin info object | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_info_unref(OSyncPluginInfo *info); | | OSYNC_EXPORT void osync_plugin_info_unref(OSyncPluginInfo *info); | |
| | | | |
|
| | | /** @brief Set reference to loop for the specific plugin | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @param loop Pointer to the loop which get set for specified OSyncPluginI | |
| | | nfo object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_info_set_loop(OSyncPluginInfo *info, void *l
oop); | | OSYNC_EXPORT void osync_plugin_info_set_loop(OSyncPluginInfo *info, void *l
oop); | |
|
| | | | |
| | | /** @brief Get loop reference of OSyncPluginInfo object | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @returns Reference to the loop of the OSyncPluginInfo object | |
| | | */ | |
| OSYNC_EXPORT void *osync_plugin_info_get_loop(OSyncPluginInfo *info); | | OSYNC_EXPORT void *osync_plugin_info_get_loop(OSyncPluginInfo *info); | |
| | | | |
|
| | | /** @brief Set the plugin configuration data | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @param config Plugin configuration | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_info_set_config(OSyncPluginInfo *info, OSync
PluginConfig *config); | | OSYNC_EXPORT void osync_plugin_info_set_config(OSyncPluginInfo *info, OSync
PluginConfig *config); | |
|
| | | | |
| | | /** @brief Returns the plugin configuration data | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @returns the plugin configuration data (null-terminated string) | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncPluginConfig *osync_plugin_info_get_config(OSyncPluginInf
o *info); | | OSYNC_EXPORT OSyncPluginConfig *osync_plugin_info_get_config(OSyncPluginInf
o *info); | |
| | | | |
|
| | | /** @brief Set plugin configuration directory | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @param configdir Configuration directory to set | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_info_set_configdir(OSyncPluginInfo *info, co
nst char *configdir); | | OSYNC_EXPORT void osync_plugin_info_set_configdir(OSyncPluginInfo *info, co
nst char *configdir); | |
|
| OSYNC_EXPORT const char *osync_plugin_info_get_configdir(OSyncPluginInfo *i
nfo); | | | |
| | | | |
|
| | | /** @brief Find ObjTypeSink of corresponding Object Type in OSyncPluginInfo | |
| | | object | |
| | | * | |
| | | * @param info Pointer to the OSyncPluginInfo object | |
| | | * @param name Name of the Object Type | |
| | | * @returns Pointer to OSyncPluginInfo for searched objtype, NULL if not av | |
| | | ailable | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncObjTypeSink *osync_plugin_info_find_objtype(OSyncPluginIn
fo *info, const char *name); | | OSYNC_EXPORT OSyncObjTypeSink *osync_plugin_info_find_objtype(OSyncPluginIn
fo *info, const char *name); | |
|
| | | | |
| | | /** @brief Adds an object type (sink) to a plugin | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @param sink The sink to add | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_info_add_objtype(OSyncPluginInfo *info, OSyn
cObjTypeSink *sink); | | OSYNC_EXPORT void osync_plugin_info_add_objtype(OSyncPluginInfo *info, OSyn
cObjTypeSink *sink); | |
|
| OSYNC_EXPORT unsigned int osync_plugin_info_num_objtypes(OSyncPluginInfo *i | | | |
| nfo); | | | |
| OSYNC_EXPORT OSyncObjTypeSink *osync_plugin_info_nth_objtype(OSyncPluginInf | | | |
| o *info, unsigned int nth); | | | |
| | | | |
|
| | | /** | |
| | | * @brief Returns all Objtype Sinks as a list | |
| | | * | |
| | | * Please be aware that the returned list has to be freed with | |
| | | * osync_list_free. If it isn't freed there will be a memory leak. | |
| | | * | |
| | | * @param Pointer to a OSyncPluginInfo | |
| | | * @return A shallow copy of the internal objtype list | |
| | | */ | |
| | | OSYNC_EXPORT OSyncList *osync_plugin_info_get_objtype_sinks(OSyncPluginInfo | |
| | | *info); | |
| | | | |
| | | /** @brief Returns the Main Sink | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @returns the Main Sink | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncObjTypeSink *osync_plugin_info_get_main_sink(OSyncPluginI
nfo *info); | | OSYNC_EXPORT OSyncObjTypeSink *osync_plugin_info_get_main_sink(OSyncPluginI
nfo *info); | |
|
| | | | |
| | | /** @brief Sets the Main Sink | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @param sink The OSyncObjTypeSink which acts as Main Sink | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_info_set_main_sink(OSyncPluginInfo *info, OS
yncObjTypeSink *sink); | | OSYNC_EXPORT void osync_plugin_info_set_main_sink(OSyncPluginInfo *info, OS
yncObjTypeSink *sink); | |
| | | | |
|
| | | /** @brief Returns the plugin format conversion environment | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @returns the plugin format conversion environment | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncFormatEnv *osync_plugin_info_get_format_env(OSyncPluginIn
fo *info); | | OSYNC_EXPORT OSyncFormatEnv *osync_plugin_info_get_format_env(OSyncPluginIn
fo *info); | |
|
| | | | |
| | | /** @brief Set Format Environment for OSyncPluginInfo object | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @param env Pointer to Format environment which gets assigned to the OSyn | |
| | | cPluginInfo object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_info_set_format_env(OSyncPluginInfo *info, O
SyncFormatEnv *env); | | OSYNC_EXPORT void osync_plugin_info_set_format_env(OSyncPluginInfo *info, O
SyncFormatEnv *env); | |
| | | | |
|
| OSYNC_EXPORT OSyncObjTypeSink *osync_plugin_info_get_sink(OSyncPluginInfo * | | /** @brief Sets the current OSyncObjTypeSink | |
| info); | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @param sink The OSyncObjTypeSink which should act as current OSyncObjTyp | |
| | | eSink | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_info_set_sink(OSyncPluginInfo *info, OSyncOb
jTypeSink *sink); | | OSYNC_EXPORT void osync_plugin_info_set_sink(OSyncPluginInfo *info, OSyncOb
jTypeSink *sink); | |
| | | | |
|
| | | /** @brief Set Group Name for plugin info object | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @param groupname Group name | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_info_set_groupname(OSyncPluginInfo *info, co
nst char *groupname); | | OSYNC_EXPORT void osync_plugin_info_set_groupname(OSyncPluginInfo *info, co
nst char *groupname); | |
|
| | | | |
| | | /** @brief Get Group Name of the OSyncPluginInfo object | |
| | | * | |
| | | * @param info Pointer to the OSyncPluginInfo object | |
| | | * @returns Group Name of the OSyncPluginInfo object | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_plugin_info_get_groupname(OSyncPluginInfo *i
nfo); | | OSYNC_EXPORT const char *osync_plugin_info_get_groupname(OSyncPluginInfo *i
nfo); | |
| | | | |
|
| | | /** @brief Set OSyncVersion for OSyncPluginInfo object | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @param version Pointer to OSyncVersion | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_info_set_version(OSyncPluginInfo *info, OSyn
cVersion *version); | | OSYNC_EXPORT void osync_plugin_info_set_version(OSyncPluginInfo *info, OSyn
cVersion *version); | |
|
| | | | |
| | | /** @brief Get OSyncVersion of the OSyncPluginInfo object | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @returns Pointer of the OSyncVersion from OSyncPluginInfo object | |
| | | */ | |
| OSYNC_EXPORT OSyncVersion *osync_plugin_info_get_version(OSyncPluginInfo *i
nfo); | | OSYNC_EXPORT OSyncVersion *osync_plugin_info_get_version(OSyncPluginInfo *i
nfo); | |
| | | | |
|
| | | /** @brief Set OSyncCapabilities of the OSyncPluginInfo object | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @param capabilities Pointer to the capabilities | |
| | | */ | |
| OSYNC_EXPORT void osync_plugin_info_set_capabilities(OSyncPluginInfo *info,
OSyncCapabilities *capabilities); | | OSYNC_EXPORT void osync_plugin_info_set_capabilities(OSyncPluginInfo *info,
OSyncCapabilities *capabilities); | |
|
| | | | |
| | | /** @brief Get OSyncCapabilities of the OSyncPluginInfo object | |
| | | * | |
| | | * @param info Pointer to the plugin info object | |
| | | * @returns OSyncCapabilities of the OSyncPluginInfo object | |
| | | */ | |
| OSYNC_EXPORT OSyncCapabilities *osync_plugin_info_get_capabilities(OSyncPlu
ginInfo *info); | | OSYNC_EXPORT OSyncCapabilities *osync_plugin_info_get_capabilities(OSyncPlu
ginInfo *info); | |
| | | | |
|
| | | /*@}*/ | |
| | | | |
| #endif /*OPENSYNC_PLUGIN_INFO_H_*/ | | #endif /*OPENSYNC_PLUGIN_INFO_H_*/ | |
| | | | |
End of changes. 24 change blocks. |
| 7 lines changed or deleted | | 156 lines changed or added | |
|
| opensync_time.h | | opensync_time.h | |
| /* | | /* | |
| * libopensync - A synchronization framework | | * libopensync - A synchronization framework | |
|
| * Copyright (C) 2007-2008 Daniel Gollub <dgollub@suse.de> | | * Copyright (C) 2004-2005 Armin Bauer <armin.bauer@opensync.org> | |
| | | * Copyright (C) 2006-2008 Daniel Gollub <gollub@b1-systems.de> | |
| | | * Copyright (C) 2007 Chris Frey <cdfrey@netdirect.ca> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * 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, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Lesser General Public License for more details. | | * Lesser General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENSYNC_TIME_H_ | | #ifndef _OPENSYNC_TIME_H_ | |
| #define _OPENSYNC_TIME_H_ | | #define _OPENSYNC_TIME_H_ | |
| | | | |
|
| | | /** | |
| | | * @defgroup OSyncTimeAPI OpenSync Time | |
| | | * @ingroup OSyncFormat | |
| | | * @brief The public part of the OSyncTimeAPI | |
| | | * | |
| | | */ | |
| | | | |
| | | /** | |
| | | * @defgroup OSyncTimeFormatting Time formatting helpers | |
| | | * @ingroup OSyncTimeAPI | |
| | | * @brief Helper functions for formatting time strings, stripping out | |
| | | * invalid characters, etc. | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| /* | | /* | |
|
| * Note: in all functions below that require a timezone offset, | | * Time formatting helper | |
| * they *require* the caller to be completely accurate with it, | | | |
| * including in the DST case. The result is only as accurate | | | |
| * as the offset you provide. | | | |
| */ | | */ | |
| | | | |
|
| /* Timeformat helper */ | | /** @brief Function returns a date-timestamp in OSyncTime Spec format | |
| | | * | |
| | | * @param vtime The timestamp which gets converted to a valid osync date-ti | |
| | | mestamp | |
| | | * @returns vtime date-timestring (the caller is responsible for freeing) | |
| | | */ | |
| OSYNC_EXPORT char *osync_time_timestamp(const char *vtime); | | OSYNC_EXPORT char *osync_time_timestamp(const char *vtime); | |
|
| | | | |
| | | /** @brief Function returns a date without timestamp in OSyncTime Spec form | |
| | | at | |
| | | * | |
| | | * @param vtime The timestamp which gets converted to a single datestamp | |
| | | * @returns valid single datestamp YYYYMMDD (the caller is responsible for | |
| | | freeing) | |
| | | */ | |
| OSYNC_EXPORT char *osync_time_datestamp(const char *vtime); | | OSYNC_EXPORT char *osync_time_datestamp(const char *vtime); | |
|
| | | | |
| | | /** @brief Function returns TRUE if vtime is a valid datestamp (YYYYMMDD) | |
| | | * | |
| | | * @returns FALSE if vtime includes a timestamp, TRUE on a single datestamp | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_time_isdate(const char *vformat); | | OSYNC_EXPORT osync_bool osync_time_isdate(const char *vformat); | |
|
| | | | |
| | | /** @brief Function returns TRUE if vtime is in UTC (YYYYMMDDTHH:MM:SSZ) | |
| | | * | |
| | | * @returns FALSE if vtime includes no Zulu, TRUE if the timestamp is UTC | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_time_isutc(const char *vformat); | | OSYNC_EXPORT osync_bool osync_time_isutc(const char *vformat); | |
|
| //char *osync_time_set_vtime(const char *vtime, const char *time, osync_boo
l is_utc); | | | |
| | | | |
|
| /* String <-> struct converters, no smarts */ | | /*@}*/ | |
| OSYNC_EXPORT struct tm *osync_time_vtime2tm(const char *vtime); | | | |
| OSYNC_EXPORT char *osync_time_tm2vtime(const struct tm *time, osync_bool is | | | |
| _utc); | | | |
| | | | |
|
| /* Timetype helper */ | | /************************************************************************** | |
| OSYNC_EXPORT time_t osync_time_vtime2unix(const char *vtime, int offset); | | ***/ | |
| OSYNC_EXPORT char *osync_time_unix2vtime(const time_t *timestamp); | | | |
| | | /** | |
| | | * @defgroup OSyncTimeStringToStruct String to struct converters. | |
| | | * @ingroup OSyncTimeAPI | |
| | | * @brief Helper functions for converting time between vtime formatted | |
| | | * strings and struct tm time structures. These functions are not | |
| | | * smart in any way, with regards to timezones or daylight saving | |
| | | * time, nor do they need to be. | |
| | | * | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| | | /** @brief Function converts vtime to tm struct | |
| | | * | |
| | | * @param vtime The formatted timestamp (YYYYMMDDTHHMMSS) | |
| | | * @param error An OSyncError struct | |
| | | * @returns struct tm (caller is responsible for freeing), NULL on error | |
| | | */ | |
| | | OSYNC_EXPORT struct tm *osync_time_vtime2tm(const char *vtime, OSyncError * | |
| | | *error); | |
| | | | |
| | | /** @brief Function converts struct tm in vtime string | |
| | | * | |
| | | * YYYYMMDDTHHMMSS[Z] | |
| | | * Returned timezone is equal to the timezone of struct tm. | |
| | | * | |
| | | * @param time The tm struct which gets converted | |
| | | * @param is_utc If struct tm is UTC time is_utc have to be TRUE | |
| | | * @param error An OSyncError struct | |
| | | * @returns vtime formatted as YYYYMMDDTHHMMSS[Z] (caller is responsible fo | |
| | | r freeing) | |
| | | */ | |
| | | OSYNC_EXPORT char *osync_time_tm2vtime(const struct tm *time, osync_bool is | |
| | | _utc, OSyncError **error); | |
| | | | |
| | | /*@}*/ | |
| | | | |
| | | /************************************************************************** | |
| | | ***/ | |
| | | | |
| | | /** | |
| | | * @defgroup OSyncTimeUnixTimeConverters Unix time converters | |
| | | * @ingroup OSyncTimeAPI | |
| | | * @brief Helper functions for converting to and from unix time_t | |
| | | * timestamps. Includes functions supporting vtime strings, | |
| | | * and struct tm's in local and UTC time. | |
| | | * | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| | | /** @brief Function converts vtime to unix time | |
| | | * | |
| | | * @param offset Seconds of UTC offset | |
| | | * @param vtime The osync formmatted timestamp | |
| | | * @param error An OSyncError struct | |
| | | * @returns Unix timestamp in time_t (UTC), ((time_t)-1) on error | |
| | | */ | |
| | | OSYNC_EXPORT time_t osync_time_vtime2unix(const char *vtime, int offset, OS | |
| | | yncError **error); | |
| | | | |
| | | /** @brief Function converts unix timestamp to vtime in UTC | |
| | | * | |
| | | * @param timestamp The unix timestamp which gets converted | |
| | | * @param error An OSyncError struct | |
| | | * @returns vtime formatted as YYYYMMDDTHHMMSSZ (caller is responsible for | |
| | | freeing) | |
| | | */ | |
| | | OSYNC_EXPORT char *osync_time_unix2vtime(const time_t *timestamp, OSyncErro | |
| | | r **error); | |
| | | | |
| /* Unix time_t converters */ | | /* Unix time_t converters */ | |
|
| OSYNC_EXPORT time_t osync_time_localtm2unix(const struct tm *tmtime); // ak | | | |
| a, mktime() | | | |
| OSYNC_EXPORT time_t osync_time_utctm2unix(const struct tm *tmtime); // | | | |
| actually useful! | | | |
| OSYNC_EXPORT struct tm *osync_time_unix2localtm(const time_t *timestamp);// | | | |
| aka, localtime() | | | |
| OSYNC_EXPORT struct tm *osync_time_unix2utctm(const time_t *timestamp); // | | | |
| aka, gmtime() | | | |
| | | | |
|
| /* Timezone helper */ | | /** @brief Function converts struct tm, in localtime, to unix timestamp. | |
| /* System Timezone-Reliable Helpers */ | | * This is the same as calling mktime(), except that | |
| OSYNC_EXPORT int osync_time_timezone_diff(const struct tm *local); | | * localtime is not modified, and tm_isdst is always | |
| OSYNC_EXPORT struct tm *osync_time_tm2utc(const struct tm *ltime, int offse | | * forced to -1. Aka, mktime(). | |
| t); | | * | |
| OSYNC_EXPORT struct tm *osync_time_tm2localtime(const struct tm *utime, int | | * @param localtime The struct tm, in localtime, which gets converted | |
| offset); | | * @param error An OSyncError struct | |
| OSYNC_EXPORT char *osync_time_vtime2utc(const char* localtime, int offset); | | * @returns time_t (in UTC of course), ((time_t)-1) on error | |
| OSYNC_EXPORT char *osync_time_vtime2localtime(const char* utc, int offset); | | */ | |
| | | OSYNC_EXPORT time_t osync_time_localtm2unix(const struct tm *localtime, OSy | |
| | | ncError **error); | |
| | | | |
|
| /* XXX This functions should only be used as workaround for plugins which | | /** @brief Function converts struct tm, in utc, to unix timestamp. | |
| only supports localtime without any timezone information. */ | | * | |
| OSYNC_EXPORT char *osync_time_vcal2localtime(const char *vcal); | | * @param utctime The struct tm, in utc, which gets converted | |
| OSYNC_EXPORT char *osync_time_vcal2utc(const char *vcal); | | * @param error An OSyncError struct | |
| | | * @returns time_t (in UTC of course), ((time_t)-1) on error | |
| | | * | |
| | | * This algorithm abuses the POSIX time functions, only because | |
| | | * there seems to be no standard API to do this more simply. | |
| | | * We could use the tm2utc() and tm2localtime() functions defined | |
| | | * farther on, but those are just simple math, and assume completely | |
| | | * that the offset provided is perfectly accurate. This is not | |
| | | * always the case, when all you have is a random date in a tm struct. | |
| | | * | |
| | | * If there is a better way, I'd love to know! - cdfrey | |
| | | */ | |
| | | OSYNC_EXPORT time_t osync_time_utctm2unix(const struct tm *utctime, OSyncEr | |
| | | ror **error); | |
| | | | |
|
| /* Alarm Duration Timeformat helper */ | | /** @brief Function converts unix timestamp to struct tm in localtime. | |
| | | * This is the same as calling localtime_r(), except you | |
| | | * have to free the returned value. Aka, localtime(). | |
| | | * | |
| | | * @param timestamp The unixtimestamp which gets converted | |
| | | * @param error An OSyncError struct | |
| | | * @returns: struct tm (in localtime) (Caller is responsible for freeing!), | |
| | | * NULL on error | |
| | | */ | |
| | | OSYNC_EXPORT struct tm *osync_time_unix2localtm(const time_t *timestamp, OS | |
| | | yncError **error); | |
| | | | |
| | | /** @brief Function converts unix timestamp to struct tm in utc. | |
| | | * This is the same as calling gmtime_r(), except you | |
| | | * have to free the returned value. Aka, gmtime(). | |
| | | * | |
| | | * @param timestamp The unixtimestamp which gets converted | |
| | | * @paran error An OSyncError struct | |
| | | * @returns: struct tm (in UTC) (Caller is responsible for freeing), NULL o | |
| | | n error | |
| | | */ | |
| | | OSYNC_EXPORT struct tm *osync_time_unix2utctm(const time_t *timestamp, OSyn | |
| | | cError **error); | |
| | | | |
| | | /*@}*/ | |
| | | | |
| | | /************************************************************************** | |
| | | ***/ | |
| | | | |
| | | /** | |
| | | * @defgroup OSyncTimeTimezoneHelpers Timezone helpers | |
| | | * @ingroup OSyncTimeAPI | |
| | | * @brief Helper functions for working with timezones, and doing | |
| | | * conversions with user-specified timezone offsets. | |
| | | * Note that in all functions below that require a timezone offset, | |
| | | * they *require* the caller to be completely accurate with it, | |
| | | * including in the DST case. The result is only as accurate | |
| | | * as the offset you provide. | |
| | | * | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| | | /** @brief Function gets offset of parameter time between UTC and | |
| | | * localtime in seconds east of UTC. (i.e. east is positive, | |
| | | * west is negative) | |
| | | * | |
| | | * @param local The point in time when the offset have to be calculated, | |
| | | * specified in localtime (need for CEST/CET) | |
| | | * @param error An OSyncError struct. Always check if error is set using | |
| | | * osync_error_is_set(error) before using the return value | |
| | | * @return Seconds of timezone offset. On error, sets the error parameter, | |
| | | * and the return value cannot be relied upon. | |
| | | */ | |
| | | OSYNC_EXPORT int osync_time_timezone_diff(const struct tm *local, OSyncErro | |
| | | r **error); | |
| | | | |
| | | /** @brief Function converts (struct tm) ltime from localtime to UTC. | |
| | | * Paramter offset is used as UTC offset. Note that _only_ the | |
| | | * following fields can be relied upon in the result: | |
| | | * tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year. | |
| | | * | |
| | | * @param ltime The struct tm which gets converted to UTC timezone | |
| | | * @param offset Seconds of UTC offset, in seconds east of UTC. | |
| | | * @param error An OSyncError struct | |
| | | * @returns struct tm in UTC (caller is responsible for freeing), NULL on e | |
| | | rror | |
| | | */ | |
| | | OSYNC_EXPORT struct tm *osync_time_tm2utc(const struct tm *ltime, int offse | |
| | | t, OSyncError **error); | |
| | | | |
| | | /** @brief Function converts (struct tm) utime from UTC to localtime | |
| | | * Paramter offset is used as UTC offset. Note that _only_ the | |
| | | * following fields can be relied upon in the result: | |
| | | * tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year. | |
| | | * | |
| | | * @param utime The struct tm which gets converted to localtime | |
| | | * @param offset Seconds of UTC offset, in seconds east of UTC. | |
| | | * @param error An OSyncError struct | |
| | | * @returns struct tm in localtime (caller is responsible for freeing), | |
| | | * NULL on error | |
| | | */ | |
| | | OSYNC_EXPORT struct tm *osync_time_tm2localtime(const struct tm *utime, int | |
| | | offset, OSyncError **error); | |
| | | | |
| | | /** @brief Functions converts a localtime vtime stamp to a UTC vtime stamp | |
| | | * | |
| | | * @param localtime The local timestamp in vtime format | |
| | | * @param offset Seconds of UTC offset, in seconds east of UTC. | |
| | | * @param error An OSyncError struct | |
| | | * @returns vtime in UTC timezone (caller is responsible for freeing), | |
| | | * NULL on error | |
| | | */ | |
| | | OSYNC_EXPORT char *osync_time_vtime2utc(const char* localtime, int offset, | |
| | | OSyncError **error); | |
| | | | |
| | | /** @brief Functions converts a UTC vtime stamp to a localtime vtime stamp | |
| | | * | |
| | | * @param utc The timestap in UTC timezone which gets converted to localtim | |
| | | e | |
| | | * @param offset The offset in seconds between UTC and localtime | |
| | | * @param error An OSyncError struct | |
| | | * @returns vtime in local timezon (caller is preponsible for freeing), | |
| | | * NULL on error | |
| | | */ | |
| | | OSYNC_EXPORT char *osync_time_vtime2localtime(const char* utc, int offset, | |
| | | OSyncError **error); | |
| | | | |
| | | /** @brief Function converts UTC offset string in offset in seconds | |
| | | * | |
| | | * @param offset The offset string of the form a timezone field (Example +0 | |
| | | 200) | |
| | | * @error An OSyncError struct | |
| | | * @returns seconds of UTC offset. On error, osync_error_is_set(error) is | |
| | | * true, and the return value is 0. | |
| | | */ | |
| | | OSYNC_EXPORT int osync_time_utcoffset2sec(const char *offset, OSyncError ** | |
| | | error); | |
| | | | |
| | | /*@}*/ | |
| | | | |
| | | /************************************************************************** | |
| | | ***/ | |
| | | | |
| | | /** | |
| | | * @defgroup OSyncTimeBackwardCompatibility Backward compatibility function | |
| | | s. | |
| | | * @ingroup OSyncTimeAPI | |
| | | * @brief These functions should only be used as workaround for plugins | |
| | | * which only support localtime without any timezone information. | |
| | | * | |
| | | * XXX This functions should only be used as workaround for plugins wh | |
| | | ich | |
| | | * only supports localtime without any timezone information. | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| | | /** @brief Functions converts timestamps of vcal to localtime | |
| | | * | |
| | | * @param vcal The vcalendar which has to be converted. | |
| | | * @param error An OSyncError struct | |
| | | * @return modified vcalendar with local timestamps (related to system time | |
| | | ). | |
| | | * Rely on error to detect error, not return value. | |
| | | */ | |
| | | OSYNC_EXPORT char *osync_time_vcal2localtime(const char *vcal, OSyncError * | |
| | | *error); | |
| | | | |
| | | /** @brief Functions converts timestamps of vcal to UTC | |
| | | * | |
| | | * @param vcal The vcalendar which has to be converted. | |
| | | * @param error An OSyncError struct | |
| | | * @return modified vcalendar with UTC timestamps (related to system time) | |
| | | * Rely on error to detect error, not return value. | |
| | | */ | |
| | | OSYNC_EXPORT char *osync_time_vcal2utc(const char *vcal, OSyncError **error | |
| | | ); | |
| | | | |
| | | /*@}*/ | |
| | | | |
| | | /************************************************************************** | |
| | | ***/ | |
| | | | |
| | | /** | |
| | | * @defgroup OSyncTimeAlarmDurationFormat Alarm duration format helpers. | |
| | | * @ingroup OSyncTimeAPI | |
| | | * @brief Functions for converting alarm durations to and from string forma | |
| | | ts. | |
| | | * | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| | | /** @brief Functions converts seconds in duration before or after alarm eve | |
| | | nt | |
| | | * | |
| | | * @param seconds | |
| | | * @returns ical alarm duration string (caller is preponsible for freeing) | |
| | | */ | |
| OSYNC_EXPORT char *osync_time_sec2alarmdu(int seconds); | | OSYNC_EXPORT char *osync_time_sec2alarmdu(int seconds); | |
|
| | | | |
| | | /** @brief Functions converts alarm duration event to seconds needed for re | |
| | | minder of vcal/ical | |
| | | * | |
| | | * TODO: Test support for ALARM after/before end and after start | |
| | | * | |
| | | * @param alarm | |
| | | * @returns seconds of alarm and duration | |
| | | */ | |
| | | | |
| OSYNC_EXPORT int osync_time_alarmdu2sec(const char *alarm); | | OSYNC_EXPORT int osync_time_alarmdu2sec(const char *alarm); | |
| | | | |
|
| /* Timezone ID helper */ | | /*@}*/ | |
| // FIXME: how do we handle iCal weekday strings with multiple days? | | | |
| // something like the following? | | | |
| //int osync_time_str2wday(const char *weekday, int *wdaymap); | | | |
| OSYNC_EXPORT int osync_time_str2wday(const char *weekday); | | | |
| OSYNC_EXPORT struct tm *osync_time_relative2tm(const char *byday, const int | | | |
| bymonth, const int year); | | | |
| OSYNC_EXPORT int osync_time_utcoffset2sec(const char *offset); | | | |
| | | | |
|
| /* Recurrence API */ | | /************************************************************************** | |
| //struct OSyncRecur *osync_recur_parse_rules(OSyncXMLFormat *event); | | ***/ | |
| // hmmm, recurrence rules only pertain to a certain | | | |
| // field.... how do we get that data? can we get a sub | | | |
| // field of a field? | | | |
| //struct tm *osync_recur_get_next(OSyncRecur *recur, struct tm *current); | | | |
| | | | |
|
| /* Smart Timezone Helpers */ | | /** | |
| /* | | * @defgroup OSyncTimeRecurrence Recurring time calculators. | |
| struct tm *osync_time_dstchange(xmlNode *dstNode); | | * @ingroup OSyncTimeAPI | |
| osync_bool osync_time_isdst(const char *vtime, xmlNode *tzid); | | * @brief Functions related to calculating recurring dates. | |
| int osync_time_tzoffset(const char *vtime, xmlNode *tz); | | * | |
| char *osync_time_tzid(xmlNode *tz); | | */ | |
| char *osync_time_tzlocation(xmlNode *tz); | | /*@{*/ | |
| xmlNode *osync_time_tzinfo(xmlNode *root, const char *tzid); | | | |
| char *osync_time_tzlocal2utc(xmlNode *root, const char *field); | | | |
| */ | | | |
| | | | |
|
| //struct tm *osync_time_dstchange(OSyncXMLFormat *event, OSyncXMLField *dat | | /** @brief Function converts a week day string to the struct tm wday intege | |
| eTimeContent); | | r. | |
| //osync_bool osync_time_isdst(OSyncXMLFormat *event, OSyncXMLField *dateTim | | * | |
| eContent); | | * FIXME: how do we handle iCal weekday strings with multiple days? | |
| //int osync_time_tzoffset(const char *vtime, xmlNode *tz); | | * something like the following? | |
| //char *osync_time_tzid(xmlNode *tz); | | * int osync_time_str2wday(const char *weekday, int *wdaymap); | |
| //char *osync_time_tzlocation(xmlNode *tz); | | * | |
| //xmlNode *osync_time_tzinfo(xmlNode *root, const char *tzid); | | * @param swday string of the week day | |
| //char *osync_time_tzlocal2utc(xmlNode *root, const char *field); | | * @returns integer of the weekday (Sunday = 0), or -1 on error | |
| | | */ | |
| | | OSYNC_EXPORT int osync_time_str2wday(const char *swday); | |
| | | | |
|
| OSYNC_EXPORT time_t osync_time_xml2unix(OSyncXMLFormat *event, OSyncXMLFiel | | /** @brief Function determines the exact date of relative information. | |
| d *dateTimeContent); | | * It is used for example to determine the last sunday of a month ( | |
| | | -1SU) | |
| | | * in a specific year. | |
| | | * Note that the RFC2445 spec states that a weekday without | |
| | | * a prefixed numeric value means *every* weekday in the month. | |
| | | * This function will fail in such a case and return NULL. | |
| | | * Also note that if byday contains multiple weekdays in its | |
| | | * string (e.g. -1SU,MO) only the first weekday will be used (SU). | |
| | | * | |
| | | * @param byday string of the relative day of month modifier | |
| | | * @param bymonth calendar number of the month (January = 1) | |
| | | * @param year calendar year (e.g. 1970, 2007, etc) | |
| | | * @param error An OSyncError struct | |
| | | * @returns struct tm of the relative information date with 00:00:00 timest | |
| | | amp | |
| | | * or NULL on error. | |
| | | * (Caller is responsible for freeing) | |
| | | */ | |
| | | OSYNC_EXPORT struct tm *osync_time_relative2tm(const char *byday, const int | |
| | | bymonth, const int year, OSyncError **error); | |
| | | | |
| | | /*@}*/ | |
| | | | |
| #endif /*_OPENSYNC_TIME_H_*/ | | #endif /*_OPENSYNC_TIME_H_*/ | |
| | | | |
End of changes. 20 change blocks. |
| 71 lines changed or deleted | | 374 lines changed or added | |
|
| opensync_updater.h | | opensync_updater.h | |
| /* | | /* | |
| * libopensync - A synchronization framework | | * libopensync - A synchronization framework | |
|
| * Copyright (C) 2008 Daniel Gollub <dgollub@suse.de> | | * Copyright (C) 2008 Daniel Gollub <gollub@b1-systems.de> | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| * version 2.1 of the License, or (at your option) any later version. | | * 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, | | * This library is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Lesser General Public License for more details. | | * Lesser General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef _OPENSYNC_UPDATER_H_ | | #ifndef _OPENSYNC_UPDATER_H_ | |
| #define _OPENSYNC_UPDATER_H_ | | #define _OPENSYNC_UPDATER_H_ | |
| | | | |
|
| /*! @brief Updater | | /** | |
| | | * @defgroup OSyncUpdaterAPI OpenSync Updater | |
| | | * @ingroup OSyncGroup | |
| | | * @brief OpenSync configuration update facilities | |
| * | | * | |
|
| * @ingroup OSyncUpdaterAPI | | * The OpenSync Updater applies the required changes to group/member/plugin | |
| **/ | | * configuration when the user upgrades to a newer version of OpenSync, usi | |
| | | ng | |
| | | * XSLT stylesheets (libxslt / libexslt). To make configuration updates wor | |
| | | k | |
| | | * we just have to place some XSLT stylesheets into the OPENSYNC_UPDATESDIR | |
| | | . | |
| | | * | |
| | | * Naming of update stylesheets looks like this: | |
| | | * | |
| | | * - syncmember-$memberapi.xsl | |
| | | * - syncgroup-$groupapi.xsl | |
| | | * - $plugin-$pluginapi.xsl | |
| | | * | |
| | | * This Updater interface should be used by any "rich" OpenSync frontend. | |
| | | * Frontends should call osync_updater_action_required() for each group. If | |
| | | * the return value is TRUE, the user should be notified that an update of | |
| | | * the configuration is required. Later the update process gets started by | |
| | | * calling: | |
| | | * | |
| | | * - (non blocking) osync_updater_process() | |
| | | * - (blocking) osync_updater_process_and_block() | |
| | | * | |
| | | * The update process works like this: | |
| | | * | |
| | | * -# Lock group | |
| | | * -# Check version of group configuration | |
| | | * -# Create group backup | |
| | | * -# Process Member configurations | |
| | | * -# Process Group configuration | |
| | | * -# Unlock group | |
| | | * | |
| | | * If the update process fails the backup gets restored. To avoid any | |
| | | * data loss, the backup will not be deleted an can be found in | |
| | | * ~/.opensync/groupX.bak(.bak.bak.bak.bak) | |
| | | * | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| typedef struct OSyncUpdaterStatus OSyncUpdaterStatus; | | typedef struct OSyncUpdaterStatus OSyncUpdaterStatus; | |
| typedef struct OSyncUpdater OSyncUpdater; | | typedef struct OSyncUpdater OSyncUpdater; | |
| | | | |
| typedef void (* osync_updater_cb) (OSyncUpdater *updater, OSyncUpdaterStatu
s *status); | | typedef void (* osync_updater_cb) (OSyncUpdater *updater, OSyncUpdaterStatu
s *status); | |
| | | | |
|
| | | /** @brief Registers a new updater | |
| | | * | |
| | | * @param group Pointer to the OSyncGroup to update | |
| | | * @param error Pointer to an error struct | |
| | | * @returns the newly created updater | |
| | | */ | |
| OSYNC_EXPORT OSyncUpdater *osync_updater_new(OSyncGroup *group, OSyncError
**error); | | OSYNC_EXPORT OSyncUpdater *osync_updater_new(OSyncGroup *group, OSyncError
**error); | |
|
| | | | |
| | | /** @brief Decrease the reference count on a updater | |
| | | * | |
| | | * @param updater Pointer to the updater | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_updater_unref(OSyncUpdater *updater); | | OSYNC_EXPORT void osync_updater_unref(OSyncUpdater *updater); | |
|
| | | | |
| | | /** @brief Increase the reference count on an updater | |
| | | * | |
| | | * @param updater Pointer to the updater | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT OSyncUpdater *osync_updater_ref(OSyncUpdater *updater); | | OSYNC_EXPORT OSyncUpdater *osync_updater_ref(OSyncUpdater *updater); | |
| | | | |
|
| | | /** @brief Register OSyncUpdater callback | |
| | | * | |
| | | * @param updater Pointer to the updater | |
| | | * @param callback The callback function to be called on updater events | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_updater_set_callback(OSyncUpdater *updater, osync_u
pdater_cb callback); | | OSYNC_EXPORT void osync_updater_set_callback(OSyncUpdater *updater, osync_u
pdater_cb callback); | |
| | | | |
|
| | | /** @brief Check if an update is required for the group | |
| | | * | |
| | | * @param updater Pointer to the updater | |
| | | * @returns TRUE if update is required on that group, FALSE if no update is | |
| | | required. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_updater_action_required(OSyncUpdater *updater
); | | OSYNC_EXPORT osync_bool osync_updater_action_required(OSyncUpdater *updater
); | |
| | | | |
|
| | | /** @brief Process update on the group. This function is not blocking. | |
| | | * | |
| | | * @param updater Pointer to the updater | |
| | | * @param error Pointer to OSyncError | |
| | | * @returns TRUE if the updater process started successfully, FALSE on erro | |
| | | r. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_updater_process(OSyncUpdater *updater, OSyncE
rror **error); | | OSYNC_EXPORT osync_bool osync_updater_process(OSyncUpdater *updater, OSyncE
rror **error); | |
|
| | | | |
| | | /** @brief Process update on the group. This function is blocking. | |
| | | * | |
| | | * @param updater Pointer to the updater | |
| | | * @param error Pointer to OSyncError | |
| | | * @returns TRUE if the updater process was successful, FALSE on error. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_updater_process_and_block(OSyncUpdater *updat
er, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_updater_process_and_block(OSyncUpdater *updat
er, OSyncError **error); | |
| | | | |
|
| | | /** @brief Set path of Updates directory, which inlcudes the update stylesh | |
| | | eets. | |
| | | * | |
| | | * @param updater Pointer to the updater | |
| | | * @param path Path to updates directory | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT void osync_updater_set_updates_directory(OSyncUpdater *updater
, const char *path); | | OSYNC_EXPORT void osync_updater_set_updates_directory(OSyncUpdater *updater
, const char *path); | |
|
| | | | |
| | | /** @brief Get path of Updates directory. | |
| | | * | |
| | | * @param updater Pointer to the updater | |
| | | * @returns Path of Updates directory. | |
| | | * | |
| | | */ | |
| OSYNC_EXPORT const char *osync_updater_get_updates_directory(OSyncUpdater *
updater); | | OSYNC_EXPORT const char *osync_updater_get_updates_directory(OSyncUpdater *
updater); | |
| | | | |
|
| | | /*@}*/ | |
| | | | |
| #endif /* _OPENSYNC_UPDATER_H_ */ | | #endif /* _OPENSYNC_UPDATER_H_ */ | |
| | | | |
End of changes. 13 change blocks. |
| 4 lines changed or deleted | | 106 lines changed or added | |
|
| opensync_xmlfield.h | | opensync_xmlfield.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| * Author: Daniel Friedrich <daniel.friedrich@opensync.org> | | * Author: Daniel Friedrich <daniel.friedrich@opensync.org> | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef OPENSYNC_XMLFIELD_H_ | | #ifndef OPENSYNC_XMLFIELD_H_ | |
| #define OPENSYNC_XMLFIELD_H_ | | #define OPENSYNC_XMLFIELD_H_ | |
| | | | |
|
| | | /** | |
| | | * @defgroup OSyncXMLFieldAPI OpenSync XMLField | |
| | | * @ingroup OSyncXMLFormat | |
| | | * @brief The public part of the OSyncXMLField | |
| | | * | |
| | | */ | |
| | | /*@{*/ | |
| | | | |
| | | /** | |
| | | * @brief Creates a new xmlfield object which will be added to the end of x | |
| | | mlfields of the xmlformat object. | |
| | | * The returned object will be freed with the xmlformat object. | |
| | | * @param xmlformat Pointer to the xmlformat object | |
| | | * @param name The name of the xmlfield | |
| | | * @param error The error which will hold the info in case of an error | |
| | | * @return A pointer to the newly allocated xmlformat object or NULL in cas | |
| | | e of error | |
| | | */ | |
| OSYNC_EXPORT OSyncXMLField *osync_xmlfield_new(OSyncXMLFormat *xmlformat, c
onst char *name, OSyncError **error); | | OSYNC_EXPORT OSyncXMLField *osync_xmlfield_new(OSyncXMLFormat *xmlformat, c
onst char *name, OSyncError **error); | |
|
| | | | |
| | | /** | |
| | | * @brief Unlink a xmlfield from its context and frees it | |
| | | * @param xmlfield The pointer to a xmlfield object | |
| | | */ | |
| OSYNC_EXPORT void osync_xmlfield_delete(OSyncXMLField *xmlfield); | | OSYNC_EXPORT void osync_xmlfield_delete(OSyncXMLField *xmlfield); | |
| | | | |
|
| OSYNC_EXPORT void osync_xmlfield_adopt_xmlfield_before_field(OSyncXMLField | | /** | |
| *xmlfield, OSyncXMLField *to_link); | | * @brief Unlink a xmlfield object | |
| OSYNC_EXPORT void osync_xmlfield_adopt_xmlfield_after_field(OSyncXMLField * | | * @param xmlfield The pointer to a xmlfield object | |
| xmlfield, OSyncXMLField *to_link); | | */ | |
| | | OSYNC_EXPORT void osync_xmlfield_unlink(OSyncXMLField *xmlfield); | |
| | | | |
|
| | | /** | |
| | | * @brief Get the name of an xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @return The name of the xmlfield | |
| | | */ | |
| OSYNC_EXPORT const char *osync_xmlfield_get_name(OSyncXMLField *xmlfield); | | OSYNC_EXPORT const char *osync_xmlfield_get_name(OSyncXMLField *xmlfield); | |
|
| | | | |
| | | /** | |
| | | * @brief Set the name of an xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @param name The name to set | |
| | | */ | |
| OSYNC_EXPORT void osync_xmlfield_set_name(OSyncXMLField *xmlfield, const ch
ar *name); | | OSYNC_EXPORT void osync_xmlfield_set_name(OSyncXMLField *xmlfield, const ch
ar *name); | |
|
| | | | |
| | | /** | |
| | | * @brief Get the next xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @return A pointer to the next xmlfield or NULL if there is no more xmlfi | |
| | | eld | |
| | | */ | |
| OSYNC_EXPORT OSyncXMLField *osync_xmlfield_get_next(OSyncXMLField *xmlfield
); | | OSYNC_EXPORT OSyncXMLField *osync_xmlfield_get_next(OSyncXMLField *xmlfield
); | |
| | | | |
|
| | | /** | |
| | | * @brief Get the previous xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @return A pointer to the previous xmlfield or NULL if there is no more x | |
| | | mlfield | |
| | | */ | |
| | | OSYNC_EXPORT OSyncXMLField *osync_xmlfield_get_prev(OSyncXMLField *xmlfield | |
| | | ); | |
| | | | |
| | | /** | |
| | | * @brief Get the parent xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @return A pointer to the parent xmlfield or NULL if there is no parent x | |
| | | mlfield | |
| | | */ | |
| | | OSYNC_EXPORT OSyncXMLField *osync_xmlfield_get_parent(OSyncXMLField *xmlfie | |
| | | ld); | |
| | | | |
| | | /** | |
| | | * @brief Get the child xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @return A pointer to the child xmlfield or NULL if there is no child xml | |
| | | field | |
| | | */ | |
| | | OSYNC_EXPORT OSyncXMLField *osync_xmlfield_get_child(OSyncXMLField *xmlfiel | |
| | | d); | |
| | | | |
| | | /** | |
| | | * @brief Links a xmlfield object from a xmlformat object before a other xm | |
| | | lfield object of a other xmlformat object | |
| | | * @param xmlfield The pointer to a xmlfield object | |
| | | * @param to_link The pointer to a xmlfield object | |
| | | */ | |
| | | OSYNC_EXPORT void osync_xmlfield_adopt_xmlfield_before_field(OSyncXMLField | |
| | | *xmlfield, OSyncXMLField *to_link); | |
| | | | |
| | | /** | |
| | | * @brief Get the value of the xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @return String pointer to the value. If the content is empty, "" gets re | |
| | | turned. | |
| | | */ | |
| | | OSYNC_EXPORT const char *osync_xmlfield_get_value(OSyncXMLField *xmlfield); | |
| | | | |
| | | /** | |
| | | * @brief Get the value of a attribute of an xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @param attr The name of the attribute | |
| | | * @return The value of the attribute of the xmlfield or NULL in case of er | |
| | | ror | |
| | | */ | |
| OSYNC_EXPORT const char *osync_xmlfield_get_attr(OSyncXMLField *xmlfield, c
onst char *attr); | | OSYNC_EXPORT const char *osync_xmlfield_get_attr(OSyncXMLField *xmlfield, c
onst char *attr); | |
|
| | | | |
| | | /** | |
| | | * @brief Set the attribute name and the attribute value of an xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @param attr The name of the attribute | |
| | | * @param value The value of the attribute | |
| | | */ | |
| OSYNC_EXPORT void osync_xmlfield_set_attr(OSyncXMLField *xmlfield, const ch
ar *attr, const char *value); | | OSYNC_EXPORT void osync_xmlfield_set_attr(OSyncXMLField *xmlfield, const ch
ar *attr, const char *value); | |
|
| OSYNC_EXPORT int osync_xmlfield_get_attr_count(OSyncXMLField *xmlfield); | | | |
| OSYNC_EXPORT const char *osync_xmlfield_get_nth_attr_name(OSyncXMLField *xm | | | |
| lfield, int nth); | | | |
| OSYNC_EXPORT const char *osync_xmlfield_get_nth_attr_value(OSyncXMLField *x | | | |
| mlfield, int nth); | | | |
| | | | |
|
| | | /** | |
| | | * @brief Get the count of attributes of an xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @return The count of attributes in the xmlfield | |
| | | */ | |
| | | OSYNC_EXPORT unsigned int osync_xmlfield_get_attr_count(OSyncXMLField *xmlf | |
| | | ield); | |
| | | | |
| | | /** | |
| | | * @brief Get the name of the nth attribute of a xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @param nth The index of the attribute | |
| | | * @return The name of the nth attribute of the xmlfield or NULL in case of | |
| | | error | |
| | | */ | |
| | | OSYNC_EXPORT const char *osync_xmlfield_get_nth_attr_name(OSyncXMLField *xm | |
| | | lfield, unsigned int nth); | |
| | | | |
| | | /** | |
| | | * @brief Get the value of the nth attribute of a xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @param nth The index of the attribute | |
| | | * @return The value of the nth attribute of the xmlfield or NULL in case o | |
| | | f error | |
| | | */ | |
| | | OSYNC_EXPORT const char *osync_xmlfield_get_nth_attr_value(OSyncXMLField *x | |
| | | mlfield, unsigned int nth); | |
| | | | |
| | | /** | |
| | | * @brief Get the value of a key/value pair of a xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @param key The key of the key/value pair | |
| | | * @return The value of the key/value pair of the xmlfield or NULL in case | |
| | | of error | |
| | | */ | |
| OSYNC_EXPORT const char *osync_xmlfield_get_key_value(OSyncXMLField *xmlfie
ld, const char *key); | | OSYNC_EXPORT const char *osync_xmlfield_get_key_value(OSyncXMLField *xmlfie
ld, const char *key); | |
|
| OSYNC_EXPORT void osync_xmlfield_set_key_value(OSyncXMLField *xmlfield, con | | | |
| st char *key, const char *value); | | | |
| OSYNC_EXPORT void osync_xmlfield_add_key_value(OSyncXMLField *xmlfield, con | | | |
| st char *key, const char *value); | | | |
| OSYNC_EXPORT int osync_xmlfield_get_key_count(OSyncXMLField *xmlfield); | | | |
| OSYNC_EXPORT const char *osync_xmlfield_get_nth_key_name(OSyncXMLField *xml | | | |
| field, int nth); | | | |
| OSYNC_EXPORT const char *osync_xmlfield_get_nth_key_value(OSyncXMLField *xm | | | |
| lfield, int nth); | | | |
| OSYNC_EXPORT void osync_xmlfield_set_nth_key_value(OSyncXMLField *xmlfield, | | | |
| int nth, const char *value); | | | |
| | | | |
|
| OSYNC_EXPORT osync_bool osync_xmlfield_compare(OSyncXMLField *xmlfield1, OS | | /** | |
| yncXMLField *xmlfield2); | | * @brief Set the key/value pair of a xmlfield | |
| OSYNC_EXPORT osync_bool osync_xmlfield_compare_similar(OSyncXMLField *xmlfi | | * @param xmlfield Pointer to the xmlfield object | |
| eld1, OSyncXMLField *xmlfield2, char* keys[]); | | * @param key The key of the key/value pair | |
| | | * @param value The value of the key/value pair | |
| | | * @return TRUE on success, FALSE on error | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_xmlfield_set_key_value(OSyncXMLField *xmlfiel | |
| | | d, const char *key, const char *value, OSyncError **error); | |
| | | | |
|
| OSYNC_EXPORT void osync_xmlfield_sort(OSyncXMLField *xmlfield); | | /** | |
| | | * @brief Add the key/value pair to a xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @param key The key of the key/value pair | |
| | | * @param value The value of the key/value pair | |
| | | * @return TRUE on success, FALSE on error | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_xmlfield_add_key_value(OSyncXMLField *xmlfiel | |
| | | d, const char *key, const char *value, OSyncError **error); | |
| | | | |
| | | /** | |
| | | * @brief Get the count of keys of a xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @return The count of keys in the xmlfield | |
| | | */ | |
| | | OSYNC_EXPORT unsigned int osync_xmlfield_get_key_count(OSyncXMLField *xmlfi | |
| | | eld); | |
| | | | |
| | | /** | |
| | | * @brief Get the name of the nth key of a xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @param nth The index of the key | |
| | | * @return The name of the nth key of the xmlfield or NULL in case of error | |
| | | */ | |
| | | OSYNC_EXPORT const char *osync_xmlfield_get_nth_key_name(OSyncXMLField *xml | |
| | | field, unsigned int nth); | |
| | | | |
| | | /** | |
| | | * @brief Get the value of the nth key of a xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @param nth The index of the key | |
| | | * @return The value of the nth key of the xmlfield or NULL in case of erro | |
| | | r | |
| | | */ | |
| | | OSYNC_EXPORT const char *osync_xmlfield_get_nth_key_value(OSyncXMLField *xm | |
| | | lfield, unsigned int nth); | |
| | | | |
| | | /** | |
| | | * @brief Set the value of the nth key of a xmlfield | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @param nth The index of the key | |
| | | * @param value The value of the key/value pair | |
| | | * @return The value of the nth key of the xmlfield or NULL in case of erro | |
| | | r | |
| | | */ | |
| | | OSYNC_EXPORT void osync_xmlfield_set_nth_key_value(OSyncXMLField *xmlfield, | |
| | | unsigned int nth, const char *value); | |
| | | | |
| | | /** | |
| | | * @brief Sort all key nodes of an xmlfield. This function needs to be call | |
| | | ed | |
| | | * if the xmlfield was build in an unsorted way. Sorting is not necessary | |
| | | if the | |
| | | * xmlfield was built in a sorted way. | |
| | | * @param xmlfield Pointer to the xmlfield object | |
| | | * @return TRUE on success, FALSE otherwise | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_xmlfield_sort(OSyncXMLField *xmlfield, OSyncE | |
| | | rror **error); | |
| | | | |
| | | /*@}*/ | |
| | | | |
| #endif /*OPENSYNC_XMLFIELD_H_*/ | | #endif /*OPENSYNC_XMLFIELD_H_*/ | |
| | | | |
End of changes. 13 change blocks. |
| 25 lines changed or deleted | | 209 lines changed or added | |
|
| opensync_xmlformat.h | | opensync_xmlformat.h | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| * | | * | |
| * Author: Daniel Friedrich <daniel.friedrich@opensync.org> | | * Author: Daniel Friedrich <daniel.friedrich@opensync.org> | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef OPENSYNC_XMLFORMAT_H_ | | #ifndef OPENSYNC_XMLFORMAT_H_ | |
| #define OPENSYNC_XMLFORMAT_H_ | | #define OPENSYNC_XMLFORMAT_H_ | |
| | | | |
| /** | | /** | |
|
| * @brief Holds all information which will be needed to compaire two xmlfie | | * @defgroup OSyncXMLFormat OpenSync XMLFormat Module | |
| lds. | | * @ingroup OSyncPublic | |
| * @ingroup OSyncXMLFormatAPI | | * @defgroup OSyncXMLFormatAPI OpenSync XMLFormat | |
| | | * @ingroup OSyncXMLFormat | |
| | | * @brief The public part of the OSyncXMLFormat | |
| */ | | */ | |
|
| typedef struct OSyncXMLPoints { | | /*@{*/ | |
| /** The name of a xmlfield */ | | | |
| char *fieldname; | | | |
| /** The points for this xmlfield */ | | | |
| int points; | | | |
| /** The keys of a xmlfield which have to be the same for equality. T | | | |
| his array must end with NULL. */ | | | |
| char** keys; | | | |
| } OSyncXMLPoints; | | | |
| | | | |
|
| | | /** | |
| | | * @brief Creates a new xmlformat object | |
| | | * @param objtype The name of the objtype (e.g.: contact) | |
| | | * @param error The error which will hold the info in case of an error | |
| | | * @return The pointer to the newly allocated xmlformat object or NULL in c | |
| | | ase of error | |
| | | */ | |
| OSYNC_EXPORT OSyncXMLFormat *osync_xmlformat_new(const char *objtype, OSync
Error **error); | | OSYNC_EXPORT OSyncXMLFormat *osync_xmlformat_new(const char *objtype, OSync
Error **error); | |
|
| | | | |
| | | /** | |
| | | * @brief Creates a new xmlformat object from a xml document. | |
| | | * @param buffer The pointer to the xml document | |
| | | * @param size The size of the xml document | |
| | | * @param error The error which will hold the info in case of an error | |
| | | * @return The pointer to the newly allocated xmlformat object or NULL in c | |
| | | ase of error | |
| | | */ | |
| OSYNC_EXPORT OSyncXMLFormat *osync_xmlformat_parse(const char *buffer, unsi
gned int size, OSyncError **error); | | OSYNC_EXPORT OSyncXMLFormat *osync_xmlformat_parse(const char *buffer, unsi
gned int size, OSyncError **error); | |
|
| | | | |
| | | /** | |
| | | * @brief Increments the reference counter | |
| | | * @param xmlformat The pointer to the xmlformat object | |
| | | */ | |
| OSYNC_EXPORT OSyncXMLFormat *osync_xmlformat_ref(OSyncXMLFormat *xmlformat)
; | | OSYNC_EXPORT OSyncXMLFormat *osync_xmlformat_ref(OSyncXMLFormat *xmlformat)
; | |
|
| | | | |
| | | /** | |
| | | * @brief Decrement the reference counter. The xmlformat object will | |
| | | * be freed if there is no more reference to it. | |
| | | * @param xmlformat The pointer to the xmlformat object | |
| | | */ | |
| OSYNC_EXPORT void osync_xmlformat_unref(OSyncXMLFormat *xmlformat); | | OSYNC_EXPORT void osync_xmlformat_unref(OSyncXMLFormat *xmlformat); | |
| | | | |
|
| OSYNC_EXPORT const char *osync_xmlformat_root_name(OSyncXMLFormat *xmlforma | | /** | |
| t); | | * @brief Get the objtype of a xmlformat | |
| | | * @param xmlformat The pointer to a xmlformat object | |
| | | * @return The objtype of the xmlformat | |
| | | */ | |
| OSYNC_EXPORT const char *osync_xmlformat_get_objtype(OSyncXMLFormat *xmlfor
mat); | | OSYNC_EXPORT const char *osync_xmlformat_get_objtype(OSyncXMLFormat *xmlfor
mat); | |
| | | | |
|
| | | /** | |
| | | * @brief Get the first field of a xmlformat | |
| | | * @param xmlformat The pointer to the xmlformat object | |
| | | * @return The first field of the xmlformat | |
| | | */ | |
| OSYNC_EXPORT OSyncXMLField *osync_xmlformat_get_first_field(OSyncXMLFormat
*xmlformat); | | OSYNC_EXPORT OSyncXMLField *osync_xmlformat_get_first_field(OSyncXMLFormat
*xmlformat); | |
|
| | | | |
| | | /** | |
| | | * @brief Search for xmlfields in the given xmlformat. It is up to the call | |
| | | er to | |
| | | * free the returned list with OSyncXMLFieldList::osync_xmlfieldlist_free | |
| | | * @param xmlformat The pointer to the xmlformat object | |
| | | * @param name The name of the xmlfields to search for | |
| | | * @param error The error which will hold the info in case of an error | |
| | | * @param ... If the xmlfield should have an attribute with special value, | |
| | | * then it is possible to specify the attribute name and the attribute | |
| | | * value. Both parameters must always be set. There can be more | |
| | | * than one attribute pair. The last parameter must always be NULL. | |
| | | * @return A pointer to the xmlfieldlist which holds all found xmlfields | |
| | | * or NULL in case of error | |
| | | */ | |
| OSYNC_EXPORT OSyncXMLFieldList *osync_xmlformat_search_field(OSyncXMLFormat
*xmlformat, const char *name, OSyncError **error, ...); | | OSYNC_EXPORT OSyncXMLFieldList *osync_xmlformat_search_field(OSyncXMLFormat
*xmlformat, const char *name, OSyncError **error, ...); | |
| | | | |
|
| OSYNC_EXPORT osync_bool osync_xmlformat_assemble(OSyncXMLFormat *xmlformat, | | /** | |
| char **buffer, unsigned int *size); | | * @brief Dump the xmlformat into a buffer. | |
| OSYNC_EXPORT osync_bool osync_xmlformat_validate(OSyncXMLFormat *xmlformat, | | * @param xmlformat The pointer to the xmlformat object | |
| OSyncError **error); | | * @param buffer The pointer to the buffer which will hold the xml document | |
| | | . It is up | |
| | | * to the caller to free this buffer. | |
| | | * @param size The pointer to the buffer which will hold the size of the xm | |
| | | l document | |
| | | * @param error The error which will hold the info in case of an error | |
| | | * @return TRUE on success, FALSE on any error | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_xmlformat_assemble(OSyncXMLFormat *xmlformat, | |
| | | char **buffer, unsigned int *size, OSyncError **error); | |
| | | | |
|
| OSYNC_EXPORT void osync_xmlformat_sort(OSyncXMLFormat *xmlformat); | | /** | |
| OSYNC_EXPORT osync_bool osync_xmlformat_is_sorted(OSyncXMLFormat *xmlformat | | * @brief Sort all xmlfields of the xmlformat. | |
| ); | | * | |
| | | * Calling this function is very expensive - try to avoid using it if poss | |
| | | ible. | |
| | | * The recommended approach is to assemble the xmlformat in a sorted way i | |
| | | nstead. | |
| | | * | |
| | | * @param xmlformat The pointer to the xmlformat object | |
| | | * @param error The error which will hold the info in case of an error | |
| | | * @return TRUE on success, FALSE on any error | |
| | | * | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_xmlformat_sort(OSyncXMLFormat *xmlformat, OSy | |
| | | ncError **error); | |
| | | | |
|
| OSYNC_EXPORT OSyncConvCmpResult osync_xmlformat_compare(OSyncXMLFormat *xml | | /** | |
| format1, OSyncXMLFormat *xmlformat2, OSyncXMLPoints points[], int basic_poi | | * @brief Check if all xmlfields of an xmlformat are sorted. | |
| nts, int treshold); | | * @param xmlformat The pointer to a xmlformat object | |
| | | * @returns TRUE if sorted, FALSE otherwise | |
| | | */ | |
| | | OSYNC_EXPORT osync_bool osync_xmlformat_is_sorted(OSyncXMLFormat *xmlformat | |
| | | ); | |
| | | | |
|
| | | /** | |
| | | * @brief Copy data from one xmlformat to another. | |
| | | * | |
| | | * @return True if the copy succeeded, false otherwise | |
| | | */ | |
| OSYNC_EXPORT osync_bool osync_xmlformat_copy(OSyncXMLFormat *source, OSyncX
MLFormat **destination, OSyncError **error); | | OSYNC_EXPORT osync_bool osync_xmlformat_copy(OSyncXMLFormat *source, OSyncX
MLFormat **destination, OSyncError **error); | |
|
| | | | |
| | | /** | |
| | | * @brief Returns the size of the OSyncXMLFormat struct. | |
| | | * | |
| | | * This is needed since the struct itself is private. | |
| | | * | |
| | | * @return The size of OSyncXMLFormat struct. | |
| | | */ | |
| OSYNC_EXPORT unsigned int osync_xmlformat_size(); | | OSYNC_EXPORT unsigned int osync_xmlformat_size(); | |
| | | | |
|
| #endif /*OPENSYNC_XMLFORMAT_H_*/ | | /*@}*/ | |
| | | | |
| | | #endif /* OPENSYNC_XMLFORMAT_H_ */ | |
| | | | |
End of changes. 15 change blocks. |
| 24 lines changed or deleted | | 106 lines changed or added | |
|