aboutsummaryrefslogtreecommitdiffstats
path: root/proto.h
blob: ad72c6dfa586db2172b0a41f3d64de2276459f9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
/* This file is automatically generated with "make proto". DO NOT EDIT */

int allow_access(char *addr, char *host, char *allow_list, char *deny_list);
void free_acl(stat_x *sxp);
int get_acl(const char *fname, stat_x *sxp);
void send_acl(int f, stat_x *sxp);
void receive_acl(int f, struct file_struct *file);
void cache_tmp_acl(struct file_struct *file, stat_x *sxp);
void uncache_tmp_acls(void);
int set_acl(const char *fname, const struct file_struct *file, stat_x *sxp, mode_t new_mode);
void match_acl_ids(void);
int default_perms_for_dir(const char *dir);
void base64_encode(const char *buf, int len, char *out, int pad);
char *auth_server(int f_in, int f_out, int module, const char *host,
		  const char *addr, const char *leader);
void auth_client(int fd, const char *user, const char *challenge);
char *get_backup_name(const char *fname);
int make_bak_dir(const char *fullpath);
int make_backup(const char *fname);
void write_stream_flags(int fd);
void read_stream_flags(int fd);
void check_batch_flags(void);
void write_batch_shell_file(int argc, char *argv[], int file_arg_cnt);
uint32 get_checksum1(char *buf1, int32 len);
void get_checksum2(char *buf, int32 len, char *sum);
void file_checksum(char *fname, char *sum, OFF_T size);
void sum_init(int seed);
void sum_update(const char *p, int32 len);
int sum_end(char *sum);
struct chmod_mode_struct *parse_chmod(const char *modestr,
				      struct chmod_mode_struct **root_mode_ptr);
int tweak_mode(int mode, struct chmod_mode_struct *chmod_modes);
int free_chmod_mode(struct chmod_mode_struct *chmod_modes);
void close_all(void);
NORETURN void _exit_cleanup(int code, const char *file, int line);
void cleanup_disable(void);
void cleanup_set(const char *fnametmp, const char *fname, struct file_struct *file,
		 int fd_r, int fd_w);
void cleanup_set_pid(pid_t pid);
char *client_addr(int fd);
char *client_name(int fd);
void client_sockaddr(int fd,
		     struct sockaddr_storage *ss,
		     socklen_t *ss_len);
int lookup_name(int fd, const struct sockaddr_storage *ss,
		socklen_t ss_len,
		char *name_buf, size_t name_buf_size,
		char *port_buf, size_t port_buf_size);
int compare_addrinfo_sockaddr(const struct addrinfo *ai,
			      const struct sockaddr_storage *ss);
int check_name(int fd,
	       const struct sockaddr_storage *ss,
	       char *name_buf, size_t name_buf_size);
int start_socket_client(char *host, int remote_argc, char *remote_argv[],
			int argc, char *argv[]);
int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char *argv[]);
int start_daemon(int f_in, int f_out);
int daemon_main(void);
void set_allow_inc_recurse(void);
void setup_protocol(int f_out,int f_in);
int claim_connection(char *fname, int max_connections);
void set_filter_dir(const char *dir, unsigned int dirlen);
void *push_local_filters(const char *dir, unsigned int dirlen);
void pop_local_filters(void *mem);
void change_local_filter_dir(const char *dname, int dlen, int dir_depth);
int check_filter(struct filter_list_struct *listp, enum logcode code,
		 const char *name, int name_is_dir);
void parse_rule(struct filter_list_struct *listp, const char *pattern,
		uint32 mflags, int xflags);
void parse_filter_file(struct filter_list_struct *listp, const char *fname,
		       uint32 mflags, int xflags);
char *get_rule_prefix(int match_flags, const char *pat, int for_xfer,
		      unsigned int *plen_ptr);
void send_filter_list(int f_out);
void recv_filter_list(int f_in);
int sparse_end(int f, OFF_T size);
int flush_write_file(int f);
int write_file(int f, char *buf, int len);
struct map_struct *map_file(int fd, OFF_T len, int32 read_size,
			    int32 blk_size);
