csync_private.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef _CSYNC_PRIVATE_H
00032 #define _CSYNC_PRIVATE_H
00033
00034 #include <stdint.h>
00035 #include <sqlite3.h>
00036
00037 #include "config.h"
00038 #include "c_lib.h"
00039 #include "csync.h"
00040
00041 #include "vio/csync_vio_method.h"
00042 #include "csync_macros.h"
00043
00044
00045
00046
00047 #define MAX_DEPTH 50
00048
00049
00050
00051
00052 #define MAX_TIME_DIFFERENCE 10
00053
00054
00055
00056
00057 #ifndef MAX_XFER_BUF_SIZE
00058 #define MAX_XFER_BUF_SIZE (16 * 1024)
00059 #endif
00060
00061 #define CSYNC_STATUS_INIT 1 << 0
00062 #define CSYNC_STATUS_UPDATE 1 << 1
00063 #define CSYNC_STATUS_RECONCILE 1 << 2
00064 #define CSYNC_STATUS_PROPAGATE 1 << 3
00065
00066 #define CSYNC_STATUS_DONE (CSYNC_STATUS_INIT | \
00067 CSYNC_STATUS_UPDATE | \
00068 CSYNC_STATUS_RECONCILE | \
00069 CSYNC_STATUS_PROPAGATE)
00070
00071 enum csync_replica_e {
00072 LOCAL_REPLICA,
00073 REMOTE_REPLCIA
00074 };
00075
00076
00077
00078
00079 struct csync_s {
00080 csync_auth_callback auth_callback;
00081 void *userdata;
00082 c_strlist_t *excludes;
00083
00084 struct {
00085 char *file;
00086 sqlite3 *db;
00087 int exists;
00088 int disabled;
00089 } statedb;
00090
00091 struct {
00092 char *uri;
00093 c_rbtree_t *tree;
00094 c_list_t *list;
00095 enum csync_replica_e type;
00096 } local;
00097
00098 struct {
00099 char *uri;
00100 c_rbtree_t *tree;
00101 c_list_t *list;
00102 enum csync_replica_e type;
00103 } remote;
00104
00105 struct {
00106 void *handle;
00107 csync_vio_method_t *method;
00108 csync_vio_method_finish_fn finish_fn;
00109 } module;
00110
00111 struct {
00112 int max_depth;
00113 int max_time_difference;
00114 int sync_symbolic_links;
00115 int unix_extensions;
00116 char *config_dir;
00117 } options;
00118
00119 struct {
00120 uid_t uid;
00121 uid_t euid;
00122 } pwd;
00123
00124
00125 enum csync_replica_e current;
00126
00127
00128 enum csync_replica_e replica;
00129
00130 int status;
00131 };
00132
00133 enum csync_ftw_type_e {
00134 CSYNC_FTW_TYPE_FILE,
00135 CSYNC_FTW_TYPE_SLINK,
00136 CSYNC_FTW_TYPE_DIR
00137 };
00138
00139 enum csync_instructions_e {
00140 CSYNC_INSTRUCTION_NONE,
00141 CSYNC_INSTRUCTION_EVAL,
00142 CSYNC_INSTRUCTION_REMOVE,
00143 CSYNC_INSTRUCTION_RENAME,
00144 CSYNC_INSTRUCTION_NEW,
00145 CSYNC_INSTRUCTION_CONFLICT,
00146 CSYNC_INSTRUCTION_IGNORE,
00147 CSYNC_INSTRUCTION_SYNC,
00148 CSYNC_INSTRUCTION_STAT_ERROR,
00149 CSYNC_INSTRUCTION_ERROR,
00150
00151 CSYNC_INSTRUCTION_DELETED,
00152 CSYNC_INSTRUCTION_UPDATED
00153 };
00154
00155 typedef struct csync_file_stat_s {
00156 ino_t inode;
00157 uid_t uid;
00158 gid_t gid;
00159 mode_t mode;
00160 off_t size;
00161 int nlink;
00162 time_t modtime;
00163 int type;
00164 enum csync_instructions_e instruction;
00165 uint64_t phash;
00166 size_t pathlen;
00167 char path[1];
00168 } csync_file_stat_t;
00169
00170
00171
00172
00173 #endif
00174