OpenSync Converter
[OpenSync Format Module]

Functions for creating and managing object format converters. More...


Typedefs

typedef osync_bool(* OSyncFormatDetectFunc )(const char *data, int size, void *userdata)
typedef osync_bool(* OSyncFormatConvertFunc )(char *input, unsigned int inpsize, 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(* OSyncFormatConverterFinalizeFunc )(void *userdata)

Enumerations

enum  OSyncConverterType { OSYNC_CONVERTER_CONV = 1, OSYNC_CONVERTER_ENCAP = 2, OSYNC_CONVERTER_DECAP = 3, OSYNC_CONVERTER_DETECTOR = 4 }

Functions

OSYNC_EXPORT OSyncFormatConverterosync_converter_new (OSyncConverterType type, OSyncObjFormat *sourceformat, OSyncObjFormat *targetformat, OSyncFormatConvertFunc convert_func, OSyncError **error)
 Creates a new converter.
OSYNC_EXPORT OSyncFormatConverterosync_converter_new_detector (OSyncObjFormat *sourceformat, OSyncObjFormat *targetformat, OSyncFormatDetectFunc detect_func, OSyncError **error)
 Creates a new detector.
OSYNC_EXPORT OSyncFormatConverterosync_converter_ref (OSyncFormatConverter *converter)
 Increase the reference count on a converter.
OSYNC_EXPORT void osync_converter_unref (OSyncFormatConverter *converter)
 Decrease the reference count on a converter.
OSYNC_EXPORT OSyncObjFormatosync_converter_get_sourceformat (OSyncFormatConverter *converter)
 Returns the source format of a converter.
OSYNC_EXPORT OSyncObjFormatosync_converter_get_targetformat (OSyncFormatConverter *converter)
 Returns the target format of a converter.
OSYNC_EXPORT OSyncConverterType osync_converter_get_type (OSyncFormatConverter *converter)
 Returns the type of a converter.
OSYNC_EXPORT OSyncObjFormatosync_converter_detect (OSyncFormatConverter *converter, OSyncData *data)
 Detects the Object Format of passed OSyncData.
OSYNC_EXPORT osync_bool osync_converter_invoke (OSyncFormatConverter *converter, OSyncData *data, const char *config, OSyncError **error)
 Invokes converter for OSyncData object with passed format converter configuration.
OSYNC_EXPORT osync_bool osync_converter_matches (OSyncFormatConverter *converter, OSyncData *data)
 Checks if the Format Converter fits the Object Format of OSyncData object.
OSYNC_EXPORT
OSyncFormatConverterPath
osync_converter_path_new (OSyncError **error)
 Creates a new converter path.
OSYNC_EXPORT
OSyncFormatConverterPath
osync_converter_path_ref (OSyncFormatConverterPath *path)
 Increase the reference count on a converter path.
OSYNC_EXPORT void osync_converter_path_unref (OSyncFormatConverterPath *path)
 Decrease the reference count on a converter path.
OSYNC_EXPORT void osync_converter_path_add_edge (OSyncFormatConverterPath *path, OSyncFormatConverter *edge)
 Add a converter to a converter path.
OSYNC_EXPORT unsigned int osync_converter_path_num_edges (OSyncFormatConverterPath *path)
 Returns the number of converters in a converter path.
OSYNC_EXPORT OSyncFormatConverterosync_converter_path_nth_edge (OSyncFormatConverterPath *path, unsigned int nth)
 Returns the nth converter in a converter path.
OSYNC_EXPORT const char * osync_converter_path_get_config (OSyncFormatConverterPath *path)
 Returns configuration for converter path.
OSYNC_EXPORT void osync_converter_path_set_config (OSyncFormatConverterPath *path, const char *config)
 Sets the configuration for converter path.
OSYNC_EXPORT void osync_converter_set_initialize_func (OSyncFormatConverter *converter, OSyncFormatConverterInitializeFunc initialize_func)
 Sets the initialize function of a converter.
OSYNC_EXPORT void osync_converter_set_finalize_func (OSyncFormatConverter *converter, OSyncFormatConverterFinalizeFunc finalize_func)
 Sets the finalize function of a converter.
OSYNC_EXPORT void osync_converter_initialize (OSyncFormatConverter *converter, const char *config, OSyncError **error)
 Invokes initialize function of a converter.
OSYNC_EXPORT void osync_converter_finalize (OSyncFormatConverter *converter)
 Invokes finalize function of a converter.


Detailed Description

Functions for creating and managing object format converters.

Enumeration Type Documentation

Type of the converter

Enumerator:
OSYNC_CONVERTER_CONV  Simple converter
OSYNC_CONVERTER_ENCAP  Encapsulator
OSYNC_CONVERTER_DECAP  Desencapsulator
OSYNC_CONVERTER_DETECTOR  Detector

Definition at line 33 of file opensync_converter.h.


Function Documentation

OSYNC_EXPORT OSyncFormatConverter* osync_converter_new ( OSyncConverterType  type,
OSyncObjFormat sourceformat,
OSyncObjFormat targetformat,
OSyncFormatConvertFunc  convert_func,
OSyncError **  error 
)

Creates a new converter.

Parameters:
type the type of converter
sourceformat the source format for the converter
targetformat the target format for the converter
convert_func the converter function
error Pointer to an error struct
Returns:
The pointer to the newly allocated converter or NULL in case of error

Definition at line 32 of file opensync_converter.c.

OSYNC_EXPORT OSyncFormatConverter* osync_converter_new_detector ( OSyncObjFormat sourceformat,
OSyncObjFormat targetformat,
OSyncFormatDetectFunc  detect_func,
OSyncError **  error 
)

Creates a new detector.

Parameters:
sourceformat the source format for the converter
targetformat the target format for the converter
detect_func the detection function
error Pointer to an error struct
Returns:
The pointer to the newly allocated detector or NULL in case of error

Definition at line 60 of file opensync_converter.c.

Referenced by osync_format_env_register_converter().

OSYNC_EXPORT OSyncFormatConverter* osync_converter_ref ( OSyncFormatConverter converter  ) 

Increase the reference count on a converter.

Parameters:
converter Pointer to the converter

Definition at line 88 of file opensync_converter.c.

Referenced by osync_converter_path_add_edge(), and osync_format_env_register_converter().

OSYNC_EXPORT void osync_converter_unref ( OSyncFormatConverter converter  ) 

Decrease the reference count on a converter.

Parameters:
converter Pointer to the converter

Definition at line 97 of file opensync_converter.c.

Referenced by osync_converter_path_unref(), and osync_format_env_unref().

OSYNC_EXPORT OSyncObjFormat* osync_converter_get_sourceformat ( OSyncFormatConverter converter  ) 

Returns the source format of a converter.

Parameters:
converter Pointer to the converter
Returns:
The source format of the specified converter

Definition at line 112 of file opensync_converter.c.

Referenced by osync_format_env_find_converter(), osync_format_env_find_converters(), and osync_format_env_register_converter().

OSYNC_EXPORT OSyncObjFormat* osync_converter_get_targetformat ( OSyncFormatConverter converter  ) 

Returns the target format of a converter.

Parameters:
converter Pointer to the converter
Returns:
The target format of the specified converter

Definition at line 118 of file opensync_converter.c.

Referenced by osync_entry_engine_convert(), osync_format_env_convert(), osync_format_env_detect_objformat(), osync_format_env_find_converter(), osync_format_env_find_converters(), and osync_format_env_register_converter().

OSYNC_EXPORT OSyncConverterType osync_converter_get_type ( OSyncFormatConverter converter  ) 

Returns the type of a converter.

Parameters:
converter Pointer to the converter
Returns:
The type of the specified converter

Definition at line 124 of file opensync_converter.c.

Referenced by osync_format_env_detect_objformat(), osync_format_env_detect_objformat_full(), and osync_format_env_register_converter().

OSYNC_EXPORT OSyncObjFormat* osync_converter_detect ( OSyncFormatConverter converter,
OSyncData data 
)

Detects the Object Format of passed OSyncData.

Parameters:
converter Pointer to the converter
data Pointer to OSyncData object which should be detected
Returns:
The detected Object Format or NULL

Definition at line 130 of file opensync_converter.c.

Referenced by osync_format_env_detect_objformat().

OSYNC_EXPORT osync_bool osync_converter_invoke ( OSyncFormatConverter converter,
OSyncData data,
const char *  config,
OSyncError **  error 
)

Invokes converter for OSyncData object with passed format converter configuration.

Parameters:
converter Pointer to the converter
data Pointer to OSyncData object which should be detected
config Format converter configuration
error Pointer to an error struct
Returns:
TRUE on successful conversion, FALSE on error

Definition at line 171 of file opensync_converter.c.

Referenced by osync_format_env_convert(), and osync_format_env_detect_objformat_full().

OSYNC_EXPORT osync_bool osync_converter_matches ( OSyncFormatConverter converter,
OSyncData data 
)

Checks if the Format Converter fits the Object Format of OSyncData object.

Parameters:
converter Pointer to the converter
data Pointer to OSyncData object which should be converted
Returns:
TRUE if Object Format matches the Converter source format, FALSE otherwise

Definition at line 220 of file opensync_converter.c.

Referenced by osync_format_env_detect_objformat(), and osync_format_env_detect_objformat_full().

OSYNC_EXPORT OSyncFormatConverterPath* osync_converter_path_new ( OSyncError **  error  ) 

Creates a new converter path.

Parameters:
error Pointer to an error struct
Returns:
The pointer to the newly allocated converter path or NULL in case of error

Definition at line 232 of file opensync_converter.c.

OSYNC_EXPORT OSyncFormatConverterPath* osync_converter_path_ref ( OSyncFormatConverterPath path  ) 

Increase the reference count on a converter path.

Parameters:
path Pointer to the converter path
Returns:
Pointer of converter path object

Definition at line 243 of file opensync_converter.c.

Referenced by osync_entry_engine_convert().

OSYNC_EXPORT void osync_converter_path_unref ( OSyncFormatConverterPath path  ) 

Decrease the reference count on a converter path.

Parameters:
path Pointer to the converter path

Definition at line 252 of file opensync_converter.c.

Referenced by osync_entry_engine_convert().

OSYNC_EXPORT void osync_converter_path_add_edge ( OSyncFormatConverterPath path,
OSyncFormatConverter edge 
)

Add a converter to a converter path.

Parameters:
path Pointer to the converter path
edge Pointer to the converter to add

Definition at line 270 of file opensync_converter.c.

OSYNC_EXPORT unsigned int osync_converter_path_num_edges ( OSyncFormatConverterPath path  ) 

Returns the number of converters in a converter path.

Parameters:
path Pointer to the converter path
Returns:
the number of converters in the specified path

Definition at line 279 of file opensync_converter.c.

Referenced by osync_entry_engine_convert(), and osync_format_env_convert().

OSYNC_EXPORT OSyncFormatConverter* osync_converter_path_nth_edge ( OSyncFormatConverterPath path,
unsigned int  nth 
)

Returns the nth converter in a converter path.

Parameters:
path Pointer to the converter path
nth The position of the converter to retrieve
Returns:
the converter at the specified index

Definition at line 285 of file opensync_converter.c.

Referenced by osync_entry_engine_convert(), and osync_format_env_convert().

OSYNC_EXPORT const char* osync_converter_path_get_config ( OSyncFormatConverterPath path  ) 

Returns configuration for converter path.

Parameters:
path Pointer to the converter path
Returns:
The converter path configuration

Definition at line 291 of file opensync_converter.c.

Referenced by osync_format_env_convert().

OSYNC_EXPORT void osync_converter_path_set_config ( OSyncFormatConverterPath path,
const char *  config 
)

Sets the configuration for converter path.

Parameters:
path Pointer to the converter path
config The converter path configuration

Definition at line 297 of file opensync_converter.c.

Referenced by osync_entry_engine_convert().

OSYNC_EXPORT void osync_converter_set_initialize_func ( OSyncFormatConverter converter,
OSyncFormatConverterInitializeFunc  initialize_func 
)

Sets the initialize function of a converter.

Parameters:
converter Pointer to the converter
initialize_func Pointer to the initialize function

Definition at line 311 of file opensync_converter.c.

OSYNC_EXPORT void osync_converter_set_finalize_func ( OSyncFormatConverter converter,
OSyncFormatConverterFinalizeFunc  finalize_func 
)

Sets the finalize function of a converter.

Parameters:
converter Pointer to the converter
finalize_func Pointer to the finalize function

Definition at line 318 of file opensync_converter.c.

OSYNC_EXPORT void osync_converter_initialize ( OSyncFormatConverter converter,
const char *  config,
OSyncError **  error 
)

Invokes initialize function of a converter.

Parameters:
converter Pointer to the converter which should be initialized
config configuration
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

Definition at line 324 of file opensync_converter.c.

OSYNC_EXPORT void osync_converter_finalize ( OSyncFormatConverter converter  ) 

Invokes finalize function of a converter.

Parameters:
converter Pointer to the converter which should be finalized

Definition at line 333 of file opensync_converter.c.


Generated on Fri Feb 13 13:33:29 2009 for OpenSync by  doxygen 1.5.7.1