char *map_ptr(struct map_struct *map, OFF_T offset, int32 len);
int unmap_file(struct map_struct *map);
void init_flist(void);
void show_flist_stats(void);
int link_stat(const char *path, STRUCT_STAT *stp, int follow_dirlinks);
int change_pathname(struct file_struct *file, const char *dir, int dirlen);
struct file_struct *make_file(const char *fname, struct file_list *flist,
			      STRUCT_STAT *stp, int flags, int filter_level);
void unmake_file(struct file_struct *file);
void send_extra_file_list(int f, int at_least);
struct file_list *send_file_list(int f, int argc, char *argv[]);
struct file_list *recv_file_list(int f);
void recv_additional_file_list(int f);
int flist_find(struct file_list *flist, struct file_struct *f);
int flist_find_ignore_dirness(struct file_list *flist, struct file_struct *f);
void clear_file(struct file_struct *file);
struct file_list *flist_new(int flags, char *msg);
void flist_free(struct file_list *flist);
int f_name_cmp(const struct file_struct *f1, const struct file_struct *f2);
int f_name_has_prefix(const struct file_struct *f1, const struct file_struct *f2);
char *f_name_buf(void);
char *f_name(const struct file_struct *f, char *fbuf);
struct file_list *get_dirlist(char *dirname, int dlen, int flags);
int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp);
void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statret,
	     stat_x *sxp, int32 iflags, uchar fnamecmp_type,
	     const char *xname);
int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st);
void check_for_finished_files(int itemizing, enum logcode code, int check_redo);
void generate_files(int f_out, const char *local_name);
struct hashtable *hashtable_create(int size, int key64);
void hashtable_destroy(struct hashtable *tbl);
void *hashtable_find(struct hashtable *tbl, int64 key, int allocate_if_missing);
void init_hard_links(void);
struct ht_int64_node *idev_find(int64 dev, int64 ino);
void idev_destroy(void);
void match_hard_links(struct file_list *flist);
int hard_link_check(struct file_struct *file, int ndx, const char *fname,
		    int statret, stat_x *sxp, int itemizing,
		    enum logcode code);
int hard_link_one(struct file_struct *file, const char *fname,
		  const char *oldname, int terse);
void finish_hard_link(struct file_struct *file, const char *fname, int fin_ndx,
		      STRUCT_STAT *stp, int itemizing, enum logcode code,
		      int alt_dest);
int skip_hard_link(struct file_struct *file, struct file_list **flist_p);
void io_set_sock_fds(int f_in, int f_out);
void set_io_timeout(int secs);
void set_msg_fd_in(int fd);
void set_msg_fd_out(int fd);
void increment_active_files(int ndx, int itemizing, enum logcode code);
int send_msg(enum msgcode code, const char *buf, int len, int convert);
void send_msg_int(enum msgcode code, int num);
void wait_for_receiver(void);
int get_redo_num(void);
int get_hlink_num(void);
void io_set_filesfrom_fds(int f_in, int f_out);
int read_line(int fd, char *buf, size_t bufsiz, int flags);
void read_args(int f_in, char *mod_name, char *buf, size_t bufsiz, int rl_nulls,
	       char ***argv_p, int *argc_p, char **request_p);
