OpenSync  0.22
Typedefs | Enumerations | Functions
OpenSync Filter

Allows filtering of changes and applying hooks to changes as they pass through opensync. More...

Typedefs

typedef enum OSyncFilterAction OSyncFilterAction
 The action that should be invoked.
 

Enumerations

enum  OSyncFilterAction { OSYNC_FILTER_IGNORE = 0, OSYNC_FILTER_ALLOW = 1, OSYNC_FILTER_DENY = 2 }
 The action that should be invoked. More...
 

Functions

void osync_filter_register (OSyncGroup *group, OSyncFilter *filter)
 Registers a filter with a group. More...
 
OSyncFilterosync_filter_new (void)
 Creates a new filter. More...
 
void osync_filter_free (OSyncFilter *filter)
 Frees a filter. More...
 
OSyncFilterosync_filter_add (OSyncGroup *group, OSyncMember *sourcemember, OSyncMember *destmember, const char *sourceobjtype, const char *destobjtype, const char *detectobjtype, OSyncFilterAction action)
 Register a new filter. More...
 
void osync_filter_remove (OSyncGroup *group, OSyncFilter *filter)
 Removes a filter from a group. More...
 
OSyncFilterosync_filter_add_custom (OSyncGroup *group, OSyncMember *sourcemember, OSyncMember *destmember, const char *sourceobjtype, const char *destobjtype, const char *detectobjtype, const char *function_name)
 Register a new custom filter. More...
 
void osync_filter_set_config (OSyncFilter *filter, const char *config)
 Sets the config for a filter. More...
 
const char * osync_filter_get_config (OSyncFilter *filter)
 Gets the config of a filter. More...
 

Detailed Description

Allows filtering of changes and applying hooks to changes as they pass through opensync.

Enumeration Type Documentation

The action that should be invoked.

Enumerator
OSYNC_FILTER_IGNORE 

This filter should be ignored

OSYNC_FILTER_ALLOW 

The change should be allowed to pass (Overwrites previous action)

OSYNC_FILTER_DENY 

The change should be denied to pass (Overwrites previous action)

Definition at line 5 of file opensync_filter.h.

Function Documentation

void osync_filter_register ( OSyncGroup group,
OSyncFilter filter 
)

Registers a filter with a group.

Parameters
groupThe group in which to register the filter
filterThe filter to register

Definition at line 185 of file opensync_filter.c.

Referenced by osync_group_load().

OSyncFilter* osync_filter_new ( void  )

Creates a new filter.

Returns
A newly allocated filter

Definition at line 197 of file opensync_filter.c.

Referenced by osync_group_load().

void osync_filter_free ( OSyncFilter filter)

Frees a filter.

Parameters
filterThe filter to free

Definition at line 210 of file opensync_filter.c.

Referenced by osync_group_flush_filters().

OSyncFilter* osync_filter_add ( OSyncGroup group,
OSyncMember sourcemember,
OSyncMember destmember,
const char *  sourceobjtype,
const char *  destobjtype,
const char *  detectobjtype,
OSyncFilterAction  action 
)

Register a new filter.

Parameters
groupFor which group to register the filter
sourcememberThe member reporting the object. NULL for any
destmemberThe member receiving the object. NULL for any
sourceobjtypeThe objtype as reported by the member without detection. NULL for any
destobjtypeThe objtype as about being saved by the member without detection. NULL for any
detectobjtypeThe objtype as detected. NULL for ignore
actionSet this to the action the filter should return for the object
Returns
The new added Filter

Definition at line 236 of file opensync_filter.c.

void osync_filter_remove ( OSyncGroup group,
OSyncFilter filter 
)

Removes a filter from a group.

Parameters
groupThe group to remove from
filterThe filter to remove

Definition at line 260 of file opensync_filter.c.

OSyncFilter* osync_filter_add_custom ( OSyncGroup group,
OSyncMember sourcemember,
OSyncMember destmember,
const char *  sourceobjtype,
const char *  destobjtype,
const char *  detectobjtype,
const char *  function_name 
)

Register a new custom filter.

Parameters
groupThe group that should store the filter
sourcememberThe member reporting the object. NULL for any
destmemberThe member receiving the object. NULL for any
sourceobjtypeThe objtype as reported by the member without detection. NULL for any
destobjtypeThe object type has it is being added on the target. NULL for any
detectobjtypeThe objtype as detected. NULL for any
function_nameThe filter function to call to decide if to filter the object.
Returns
The new added Filter

Definition at line 280 of file opensync_filter.c.

void osync_filter_set_config ( OSyncFilter filter,
const char *  config 
)

Sets the config for a filter.

Config must be a null-terminated string

Parameters
filterThe filter
configThe new config for this filter

Definition at line 305 of file opensync_filter.c.

const char* osync_filter_get_config ( OSyncFilter filter)

Gets the config of a filter.

Parameters
filterThe filter
Returns
The config of this filter

Definition at line 320 of file opensync_filter.c.