csync public API


Data Structures

struct  csync_tree_walk_file_s
 CSync File Traversal structure. More...

Defines

#define CSYNC_CONF_DIR   ".csync"
#define CSYNC_CONF_FILE   "csync.conf"
#define CSYNC_EXCLUDE_FILE   "csync_exclude.conf"
#define CSYNC_LOCK_FILE   "lock"
#define CSYNC_LOG_FILE   "csync_log.conf"
#define CSYNC_STRINGIFY(s)   CSYNC_TOSTRING(s)
#define CSYNC_TOSTRING(s)   #s
#define CSYNC_VERSION(a, b, c)   CSYNC_VERSION_DOT(a, b, c)
#define CSYNC_VERSION_DOT(a, b, c)   a ##.## b ##.## c
#define CSYNC_VERSION_INT(a, b, c)   ((a) << 16 | (b) << 8 | (c))
#define LIBCSYNC_VERSION
#define LIBCSYNC_VERSION_INT
#define LIBCSYNC_VERSION_MAJOR   0
#define LIBCSYNC_VERSION_MICRO   8
#define LIBCSYNC_VERSION_MINOR   50

Typedefs

typedef struct csync_s CSYNC
typedef int(* csync_auth_callback )(const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata)
typedef enum csync_error_codes_e CSYNC_ERROR_CODE
typedef int csync_treewalk_visit_func (TREE_WALK_FILE *, void *)
typedef struct
csync_tree_walk_file_s 
TREE_WALK_FILE

Enumerations

enum  csync_error_codes_e {
  CSYNC_ERR_NONE = 0, CSYNC_ERR_LOG, CSYNC_ERR_LOCK, CSYNC_ERR_STATEDB_LOAD,
  CSYNC_ERR_MODULE, CSYNC_ERR_TIMESKEW, CSYNC_ERR_FILESYSTEM, CSYNC_ERR_TREE,
  CSYNC_ERR_MEM, CSYNC_ERR_PARAM, CSYNC_ERR_RECONCILE, CSYNC_ERR_PROPAGATE,
  CSYNC_ERR_ACCESS_FAILED, CSYNC_ERR_REMOTE_CREATE, CSYNC_ERR_REMOTE_STAT, CSYNC_ERR_LOCAL_CREATE,
  CSYNC_ERR_LOCAL_STAT, CSYNC_ERR_PROXY, CSYNC_ERR_UNSPEC
}
enum  csync_instructions_e {
  CSYNC_INSTRUCTION_NONE = 0x00000000, CSYNC_INSTRUCTION_EVAL = 0x00000001, CSYNC_INSTRUCTION_REMOVE = 0x00000002, CSYNC_INSTRUCTION_RENAME = 0x00000004,
  CSYNC_INSTRUCTION_NEW = 0x00000008, CSYNC_INSTRUCTION_CONFLICT = 0x00000010, CSYNC_INSTRUCTION_IGNORE = 0x00000020, CSYNC_INSTRUCTION_SYNC = 0x00000040,
  CSYNC_INSTRUCTION_STAT_ERROR = 0x00000080, CSYNC_INSTRUCTION_ERROR = 0x00000100, CSYNC_INSTRUCTION_DELETED = 0x00000200, CSYNC_INSTRUCTION_UPDATED = 0x00000400
}

Functions

