OpenSync  0.22
Functions
OpenSync Environment

The public API of the opensync environment. More...

Functions

OSyncEnv * osync_env_new (void)
 This will create a new opensync environment. More...
 
void osync_env_free (OSyncEnv *env)
 Frees a osync environment. More...
 
void osync_env_set_option (OSyncEnv *env, const char *name, const char *value)
 Sets a options on the environment. More...
 
osync_bool osync_env_initialize (OSyncEnv *env, OSyncError **error)
 Initializes the environment (loads plugins) More...
 
osync_bool osync_env_finalize (OSyncEnv *env, OSyncError **error)
 Finalizes the environment. More...
 
osync_bool osync_env_load_formats (OSyncEnv *env, const char *path, OSyncError **error)
 Loads all format and conversion plugins. More...
 
osync_bool osync_env_load_plugins (OSyncEnv *env, const char *path, OSyncError **error)
 Loads the sync modules from a given directory. More...
 
OSyncPluginosync_env_find_plugin (OSyncEnv *env, const char *name)
 Finds the plugin with the given name. More...
 
int osync_env_num_plugins (OSyncEnv *env)
 Returns the number of loaded plugins. More...
 
OSyncPluginosync_env_nth_plugin (OSyncEnv *env, int nth)
 Returns pointer to nth plugin. More...
 
osync_bool osync_env_plugin_is_usable (OSyncEnv *env, const char *pluginname, OSyncError **error)
 Checks if a plugin is available and usable. More...
 
osync_bool osync_env_load_groups (OSyncEnv *env, const char *p, OSyncError **error)
 Loads the plugins from a given directory. More...
 
OSyncGrouposync_env_find_group (OSyncEnv *env, const char *name)
 Finds the group with the given name. More...
 
void osync_env_append_group (OSyncEnv *env, OSyncGroup *group)
 Adds the given group to the environment. More...
 
void osync_env_remove_group (OSyncEnv *env, OSyncGroup *group)
 Removes the given group from the enviroment. More...
 
int osync_env_num_groups (OSyncEnv *env)
 Counts the groups in the environment. More...
 
OSyncGrouposync_env_nth_group (OSyncEnv *env, int nth)
 Returns the nth group. More...
 

Detailed Description

The public API of the opensync environment.

Function Documentation

OSyncEnv* osync_env_new ( void  )

This will create a new opensync environment.

The environment will hold all information about plugins, groups etc

Returns
A pointer to a newly allocated environment. NULL on error.

Definition at line 186 of file opensync_env.c.

void osync_env_free ( OSyncEnv *  env)

Frees a osync environment.

Frees a osync environment and all resources.

Parameters
envPointer to the environment to free

Definition at line 207 of file opensync_env.c.

void osync_env_set_option ( OSyncEnv *  env,
const char *  name,
const char *  value 
)

Sets a options on the environment.

Parameters
envPointer to the environment
nameName of the option to set
valueValue to set

Definition at line 222 of file opensync_env.c.

Referenced by osync_env_new().

osync_bool osync_env_initialize ( OSyncEnv *  env,
OSyncError **  error 
)

Initializes the environment (loads plugins)

This will load all available plugins from disk. You can configure the location to look for plugins before calling this function

Parameters
envPointer to a OSyncEnv environment
errorPointer to a error struct to return a error
Returns
TRUE on success, FALSE otherwise

Definition at line 240 of file opensync_env.c.

osync_bool osync_env_finalize ( OSyncEnv *  env,
OSyncError **  error 
)

Finalizes the environment.

This will finalize the environment and unload and free all loaded plugins

Parameters
envPointer to a OSyncEnv environment
errorPointer to a error struct to return a error
Returns
TRUE on success, FALSE otherwise

Definition at line 289 of file opensync_env.c.

osync_bool osync_env_load_formats ( OSyncEnv *  env,
const char *  path,
OSyncError **  error 
)

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

Parameters
envThe format environment
pathThe path to load from or NULL if to load from default path
errorThe location to return a error to
Returns
TRUE if successfull, FALSE otherwise

Definition at line 334 of file opensync_env.c.

Referenced by osync_env_initialize().

