OpenSync
0.22
|
Functions to register and manage plugins. More...
Data Structures | |
struct | OSyncPluginFunctions |
The functions that can be called on a plugin. More... | |
struct | OSyncPluginTimeouts |
The timeouts for the asynchronous functions of a plugin. More... | |
struct | OSyncFormatFunctions |
The functions for accessing formats on a plugin. More... | |
struct | OSyncPluginInfo |
Gives information about a plugin. More... | |
Typedefs | |
typedef struct OSyncPluginFunctions | OSyncPluginFunctions |
The functions that can be called on a plugin. | |
typedef struct OSyncPluginTimeouts | OSyncPluginTimeouts |
The timeouts for the asynchronous functions of a plugin. More... | |
typedef struct OSyncFormatFunctions | OSyncFormatFunctions |
The functions for accessing formats on a plugin. | |
typedef struct OSyncPluginInfo | OSyncPluginInfo |
Gives information about a plugin. | |
Enumerations | |
enum | OSyncConfigurationTypes { NO_CONFIGURATION = 0, OPTIONAL_CONFIGURATION = 1, NEEDS_CONFIGURATION = 2 } |
Gives information about wether the plugin has to be configured or not. More... | |
Functions | |
OSyncPlugin * | osync_plugin_new (OSyncEnv *env) |
This will create a new plugin struct. More... | |
OSyncPluginInfo * | osync_plugin_new_info (OSyncEnv *env) |
Registers a new plugin. More... | |
void | osync_plugin_free (OSyncPlugin *plugin) |
Used to free a plugin. More... | |
void * | osync_plugin_get_function (OSyncPlugin *plugin, const char *name, OSyncError **error) |
Used to look up a symbol on the plugin. More... | |
osync_bool | osync_module_load (OSyncEnv *env, const char *path, OSyncError **error) |
dlopen()s a format plugin More... | |
void | osync_module_unload (OSyncEnv *env, GModule *module) |
Closes a module. More... | |
osync_bool | osync_module_load_dir (OSyncEnv *env, const char *path, osync_bool must_exist, OSyncError **error) |
Loads the modules from a given directory. More... | |
const char * | osync_plugin_get_name (OSyncPlugin *plugin) |
Returns the name of the loaded plugin. More... | |
const char * | osync_plugin_get_longname (OSyncPlugin *plugin) |
Returns the long name of the loaded plugin. More... | |
const char * | osync_plugin_get_description (OSyncPlugin *plugin) |
Returns the description of the plugin. More... | |
OSyncPluginTimeouts | osync_plugin_get_timeouts (OSyncPlugin *plugin) |
Returns the timeouts of the plugin. More... | |
void * | osync_plugin_get_plugin_data (OSyncPlugin *plugin) |
Returns the plugin_info data, set by the plugin. More... | |
const char * | osync_plugin_get_path (OSyncPlugin *plugin) |
Get full path for plugin module. More... | |
void | osync_plugin_set_commit_objformat (OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatCommitFn commit_change) |
Sets the commit function of a format. More... | |
void | osync_plugin_set_access_objformat (OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatAccessFn access) |
Sets the access function of a format. More... | |
void | osync_plugin_set_read_objformat (OSyncPluginInfo *info, const char *objtypestr, const char *formatstr, OSyncFormatReadFn read) |
Sets the read function of a format. More... | |
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. More... | |
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. More... | |
void | osync_plugin_accept_objtype (OSyncPluginInfo *info, const char *objtypestr) |
Tells opensync that the plugin can accepts this object. More... | |
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. More... | |
Functions to register and manage plugins.
typedef struct OSyncPluginTimeouts OSyncPluginTimeouts |
The timeouts for the asynchronous functions of a plugin.
The default timeout it 60 seconds. Set this to 0 if you dont want to have a timeout
Gives information about wether the plugin has to be configured or not.
Definition at line 80 of file opensync_plugin.h.
OSyncPlugin* osync_plugin_new | ( | OSyncEnv * | env | ) |
This will create a new plugin struct.
The plugin struct represents a sync plugin
env | For which environment to register this plugin. May be NULL |
Definition at line 167 of file opensync_plugin.c.
Referenced by osync_plugin_new_info().
OSyncPluginInfo* osync_plugin_new_info | ( | OSyncEnv * | env | ) |
Registers a new plugin.
This function creates a new OSyncPluginInfo 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 get_info() function, that allows registering of only one plugin.
Definition at line 205 of file opensync_plugin.c.
void osync_plugin_free | ( | OSyncPlugin * | plugin | ) |
Used to free a plugin.
Frees a plugin
plugin | Pointer to the plugin |
Definition at line 222 of file opensync_plugin.c.
Referenced by osync_env_finalize().
void* osync_plugin_get_function | ( | OSyncPlugin * | plugin, |
const char * | name, | ||
OSyncError ** | error | ||
) |
Used to look up a symbol on the plugin.
Looks up and returns a function
plugin | Pointer to the plugin |
name | The name of the function to look up |
error | Pointer to a error struct |
Definition at line 243 of file opensync_plugin.c.
Referenced by osync_member_call_plugin().
osync_bool osync_module_load | ( | OSyncEnv * | env, |
const char * | path, | ||
OSyncError ** | error | ||
) |
dlopen()s a format plugin
The get_info() function on the format plugin gets called
env | The environment in which to open the plugin |
path | Where to find this plugin |
error | Pointer to a error struct |
Definition at line 270 of file opensync_plugin.c.
Referenced by osync_module_load_dir().
void osync_module_unload | ( | OSyncEnv * | env, |
GModule * | module | ||
) |
Closes a module.
env | The environment from which to remove the module |
module | The module to unload |
Definition at line 317 of file opensync_plugin.c.
Referenced by osync_env_finalize().
osync_bool osync_module_load_dir | ( | OSyncEnv * | env, |
const char * | path, | ||
osync_bool | must_exist, | ||
OSyncError ** | error | ||
) |
Loads the modules from a given directory.
Loads all modules from a directory into a osync environment
env | Pointer to a OSyncEnv environment |
path | The path where to look for plugins, NULL for the default sync module directory |
must_exist | If set to TRUE, this function will return an error if the directory does not exist |
error | Pointer to a error struct to return a error |
Definition at line 336 of file opensync_plugin.c.
Referenced by osync_env_load_formats(), and osync_env_load_plugins().
const char* osync_plugin_get_name | ( | OSyncPlugin * | plugin | ) |
Returns the name of the loaded plugin.
plugin | Pointer to the plugin |
Definition at line 397 of file opensync_plugin.c.
Referenced by osync_member_instance_plugin(), and osync_member_save().
const char* osync_plugin_get_longname | ( | OSyncPlugin * | plugin | ) |
Returns the long name of the loaded plugin.
plugin | Pointer to the plugin |
Definition at line 409 of file opensync_plugin.c.
const char* osync_plugin_get_description | ( | OSyncPlugin * | plugin | ) |
Returns the description of the plugin.
plugin | Pointer to the plugin |
Definition at line 421 of file opensync_plugin.c.
OSyncPluginTimeouts osync_plugin_get_timeouts | ( | OSyncPlugin * | plugin | ) |
Returns the timeouts of the plugin.
plugin | Pointer to the plugin |
Definition at line 433 of file opensync_plugin.c.
void* osync_plugin_get_plugin_data | ( | OSyncPlugin * | plugin | ) |
Returns the plugin_info data, set by the plugin.
plugin | Pointer to the plugin |
Definition at line 444 of file opensync_plugin.c.
Referenced by osync_member_get_plugindata().
const char* osync_plugin_get_path | ( | OSyncPlugin * | plugin | ) |
Get full path for plugin module.
plugin | Pointer to the plugin |
Definition at line 455 of file opensync_plugin.c.
void osync_plugin_set_commit_objformat | ( | OSyncPluginInfo * | info, |
const char * | objtypestr, | ||
const char * | formatstr, | ||
OSyncFormatCommitFn | commit_change | ||
) |
Sets the commit function of a format.
info | Pointer to a plugin info struct to fill |
objtypestr | The name of the object type |
formatstr | The name of the format |
commit_change | The pointer to your commit_change function |
Definition at line 469 of file opensync_plugin.c.
void osync_plugin_set_access_objformat | ( | OSyncPluginInfo * | info, |
const char * | objtypestr, | ||
const char * | formatstr, | ||
OSyncFormatAccessFn | access | ||
) |
Sets the access function of a format.
info | Pointer to a plugin info struct to fill |
objtypestr | The name of the object type |
formatstr | The name of the format |
access | The pointer to your access function |
Definition at line 494 of file opensync_plugin.c.
void osync_plugin_set_read_objformat | ( | OSyncPluginInfo * | info, |
const char * | objtypestr, | ||
const char * | formatstr, | ||
OSyncFormatReadFn | read | ||
) |
Sets the read function of a format.
info | Pointer to a plugin info struct to fill |
objtypestr | The name of the object type |
formatstr | The name of the format |
read | The pointer to your read function |
Definition at line 519 of file opensync_plugin.c.
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.
info | Pointer to a plugin info struct to fill |
objtypestr | The name of the object type |
formatstr | The name of the format |
batch | The pointer to your batch_commit function |
Definition at line 536 of file opensync_plugin.c.
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.
info | Pointer to a plugin info struct to fill |
objtypestr | The name of the object type |
formatstr | The name of the format |
committed_all | The pointer to your committed_all function |
Definition at line 561 of file opensync_plugin.c.
void osync_plugin_accept_objtype | ( | OSyncPluginInfo * | info, |
const char * | objtypestr | ||
) |
Tells opensync that the plugin can accepts this object.
Tells opensync that the plugin can accepts this object. Used by the plugin in the get_info() function
info | The plugin info on which to operate |
objtypestr | The name of the object which to accept |
Definition at line 579 of file opensync_plugin.c.
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.
Tells opensync that the plugin can accepts this format. Used by the plugin in the get_info() function
info | The plugin info on which to operate |
objtypestr | The name of the objecttype |
formatstr | The name of the format to accept |
extension | The name of the extension that the plugin wants. NULL if none |
Definition at line 597 of file opensync_plugin.c.