int csync_add_exclude_list (CSYNC *ctx, const char *path)
int csync_create (CSYNC **csync, const char *local, const char *remote)
int csync_destroy (CSYNC *ctx)
int csync_disable_statedb (CSYNC *ctx)
int csync_enable_conflictcopys (CSYNC *ctx)
int csync_enable_statedb (CSYNC *ctx)
csync_auth_callback csync_get_auth_callback (CSYNC *ctx)
const char * csync_get_config_dir (CSYNC *ctx)
CSYNC_ERROR_CODE csync_get_error (CSYNC *ctx)
bool csync_get_local_only (CSYNC *ctx)
const char * csync_get_statedb_file (CSYNC *ctx)
int csync_get_status (CSYNC *ctx)
void * csync_get_userdata (CSYNC *ctx)
int csync_init (CSYNC *ctx)
int csync_is_statedb_disabled (CSYNC *ctx)
int csync_propagate (CSYNC *ctx)
int csync_reconcile (CSYNC *ctx)
int csync_remove_config_dir (CSYNC *ctx)
int csync_set_auth_callback (CSYNC *ctx, csync_auth_callback cb)
int csync_set_config_dir (CSYNC *ctx, const char *path)
int csync_set_local_only (CSYNC *ctx, bool local_only)
int csync_set_status (CSYNC *ctx, int status)
int csync_set_userdata (CSYNC *ctx, void *userdata)
int csync_update (CSYNC *ctx)
const char * csync_version (int req_version)
int csync_walk_local_tree (CSYNC *ctx, csync_treewalk_visit_func *visitor, int filter)
int csync_walk_remote_tree (CSYNC *ctx, csync_treewalk_visit_func *visitor, int filter)

Variables

gid_t csync_tree_walk_file_s::gid
enum csync_instructions_e csync_tree_walk_file_s::instruction
mode_t csync_tree_walk_file_s::mode
time_t csync_tree_walk_file_s::modtime
int csync_tree_walk_file_s::type
uid_t csync_tree_walk_file_s::uid


Define Documentation

#define CSYNC_CONF_DIR   ".csync"

Definition at line 66 of file csync.h.

#define CSYNC_CONF_FILE   "csync.conf"

Definition at line 67 of file csync.h.

#define CSYNC_EXCLUDE_FILE   "csync_exclude.conf"

Definition at line 69 of file csync.h.

#define CSYNC_LOCK_FILE   "lock"

Definition at line 70 of file csync.h.

#define CSYNC_LOG_FILE   "csync_log.conf"

Definition at line 68 of file csync.h.

#define CSYNC_STRINGIFY (  )     CSYNC_TOSTRING(s)

Definition at line 43 of file csync.h.

#define CSYNC_TOSTRING (  )     #s

Definition at line 44 of file csync.h.

#define CSYNC_VERSION ( a,
b,
 )     CSYNC_VERSION_DOT(a, b, c)

Definition at line 49 of file csync.h.

#define CSYNC_VERSION_DOT ( a,
b,
 )     a ##.## b ##.## c

Definition at line 48 of file csync.h.

#define CSYNC_VERSION_INT ( a,
b,
 )     ((a) << 16 | (b) << 8 | (c))

Definition at line 47 of file csync.h.

#define LIBCSYNC_VERSION

#define LIBCSYNC_VERSION_INT

#define LIBCSYNC_VERSION_MAJOR   0

Definition at line 52 of file csync.h.

#define LIBCSYNC_VERSION_MICRO   8

Definition at line 54 of file csync.h.

#define LIBCSYNC_VERSION_MINOR   50

Definition at line 53 of file csync.h.


Typedef Documentation

typedef struct csync_s CSYNC

csync handle

Definition at line 150 of file csync.h.

typedef int(* csync_auth_callback)(const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata)

Definition at line 72 of file csync.h.

Definition at line 96 of file csync.h.

Definition at line 385 of file csync.h.

Definition at line 145 of file csync.h.


Enumeration Type Documentation

Enumerator:
CSYNC_ERR_NONE 
CSYNC_ERR_LOG 
CSYNC_ERR_LOCK 
CSYNC_ERR_STATEDB_LOAD 
CSYNC_ERR_MODULE 
CSYNC_ERR_TIMESKEW 
CSYNC_ERR_FILESYSTEM 
CSYNC_ERR_TREE 
CSYNC_ERR_MEM 
CSYNC_ERR_PARAM 
CSYNC_ERR_RECONCILE 
CSYNC_ERR_PROPAGATE 
CSYNC_ERR_ACCESS_FAILED 
CSYNC_ERR_REMOTE_CREATE 
CSYNC_ERR_REMOTE_STAT 
CSYNC_ERR_LOCAL_CREATE 
CSYNC_ERR_LOCAL_STAT 
CSYNC_ERR_PROXY 
CSYNC_ERR_UNSPEC 

Definition at line 75 of file csync.h.

Instruction enum.

In the file traversal structure, it describes the csync state of a file.

Enumerator:
CSYNC_INSTRUCTION_NONE 
CSYNC_INSTRUCTION_EVAL 
CSYNC_INSTRUCTION_REMOVE 
CSYNC_INSTRUCTION_RENAME 
CSYNC_INSTRUCTION_NEW 
CSYNC_INSTRUCTION_CONFLICT 
CSYNC_INSTRUCTION_IGNORE 
CSYNC_INSTRUCTION_SYNC 
CSYNC_INSTRUCTION_STAT_ERROR 
CSYNC_INSTRUCTION_ERROR 
CSYNC_INSTRUCTION_DELETED 
CSYNC_INSTRUCTION_UPDATED 

Definition at line 102 of file csync.h.


Function Documentation

int csync_add_exclude_list ( CSYNC ctx,
const char *  path 
)

Add an additional exclude list.

Parameters:
ctx The context to add the exclude list.
path The path pointing to the file.
Returns:
0 on success, less than 0 if an error occured.

int csync_create ( CSYNC **  csync,
const char *  local,
const char *  remote 
)

Allocate a csync context.

Parameters:
csync The context variable to allocate.
Returns:
0 on success, less than 0 if an error occured.

int csync_destroy ( CSYNC ctx  ) 

Destroy the csync context.

Writes the statedb, unlocks csync and frees the memory.

Parameters:
ctx The context to destroy.
Returns:
0 on success, less than 0 if an error occured.

int csync_disable_statedb ( CSYNC ctx  ) 

Disable the usage of the statedb.

It is enabled by default.

Parameters:
ctx The csync context.
Returns:
0 on success, less than 0 if an error occured.

int csync_enable_conflictcopys ( CSYNC ctx  ) 

Enable the creation of backup copys if files are changed on both sides.

Parameters:
ctx The csync context.
Returns:
0 on success, less than 0 if an error occured.

int csync_enable_statedb ( CSYNC ctx  ) 

Enable the usage of the statedb.

It is enabled by default.

Parameters:
ctx The csync context.
Returns:
0 on success, less than 0 if an error occured.

csync_auth_callback csync_get_auth_callback ( CSYNC ctx  ) 

Get the authentication callback set.

Parameters:
ctx The csync context.
Returns:
The authentication callback set or NULL if an error occured.

const char* csync_get_config_dir ( CSYNC ctx  ) 

Get the config directory.

Parameters:
ctx The csync context.
Returns:
The path of the config directory or NULL on error.

CSYNC_ERROR_CODE csync_get_error ( CSYNC ctx  ) 

Get the error code from the last operation.

Returns:
An error code defined by structure CSYNC_ERROR_CODE

bool csync_get_local_only ( CSYNC ctx  ) 

Retrieve the flag to tell csync that only a local run is intended.

Returns:
1: stay local only, 0: local and remote mode

const char* csync_get_statedb_file ( CSYNC ctx  ) 

Get the path of the statedb file used.

Parameters:
ctx The csync context.
Returns:
The path to the statedb file, NULL if an error occured.

int csync_get_status ( CSYNC ctx  ) 

void* csync_get_userdata ( CSYNC ctx  ) 

Get the userdata saved in the context.

Parameters:
ctx The csync context.
Returns:
The userdata saved in the context, NULL if an error occured.

int csync_init ( CSYNC ctx  ) 

Initialize the file synchronizer.

This function loads the configuration, the statedb and locks the client.