int io_start_buffering_out(int f_out);
int io_start_buffering_in(int f_in);
void io_end_buffering_in(void);
void io_end_buffering_out(void);
void maybe_flush_socket(int important);
void maybe_send_keepalive(void);
void start_flist_forward(int f_in);
void stop_flist_forward(void);
unsigned short read_shortint(int f);
int32 read_int(int f);
int32 read_varint(int f);
int64 read_varlong(int f, uchar min_bytes);
int64 read_longint(int f);
void read_buf(int f, char *buf, size_t len);
void read_sbuf(int f, char *buf, size_t len);
uchar read_byte(int f);
int read_vstring(int f, char *buf, int bufsize);
void read_sum_head(int f, struct sum_struct *sum);
void write_sum_head(int f, struct sum_struct *sum);
int io_flush(int flush_it_all);
void write_shortint(int f, unsigned short x);
void write_int(int f, int32 x);
void write_varint(int f, int32 x);
void write_varlong(int f, int64 x, uchar min_bytes);
void write_longint(int f, int64 x);
void write_buf(int f, const char *buf, size_t len);
void write_sbuf(int f, const char *buf);
void write_byte(int f, uchar c);
void write_vstring(int f, const char *str, int len);
void write_ndx(int f, int32 ndx);
int32 read_ndx(int f);
int read_line_old(int f, char *buf, size_t bufsiz);
void io_printf(int fd, const char *format, ...);
void io_start_multiplex_out(void);
void io_start_multiplex_in(void);
int io_multiplex_write(enum msgcode code, const char *buf, size_t len, int convert);
void io_end_multiplex_in(void);
void io_end_multiplex_out(void);
void start_write_batch(int fd);
void stop_write_batch(void);
char *lp_bind_address(void);
char *lp_motd_file(void);
char *lp_pid_file(void);
char *lp_socket_options(void);
int lp_rsync_port(void);
char *lp_auth_users(int module_id);
char *lp_charset(int module_id);
char *lp_comment(int module_id);
char *lp_dont_compress(int module_id);
char *lp_exclude(int module_id);
char *lp_exclude_from(int module_id);
char *lp_filter(int module_id);
char *lp_gid(int module_id);
char *lp_hosts_allow(int module_id);
char *lp_hosts_deny(int module_id);
char *lp_include(int module_id);
char *lp_include_from(int module_id);
char *lp_incoming_chmod(int module_id);
char *lp_lock_file(int module_id);
char *lp_log_file(int module_id);
char *lp_log_format(int module_id);
char *lp_name(int module_id);
char *lp_outgoing_chmod(int module_id);
char *lp_path(int module_id);
char *lp_postxfer_exec(int module_id);
char *lp_prexfer_exec(int module_id);
char *lp_refuse_options(int module_id);
char *lp_secrets_file(int module_id);
char *lp_temp_dir(int module_id);
char *lp_uid(int module_id);
int lp_max_connections(int module_id);
int lp_max_verbosity(int module_id);
int lp_syslog_facility(int module_id);
int lp_timeout(int module_id);
BOOL lp_fake_super(int module_id);
BOOL lp_ignore_errors(int module_id);
BOOL lp_ignore_nonreadable(int module_id);
BOOL lp_list(int module_id);
BOOL lp_munge_symlinks(int module_id);
BOOL lp_numeric_ids(int module_id);
BOOL lp_read_only(int module_id);
BOOL lp_strict_modes(int module_id);
BOOL lp_transfer_logging(int module_id);
BOOL lp_use_chroot(int module_id);
BOOL lp_write_only(int module_id);
BOOL lp_load(char *pszFname, int globals_only);
int lp_numservices(void);
int lp_number(char *name);
void log_init(int restart);
void logfile_close(void);
void logfile_reopen(void);
void rwrite(enum logcode code, const char *buf, int len, int is_utf8);
void rprintf(enum logcode code, const char *format, ...);
void rsyserr(enum logcode code, int errcode, const char *format, ...);
void rflush(enum logcode code);
int log_format_has(const char *format, char esc);
void log_item(enum logcode code, struct file_struct *file,
	      struct stats *initial_stats, int iflags, const char *hlink);
void maybe_log_item(struct file_struct *file, int iflags, int itemizing,
		    const char *buf);
void log_delete(const char *fname, int mode);
void log_exit(int code, const char *file, int line);
pid_t wait_process(pid_t pid, int *status_ptr, int flags);
int child_main(int argc, char *argv[]);
void start_server(int f_in, int f_out, int argc, char *argv[]);
int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[]);
RETSIGTYPE remember_children(UNUSED(int val));
const char *get_panic_action(void);
int main(int argc,char *argv[]);
void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len);
void match_report(void);
void usage(enum logcode F);
void option_error(void);
int parse_arguments(int *argc_p, const char ***argv_p);
void server_options(char **args, int *argc_p);
char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr);
BOOL pm_process( char *FileName,
                 BOOL (*sfunc)(char *),
                 BOOL (*pfunc)(char *, char *) );
