doc
csync_private.h
Go to the documentation of this file.
1/*
2 * cynapses libc functions
3 *
4 * Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
5 * Copyright (c) 2012-2013 by Klaas Freitag <freitag@owncloud.com>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22/**
23 * @file csync_private.h
24 *
25 * @brief Private interface of csync
26 *
27 * @defgroup csyncInternalAPI csync internal API
28 *
29 * @{
30 */
31
32#ifndef _CSYNC_PRIVATE_H
33#define _CSYNC_PRIVATE_H
34
35#include <stdint.h>
36#include <stdbool.h>
37#include <sqlite3.h>
38
39#include "config.h"
40#include "c_lib.h"
41#include "c_private.h"
42#include "csync.h"
43
44#ifdef HAVE_ICONV_H
45#include <iconv.h>
46#endif
47#ifdef HAVE_SYS_ICONV_H
48#include <sys/iconv.h>
49#endif
50
52#include "csync_macros.h"
53
54/**
55 * How deep to scan directories.
56 */
57#define MAX_DEPTH 50
58
59/**
60 * Maximum time difference between two replicas in seconds
61 */
62#define MAX_TIME_DIFFERENCE 10
63
64/**
65 * Maximum size of a buffer for transfer
66 */
67#ifndef MAX_XFER_BUF_SIZE
68#define MAX_XFER_BUF_SIZE (16 * 1024)
69#endif
70
71#define CSYNC_STATUS_INIT 1 << 0
72#define CSYNC_STATUS_UPDATE 1 << 1
73#define CSYNC_STATUS_RECONCILE 1 << 2
74#define CSYNC_STATUS_PROPAGATE 1 << 3
75
76#define CSYNC_STATUS_DONE (CSYNC_STATUS_INIT | \
77 CSYNC_STATUS_UPDATE | \
78 CSYNC_STATUS_RECONCILE | \
79 CSYNC_STATUS_PROPAGATE)
80
84};
85
86/**
87 * @brief csync public structure
88 */
89struct csync_s {
90 struct {
94 void *userdata;
97
98 struct {
99 char *file;
100 sqlite3 *db;
104
105 struct {
106 char *uri;
111
112 struct {
113 char *uri;
118
119 struct {
120 void *handle;
124 } module;
125
126 struct {
134#if defined(HAVE_ICONV) && defined(WITH_ICONV)
135 iconv_t iconv_cd;
136#endif
138
139 struct {
140 uid_t uid;
141 uid_t euid;
143
144 struct {
147 long long byte_sum;
148 long long byte_current;
150
151 /* replica we are currently walking */
153
154 /* replica we want to work on */
156
157 /* csync error code */
159
161
163};
164
170
171#ifdef _MSC_VER
172#pragma pack(1)
173#endif
175 uint64_t phash; /* u64 */
176 time_t modtime; /* u64 */
177 off_t size; /* u64 */
178 size_t pathlen; /* u64 */
179 ino_t inode; /* u64 */
180 uid_t uid; /* u32 */
181 gid_t gid; /* u32 */
182 mode_t mode; /* u32 */
183 int nlink; /* u32 */
184 int type; /* u32 */
186 char path[1]; /* u8 */
187}
188#if !defined(__SUNPRO_C) && !defined(_MSC_VER)
189__attribute__ ((packed))
190#endif
191#ifdef _MSC_VER
192#pragma pack()
193#endif
194;
195
197
198/*
199 * context for the treewalk function
200 */
202{
205 void *userdata;
208
209/**
210 * }@
211 */
212#endif /* _CSYNC_PRIVATE_H */
213/* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */
Application developer interface for csync.
void(* csync_vio_method_finish_fn)(csync_vio_method_t *method)
enum csync_replica_e replica
csync_vio_capabilities_t capabilities
enum csync_instructions_e instruction
bool local_only_mode
void * handle
struct csync_s::@5 options
csync_ftw_type_e
int max_time_difference
enum csync_replica_e type
struct _csync_treewalk_context_s __attribute__
enum csync_replica_e type
int sync_symbolic_links
c_rbtree_t * tree
struct csync_s::@3 remote
enum csync_replica_e current
enum csync_status_codes_e status_code
int current_file_no
struct csync_s::@7 progress
struct csync_s::@1 statedb
c_rbtree_t * tree
csync_replica_e
char * config_dir
c_list_t * list
char * error_string
csync_file_progress_callback file_progress_cb
csync_overall_progress_callback overall_progress_cb
c_list_t * list
long long byte_sum
void * userdata
struct csync_s::@0 callbacks
sqlite3 * db
csync_vio_method_t * method
char * uri
struct csync_s::@2 local
char * file
long long byte_current
bool with_conflict_copys
csync_auth_callback auth_function
c_strlist_t * excludes
csync_vio_method_finish_fn finish_fn
int unix_extensions
csync_treewalk_visit_func * user_visitor
struct csync_s::@6 pwd
@ CSYNC_FTW_TYPE_SLINK
@ CSYNC_FTW_TYPE_DIR
@ CSYNC_FTW_TYPE_FILE
@ LOCAL_REPLICA
@ REMOTE_REPLICA
int csync_treewalk_visit_func(TREE_WALK_FILE *, void *)
Definition csync.h:493
void(* csync_overall_progress_callback)(const char *file_name, int file_no, int file_cnt, long long o1, long long o2, void *userdata)
Callback definition for overall progress callback.
Definition csync.h:596
csync_instructions_e
Definition csync.h:135
void(* csync_file_progress_callback)(const char *remote_url, enum csync_notify_type_e kind, long long o1, long long o2, void *userdata)
Callback definition for individual file progress callback.
Definition csync.h:569
int(* csync_auth_callback)(const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata)
Definition csync.h:185
csync_status_codes_e
Instruction enum.
Definition csync.h:77
Used for each element in a doubly-linked list.
Definition c_list.h:54
Structure that represents a red-black tree.
Definition c_rbtree.h:109
Structure for a stringlist.
Definition c_string.h:53
csync public structure