Parameters:
ctx The context to initialize.
Returns:
0 on success, less than 0 if an error occured.

int csync_is_statedb_disabled ( CSYNC ctx  ) 

Check if the statedb usage is enabled.

Parameters:
ctx The csync context.
Returns:
1 if it is enabled, 0 if it is disabled.

int csync_propagate ( CSYNC ctx  ) 

Propagation.

Parameters:
ctx The context to run the propagation on.
Returns:
0 on success, less than 0 if an error occured.

int csync_reconcile ( CSYNC ctx  ) 

Reconciliation.

Parameters:
ctx The context to run the reconciliation on.
Returns:
0 on success, less than 0 if an error occured.

int csync_remove_config_dir ( CSYNC ctx  ) 

Remove the complete config directory.

Parameters:
ctx The csync context.
Returns:
0 on success, less than 0 if an error occured.

int csync_set_auth_callback ( CSYNC ctx,
csync_auth_callback  cb 
)

Set the authentication callback.

Parameters:
ctx The csync context.
cb The authentication callback.
Returns:
0 on success, less than 0 if an error occured.

int csync_set_config_dir ( CSYNC ctx,
const char *  path 
)

Change the config directory.

Parameters:
ctx The csync context.
path The path to the new config directory.
Returns:
0 on success, less than 0 if an error occured.

int csync_set_local_only ( CSYNC ctx,
bool  local_only 
)

Flag to tell csync that only a local run is intended.

Call before csync_init

Parameters:
local_only Bool flag to indicate local only mode.
Returns:
0 on success, less than 0 if an error occured.

int csync_set_status ( CSYNC ctx,
int  status 
)

int csync_set_userdata ( CSYNC ctx,
void *  userdata 
)

Save userdata to the context which is passed to the auth callback function.

Parameters:
ctx The csync context.
userdata The userdata to be stored in the context.
Returns:
0 on success, less than 0 if an error occured.

int csync_update ( CSYNC ctx  ) 

Update detection.

Parameters:
ctx The context to run the update detection on.
Returns:
0 on success, less than 0 if an error occured.

const char* csync_version ( int  req_version  ) 

Check if csync is the required version or get the version string.

Parameters:
req_version The version required.
Returns:
If the version of csync is newer than the version required it will return a version string. NULL if the version is older.
Example:

  if (csync_version(CSYNC_VERSION_INT(0,42,1)) == NULL) {
    fprintf(stderr, "libcsync version is too old!\n");
    exit(1);
  }

  if (debug) {
    printf("csync %s\n", csync_version(0));
  }

int csync_walk_local_tree ( CSYNC ctx,
csync_treewalk_visit_func visitor,
int  filter 
)

Walk the local file tree and call a visitor function for each file.

Parameters:
ctx The csync context.
visitor A callback function to handle the file info.
filter A filter, built from or'ed csync_instructions_e
Returns:
0 on success, less than 0 if an error occured.

int csync_walk_remote_tree ( CSYNC ctx,
csync_treewalk_visit_func visitor,
int  filter 
)

Walk the remote file tree and call a visitor function for each file.

Parameters:
ctx The csync context.
visitor A callback function to handle the file info.
filter A filter, built from and'ed csync_instructions_e
Returns:
0 on success, less than 0 if an error occured.


Variable Documentation

gid_t csync_tree_walk_file_s::gid [inherited]

Definition at line 139 of file csync.h.

Definition at line 143 of file csync.h.

mode_t csync_tree_walk_file_s::mode [inherited]

Definition at line 141 of file csync.h.

time_t csync_tree_walk_file_s::modtime [inherited]

Definition at line 133 of file csync.h.

Definition at line 142 of file csync.h.

uid_t csync_tree_walk_file_s::uid [inherited]

Definition at line 138 of file csync.h.


Generated on Mon Aug 18 13:53:09 2014 for doc by  doxygen 1.5.6