2008-02-27 20:56:47 +03:00
|
|
|
/*
|
|
|
|
* libcsync -- a library to sync a directory with another
|
|
|
|
*
|
|
|
|
* Copyright (c) 2006-2008 by Andreas Schneider <mail@cynapses.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
2008-07-10 12:25:12 +04:00
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2008-02-27 20:56:47 +03:00
|
|
|
*
|
2008-07-10 12:25:12 +04:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2008-02-27 20:56:47 +03:00
|
|
|
*
|
2008-07-10 12:25:12 +04:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-02-27 20:56:47 +03:00
|
|
|
*
|
2008-07-10 12:25:12 +04:00
|
|
|
* vim: ts=2 sw=2 et cindent
|
2008-02-27 20:56:47 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file csync.h
|
|
|
|
*
|
|
|
|
* @brief Application developer interface for csync.
|
|
|
|
*
|
|
|
|
* @defgroup csyncPublicAPI csync public API
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _CSYNC_H
|
|
|
|
#define _CSYNC_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* csync version information
|
|
|
|
*/
|
|
|
|
#define CSYNC_VERSION_MAJOR 0
|
2008-03-03 12:20:31 +03:00
|
|
|
#define CSYNC_VERSION_MINOR 42
|
2008-02-27 20:56:47 +03:00
|
|
|
#define CSYNC_VERSION_PATCH 0
|
2008-07-02 12:59:37 +04:00
|
|
|
#define CSYNC_VERSION_STRING "csync version 0.42.0 alpha4"
|
2008-02-27 20:56:47 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* csync file declarations
|
|
|
|
*/
|
|
|
|
#define CSYNC_CONF_DIR ".csync"
|
|
|
|
#define CSYNC_CONF_FILE "csync.conf"
|
|
|
|
#define CSYNC_LOG_FILE "csync_log.conf"
|
|
|
|
#define CSYNC_EXCLUDE_FILE "csync_exclude.conf"
|
|
|
|
#define CSYNC_LOCK_FILE "lock"
|
|
|
|
|
2008-08-08 19:28:33 +04:00
|
|
|
typedef void (*csync_auth_callback) (char *usr, size_t usrlen, char *pwd, size_t pwlen, int pwonly);
|
2008-05-13 15:38:03 +04:00
|
|
|
|
2008-02-29 20:04:51 +03:00
|
|
|
/**
|
|
|
|
* csync handle
|
2008-02-27 20:56:47 +03:00
|
|
|
*/
|
2008-02-29 20:04:51 +03:00
|
|
|
typedef struct csync_s CSYNC;
|
2008-02-27 20:56:47 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Allocate a csync context.
|
|
|
|
*
|
2008-02-29 19:57:49 +03:00
|
|
|
* @param csync The context variable to allocate.
|
2008-02-27 20:56:47 +03:00
|
|
|
*
|
2008-02-29 19:57:49 +03:00
|
|
|
* @return 0 on success, less than 0 if an error occured.
|
2008-02-27 20:56:47 +03:00
|
|
|
*/
|
2008-04-22 19:23:26 +04:00
|
|
|
int csync_create(CSYNC **csync, const char *local, const char *remote);
|
2008-02-27 20:56:47 +03:00
|
|
|
|
2008-02-29 19:57:49 +03:00
|
|
|
/**
|
|
|
|
* @brief Initialize the file synchronizer.
|
|
|
|
*
|
2008-07-09 12:10:00 +04:00
|
|
|
* This function loads the configuration, the statedb and locks the client.
|
2008-02-29 19:57:49 +03:00
|
|
|
*
|
|
|
|
* @param ctx The context to initialize.
|
|
|
|
*
|
|
|
|
* @return 0 on success, less than 0 if an error occured.
|
|
|
|
*/
|
2008-02-29 13:41:15 +03:00
|
|
|
int csync_init(CSYNC *ctx);
|
2008-02-27 20:56:47 +03:00
|
|
|
|
2008-02-29 19:57:49 +03:00
|
|
|
/**
|
|
|
|
* @brief Update detection
|
|
|
|
*
|
|
|
|
* @param ctx The context to run the update detection on.
|
|
|
|
*
|
|
|
|
* @return 0 on success, less than 0 if an error occured.
|
|
|
|
*/
|
2008-02-29 13:41:15 +03:00
|
|
|
int csync_update(CSYNC *ctx);
|
2008-02-27 20:56:47 +03:00
|
|
|
|
2008-02-29 19:57:49 +03:00
|
|
|
/**
|
|
|
|
* @brief Reconciliation
|
|
|
|
*
|
|
|
|
* @param ctx The context to run the reconciliation on.
|
|
|
|
*
|
|
|
|
* @return 0 on success, less than 0 if an error occured.
|
|
|
|
*/
|
2008-02-29 13:41:15 +03:00
|
|
|
int csync_reconcile(CSYNC *ctx);
|
2008-02-27 20:56:47 +03:00
|
|
|
|
2008-02-29 19:57:49 +03:00
|
|
|
/**
|
|
|
|
* @brief Propagation
|
|
|
|
*
|
|
|
|
* @param ctx The context to run the propagation on.
|
|
|
|
*
|
|
|
|
* @return 0 on success, less than 0 if an error occured.
|
|
|
|
*/
|
2008-02-29 13:41:15 +03:00
|
|
|
int csync_propagate(CSYNC *ctx);
|
2008-02-27 20:56:47 +03:00
|
|
|
|
2008-02-29 19:57:49 +03:00
|
|
|
/**
|
|
|
|
* @brief Destroy the csync context
|
|
|
|
*
|
2008-07-09 12:10:00 +04:00
|
|
|
* Writes the statedb, unlocks csync and frees the memory.
|
2008-02-29 19:57:49 +03:00
|
|
|
*
|
|
|
|
* @param ctx The context to destroy.
|
|
|
|
*
|
|
|
|
* @return 0 on success, less than 0 if an error occured.
|
|
|
|
*/
|
2008-02-29 13:41:15 +03:00
|
|
|
int csync_destroy(CSYNC *ctx);
|
2008-02-27 20:56:47 +03:00
|
|
|
|
2008-02-29 19:57:49 +03:00
|
|
|
/**
|
|
|
|
* @brief Get the csync version.
|
|
|
|
*
|
|
|
|
* @return The csync version as a string.
|
|
|
|
*/
|
2008-02-29 13:41:15 +03:00
|
|
|
const char *csync_version(void);
|
2008-02-27 20:56:47 +03:00
|
|
|
|
2008-05-20 17:50:02 +04:00
|
|
|
int csync_add_exclude_list(CSYNC *ctx, const char *path);
|
2008-05-20 18:33:03 +04:00
|
|
|
char *csync_get_config_dir(CSYNC *ctx);
|
|
|
|
int csync_set_config_dir(CSYNC *ctx, const char *path);
|
|
|
|
int csync_remove_config_dir(CSYNC *ctx);
|
2008-07-09 12:10:00 +04:00
|
|
|
int csync_enable_statedb(CSYNC *ctx);
|
|
|
|
int csync_disable_statedb(CSYNC *ctx);
|
|
|
|
int csync_is_statedb_disabled(CSYNC *ctx);
|
2008-06-24 15:36:27 +04:00
|
|
|
csync_auth_callback csync_get_auth_callback(CSYNC *ctx);
|
|
|
|
int csync_set_auth_callback(CSYNC *ctx, csync_auth_callback cb);
|
2008-07-09 12:10:00 +04:00
|
|
|
char *csync_get_statedb_file(CSYNC *ctx);
|
2008-05-05 13:09:16 +04:00
|
|
|
int csync_get_status(CSYNC *ctx);
|
2008-05-20 18:33:03 +04:00
|
|
|
int csync_set_status(CSYNC *ctx, int status);
|
2008-05-05 13:09:16 +04:00
|
|
|
|
2008-02-27 20:56:47 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* }@
|
|
|
|
*/
|
|
|
|
#endif /* _CSYNC_H */
|
|
|
|
|