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 
00068 #define CSYNC_STATUS_DONE (CSYNC_STATUS_INIT | \
00069                            CSYNC_STATUS_UPDATE | \
00070                            CSYNC_STATUS_RECONCILE | \
00071                            CSYNC_STATUS_PROPAGATE)
00072 
00073 enum csync_replica_e {
00074   LOCAL_REPLICA,
00075   REMOTE_REPLCIA
00076 };
00077 
00078 
00079 
00080 
00081 struct csync_s {
00082   csync_auth_callback auth_callback;
00083   void *userdata;
00084   c_strlist_t *excludes;
00085 
00086   struct {
00087     char *file;
00088     sqlite3 *db;
00089     int exists;
00090     int disabled;
00091   } statedb;
00092 
00093   struct {
00094     char *uri;
00095     c_rbtree_t *tree;
00096     c_list_t *list;
00097     enum csync_replica_e type;
00098   } local;
00099 
00100   struct {
00101     char *uri;
00102     c_rbtree_t *tree;
00103     c_list_t *list;
00104     enum csync_replica_e type;
00105   } remote;
00106 
00107   struct {
00108     void *handle;
00109     csync_vio_method_t *method;
00110     csync_vio_method_finish_fn finish_fn;
00111   } module;
00112 
00113   struct {
00114     int max_depth;
00115     int max_time_difference;
00116     int sync_symbolic_links;
00117     int unix_extensions;
00118     char *config_dir;
00119   } options;
00120 
00121   struct {
00122     uid_t uid;
00123     uid_t euid;
00124   } pwd;
00125 
00126   
00127   enum csync_replica_e current;
00128 
00129   
00130   enum csync_replica_e replica;
00131 
00132   int status;
00133 };
00134 
00135 enum csync_ftw_type_e {
00136   CSYNC_FTW_TYPE_FILE,
00137   CSYNC_FTW_TYPE_SLINK,
00138   CSYNC_FTW_TYPE_DIR
00139 };
00140 
00141 enum csync_instructions_e {
00142   CSYNC_INSTRUCTION_NONE,
00143   CSYNC_INSTRUCTION_EVAL,
00144   CSYNC_INSTRUCTION_REMOVE,
00145   CSYNC_INSTRUCTION_RENAME,
00146   CSYNC_INSTRUCTION_NEW,
00147   CSYNC_INSTRUCTION_CONFLICT,
00148   CSYNC_INSTRUCTION_IGNORE,
00149   CSYNC_INSTRUCTION_SYNC,
00150   CSYNC_INSTRUCTION_STAT_ERROR,
00151   CSYNC_INSTRUCTION_ERROR,
00152   
00153   CSYNC_INSTRUCTION_DELETED,
00154   CSYNC_INSTRUCTION_UPDATED
00155 };
00156 
00157 typedef struct csync_file_stat_s {
00158   ino_t inode;
00159   uid_t uid;
00160   gid_t gid;
00161   mode_t mode;
00162   off_t size;
00163   int nlink;
00164   time_t modtime;
00165   int type;
00166   enum csync_instructions_e instruction;
00167   uint64_t phash;
00168   size_t pathlen;
00169   char path[1];
00170 } csync_file_stat_t;
00171 
00172 
00173 
00174 
00175 #endif 
00176