OpenSync  0.22
opensync_plugin.h
1 
5 typedef struct OSyncPluginFunctions {
7  osync_bool (* get_config) (char *, char **, int *);
9  osync_bool (* store_config) (char *, const char *, int);
11  osync_bool (* is_available) (OSyncError **);
13  void * (* initialize) (OSyncMember *, OSyncError **);
15  void (* finalize) (void *);
17  void (* connect) (OSyncContext *);
19  void (* sync_done) (OSyncContext *ctx);
21  void (* disconnect) (OSyncContext *);
23  void (* get_changeinfo) (OSyncContext *);
25  void (* get_data) (OSyncContext *, OSyncChange *);
28 
36 typedef struct OSyncPluginTimeouts {
38  unsigned int connect_timeout;
40  unsigned int sync_done_timeout;
42  unsigned int disconnect_timeout;
44  unsigned int get_changeinfo_timeout;
46  unsigned int get_data_timeout;
48  unsigned int commit_timeout;
50  unsigned int read_change_timeout;
52 
53 typedef osync_bool (* OSyncFormatCommitFn) (OSyncContext *, OSyncChange *);
54 typedef osync_bool (* OSyncFormatAccessFn) (OSyncContext *, OSyncChange *);
55 typedef void (* OSyncFormatCommittedAllFn) (OSyncContext *);
56 typedef void (* OSyncFormatReadFn) (OSyncContext *, OSyncChange *);
57 typedef void (* OSyncFormatBatchCommitFn) (OSyncContext *, OSyncContext **, OSyncChange **);
58 
62 typedef struct OSyncFormatFunctions {
64  OSyncFormatCommitFn commit_change;
66  OSyncFormatCommittedAllFn committed_all;
68  OSyncFormatBatchCommitFn batch_commit;
70  OSyncFormatAccessFn access;
72  OSyncFormatReadFn read;
74 
80 typedef enum {
88 
92 typedef struct OSyncPluginInfo {
94  int version;
96  const char *name;
98  const char *longname;
100  const char *description;
102  osync_bool is_threadsafe;
116  void *plugin_data;
118 
119 OSyncPlugin *osync_plugin_new(OSyncEnv *env);
120 OSyncPluginInfo *osync_plugin_new_info(OSyncEnv *env);
121 void osync_plugin_free(OSyncPlugin *plugin);
122 
123 osync_bool osync_module_load(OSyncEnv *env, const char *path, OSyncError **error);
124 osync_bool osync_module_load_dir(OSyncEnv *env, const char *path, osync_bool must_exist, OSyncError **oserror);
125 
126 OSyncPlugin *osync_plugin_from_name(OSyncEnv *osinfo, const char *name);
127 const char *osync_plugin_get_name(OSyncPlugin *plugin);
128 const char *osync_plugin_get_longname(OSyncPlugin *plugin);
129 const char *osync_plugin_get_description(OSyncPlugin *plugin);
132 const char *osync_plugin_get_path(OSyncPlugin *plugin);
133 
134 void *osync_plugin_get_function(OSyncPlugin *plugin, const char *name, OSyncError **error);
135 void osync_plugin_accept_objtype(OSyncPluginInfo *info, const char *objtypestr);
136 void osync_plugin_accept_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, const char *extension);
137 void osync_plugin_set_commit_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatCommitFn commit_change);
138 void osync_plugin_set_access_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatAccessFn access_fn);
139 void osync_plugin_set_read_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatReadFn read_fn);
140 void osync_plugin_set_batch_commit_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatBatchCommitFn batch);
141 void osync_plugin_set_committed_all_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatCommittedAllFn committed_all);
void osync_plugin_free(OSyncPlugin *plugin)
Used to free a plugin.
unsigned int get_data_timeout
void osync_plugin_set_access_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatAccessFn access_fn)
Sets the access function of a format.
OSyncPluginTimeouts osync_plugin_get_timeouts(OSyncPlugin *plugin)
Returns the timeouts of the plugin.
The functions for accessing formats on a plugin.
Represent an error.
OSyncPluginInfo * osync_plugin_new_info(OSyncEnv *env)
Registers a new plugin.
osync_bool osync_module_load(OSyncEnv *env, const char *path, OSyncError **error)
dlopen()s a format plugin
OSyncFormatCommitFn commit_change
void osync_plugin_set_commit_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatCommitFn commit_change)
Sets the commit function of a format.
OSyncFormatBatchCommitFn batch_commit
OSyncPlugin * osync_plugin_new(OSyncEnv *env)
This will create a new plugin struct.
Represent a synchronzation plugin.
osync_bool(* store_config)(char *, const char *, int)
OSyncFormatCommittedAllFn committed_all
struct OSyncPluginTimeouts OSyncPluginTimeouts
The timeouts for the asynchronous functions of a plugin.
OSyncFormatReadFn read
void(* disconnect)(OSyncContext *)
OSyncPlugin * plugin
unsigned int read_change_timeout
void(* connect)(OSyncContext *)
void * osync_plugin_get_function(OSyncPlugin *plugin, const char *name, OSyncError **error)
Used to look up a symbol on the plugin.
void osync_plugin_accept_objtype(OSyncPluginInfo *info, const char *objtypestr)
Tells opensync that the plugin can accepts this object.
void * osync_plugin_get_plugin_data(OSyncPlugin *plugin)
Returns the plugin_info data, set by the plugin.
const char * longname
osync_bool is_threadsafe
unsigned int connect_timeout
void osync_plugin_set_committed_all_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatCommittedAllFn committed_all)
Sets the committed_all function of a format.
A member of a group which represent a single device.
const char * osync_plugin_get_name(OSyncPlugin *plugin)
Returns the name of the loaded plugin.
unsigned int sync_done_timeout
osync_bool osync_module_load_dir(OSyncEnv *env, const char *path, osync_bool must_exist, OSyncError **oserror)
Loads the modules from a given directory.
const char * name
OSyncFormatAccessFn access
void osync_plugin_set_read_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatReadFn read_fn)
Sets the read function of a format.
unsigned int disconnect_timeout
Gives information about a plugin.
osync_bool(* get_config)(char *, char **, int *)
A change object.
osync_bool(* is_available)(OSyncError **)
unsigned int get_changeinfo_timeout
const char * osync_plugin_get_description(OSyncPlugin *plugin)
Returns the description of the plugin.
void(* finalize)(void *)
const char * osync_plugin_get_path(OSyncPlugin *plugin)
Get full path for plugin module.
struct OSyncFormatFunctions OSyncFormatFunctions
The functions for accessing formats on a plugin.
OSyncConfigurationTypes config_type
const char * description
void osync_plugin_accept_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, const char *extension)
Tells opensync that the plugin can accepts this format for the given object.
struct OSyncPluginInfo OSyncPluginInfo
Gives information about a plugin.
void(* get_changeinfo)(OSyncContext *)
void osync_plugin_set_batch_commit_objformat(OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatBatchCommitFn batch)
Sets the batch_commit function of a format.
struct OSyncPluginFunctions OSyncPluginFunctions
The functions that can be called on a plugin.
The functions that can be called on a plugin.
OSyncPluginFunctions functions
OSyncPluginTimeouts timeouts
void(* sync_done)(OSyncContext *ctx)
unsigned int commit_timeout
OSyncConfigurationTypes
Gives information about wether the plugin has to be configured or not.
void(* get_data)(OSyncContext *, OSyncChange *)
The timeouts for the asynchronous functions of a plugin.
const char * osync_plugin_get_longname(OSyncPlugin *plugin)
Returns the long name of the loaded plugin.