|
|
@@ -33,10 +33,10 @@
|
|
|
#define _CSYNC_H
|
|
|
|
|
|
#include "std/c_private.h"
|
|
|
+#include "ocsynclib.h"
|
|
|
#include <sys/stat.h>
|
|
|
#include <stdbool.h>
|
|
|
#include <stdint.h>
|
|
|
-#include <unistd.h>
|
|
|
#include <sys/types.h>
|
|
|
#include <config_csync.h>
|
|
|
|
|
|
@@ -125,20 +125,22 @@ typedef enum csync_status_codes_e CSYNC_STATUS;
|
|
|
* the csync state of a file.
|
|
|
*/
|
|
|
enum csync_instructions_e {
|
|
|
- CSYNC_INSTRUCTION_NONE = 0x00000000, /* Nothing to do (UPDATE|RECONCILE) */
|
|
|
- CSYNC_INSTRUCTION_EVAL = 0x00000001, /* There was changed compared to the DB (UPDATE) */
|
|
|
- CSYNC_INSTRUCTION_REMOVE = 0x00000002, /* The file need to be removed (RECONCILE) */
|
|
|
- CSYNC_INSTRUCTION_RENAME = 0x00000004, /* The file need to be renamed (RECONCILE) */
|
|
|
- CSYNC_INSTRUCTION_EVAL_RENAME= 0x00000800, /* The file is new, it is the destination of a rename (UPDATE) */
|
|
|
- CSYNC_INSTRUCTION_NEW = 0x00000008, /* The file is new compared to the db (UPDATE) */
|
|
|
- CSYNC_INSTRUCTION_CONFLICT = 0x00000010, /* The file need to be downloaded because it is a conflict (RECONCILE) */
|
|
|
- CSYNC_INSTRUCTION_IGNORE = 0x00000020, /* The file is ignored (UPDATE|RECONCILE) */
|
|
|
- CSYNC_INSTRUCTION_SYNC = 0x00000040, /* The file need to be pushed to the other remote (RECONCILE) */
|
|
|
- CSYNC_INSTRUCTION_STAT_ERROR = 0x00000080,
|
|
|
- CSYNC_INSTRUCTION_ERROR = 0x00000100,
|
|
|
- CSYNC_INSTRUCTION_TYPE_CHANGE = 0x0000200, /* Like NEW, but deletes the old entity first (RECONCILE)
|
|
|
- Used when the type of something changes from directory to file
|
|
|
- or back. */
|
|
|
+ CSYNC_INSTRUCTION_NONE = 0x00000000, /* Nothing to do (UPDATE|RECONCILE) */
|
|
|
+ CSYNC_INSTRUCTION_EVAL = 0x00000001, /* There was changed compared to the DB (UPDATE) */
|
|
|
+ CSYNC_INSTRUCTION_REMOVE = 0x00000002, /* The file need to be removed (RECONCILE) */
|
|
|
+ CSYNC_INSTRUCTION_RENAME = 0x00000004, /* The file need to be renamed (RECONCILE) */
|
|
|
+ CSYNC_INSTRUCTION_EVAL_RENAME = 0x00000800, /* The file is new, it is the destination of a rename (UPDATE) */
|
|
|
+ CSYNC_INSTRUCTION_NEW = 0x00000008, /* The file is new compared to the db (UPDATE) */
|
|
|
+ CSYNC_INSTRUCTION_CONFLICT = 0x00000010, /* The file need to be downloaded because it is a conflict (RECONCILE) */
|
|
|
+ CSYNC_INSTRUCTION_IGNORE = 0x00000020, /* The file is ignored (UPDATE|RECONCILE) */
|
|
|
+ CSYNC_INSTRUCTION_SYNC = 0x00000040, /* The file need to be pushed to the other remote (RECONCILE) */
|
|
|
+ CSYNC_INSTRUCTION_STAT_ERROR = 0x00000080,
|
|
|
+ CSYNC_INSTRUCTION_ERROR = 0x00000100,
|
|
|
+ CSYNC_INSTRUCTION_TYPE_CHANGE = 0x00000200, /* Like NEW, but deletes the old entity first (RECONCILE)
|
|
|
+ Used when the type of something changes from directory to file
|
|
|
+ or back. */
|
|
|
+ CSYNC_INSTRUCTION_UPDATE_METADATA = 0x00000400, /* If the etag has been updated and need to be writen to the db,
|
|
|
+ but without any propagation (UPDATE|RECONCILE) */
|
|
|
};
|
|
|
|
|
|
enum csync_ftw_type_e {
|
|
|
@@ -227,14 +229,14 @@ struct csync_vio_file_stat_s {
|
|
|
char *original_name; // only set if locale conversion fails
|
|
|
};
|
|
|
|
|
|
-csync_vio_file_stat_t *csync_vio_file_stat_new(void);
|
|
|
-csync_vio_file_stat_t *csync_vio_file_stat_copy(csync_vio_file_stat_t *file_stat);
|
|
|
+csync_vio_file_stat_t OCSYNC_EXPORT *csync_vio_file_stat_new(void);
|
|
|
+csync_vio_file_stat_t OCSYNC_EXPORT *csync_vio_file_stat_copy(csync_vio_file_stat_t *file_stat);
|
|
|
|
|
|
-void csync_vio_file_stat_destroy(csync_vio_file_stat_t *fstat);
|
|
|
+void OCSYNC_EXPORT csync_vio_file_stat_destroy(csync_vio_file_stat_t *fstat);
|
|
|
|
|
|
-void csync_vio_file_stat_set_file_id( csync_vio_file_stat_t* dst, const char* src );
|
|
|
+void OCSYNC_EXPORT csync_vio_file_stat_set_file_id( csync_vio_file_stat_t* dst, const char* src );
|
|
|
|
|
|
-void csync_vio_set_file_id(char* dst, const char *src );
|
|
|
+void OCSYNC_EXPORT csync_vio_set_file_id(char* dst, const char *src );
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -254,9 +256,6 @@ struct csync_tree_walk_file_s {
|
|
|
enum csync_ftw_type_e type;
|
|
|
enum csync_instructions_e instruction;
|
|
|
|
|
|
- /* For directories: If the etag has been updated and need to be writen on the db */
|
|
|
- int should_update_metadata;
|
|
|
-
|
|
|
/* For directories: Does it have children that were ignored (hidden or ignore pattern) */
|
|
|
int has_ignored_files;
|
|
|
|
|
|
@@ -318,7 +317,7 @@ typedef const char* (*csync_checksum_hook) (
|
|
|
*
|
|
|
* @param csync The context variable to allocate.
|
|
|
*/
|
|
|
-void csync_create(CSYNC **csync, const char *local, const char *remote);
|
|
|
+void OCSYNC_EXPORT csync_create(CSYNC **csync, const char *local);
|
|
|
|
|
|
/**
|
|
|
* @brief Initialize the file synchronizer.
|
|
|
@@ -327,7 +326,7 @@ void csync_create(CSYNC **csync, const char *local, const char *remote);
|
|
|
*
|
|
|
* @param ctx The context to initialize.
|
|
|
*/
|
|
|
-void csync_init(CSYNC *ctx, const char *db_file);
|
|
|
+void OCSYNC_EXPORT csync_init(CSYNC *ctx, const char *db_file);
|
|
|
|
|
|
/**
|
|
|
* @brief Update detection
|
|
|
@@ -336,7 +335,7 @@ void csync_init(CSYNC *ctx, const char *db_file);
|
|
|
*
|
|
|
* @return 0 on success, less than 0 if an error occurred.
|
|
|
*/
|
|
|
-int csync_update(CSYNC *ctx);
|
|
|
+int OCSYNC_EXPORT csync_update(CSYNC *ctx);
|
|
|
|
|
|
/**
|
|
|
* @brief Reconciliation
|
|
|
@@ -345,7 +344,7 @@ int csync_update(CSYNC *ctx);
|
|
|
*
|
|
|
* @return 0 on success, less than 0 if an error occurred.
|
|
|
*/
|
|
|
-int csync_reconcile(CSYNC *ctx);
|
|
|
+int OCSYNC_EXPORT csync_reconcile(CSYNC *ctx);
|
|
|
|
|
|
/**
|
|
|
* @brief Re-initializes the csync context
|
|
|
@@ -354,7 +353,7 @@ int csync_reconcile(CSYNC *ctx);
|
|
|
*
|
|
|
* @return 0 on success, less than 0 if an error occurred.
|
|
|
*/
|
|
|
-int csync_commit(CSYNC *ctx);
|
|
|
+int OCSYNC_EXPORT csync_commit(CSYNC *ctx);
|
|
|
|
|
|
/**
|
|
|
* @brief Destroy the csync context
|
|
|
@@ -365,7 +364,7 @@ int csync_commit(CSYNC *ctx);
|
|
|
*
|
|
|
* @return 0 on success, less than 0 if an error occurred.
|
|
|
*/
|
|
|
-int csync_destroy(CSYNC *ctx);
|
|
|
+int OCSYNC_EXPORT csync_destroy(CSYNC *ctx);
|
|
|
|
|
|
/**
|
|
|
* @brief Get the userdata saved in the context.
|
|
|
@@ -387,7 +386,7 @@ void *csync_get_userdata(CSYNC *ctx);
|
|
|
*
|
|
|
* @return 0 on success, less than 0 if an error occurred.
|
|
|
*/
|
|
|
-int csync_set_userdata(CSYNC *ctx, void *userdata);
|
|
|
+int OCSYNC_EXPORT csync_set_userdata(CSYNC *ctx, void *userdata);
|
|
|
|
|
|
/**
|
|
|
* @brief Get the authentication callback set.
|
|
|
@@ -397,7 +396,7 @@ int csync_set_userdata(CSYNC *ctx, void *userdata);
|
|
|
* @return The authentication callback set or NULL if an error
|
|
|
* occurred.
|
|
|
*/
|
|
|
-csync_auth_callback csync_get_auth_callback(CSYNC *ctx);
|
|
|
+csync_auth_callback OCSYNC_EXPORT csync_get_auth_callback(CSYNC *ctx);
|
|
|
|
|
|
/**
|
|
|
* @brief Set the authentication callback.
|
|
|
@@ -408,7 +407,7 @@ csync_auth_callback csync_get_auth_callback(CSYNC *ctx);
|
|
|
*
|
|
|
* @return 0 on success, less than 0 if an error occurred.
|
|
|
*/
|
|
|
-int csync_set_auth_callback(CSYNC *ctx, csync_auth_callback cb);
|
|
|
+int OCSYNC_EXPORT csync_set_auth_callback(CSYNC *ctx, csync_auth_callback cb);
|
|
|
|
|
|
/**
|
|
|
* @brief Set the log level.
|
|
|
@@ -417,14 +416,14 @@ int csync_set_auth_callback(CSYNC *ctx, csync_auth_callback cb);
|
|
|
*
|
|
|
* @return 0 on success, < 0 if an error occurred.
|
|
|
*/
|
|
|
-int csync_set_log_level(int level);
|
|
|
+int OCSYNC_EXPORT csync_set_log_level(int level);
|
|
|
|
|
|
/**
|
|
|
* @brief Get the log verbosity
|
|
|
*
|
|
|
* @return The log verbosity, -1 on error.
|
|
|
*/
|
|
|
-int csync_get_log_level(void);
|
|
|
+int OCSYNC_EXPORT csync_get_log_level(void);
|
|
|
|
|
|
/**
|
|
|
* @brief Get the logging callback set.
|
|
|
@@ -432,7 +431,7 @@ int csync_get_log_level(void);
|
|
|
* @return The logging callback set or NULL if an error
|
|
|
* occurred.
|
|
|
*/
|
|
|
-csync_log_callback csync_get_log_callback(void);
|
|
|
+csync_log_callback OCSYNC_EXPORT csync_get_log_callback(void);
|
|
|
|
|
|
/**
|
|
|
* @brief Set the logging callback.
|
|
|
@@ -441,14 +440,14 @@ csync_log_callback csync_get_log_callback(void);
|
|
|
*
|
|
|
* @return 0 on success, less than 0 if an error occurred.
|
|
|
*/
|
|
|
-int csync_set_log_callback(csync_log_callback cb);
|
|
|
+int OCSYNC_EXPORT csync_set_log_callback(csync_log_callback cb);
|
|
|
|
|
|
/**
|
|
|
* @brief get the userdata set for the logging callback.
|
|
|
*
|
|
|
* @return The userdata or NULL.
|
|
|
*/
|
|
|
-void *csync_get_log_userdata(void);
|
|
|
+void OCSYNC_EXPORT *csync_get_log_userdata(void);
|
|
|
|
|
|
/**
|
|
|
* @brief Set the userdata passed to the logging callback.
|
|
|
@@ -457,13 +456,13 @@ void *csync_get_log_userdata(void);
|
|
|
*
|
|
|
* @return 0 on success, less than 0 if an error occurred.
|
|
|
*/
|
|
|
-int csync_set_log_userdata(void *data);
|
|
|
+int OCSYNC_EXPORT csync_set_log_userdata(void *data);
|
|
|
|
|
|
/* Used for special modes or debugging */
|
|
|
-CSYNC_STATUS csync_get_status(CSYNC *ctx);
|
|
|
+CSYNC_STATUS OCSYNC_EXPORT csync_get_status(CSYNC *ctx);
|
|
|
|
|
|
/* Used for special modes or debugging */
|
|
|
-int csync_set_status(CSYNC *ctx, int status);
|
|
|
+int OCSYNC_EXPORT csync_set_status(CSYNC *ctx, int status);
|
|
|
|
|
|
typedef int csync_treewalk_visit_func(TREE_WALK_FILE* ,void*);
|
|
|
|
|
|
@@ -476,7 +475,7 @@ typedef int csync_treewalk_visit_func(TREE_WALK_FILE* ,void*);
|
|
|
*
|
|
|
* @return 0 on success, less than 0 if an error occurred.
|
|
|
*/
|
|
|
-int csync_walk_local_tree(CSYNC *ctx, csync_treewalk_visit_func *visitor, int filter);
|
|
|
+int OCSYNC_EXPORT csync_walk_local_tree(CSYNC *ctx, csync_treewalk_visit_func *visitor, int filter);
|
|
|
|
|
|
/**
|
|
|
* @brief Walk the remote file tree and call a visitor function for each file.
|
|
|
@@ -487,7 +486,7 @@ int csync_walk_local_tree(CSYNC *ctx, csync_treewalk_visit_func *visitor, int fi
|
|
|
*
|
|
|
* @return 0 on success, less than 0 if an error occurred.
|
|
|
*/
|
|
|
-int csync_walk_remote_tree(CSYNC *ctx, csync_treewalk_visit_func *visitor, int filter);
|
|
|
+int OCSYNC_EXPORT csync_walk_remote_tree(CSYNC *ctx, csync_treewalk_visit_func *visitor, int filter);
|
|
|
|
|
|
/**
|
|
|
* @brief Get the csync status string.
|
|
|
@@ -496,7 +495,7 @@ int csync_walk_remote_tree(CSYNC *ctx, csync_treewalk_visit_func *visitor, int f
|
|
|
*
|
|
|
* @return A const pointer to a string with more precise status info.
|
|
|
*/
|
|
|
-const char *csync_get_status_string(CSYNC *ctx);
|
|
|
+const char OCSYNC_EXPORT *csync_get_status_string(CSYNC *ctx);
|
|
|
|
|
|
#ifdef WITH_ICONV
|
|
|
/**
|
|
|
@@ -506,7 +505,7 @@ const char *csync_get_status_string(CSYNC *ctx);
|
|
|
*
|
|
|
* @return 0 on success, or an iconv error number.
|
|
|
*/
|
|
|
-int csync_set_iconv_codec(const char *from);
|
|
|
+int OCSYNC_EXPORT csync_set_iconv_codec(const char *from);
|
|
|
#endif
|
|
|
|
|
|
/**
|
|
|
@@ -514,24 +513,24 @@ int csync_set_iconv_codec(const char *from);
|
|
|
*
|
|
|
* @param ctx The csync context.
|
|
|
*/
|
|
|
-void csync_request_abort(CSYNC *ctx);
|
|
|
+void OCSYNC_EXPORT csync_request_abort(CSYNC *ctx);
|
|
|
|
|
|
/**
|
|
|
* @brief Clears the abort flag. Can be called from another thread.
|
|
|
*
|
|
|
* @param ctx The csync context.
|
|
|
*/
|
|
|
-void csync_resume(CSYNC *ctx);
|
|
|
+void OCSYNC_EXPORT csync_resume(CSYNC *ctx);
|
|
|
|
|
|
/**
|
|
|
* @brief Checks for the abort flag, to be used from the modules.
|
|
|
*
|
|
|
* @param ctx The csync context.
|
|
|
*/
|
|
|
-int csync_abort_requested(CSYNC *ctx);
|
|
|
+int OCSYNC_EXPORT csync_abort_requested(CSYNC *ctx);
|
|
|
|
|
|
-char *csync_normalize_etag(const char *);
|
|
|
-time_t oc_httpdate_parse( const char *date );
|
|
|
+char OCSYNC_EXPORT *csync_normalize_etag(const char *);
|
|
|
+time_t OCSYNC_EXPORT oc_httpdate_parse( const char *date );
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
}
|