proto.h 18 KB

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