osync_bool osync_env_load_plugins ( OSyncEnv *  env,
const char *  path,
OSyncError **  error 
)

Loads the sync modules from a given directory.

Loads all sync modules from a directory into a osync environment

Parameters
envPointer to a OSyncEnv environment
pathThe path where to look for plugins
errorPointer to a error struct to return a error
Returns
TRUE on success, FALSE otherwise

Definition at line 363 of file opensync_env.c.

Referenced by osync_env_initialize().

OSyncPlugin* osync_env_find_plugin ( OSyncEnv *  env,
const char *  name 
)

Finds the plugin with the given name.

Finds the plugin with the given name

Parameters
envPointer to a OSyncEnv environment
nameThe name to search for
Returns
The plugin or NULL if not found

Definition at line 391 of file opensync_env.c.

Referenced by osync_env_plugin_is_usable(), and osync_member_instance_plugin().

int osync_env_num_plugins ( OSyncEnv *  env)

Returns the number of loaded plugins.

Returns the number of loaded plugins. 0 if used before initialization

Parameters
envPointer to a OSyncEnv environment
Returns
Number of plugins

Definition at line 413 of file opensync_env.c.

Referenced by osync_env_find_plugin().

OSyncPlugin* osync_env_nth_plugin ( OSyncEnv *  env,
int  nth 
)

Returns pointer to nth plugin.

Returns pointer to nth plugin

Parameters
envPointer to a OSyncEnv environment
nthWhich plugin to return
Returns
Pointer to plugin

Definition at line 427 of file opensync_env.c.

Referenced by osync_env_find_plugin().

osync_bool osync_env_plugin_is_usable ( OSyncEnv *  env,
const char *  pluginname,
OSyncError **  error 
)

Checks if a plugin is available and usable.

Parameters
envThe environment in which the plugin should be loaded
pluginnameThe name of the plugin to check for
errorIf the return was FALSE, will contain the information why the plugin is not available
Returns
TRUE if plugin was found and is usable, FALSE otherwise

Definition at line 440 of file opensync_env.c.

osync_bool osync_env_load_groups ( OSyncEnv *  env,
const char *  p,
OSyncError **  error 
)

Loads the plugins from a given directory.

Loads all plugins from a directory into a osync environment. The directory must exist prior to opening.

Parameters
envPointer to a OSyncEnv environment
pathThe path where to look for groups
errorPointer to a error struct to return a error
Returns
TRUE on success, FALSE otherwise

Definition at line 472 of file opensync_env.c.

Referenced by osync_env_initialize().

OSyncGroup* osync_env_find_group ( OSyncEnv *  env,
const char *  name 
)

Finds the group with the given name.

Finds the group with the given name

Parameters
envPointer to a OSyncEnv environment
nameName of the group to search
Returns
Pointer to group. NULL if not found

Definition at line 563 of file opensync_env.c.

void osync_env_append_group ( OSyncEnv *  env,
OSyncGroup group 
)

Adds the given group to the environment.

Adds the given group to the environment

Parameters
envPointer to a OSyncEnv environment
groupThe group to add

Definition at line 585 of file opensync_env.c.

Referenced by osync_group_new().

void osync_env_remove_group ( OSyncEnv *  env,
OSyncGroup group 
)

Removes the given group from the enviroment.

Removes the given group from the environment

Parameters
envPointer to a OSyncEnv environment
groupThe group to add

Definition at line 598 of file opensync_env.c.

Referenced by osync_group_free().

int osync_env_num_groups ( OSyncEnv *  env)

Counts the groups in the environment.

Returns the number of groups

Parameters
envPointer to a OSyncEnv environment
Returns
Number of groups

Definition at line 611 of file opensync_env.c.

Referenced by osync_env_find_group().

OSyncGroup* osync_env_nth_group ( OSyncEnv *  env,
int  nth 
)

Returns the nth group.

Returns the nth groups from the environment

Parameters
envPointer to a OSyncEnv environment
nthWhich group to return
Returns
Pointer to the group

Definition at line 625 of file opensync_env.c.

Referenced by osync_env_finalize(), and osync_env_find_group().