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