pid_t piped_child(char **command, int *f_in, int *f_out);
pid_t local_child(int argc, char **argv, int *f_in, int *f_out,
		  int (*child_main)(int, char*[]));
void set_current_file_index(struct file_struct *file, int ndx);
void end_progress(OFF_T size);
void show_progress(OFF_T ofs, OFF_T size);
int get_tmpname(char *fnametmp, const char *fname);
int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file);
int recv_files(int f_in, char *local_name);
void setup_iconv(void);
int iconvbufs(iconv_t ic, xbuf *in, xbuf *out, int flags);
void send_protected_args(int fd, char *args[]);
int read_ndx_and_attrs(int f_in, int *iflag_ptr, uchar *type_ptr,
		       char *buf, int *len_ptr);
void free_sums(struct sum_struct *s);
mode_t dest_mode(mode_t flist_mode, mode_t stat_mode, int dflt_perms,
		 int exists);
int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
		   const char *fnamecmp, int flags);
RETSIGTYPE sig_int(UNUSED(int val));
int finish_transfer(const char *fname, const char *fnametmp,
		    const char *fnamecmp, const char *partialptr,
		    struct file_struct *file, int ok_to_set_time,
		    int overwriting_basis);
struct file_list *flist_for_ndx(int ndx, const char *fatal_error_loc);
const char *who_am_i(void);
void successful_send(int ndx);
void send_files(int f_in, int f_out);
int try_bind_local(int s, int ai_family, int ai_socktype,
		   const char *bind_addr);
int open_socket_out(char *host, int port, const char *bind_addr,
		    int af_hint);
int open_socket_out_wrapped(char *host, int port, const char *bind_addr,
			    int af_hint);
int is_a_socket(int fd);
void start_accept_loop(int port, int (*fn)(int, int));
void set_socket_options(int fd, char *options);
int do_unlink(const char *fname);
int do_symlink(const char *fname1, const char *fname2);
int do_link(const char *fname1, const char *fname2);
int do_lchown(const char *path, uid_t owner, gid_t group);
int do_mknod(const char *pathname, mode_t mode, DEV_T dev);
int do_rmdir(const char *pathname);
int do_open(const char *pathname, int flags, mode_t mode);
int do_chmod(const char *path, mode_t mode);
int do_rename(const char *fname1, const char *fname2);
int do_ftruncate(int fd, OFF_T size);
void trim_trailing_slashes(char *name);
int do_mkdir(char *fname, mode_t mode);
int do_mkstemp(char *template, mode_t perms);
int do_stat(const char *fname, STRUCT_STAT *st);
int do_lstat(const char *fname, STRUCT_STAT *st);
int do_fstat(int fd, STRUCT_STAT *st);
OFF_T do_lseek(int fd, OFF_T offset, int whence);
int do_utimensat(const char *fname, time_t modtime, uint32 mod_nsec);
int do_lutimes(const char *fname, time_t modtime, uint32 mod_nsec);
int do_utimes(const char *fname, time_t modtime, uint32 mod_nsec);
int do_utime(const char *fname, time_t modtime, UNUSED(uint32 mod_nsec));
void set_compression(const char *fname);
void send_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
		int32 n, int32 toklen);
int32 recv_token(int f, char **data);
void see_token(char *data, int32 toklen);
uid_t match_uid(uid_t uid);
gid_t match_gid(gid_t gid, uint16 *flags_ptr);
const char *add_uid(uid_t uid);
const char *add_gid(gid_t gid);
void send_id_list(int f);
uid_t recv_user_name(int f, uid_t uid);
gid_t recv_group_name(int f, gid_t gid, uint16 *flags_ptr);
void recv_id_list(int f, struct file_list *flist);
void set_nonblocking(int fd);
void set_blocking(int fd);
int fd_pair(int fd[2]);
void print_child_argv(const char *prefix, char **cmd);
NORETURN void out_of_memory(const char *str);
NORETURN void overflow_exit(const char *str);
int set_modtime(const char *fname, time_t modtime, mode_t mode);
int mkdir_defmode(char *fname);
int create_directory_path(char *fname);
int full_write(int desc, const char *ptr, size_t len);
int copy_file(const char *source, const char *dest, int ofd,
	      mode_t mode, int create_bak_dir);
