proto.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. /* This file is automatically generated with "make proto". DO NOT EDIT */
  2. int allow_access(char *addr, char *host, char *allow_list, char *deny_list);
  3. void free_acl(stat_x *sxp);
  4. int get_acl(const char *fname, stat_x *sxp);
  5. void send_acl(stat_x *sxp, int f);
  6. void receive_acl(struct file_struct *file, int f);
  7. void cache_acl(struct file_struct *file, stat_x *sxp);
  8. int set_acl(const char *fname, const struct file_struct *file, stat_x *sxp);
  9. void match_acl_ids(void);
  10. int default_perms_for_dir(const char *dir);
  11. void base64_encode(const char *buf, int len, char *out, int pad);
  12. char *auth_server(int f_in, int f_out, int module, const char *host,
  13. const char *addr, const char *leader);
  14. void auth_client(int fd, const char *user, const char *challenge);
  15. char *get_backup_name(const char *fname);
  16. int make_bak_dir(const char *fullpath);
  17. int make_backup(const char *fname);
  18. void write_stream_flags(int fd);
  19. void read_stream_flags(int fd);
  20. void check_batch_flags(void);
  21. void write_batch_shell_file(int argc, char *argv[], int file_arg_cnt);
  22. uint32 get_checksum1(char *buf1, int32 len);
  23. void get_checksum2(char *buf, int32 len, char *sum);
  24. void file_checksum(char *fname, char *sum, OFF_T size);
  25. void sum_init(int seed);
  26. void sum_update(const char *p, int32 len);
  27. int sum_end(char *sum);
  28. struct chmod_mode_struct *parse_chmod(const char *modestr,
  29. struct chmod_mode_struct **root_mode_ptr);
  30. int tweak_mode(int mode, struct chmod_mode_struct *chmod_modes);
  31. int free_chmod_mode(struct chmod_mode_struct *chmod_modes);
  32. void close_all(void);
  33. NORETURN void _exit_cleanup(int code, const char *file, int line);
  34. void cleanup_disable(void);
  35. void cleanup_set(const char *fnametmp, const char *fname, struct file_struct *file,
  36. int fd_r, int fd_w);
  37. void cleanup_set_pid(pid_t pid);
  38. char *client_addr(int fd);
  39. char *client_name(int fd);
  40. void client_sockaddr(int fd,
  41. struct sockaddr_storage *ss,
  42. socklen_t *ss_len);
  43. int lookup_name(int fd, const struct sockaddr_storage *ss,
  44. socklen_t ss_len,
  45. char *name_buf, size_t name_buf_size,
  46. char *port_buf, size_t port_buf_size);
  47. int compare_addrinfo_sockaddr(const struct addrinfo *ai,
  48. const struct sockaddr_storage *ss);
  49. int check_name(int fd,
  50. const struct sockaddr_storage *ss,
  51. char *name_buf, size_t name_buf_size);
  52. int start_socket_client(char *host, int remote_argc, char *remote_argv[],
  53. int argc, char *argv[]);
  54. int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char *argv[]);
  55. int start_daemon(int f_in, int f_out);
  56. int daemon_main(void);
  57. void set_allow_inc_recurse(void);
  58. void setup_protocol(int f_out,int f_in);
  59. int claim_connection(char *fname, int max_connections);
  60. void set_filter_dir(const char *dir, unsigned int dirlen);
  61. void *push_local_filters(const char *dir, unsigned int dirlen);
  62. void pop_local_filters(void *mem);
  63. void change_local_filter_dir(const char *dname, int dlen, int dir_depth);
  64. int check_filter(struct filter_list_struct *listp, enum logcode code,
  65. const char *name, int name_is_dir);
  66. void parse_rule(struct filter_list_struct *listp, const char *pattern,
  67. uint32 mflags, int xflags);
  68. void parse_filter_file(struct filter_list_struct *listp, const char *fname,
  69. uint32 mflags, int xflags);
  70. char *get_rule_prefix(int match_flags, const char *pat, int for_xfer,
  71. unsigned int *plen_ptr);
  72. void send_filter_list(int f_out);
  73. void recv_filter_list(int f_in);
  74. int sparse_end(int f);
  75. int flush_write_file(int f);
  76. int write_file(int f,char *buf,size_t len);
  77. struct map_struct *map_file(int fd, OFF_T len, int32 read_size,
  78. int32 blk_size);
  79. char *map_ptr(struct map_struct *map, OFF_T offset, int32 len);
  80. int unmap_file(struct map_struct *map);
  81. void init_flist(void);
  82. void show_flist_stats(void);
  83. int link_stat(const char *path, STRUCT_STAT *stp, int follow_dirlinks);
  84. int change_pathname(struct file_struct *file, const char *dir, int dirlen);
  85. struct file_struct *make_file(const char *fname, struct file_list *flist,
  86. STRUCT_STAT *stp, int flags, int filter_level);
  87. void unmake_file(struct file_struct *file);
  88. void send_extra_file_list(int f, int at_least);
  89. struct file_list *send_file_list(int f, int argc, char *argv[]);
  90. struct file_list *recv_file_list(int f);
  91. void recv_additional_file_list(int f);
  92. int flist_find(struct file_list *flist, struct file_struct *f);
  93. void clear_file(struct file_struct *file);
  94. struct file_list *flist_new(int flags, char *msg);
  95. void flist_free(struct file_list *flist);
  96. int f_name_cmp(const struct file_struct *f1, const struct file_struct *f2);
  97. int f_name_has_prefix(const struct file_struct *f1, const struct file_struct *f2);
  98. char *f_name_buf(void);
  99. char *f_name(const struct file_struct *f, char *fbuf);
  100. struct file_list *get_dirlist(char *dirname, int dlen, int ignore_filter_rules);
  101. int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp);
  102. void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statret,
  103. stat_x *sxp, int32 iflags, uchar fnamecmp_type,
  104. const char *xname);
  105. int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st);
  106. void check_for_finished_files(int itemizing, enum logcode code, int check_redo);
  107. void generate_files(int f_out, const char *local_name);
  108. struct hashtable *hashtable_create(int size, int key64);
  109. void hashtable_destroy(struct hashtable *tbl);
  110. void *hashtable_find(struct hashtable *tbl, int64 key, int allocate_if_missing);
  111. void init_hard_links(void);
  112. struct ht_int64_node *idev_find(int64 dev, int64 ino);
  113. void idev_destroy(void);
  114. void match_hard_links(struct file_list *flist);
  115. int hard_link_check(struct file_struct *file, int ndx, const char *fname,
  116. int statret, stat_x *sxp, int itemizing,
  117. enum logcode code);
  118. int hard_link_one(struct file_struct *file, const char *fname,
  119. const char *oldname, int terse);
  120. void finish_hard_link(struct file_struct *file, const char *fname, int fin_ndx,
  121. STRUCT_STAT *stp, int itemizing, enum logcode code,
  122. int alt_dest);
  123. int skip_hard_link(struct file_struct *file, struct file_list **flist_p);
  124. void io_set_sock_fds(int f_in, int f_out);
  125. void set_io_timeout(int secs);
  126. void set_msg_fd_in(int fd);
  127. void set_msg_fd_out(int fd);
  128. void increment_active_files(int ndx, int itemizing, enum logcode code);
  129. int send_msg(enum msgcode code, const char *buf, int len, int convert);
  130. void send_msg_int(enum msgcode code, int num);
  131. void wait_for_receiver(void);
  132. int get_redo_num(void);
  133. int get_hlink_num(void);
  134. void io_set_filesfrom_fds(int f_in, int f_out);
  135. int read_line(int fd, char *buf, size_t bufsiz, int flags);
  136. void read_args(int f_in, char *mod_name, char *buf, size_t bufsiz, int rl_nulls,
  137. char ***argv_p, int *argc_p, char **request_p);
  138. int io_start_buffering_out(int f_out);
  139. int io_start_buffering_in(int f_in);
  140. void io_end_buffering_in(void);
  141. void io_end_buffering_out(void);
  142. void maybe_flush_socket(int important);
  143. void maybe_send_keepalive(void);
  144. void start_flist_forward(int f_in);
  145. void stop_flist_forward();
  146. unsigned short read_shortint(int f);
  147. int32 read_int(int f);
  148. int32 read_varint(int f);
  149. int64 read_varlong(int f, uchar min_bytes);
  150. int64 read_longint(int f);
  151. void read_buf(int f, char *buf, size_t len);
  152. void read_sbuf(int f, char *buf, size_t len);
  153. uchar read_byte(int f);
  154. int read_vstring(int f, char *buf, int bufsize);
  155. void read_sum_head(int f, struct sum_struct *sum);
  156. void write_sum_head(int f, struct sum_struct *sum);
  157. int io_flush(int flush_it_all);
  158. void write_shortint(int f, unsigned short x);
  159. void write_int(int f, int32 x);
  160. void write_varint(int f, int32 x);
  161. void write_varlong(int f, int64 x, uchar min_bytes);
  162. void write_longint(int f, int64 x);
  163. void write_buf(int f, const char *buf, size_t len);
  164. void write_sbuf(int f, const char *buf);
  165. void write_byte(int f, uchar c);
  166. void write_vstring(int f, const char *str, int len);
  167. void write_ndx(int f, int32 ndx);
  168. int32 read_ndx(int f);
  169. int read_line_old(int f, char *buf, size_t bufsiz);
  170. void io_printf(int fd, const char *format, ...);
  171. void io_start_multiplex_out(void);
  172. void io_start_multiplex_in(void);
  173. int io_multiplex_write(enum msgcode code, const char *buf, size_t len, int convert);
  174. void io_end_multiplex_in(void);
  175. void io_end_multiplex_out(void);
  176. void start_write_batch(int fd);
  177. void stop_write_batch(void);
  178. char *lp_bind_address(void);
  179. char *lp_motd_file(void);
  180. char *lp_pid_file(void);
  181. char *lp_socket_options(void);
  182. int lp_rsync_port(void);
  183. char *lp_auth_users(int module_id);
  184. char *lp_charset(int module_id);
  185. char *lp_comment(int module_id);
  186. char *lp_dont_compress(int module_id);
  187. char *lp_exclude(int module_id);
  188. char *lp_exclude_from(int module_id);
  189. char *lp_filter(int module_id);
  190. char *lp_gid(int module_id);
  191. char *lp_hosts_allow(int module_id);
  192. char *lp_hosts_deny(int module_id);
  193. char *lp_include(int module_id);
  194. char *lp_include_from(int module_id);
  195. char *lp_incoming_chmod(int module_id);
  196. char *lp_lock_file(int module_id);
  197. char *lp_log_file(int module_id);
  198. char *lp_log_format(int module_id);
  199. char *lp_name(int module_id);
  200. char *lp_outgoing_chmod(int module_id);
  201. char *lp_path(int module_id);
  202. char *lp_postxfer_exec(int module_id);
  203. char *lp_prexfer_exec(int module_id);
  204. char *lp_refuse_options(int module_id);
  205. char *lp_secrets_file(int module_id);
  206. char *lp_temp_dir(int module_id);
  207. char *lp_uid(int module_id);
  208. int lp_max_connections(int module_id);
  209. int lp_max_verbosity(int module_id);
  210. int lp_syslog_facility(int module_id);
  211. int lp_timeout(int module_id);
  212. BOOL lp_fake_super(int module_id);
  213. BOOL lp_ignore_errors(int module_id);
  214. BOOL lp_ignore_nonreadable(int module_id);
  215. BOOL lp_list(int module_id);
  216. BOOL lp_munge_symlinks(int module_id);
  217. BOOL lp_numeric_ids(int module_id);
  218. BOOL lp_read_only(int module_id);
  219. BOOL lp_strict_modes(int module_id);
  220. BOOL lp_transfer_logging(int module_id);
  221. BOOL lp_use_chroot(int module_id);
  222. BOOL lp_write_only(int module_id);
  223. BOOL lp_load(char *pszFname, int globals_only);
  224. int lp_numservices(void);
  225. int lp_number(char *name);
  226. void log_init(int restart);
  227. void logfile_close(void);
  228. void logfile_reopen(void);
  229. void rwrite(enum logcode code, const char *buf, int len, int is_utf8);
  230. void rprintf(enum logcode code, const char *format, ...);
  231. void rsyserr(enum logcode code, int errcode, const char *format, ...);
  232. void rflush(enum logcode code);
  233. int log_format_has(const char *format, char esc);
  234. void log_item(enum logcode code, struct file_struct *file,
  235. struct stats *initial_stats, int iflags, const char *hlink);
  236. void maybe_log_item(struct file_struct *file, int iflags, int itemizing,
  237. const char *buf);
  238. void log_delete(const char *fname, int mode);
  239. void log_exit(int code, const char *file, int line);
  240. pid_t wait_process(pid_t pid, int *status_ptr, int flags);
  241. int child_main(int argc, char *argv[]);
  242. void start_server(int f_in, int f_out, int argc, char *argv[]);
  243. int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[]);
  244. RETSIGTYPE remember_children(UNUSED(int val));
  245. const char *get_panic_action(void);
  246. int main(int argc,char *argv[]);
  247. void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len);
  248. void match_report(void);
  249. void usage(enum logcode F);
  250. void option_error(void);
  251. int parse_arguments(int *argc_p, const char ***argv_p);
  252. void server_options(char **args, int *argc_p);
  253. char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr);
  254. BOOL pm_process( char *FileName,
  255. BOOL (*sfunc)(char *),
  256. BOOL (*pfunc)(char *, char *) );
  257. pid_t piped_child(char **command, int *f_in, int *f_out);
  258. pid_t local_child(int argc, char **argv, int *f_in, int *f_out,
  259. int (*child_main)(int, char*[]));
  260. void set_current_file_index(struct file_struct *file, int ndx);
  261. void end_progress(OFF_T size);
  262. void show_progress(OFF_T ofs, OFF_T size);
  263. int get_tmpname(char *fnametmp, const char *fname);
  264. int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file);
  265. int recv_files(int f_in, char *local_name);
  266. void setup_iconv(void);
  267. int iconvbufs(iconv_t ic, xbuf *in, xbuf *out, int flags);
  268. void send_protected_args(int fd, char *args[]);
  269. int read_ndx_and_attrs(int f_in, int *iflag_ptr, uchar *type_ptr,
  270. char *buf, int *len_ptr);
  271. void free_sums(struct sum_struct *s);
  272. mode_t dest_mode(mode_t flist_mode, mode_t stat_mode, int dflt_perms,
  273. int exists);
  274. int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
  275. const char *fnamecmp, int flags);
  276. RETSIGTYPE sig_int(UNUSED(int val));
  277. int finish_transfer(const char *fname, const char *fnametmp,
  278. const char *fnamecmp, const char *partialptr,
  279. struct file_struct *file, int ok_to_set_time,
  280. int overwriting_basis);
  281. struct file_list *flist_for_ndx(int ndx, const char *fatal_error_loc);
  282. const char *who_am_i(void);
  283. void successful_send(int ndx);
  284. void send_files(int f_in, int f_out);
  285. int try_bind_local(int s, int ai_family, int ai_socktype,
  286. const char *bind_addr);
  287. int open_socket_out(char *host, int port, const char *bind_addr,
  288. int af_hint);
  289. int open_socket_out_wrapped(char *host, int port, const char *bind_addr,
  290. int af_hint);
  291. int is_a_socket(int fd);
  292. void start_accept_loop(int port, int (*fn)(int, int));
  293. void set_socket_options(int fd, char *options);
  294. int sock_exec(const char *prog);
  295. int do_unlink(const char *fname);
  296. int do_symlink(const char *fname1, const char *fname2);
  297. int do_link(const char *fname1, const char *fname2);
  298. int do_lchown(const char *path, uid_t owner, gid_t group);
  299. int do_mknod(const char *pathname, mode_t mode, dev_t dev);
  300. int do_rmdir(const char *pathname);
  301. int do_open(const char *pathname, int flags, mode_t mode);
  302. int do_chmod(const char *path, mode_t mode);
  303. int do_rename(const char *fname1, const char *fname2);
  304. void trim_trailing_slashes(char *name);
  305. int do_mkdir(char *fname, mode_t mode);
  306. int do_mkstemp(char *template, mode_t perms);
  307. int do_stat(const char *fname, STRUCT_STAT *st);
  308. int do_lstat(const char *fname, STRUCT_STAT *st);
  309. int do_fstat(int fd, STRUCT_STAT *st);
  310. OFF_T do_lseek(int fd, OFF_T offset, int whence);
  311. void set_compression(const char *fname);
  312. void send_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
  313. int32 n, int32 toklen);
  314. int32 recv_token(int f, char **data);
  315. void see_token(char *data, int32 toklen);
  316. uid_t match_uid(uid_t uid);
  317. gid_t match_gid(gid_t gid, uint16 *flags_ptr);
  318. const char *add_uid(uid_t uid);
  319. const char *add_gid(gid_t gid);
  320. void send_id_list(int f);
  321. uid_t recv_user_name(int f, uid_t uid);
  322. gid_t recv_group_name(int f, gid_t gid, uint16 *flags_ptr);
  323. void recv_id_list(int f, struct file_list *flist);
  324. void set_nonblocking(int fd);
  325. void set_blocking(int fd);
  326. int fd_pair(int fd[2]);
  327. void print_child_argv(const char *prefix, char **cmd);
  328. NORETURN void out_of_memory(const char *str);
  329. NORETURN void overflow_exit(const char *str);
  330. int set_modtime(const char *fname, time_t modtime, mode_t mode);
  331. int mkdir_defmode(char *fname);
  332. int create_directory_path(char *fname);
  333. int full_write(int desc, const char *ptr, size_t len);
  334. int copy_file(const char *source, const char *dest, int ofd,
  335. mode_t mode, int create_bak_dir);
  336. int robust_unlink(const char *fname);
  337. int robust_rename(const char *from, const char *to, const char *partialptr,
  338. int mode);
  339. pid_t do_fork(void);
  340. void kill_all(int sig);
  341. int name_to_uid(const char *name, uid_t *uid_p);
  342. int name_to_gid(const char *name, gid_t *gid_p);
  343. int lock_range(int fd, int offset, int len);
  344. int glob_expand(const char *arg, char ***argv_p, int *argc_p, int *maxargs_p);
  345. void glob_expand_module(char *base1, char *arg, char ***argv_p, int *argc_p, int *maxargs_p);
  346. void strlower(char *s);
  347. size_t pathjoin(char *dest, size_t destsize, const char *p1, const char *p2);
  348. size_t stringjoin(char *dest, size_t destsize, ...);
  349. int count_dir_elements(const char *p);
  350. unsigned int clean_fname(char *name, int flags);
  351. char *sanitize_path(char *dest, const char *p, const char *rootdir, int depth,
  352. int flags);
  353. int change_dir(const char *dir, int set_path_only);
  354. char *full_fname(const char *fn);
  355. char *partial_dir_fname(const char *fname);
  356. int handle_partial_dir(const char *fname, int create);
  357. int unsafe_symlink(const char *dest, const char *src);
  358. char *human_num(int64 num);
  359. char *human_dnum(double dnum, int decimal_digits);
  360. char *timestring(time_t t);
  361. int msleep(int t);
  362. int cmp_time(time_t file1, time_t file2);
  363. int _Insure_trap_error(int a1, int a2, int a3, int a4, int a5, int a6);
  364. void *_new_array(unsigned long num, unsigned int size, int use_calloc);
  365. void *_realloc_array(void *ptr, unsigned int size, size_t num);
  366. const char *find_filename_suffix(const char *fn, int fn_len, int *len_ptr);
  367. uint32 fuzzy_distance(const char *s1, int len1, const char *s2, int len2);
  368. struct bitbag *bitbag_create(int max_ndx);
  369. void bitbag_set_bit(struct bitbag *bb, int ndx);
  370. void bitbag_clear_bit(struct bitbag *bb, int ndx);
  371. int bitbag_check_bit(struct bitbag *bb, int ndx);
  372. int bitbag_next_bit(struct bitbag *bb, int after);
  373. void *expand_item_list(item_list *lp, size_t item_size,
  374. const char *desc, int incr);
  375. void free_xattr(stat_x *sxp);
  376. int get_xattr(const char *fname, stat_x *sxp);
  377. int copy_xattrs(const char *source, const char *dest);
  378. int send_xattr(stat_x *sxp, int f);
  379. int xattr_diff(struct file_struct *file, stat_x *sxp, int find_all);
  380. void send_xattr_request(const char *fname, struct file_struct *file, int f_out);
  381. int recv_xattr_request(struct file_struct *file, int f_in);
  382. void receive_xattr(struct file_struct *file, int f);
  383. void cache_xattr(struct file_struct *file, stat_x *sxp);
  384. int set_xattr(const char *fname, const struct file_struct *file,
  385. const char *fnamecmp, stat_x *sxp);
  386. char *get_xattr_acl(const char *fname, int is_access_acl, size_t *len_p);
  387. int set_xattr_acl(const char *fname, int is_access_acl, const char *buf, size_t buf_len);
  388. int del_def_xattr_acl(const char *fname);
  389. int get_stat_xattr(const char *fname, int fd, STRUCT_STAT *fst, STRUCT_STAT *xst);
  390. int set_stat_xattr(const char *fname, struct file_struct *file, mode_t new_mode);
  391. int x_stat(const char *fname, STRUCT_STAT *fst, STRUCT_STAT *xst);
  392. int x_lstat(const char *fname, STRUCT_STAT *fst, STRUCT_STAT *xst);
  393. int x_fstat(int fd, STRUCT_STAT *fst, STRUCT_STAT *xst);
  394. int sys_gettimeofday(struct timeval *tv);