doc
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
src
vio
csync_vio_method.h
Go to the documentation of this file.
1
/*
2
* libcsync -- a library to sync a directory with another
3
*
4
* Copyright (c) 2008 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
* vim: ft=c.doxygen ts=2 sw=2 et cindent
21
*/
22
23
#ifndef _CSYNC_VIO_METHOD_H
24
#define _CSYNC_VIO_METHOD_H
25
26
#include <sys/time.h>
27
28
#include "
csync.h
"
29
#include "
vio/csync_vio_file_stat.h
"
30
#include "
vio/csync_vio_handle.h
"
31
32
#define VIO_METHOD_HAS_FUNC(method,func) \
33
((((char *)&((method)->func)) - ((char *)(method)) < (method)->method_table_size) \
34
&& method->func != NULL)
35
36
typedef
struct
csync_vio_method_s
csync_vio_method_t
;
37
38
/* module capabilities definition.
39
* remember to set useful defaults in csync_vio.c if you add something here. */
40
struct
csync_vio_capabilities_s
{
41
bool
atomar_copy_support
;
/* set to true if the backend provides atomar copy */
42
bool
do_post_copy_stat
;
/* true if csync should check the copy afterwards */
43
bool
time_sync_required
;
/* true if local and remote need to be time synced */
44
int
unix_extensions
;
/* -1: do csync detection, 0: no unix extensions,
45
1: extensions available */
46
};
47
48
typedef
struct
csync_vio_capabilities_s
csync_vio_capabilities_t
;
49
50
typedef
csync_vio_method_t
*(*csync_vio_method_init_fn)(
const
char
*method_name,
51
const
char
*config_args,
csync_auth_callback
cb,
void
*userdata);
52
typedef
void (*
csync_vio_method_finish_fn
)(
csync_vio_method_t
*method);
53
54
typedef
csync_vio_capabilities_t
*(*csync_method_get_capabilities_fn)(void);
55
56
typedef
csync_vio_method_handle_t
*(*csync_method_open_fn)(
const
char
*durl,
int
flags, mode_t
mode
);
57
typedef
csync_vio_method_handle_t
*(*csync_method_creat_fn)(
const
char
*durl, mode_t
mode
);
58
typedef
int (*
csync_method_close_fn
)(
csync_vio_method_handle_t
*fhandle);
59
typedef
ssize_t (*
csync_method_read_fn
)(
csync_vio_method_handle_t
*fhandle,
void
*buf,
size_t
count);
60
typedef
ssize_t (*
csync_method_write_fn
)(
csync_vio_method_handle_t
*fhandle,
const
void
*buf,
size_t
count);
61
typedef
off_t (*
csync_method_lseek_fn
)(
csync_vio_method_handle_t
*fhandle, off_t offset,
int
whence);
62
63
typedef
csync_vio_method_handle_t
*(*csync_method_opendir_fn)(
const
char
*name);
64
typedef
int (*
csync_method_closedir_fn
)(
csync_vio_method_handle_t
*dhandle);
65
typedef
csync_vio_file_stat_t
*(*csync_method_readdir_fn)(
csync_vio_method_handle_t
*dhandle);
66
67
typedef
int (*
csync_method_mkdir_fn
)(
const
char
*uri, mode_t
mode
);
68
typedef
int (*
csync_method_rmdir_fn
)(
const
char
*uri);
69
70
typedef
int (*
csync_method_stat_fn
)(
const
char
*uri,
csync_vio_file_stat_t
*buf);
71
typedef
int (*
csync_method_rename_fn
)(
const
char
*olduri,
const
char
*newuri);
72
typedef
int (*
csync_method_unlink_fn
)(
const
char
*uri);
73
74
typedef
int (*
csync_method_chmod_fn
)(
const
char
*uri, mode_t
mode
);
75
typedef
int (*
csync_method_chown_fn
)(
const
char
*uri, uid_t owner, gid_t group);
76
77
typedef
int (*
csync_method_utimes_fn
)(
const
char
*uri,
const
struct
timeval times[2]);
78
79
struct
csync_vio_method_s
{
80
size_t
method_table_size
;
/* Used for versioning */
81
csync_method_get_capabilities_fn
get_capabilities
;
82
csync_method_open_fn
open
;
83
csync_method_creat_fn
creat
;
84
csync_method_close_fn
close
;
85
csync_method_read_fn
read
;
86
csync_method_write_fn
write
;
87
csync_method_lseek_fn
lseek
;
88
csync_method_opendir_fn
opendir
;
89
csync_method_closedir_fn
closedir
;
90
csync_method_readdir_fn
readdir
;
91
csync_method_mkdir_fn
mkdir
;
92
csync_method_rmdir_fn
rmdir
;
93
csync_method_stat_fn
stat
;
94
csync_method_rename_fn
rename
;
95
csync_method_unlink_fn
unlink
;
96
csync_method_chmod_fn
chmod
;
97
csync_method_chown_fn
chown
;
98
csync_method_utimes_fn
utimes
;
99
};
100
101
#endif
/* _CSYNC_VIO_H */
Generated by
1.8.1