Go to the documentation of this file.
38 #include <sys/types.h>
45 #define CSYNC_STRINGIFY(s) CSYNC_TOSTRING(s)
46 #define CSYNC_TOSTRING(s) #s
49 #define CSYNC_VERSION_INT(a, b, c) ((a) << 16 | (b) << 8 | (c))
50 #define CSYNC_VERSION_DOT(a, b, c) a ##.## b ##.## c
51 #define CSYNC_VERSION(a, b, c) CSYNC_VERSION_DOT(a, b, c)
54 #define LIBCSYNC_VERSION_MAJOR 0
55 #define LIBCSYNC_VERSION_MINOR 50
56 #define LIBCSYNC_VERSION_MICRO 0
58 #define LIBCSYNC_VERSION_INT CSYNC_VERSION_INT(LIBCSYNC_VERSION_MAJOR, \
59 LIBCSYNC_VERSION_MINOR, \
60 LIBCSYNC_VERSION_MICRO)
61 #define LIBCSYNC_VERSION CSYNC_VERSION(LIBCSYNC_VERSION_MAJOR, \
62 LIBCSYNC_VERSION_MINOR, \
63 LIBCSYNC_VERSION_MICRO)
68 #define CSYNC_CONF_DIR ".csync"
69 #define CSYNC_CONF_FILE "csync.conf"
70 #define CSYNC_EXCLUDE_FILE "csync_exclude.conf"
71 #define CSYNC_LOCK_FILE "lock"
125 # define likely(x) (x)
128 # define unlikely(x) (x)
131 #define CSYNC_STATUS_IS_OK(x) (likely((x) == CSYNC_STATUS_OK))
132 #define CSYNC_STATUS_IS_ERR(x) (unlikely((x) >= CSYNC_STATUS_ERROR))
133 #define CSYNC_STATUS_IS_EQUAL(x, y) ((x) == (y))
186 int echo,
int verify,
void *
userdata);
189 const char *
function,
534 int csync_set_iconv_codec(
const char *from);
570 long long o1,
long long o2,
void *
userdata);
@ CSYNC_STATUS_CONNECT_ERROR
@ CSYNC_STATUS_QUOTA_EXCEEDED
const char * csync_get_config_dir(CSYNC *ctx)
Get the config directory.
const char * csync_version(int req_version)
Check if csync is the required version or get the version string.
int csync_set_auth_callback(CSYNC *ctx, csync_auth_callback cb)
Set the authentication callback.
@ CSYNC_INSTRUCTION_ERROR
int csync_is_statedb_disabled(CSYNC *ctx)
Check if the statedb usage is enabled.
@ CSYNC_NOTIFY_START_DOWNLOAD
CSync File Traversal structure.
int(* csync_auth_callback)(const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata)
@ CSYNC_STATUS_PERMISSION_DENIED
@ CSYNC_INSTRUCTION_CONFLICT
@ CSYNC_STATUS_FILE_EXISTS
int csync_set_status(CSYNC *ctx, int status)
int csync_set_file_progress_callback(CSYNC *ctx, csync_file_progress_callback cb)
Set a progress callback for individual files.
int csync_treewalk_visit_func(TREE_WALK_FILE *, void *)
@ CSYNC_STATUS_STATEDB_WRITE_ERROR
int csync_set_log_userdata(void *data)
Set the userdata passed to the logging callback.
const char * csync_get_statedb_file(CSYNC *ctx)
Get the path of the statedb file used.
@ CSYNC_STATUS_RECONCILE_ERROR
void(* csync_log_callback)(int verbosity, const char *function, const char *buffer, void *userdata)
void * csync_get_log_userdata(void)
get the userdata set for the logging callback.
bool csync_status_ok(CSYNC *ctx)
Check internal csync status.
@ CSYNC_STATUS_STATEDB_LOAD_ERROR
@ CSYNC_INSTRUCTION_RENAME
@ CSYNC_STATUS_MERGE_FILETREE_ERROR
@ CSYNC_STATUS_REMOTE_ACCESS_ERROR
@ CSYNC_INSTRUCTION_UPDATED
const char * csync_get_status_string(CSYNC *ctx)
Get the csync status string.
@ CSYNC_STATUS_MEMORY_ERROR
@ CSYNC_STATUS_READDIR_ERROR
@ CSYNC_STATUS_HTTP_ERROR
int csync_reconcile(CSYNC *ctx)
Reconciliation.
@ CSYNC_NOTIFY_FINISHED_UPLOAD
int csync_propagate(CSYNC *ctx)
Propagation.
@ CSYNC_STATUS_TREE_ERROR
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.
enum csync_instructions_e instruction
struct csync_s::@3 remote
@ CSYNC_STATUS_PARAM_ERROR
@ CSYNC_INSTRUCTION_REMOVE
int csync_init(CSYNC *ctx)
Initialize the file synchronizer.
@ CSYNC_STATUS_PROXY_ERROR
int csync_set_overall_progress_callback(CSYNC *ctx, csync_overall_progress_callback cb)
Set a progress callback for the overall files.
int csync_set_local_only(CSYNC *ctx, bool local_only)
Flag to tell csync that only a local run is intended.
@ CSYNC_INSTRUCTION_STAT_ERROR
@ CSYNC_STATUS_FILESYSTEM_UNKNOWN
csync_status_codes_e
Instruction enum.
int csync_set_module_property(CSYNC *ctx, const char *key, void *value)
Set a property to module.
@ CSYNC_STATUS_FILE_SIZE_ERROR
@ CSYNC_NOTIFY_FINISHED_DOWNLOAD
@ CSYNC_STATUS_LOCAL_CREATE_ERROR
int csync_set_userdata(CSYNC *ctx, void *userdata)
Save userdata to the context which is passed to the auth callback function.
int csync_add_exclude_list(CSYNC *ctx, const char *path)
Add an additional exclude list.
bool csync_get_local_only(CSYNC *ctx)
Retrieve the flag to tell csync that only a local run is intended.
int csync_get_log_level(void)
Get the log verbosity.
@ CSYNC_STATUS_PROPAGATE_ERROR
@ CSYNC_STATUS_SERVICE_UNAVAILABLE
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.
int csync_create(CSYNC **csync, const char *local, const char *remote)
Allocate a csync context.
int csync_enable_conflictcopys(CSYNC *ctx)
Enable the creation of backup copys if files are changed on both sides.
enum csync_status_codes_e CSYNC_STATUS
int csync_commit(CSYNC *ctx)
Commit the sync results to journal.
void * csync_get_userdata(CSYNC *ctx)
Get the userdata saved in the context.
@ CSYNC_INSTRUCTION_IGNORE
@ CSYNC_STATUS_OPENDIR_ERROR
int csync_disable_statedb(CSYNC *ctx)
Disable the usage of the statedb.
int csync_set_log_level(int level)
Set the log level.
int csync_update(CSYNC *ctx)
Update detection.
@ CSYNC_STATUS_CONTEXT_LOST
void(* csync_overall_progress_callback)(const char *file_name, int file_no, int file_cnt, long long o1, long long o2, void *userdata)
Callback definition for overall progress callback.
int csync_set_config_dir(CSYNC *ctx, const char *path)
Change the config directory.
@ CSYNC_NOTIFY_START_UPLOAD
@ CSYNC_INSTRUCTION_DELETED
void(* csync_file_progress_callback)(const char *remote_url, enum csync_notify_type_e kind, long long o1, long long o2, void *userdata)
Callback definition for individual file progress callback.
csync_log_callback csync_get_log_callback(void)
Get the logging callback set.
@ CSYNC_STATUS_REMOTE_STAT_ERROR
int csync_destroy(CSYNC *ctx)
Destroy the csync context.
int csync_remove_config_dir(CSYNC *ctx)
Remove the complete config directory.
@ CSYNC_STATUS_OUT_OF_SPACE
int csync_enable_statedb(CSYNC *ctx)
Enable the usage of the statedb.
@ CSYNC_STATUS_LOCAL_STAT_ERROR
@ CSYNC_STATUS_REMOTE_CREATE_ERROR
@ CSYNC_STATUS_UNSUCCESSFUL
int csync_set_log_callback(csync_log_callback cb)
Set the logging callback.
@ CSYNC_STATUS_LOOKUP_ERROR
@ CSYNC_STATUS_OPEN_ERROR
@ CSYNC_STATUS_SERVER_AUTH_ERROR
@ CSYNC_STATUS_CSYNC_STATUS_ERROR
@ CSYNC_STATUS_PROXY_AUTH_ERROR
int csync_get_status(CSYNC *ctx)
csync_auth_callback csync_get_auth_callback(CSYNC *ctx)
Get the authentication callback set.
@ CSYNC_STATUS_UPDATE_ERROR