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 <sqlite3.h>
36 
37 #include "config.h"
38 #include "c_lib.h"
39 #include "csync.h"
40 
41 #include "vio/csync_vio_method.h"
42 #include "csync_macros.h"
43 
44 /**
45  * How deep to scan directories.
46  */
47 #define MAX_DEPTH 50
48 
49 /**
50  * Maximum time difference between two replicas in seconds
51  */
52 #define MAX_TIME_DIFFERENCE 10
53 
54 /**
55  * Maximum size of a buffer for transfer
56  */
57 #ifndef MAX_XFER_BUF_SIZE
58 #define MAX_XFER_BUF_SIZE (16 * 1024)
59 #endif
60 
61 #define CSYNC_STATUS_INIT 1 << 0
62 #define CSYNC_STATUS_UPDATE 1 << 1
63 #define CSYNC_STATUS_RECONCILE 1 << 2
64 #define CSYNC_STATUS_PROPAGATE 1 << 3
65 
66 #define CSYNC_STATUS_DONE (CSYNC_STATUS_INIT | \
67  CSYNC_STATUS_UPDATE | \
68  CSYNC_STATUS_RECONCILE | \
69  CSYNC_STATUS_PROPAGATE)
70 
74 };
75 
76 /**
77  * @brief csync public structure
78  */
79 struct csync_s {
81  void *userdata;
83 
84  struct {
85  char *file;
86  sqlite3 *db;
87  int exists;
88  int disabled;
89  } statedb;
90 
91  struct {
92  char *uri;
96  } local;
97 
98  struct {
99  char *uri;
103  } remote;
104 
105  struct {
106  void *handle;
109  } module;
110 
111  struct {
116  char *config_dir;
117  } options;
118 
119  struct {
120  uid_t uid;
121  uid_t euid;
122  } pwd;
123 
124  /* replica we are currently walking */
126 
127  /* replica we want to work on */
129 
130  int status;
131 };
132 
137 };
138 
150  /* instructions for the propagator */
153 };
154 
155 typedef struct csync_file_stat_s {
156  ino_t inode;
157  uid_t uid;
158  gid_t gid;
159  mode_t mode;
160  off_t size;
161  int nlink;
162  time_t modtime;
163  int type;
165  uint64_t phash;
166  size_t pathlen;
167  char path[1];
169 
170 /**
171  * }@
172  */
173 #endif /* _CSYNC_PRIVATE_H */
174 /* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */