doc
csync_vio_method.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  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef _CSYNC_VIO_METHOD_H
22 #define _CSYNC_VIO_METHOD_H
23 
24 #include <sys/time.h>
25 
26 #include "csync.h"
28 #include "vio/csync_vio_handle.h"
29 
30 #define VIO_METHOD_HAS_FUNC(method,func) \
31  (method != NULL && method->func != NULL \
32  && ((size_t)(((char *)&((method)->func)) - ((char *)(method))) < (method)->method_table_size))
33 
35 
40 };
41 
43 
44 typedef csync_vio_method_t *(*csync_vio_method_init_fn)(const char *method_name,
45  const char *config_args, csync_auth_callback cb, void *userdata);
47 
48 typedef csync_vio_capabilities_t *(*csync_method_get_capabilities_fn)(void);
49 
50 typedef csync_vio_method_handle_t *(*csync_method_open_fn)(const char *durl, int flags, mode_t mode);
51 typedef csync_vio_method_handle_t *(*csync_method_creat_fn)(const char *durl, mode_t mode);
53 typedef ssize_t (*csync_method_read_fn)(csync_vio_method_handle_t *fhandle, void *buf, size_t count);
54 typedef ssize_t (*csync_method_write_fn)(csync_vio_method_handle_t *fhandle, const void *buf, size_t count);
55 typedef off_t (*csync_method_lseek_fn)(csync_vio_method_handle_t *fhandle, off_t offset, int whence);
56 
57 typedef csync_vio_method_handle_t *(*csync_method_opendir_fn)(const char *name);
59 typedef csync_vio_file_stat_t *(*csync_method_readdir_fn)(csync_vio_method_handle_t *dhandle);
60 
61 typedef int (*csync_method_mkdir_fn)(const char *uri, mode_t mode);
62 typedef int (*csync_method_rmdir_fn)(const char *uri);
63 
64 typedef int (*csync_method_stat_fn)(const char *uri, csync_vio_file_stat_t *buf);
65 typedef int (*csync_method_rename_fn)(const char *olduri, const char *newuri);
66 typedef int (*csync_method_unlink_fn)(const char *uri);
67 
68 typedef int (*csync_method_chmod_fn)(const char *uri, mode_t mode);
69 typedef int (*csync_method_chown_fn)(const char *uri, uid_t owner, gid_t group);
70 
71 typedef int (*csync_method_utimes_fn)(const char *uri, const struct timeval times[2]);
72 
73 typedef int (*csync_method_set_property_fn)(const char *key, void *data);
74 
75 typedef char* (*csync_method_get_error_string_fn)();
76 
77 typedef int (*csync_method_commit_fn)();
78 
85 
87  size_t method_table_size; /* Used for versioning */
111 };
112 
113 #endif /* _CSYNC_VIO_H */
csync_method_creat_fn
csync_vio_method_handle_t *(* csync_method_creat_fn)(const char *durl, mode_t mode)
Definition: csync_vio_method.h:51
csync_vio_method_s::rename
csync_method_rename_fn rename
Definition: csync_vio_method.h:101
csync_method_readdir_fn
csync_vio_file_stat_t *(* csync_method_readdir_fn)(csync_vio_method_handle_t *dhandle)
Definition: csync_vio_method.h:59
csync_vio_method_s::commit
csync_method_commit_fn commit
Definition: csync_vio_method.h:108
csync_vio_method_s::opendir
csync_method_opendir_fn opendir
Definition: csync_vio_method.h:95
csync_vio_handle.h
csync_vio_method_finish_fn
void(* csync_vio_method_finish_fn)(csync_vio_method_t *method)
Definition: csync_vio_method.h:46
csync.h
Application developer interface for csync.
csync_auth_callback
int(* csync_auth_callback)(const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata)
Definition: csync.h:185
csync_vio_capabilities_s::put_support
bool put_support
Definition: csync_vio_method.h:39
csync_vio_method_s::rmdir
csync_method_rmdir_fn rmdir
Definition: csync_vio_method.h:99
csync_vio_method_s::lseek
csync_method_lseek_fn lseek
Definition: csync_vio_method.h:94
csync_method_get_error_string_fn
char *(* csync_method_get_error_string_fn)()
Definition: csync_vio_method.h:75
csync_vio_method_s::put
csync_method_put_fn put
Definition: csync_vio_method.h:109
csync_vio_method_s::method_table_size
size_t method_table_size
Definition: csync_vio_method.h:87
csync_vio_method_s::write
csync_method_write_fn write
Definition: csync_vio_method.h:93
csync_vio_capabilities_s
Definition: csync_vio_method.h:36
mode
mode_t mode
Definition: csync_private.h:7
csync_method_chown_fn
int(* csync_method_chown_fn)(const char *uri, uid_t owner, gid_t group)
Definition: csync_vio_method.h:69
csync_method_stat_fn
int(* csync_method_stat_fn)(const char *uri, csync_vio_file_stat_t *buf)
Definition: csync_vio_method.h:64
csync_method_chmod_fn
int(* csync_method_chmod_fn)(const char *uri, mode_t mode)
Definition: csync_vio_method.h:68
csync_vio_capabilities_s::get_support
bool get_support
Definition: csync_vio_method.h:38
csync_vio_method_s::set_property
csync_method_set_property_fn set_property
Definition: csync_vio_method.h:106
csync_method_mkdir_fn
int(* csync_method_mkdir_fn)(const char *uri, mode_t mode)
Definition: csync_vio_method.h:61
csync_method_read_fn
ssize_t(* csync_method_read_fn)(csync_vio_method_handle_t *fhandle, void *buf, size_t count)
Definition: csync_vio_method.h:53
csync_vio_method_s::chmod
csync_method_chmod_fn chmod
Definition: csync_vio_method.h:103
csync_vio_file_stat.h
csync_vio_method_s::get_error_string
csync_method_get_error_string_fn get_error_string
Definition: csync_vio_method.h:107
csync_vio_method_s::get_capabilities
csync_method_get_capabilities_fn get_capabilities
Definition: csync_vio_method.h:88
csync_vio_method_s::unlink
csync_method_unlink_fn unlink
Definition: csync_vio_method.h:102
csync_method_rmdir_fn
int(* csync_method_rmdir_fn)(const char *uri)
Definition: csync_vio_method.h:62
csync_vio_method_s::creat
csync_method_creat_fn creat
Definition: csync_vio_method.h:90
csync_vio_method_s::utimes
csync_method_utimes_fn utimes
Definition: csync_vio_method.h:105
csync_method_commit_fn
int(* csync_method_commit_fn)()
Definition: csync_vio_method.h:77
csync_method_put_fn
int(* csync_method_put_fn)(csync_vio_method_handle_t *flocal, csync_vio_method_handle_t *fremote, csync_vio_file_stat_t *st)
Definition: csync_vio_method.h:82
csync_vio_method_s::close
csync_method_close_fn close
Definition: csync_vio_method.h:91
csync_method_lseek_fn
off_t(* csync_method_lseek_fn)(csync_vio_method_handle_t *fhandle, off_t offset, int whence)
Definition: csync_vio_method.h:55
csync_vio_method_s::closedir
csync_method_closedir_fn closedir
Definition: csync_vio_method.h:96
csync_vio_method_s::get
csync_method_get_fn get
Definition: csync_vio_method.h:110
csync_vio_method_s::mkdir
csync_method_mkdir_fn mkdir
Definition: csync_vio_method.h:98
csync_method_write_fn
ssize_t(* csync_method_write_fn)(csync_vio_method_handle_t *fhandle, const void *buf, size_t count)
Definition: csync_vio_method.h:54
csync_method_rename_fn
int(* csync_method_rename_fn)(const char *olduri, const char *newuri)
Definition: csync_vio_method.h:65
csync_method_utimes_fn
int(* csync_method_utimes_fn)(const char *uri, const struct timeval times[2])
Definition: csync_vio_method.h:71
csync_vio_method_s::open
csync_method_open_fn open
Definition: csync_vio_method.h:89
csync_method_unlink_fn
int(* csync_method_unlink_fn)(const char *uri)
Definition: csync_vio_method.h:66
csync_vio_method_handle_t
void csync_vio_method_handle_t
Definition: csync_vio_handle.h:24
csync_vio_method_s::readdir
csync_method_readdir_fn readdir
Definition: csync_vio_method.h:97
csync_method_opendir_fn
csync_vio_method_handle_t *(* csync_method_opendir_fn)(const char *name)
Definition: csync_vio_method.h:57
csync_vio_file_stat_s
Definition: csync_vio_file_stat.h:75
csync_method_get_fn
int(* csync_method_get_fn)(csync_vio_method_handle_t *flocal, csync_vio_method_handle_t *fremote, csync_vio_file_stat_t *st)
Definition: csync_vio_method.h:79
csync_method_close_fn
int(* csync_method_close_fn)(csync_vio_method_handle_t *fhandle)
Definition: csync_vio_method.h:52
csync_vio_method_s
Definition: csync_vio_method.h:86
csync_method_closedir_fn
int(* csync_method_closedir_fn)(csync_vio_method_handle_t *dhandle)
Definition: csync_vio_method.h:58
csync_vio_method_s::read
csync_method_read_fn read
Definition: csync_vio_method.h:92
csync_vio_method_s::chown
csync_method_chown_fn chown
Definition: csync_vio_method.h:104
csync_method_get_capabilities_fn
csync_vio_capabilities_t *(* csync_method_get_capabilities_fn)(void)
Definition: csync_vio_method.h:48
csync_vio_capabilities_s::atomar_copy_support
bool atomar_copy_support
Definition: csync_vio_method.h:37
csync_method_set_property_fn
int(* csync_method_set_property_fn)(const char *key, void *data)
Definition: csync_vio_method.h:73
csync_method_open_fn
csync_vio_method_handle_t *(* csync_method_open_fn)(const char *durl, int flags, mode_t mode)
Definition: csync_vio_method.h:50
csync_vio_method_s::stat
csync_method_stat_fn stat
Definition: csync_vio_method.h:100