int robust_unlink(const char *fname);
int robust_rename(const char *from, const char *to, const char *partialptr,
		  int mode);
pid_t do_fork(void);
void kill_all(int sig);
int name_to_uid(const char *name, uid_t *uid_p);
int name_to_gid(const char *name, gid_t *gid_p);
int lock_range(int fd, int offset, int len);
int glob_expand(const char *arg, char ***argv_p, int *argc_p, int *maxargs_p);
void glob_expand_module(char *base1, char *arg, char ***argv_p, int *argc_p, int *maxargs_p);
void strlower(char *s);
size_t pathjoin(char *dest, size_t destsize, const char *p1, const char *p2);
size_t stringjoin(char *dest, size_t destsize, ...);
int count_dir_elements(const char *p);
unsigned int clean_fname(char *name, int flags);
char *sanitize_path(char *dest, const char *p, const char *rootdir, int depth,
		    int flags);
int change_dir(const char *dir, int set_path_only);
char *normalize_path(char *path, BOOL force_newbuf, unsigned int *len_ptr);
char *full_fname(const char *fn);
char *partial_dir_fname(const char *fname);
int handle_partial_dir(const char *fname, int create);
int unsafe_symlink(const char *dest, const char *src);
char *human_num(int64 num);
char *human_dnum(double dnum, int decimal_digits);
char *timestring(time_t t);
int msleep(int t);
int cmp_time(time_t file1, time_t file2);
int _Insure_trap_error(int a1, int a2, int a3, int a4, int a5, int a6);
void *_new_array(unsigned long num, unsigned int size, int use_calloc);
void *_realloc_array(void *ptr, unsigned int size, size_t num);
const char *find_filename_suffix(const char *fn, int fn_len, int *len_ptr);
uint32 fuzzy_distance(const char *s1, int len1, const char *s2, int len2);
struct bitbag *bitbag_create(int max_ndx);
void bitbag_set_bit(struct bitbag *bb, int ndx);
void bitbag_clear_bit(struct bitbag *bb, int ndx);
int bitbag_check_bit(struct bitbag *bb, int ndx);
int bitbag_next_bit(struct bitbag *bb, int after);
void flist_ndx_push(flist_ndx_list *lp, int ndx);
int flist_ndx_pop(flist_ndx_list *lp);
void *expand_item_list(item_list *lp, size_t item_size,
		       const char *desc, int incr);
void free_xattr(stat_x *sxp);
int get_xattr(const char *fname, stat_x *sxp);
int copy_xattrs(const char *source, const char *dest);
int send_xattr(int f, stat_x *sxp);
int xattr_diff(struct file_struct *file, stat_x *sxp, int find_all);
void send_xattr_request(const char *fname, struct file_struct *file, int f_out);
int recv_xattr_request(struct file_struct *file, int f_in);
void receive_xattr(int f, struct file_struct *file);
void cache_tmp_xattr(struct file_struct *file, stat_x *sxp);
void uncache_tmp_xattrs(void);
int set_xattr(const char *fname, const struct file_struct *file,
	      const char *fnamecmp, stat_x *sxp);
char *get_xattr_acl(const char *fname, int is_access_acl, size_t *len_p);
int set_xattr_acl(const char *fname, int is_access_acl, const char *buf, size_t buf_len);
int del_def_xattr_acl(const char *fname);
int get_stat_xattr(const char *fname, int fd, STRUCT_STAT *fst, STRUCT_STAT *xst);
int set_stat_xattr(const char *fname, struct file_struct *file, mode_t new_mode);
int x_stat(const char *fname, STRUCT_STAT *fst, STRUCT_STAT *xst);
int x_lstat(const char *fname, STRUCT_STAT *fst, STRUCT_STAT *xst);
int x_fstat(int fd, STRUCT_STAT *fst, STRUCT_STAT *xst);
int sys_gettimeofday(struct timeval *tv);