doc
csync_private.h
Go to the documentation of this file.
1 /*
2  * libcsync -- a library to sync a directory with another
3  *
4  * Copyright (c) 2006 by Andreas Schneider <mail@cynapses.org>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 /**
22  * @file csync_private.h
23  *
24  * @brief Private interface of csync
25  *
26  * @defgroup csyncInternalAPI csync internal API
27  *
28  * @{
29  */
30 
31 #ifndef _CSYNC_PRIVATE_H
32 #define _CSYNC_PRIVATE_H
33 
34 #include <stdint.h>
35 #include <stdbool.h>
36 #include <sqlite3.h>
37 
38 #include "config.h"
39 #include "c_lib.h"
40 #include "c_private.h"
41 #include "csync.h"
42 
43 #include "vio/csync_vio_method.h"
44 #include "csync_macros.h"
45 
46 /**
47  * How deep to scan directories.
48  */
49 #define MAX_DEPTH 50
50 
51 /**
52  * Maximum time difference between two replicas in seconds
53  */
54 #define MAX_TIME_DIFFERENCE 10
55 
56 /**
57  * Maximum size of a buffer for transfer
58  */
59 #ifndef MAX_XFER_BUF_SIZE
60 #define MAX_XFER_BUF_SIZE (16 * 1024)
61 #endif
62 
63 #define CSYNC_STATUS_INIT 1 << 0
64 #define CSYNC_STATUS_UPDATE 1 << 1
65 #define CSYNC_STATUS_RECONCILE 1 << 2
66 #define CSYNC_STATUS_PROPAGATE 1 << 3
67 
68 #define CSYNC_STATUS_DONE (CSYNC_STATUS_INIT | \
69  CSYNC_STATUS_UPDATE | \
70  CSYNC_STATUS_RECONCILE | \
71  CSYNC_STATUS_PROPAGATE)
72 
76 };
77 
78 /**
79  * @brief csync public structure
80  */
81 struct csync_s {
83  void *userdata;
85 
86  struct {
87  char *file;
88  sqlite3 *db;
89  int exists;
90  int disabled;
91  } statedb;
92 
93  struct {
94  char *uri;
98  } local;
99 
100  struct {
101  char *uri;
105  } remote;
106 
107  struct {
108  void *handle;
112  } module;
113 
114  struct {
119  char *config_dir;
123  } options;
124 
125  struct {
126  uid_t uid;
127  uid_t euid;
128  } pwd;
129 
130  /* replica we are currently walking */
132 
133  /* replica we want to work on */
135 
136  /* error code of the last operation */
138 
139  int status;
140 };
141 
146 };
147 
148 #ifdef _MSC_VER
149 #pragma pack(1)
150 #endif
152  uint64_t phash; /* u64 */
153  time_t modtime; /* u64 */
154  off_t size; /* u64 */
155  size_t pathlen; /* u64 */
156  uint64_t inode; /* u64 */
157  uid_t uid; /* u32 */
158  gid_t gid; /* u32 */
159  mode_t mode; /* u32 */
160  int nlink; /* u32 */
161  int type; /* u32 */
162  char *destpath; /* for renames */
164  char path[1]; /* u8 */
165 }
166 #if !defined(__SUNPRO_C) && !defined(_MSC_VER)
167 __attribute__ ((packed))
168 #endif
169 #ifdef _MSC_VER
170 #pragma pack()
171 #endif
172 ;
176 /*
177  * context for the treewalk function
178  */
180 {
183  void *userdata;
184 };
186 
187 /**
188  * }@
189  */
190 #endif /* _CSYNC_PRIVATE_H */
191 /* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */