csync.h

Go to the documentation of this file.
00001 /*
00002  * libcsync -- a library to sync a directory with another
00003  *
00004  * Copyright (c) 2006-2008 by Andreas Schneider <mail@cynapses.org>
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019  *
00020  * vim: ts=2 sw=2 et cindent
00021  */
00022 
00023 /**
00024  * @file csync.h
00025  *
00026  * @brief Application developer interface for csync.
00027  *
00028  * @defgroup csyncPublicAPI csync public API
00029  *
00030  * @{
00031  */
00032 
00033 #ifndef _CSYNC_H
00034 #define _CSYNC_H
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 /*
00041  * csync version information
00042  */
00043 #define CSYNC_VERSION_MAJOR 0
00044 #define CSYNC_VERSION_MINOR 42
00045 #define CSYNC_VERSION_PATCH 0
00046 #define CSYNC_VERSION_STRING "csync version 0.42.0 rc3"
00047 
00048 /*
00049  * csync file declarations
00050  */
00051 #define CSYNC_CONF_DIR ".csync"
00052 #define CSYNC_CONF_FILE "csync.conf"
00053 #define CSYNC_LOG_FILE "csync_log.conf"
00054 #define CSYNC_EXCLUDE_FILE "csync_exclude.conf"
00055 #define CSYNC_LOCK_FILE "lock"
00056 
00057 typedef int (*csync_auth_callback) (const char *prompt, char *buf, size_t len, int echo, int verify);
00058 
00059 /**
00060  * csync handle
00061  */
00062 typedef struct csync_s CSYNC;
00063 
00064 /**
00065  * @brief Allocate a csync context.
00066  *
00067  * @param csync  The context variable to allocate.
00068  *
00069  * @return  0 on success, less than 0 if an error occured.
00070  */
00071 int csync_create(CSYNC **csync, const char *local, const char *remote);
00072 
00073 /**
00074  * @brief Initialize the file synchronizer.
00075  *
00076  * This function loads the configuration, the statedb and locks the client.
00077  *
00078  * @param ctx  The context to initialize.
00079  *
00080  * @return  0 on success, less than 0 if an error occured.
00081  */
00082 int csync_init(CSYNC *ctx);
00083 
00084 /**
00085  * @brief Update detection
00086  *
00087  * @param ctx  The context to run the update detection on.
00088  *
00089  * @return  0 on success, less than 0 if an error occured.
00090  */
00091 int csync_update(CSYNC *ctx);
00092 
00093 /**
00094  * @brief Reconciliation
00095  *
00096  * @param ctx  The context to run the reconciliation on.
00097  *
00098  * @return  0 on success, less than 0 if an error occured.
00099  */
00100 int csync_reconcile(CSYNC *ctx);
00101 
00102 /**
00103  * @brief Propagation
00104  *
00105  * @param ctx  The context to run the propagation on.
00106  *
00107  * @return  0 on success, less than 0 if an error occured.
00108  */
00109 int csync_propagate(CSYNC *ctx);
00110 
00111 /**
00112  * @brief Destroy the csync context
00113  *
00114  * Writes the statedb, unlocks csync and frees the memory.
00115  *
00116  * @param ctx  The context to destroy.
00117  *
00118  * @return  0 on success, less than 0 if an error occured.
00119  */
00120 int csync_destroy(CSYNC *ctx);
00121 
00122 /**
00123  * @brief Get the csync version.
00124  *
00125  * @return  The csync version as a string.
00126  */
00127 const char *csync_version(void);
00128 
00129 int csync_add_exclude_list(CSYNC *ctx, const char *path);
00130 char *csync_get_config_dir(CSYNC *ctx);
00131 int csync_set_config_dir(CSYNC *ctx, const char *path);
00132 int csync_remove_config_dir(CSYNC *ctx);
00133 int csync_enable_statedb(CSYNC *ctx);
00134 int csync_disable_statedb(CSYNC *ctx);
00135 int csync_is_statedb_disabled(CSYNC *ctx);
00136 csync_auth_callback csync_get_auth_callback(CSYNC *ctx);
00137 int csync_set_auth_callback(CSYNC *ctx, csync_auth_callback cb);
00138 char *csync_get_statedb_file(CSYNC *ctx);
00139 int csync_get_status(CSYNC *ctx);
00140 int csync_set_status(CSYNC *ctx, int status);
00141 
00142 #ifdef __cplusplus
00143 }
00144 #endif
00145 
00146 /**
00147  * }@
00148  */
00149 #endif /* _CSYNC_H */
00150 

Generated on Wed Feb 25 18:38:49 2009 for csync by  doxygen 1.5.6