version 1.36, 2021/03/31 19:45:16 |
version 1.36.2.1, 2021/11/09 13:41:24 |
|
|
#define BLOCK_SIZE_MIN (700) |
#define BLOCK_SIZE_MIN (700) |
|
|
/* |
/* |
|
* Maximum number of base directories that can be used. |
|
*/ |
|
#define MAX_BASEDIR 20 |
|
|
|
#define BASE_MODE_COMPARE 1 |
|
#define BASE_MODE_COPY 2 |
|
#define BASE_MODE_LINK 3 |
|
|
|
/* |
* The sender and receiver use a two-phase synchronisation process. |
* The sender and receiver use a two-phase synchronisation process. |
* The first uses two-byte hashes; the second, 16-byte. |
* The first uses two-byte hashes; the second, 16-byte. |
* (The second must hold a full MD4 digest.) |
* (The second must hold a full MD4 digest.) |
|
|
#define CSUM_LENGTH_PHASE2 (16) |
#define CSUM_LENGTH_PHASE2 (16) |
|
|
/* |
/* |
|
* Rsync error codes. |
|
*/ |
|
#define ERR_SYNTAX 1 |
|
#define ERR_PROTOCOL 2 |
|
#define ERR_SOCK_IO 10 |
|
#define ERR_FILE_IO 11 |
|
#define ERR_WIREPROTO 12 |
|
#define ERR_IPC 14 /* catchall for any kind of syscall error */ |
|
#define ERR_TERMIMATED 16 |
|
#define ERR_WAITPID 21 |
|
#define ERR_NOMEM 22 |
|
|
|
/* |
* Use this for --timeout. |
* Use this for --timeout. |
* All poll events will use it and catch time-outs. |
* All poll events will use it and catch time-outs. |
*/ |
*/ |
|
|
int no_motd; /* --no-motd */ |
int no_motd; /* --no-motd */ |
int numeric_ids; /* --numeric-ids */ |
int numeric_ids; /* --numeric-ids */ |
int one_file_system; /* -x */ |
int one_file_system; /* -x */ |
|
int alt_base_mode; |
|
off_t max_size; /* --max-size */ |
|
off_t min_size; /* --min-size */ |
char *rsync_path; /* --rsync-path */ |
char *rsync_path; /* --rsync-path */ |
char *ssh_prog; /* --rsh or -e */ |
char *ssh_prog; /* --rsh or -e */ |
char *port; /* --port */ |
char *port; /* --port */ |
char *address; /* --address */ |
char *address; /* --address */ |
|
char *basedir[MAX_BASEDIR]; |
}; |
}; |
|
|
|
enum rule_type { |
|
RULE_NONE, |
|
RULE_EXCLUDE, |
|
RULE_INCLUDE, |
|
RULE_CLEAR, |
|
#ifdef NOTYET |
|
RULE_MERGE, |
|
RULE_DIR_MERGE, |
|
RULE_SHOW, |
|
RULE_HIDE, |
|
RULE_PROTECT, |
|
RULE_RISK, |
|
#endif |
|
}; |
|
|
/* |
/* |
* An individual block description for a file. |
* An individual block description for a file. |
* See struct blkset. |
* See struct blkset. |
|
|
#define ERRX(_fmt, ...) \ |
#define ERRX(_fmt, ...) \ |
rsync_errx( (_fmt), ##__VA_ARGS__) |
rsync_errx( (_fmt), ##__VA_ARGS__) |
|
|
void rsync_log(int, const char *, ...) |
void rsync_log(int, const char *, ...) |
__attribute__((format(printf, 2, 3))); |
__attribute__((format(printf, 2, 3))); |
void rsync_warnx1(const char *, ...) |
void rsync_warnx1(const char *, ...) |
__attribute__((format(printf, 1, 2))); |
__attribute__((format(printf, 1, 2))); |
void rsync_warn(int, const char *, ...) |
void rsync_warn(int, const char *, ...) |
__attribute__((format(printf, 2, 3))); |
__attribute__((format(printf, 2, 3))); |
void rsync_warnx(const char *, ...) |
void rsync_warnx(const char *, ...) |
__attribute__((format(printf, 1, 2))); |
__attribute__((format(printf, 1, 2))); |
void rsync_err(const char *, ...) |
void rsync_err(const char *, ...) |
__attribute__((format(printf, 1, 2))); |
__attribute__((format(printf, 1, 2))); |
void rsync_errx(const char *, ...) |
void rsync_errx(const char *, ...) |
__attribute__((format(printf, 1, 2))); |
__attribute__((format(printf, 1, 2))); |
void rsync_errx1(const char *, ...) |
void rsync_errx1(const char *, ...) |
__attribute__((format(printf, 1, 2))); |
__attribute__((format(printf, 1, 2))); |
|
|
int flist_del(struct sess *, int, |
int flist_del(struct sess *, int, const struct flist *, size_t); |
const struct flist *, size_t); |
int flist_gen(struct sess *, size_t, char **, struct flist **, size_t *); |
int flist_gen(struct sess *, size_t, char **, |
int flist_gen_local(struct sess *, const char *, struct flist **, size_t *); |
struct flist **, size_t *); |
void flist_free(struct flist *, size_t); |
int flist_gen_local(struct sess *, const char *, |
int flist_recv(struct sess *, int, struct flist **, size_t *); |
struct flist **, size_t *); |
int flist_send(struct sess *, int, int, const struct flist *, size_t); |
void flist_free(struct flist *, size_t); |
int flist_gen_dels(struct sess *, const char *, struct flist **, size_t *, |
int flist_recv(struct sess *, int, |
const struct flist *, size_t); |
struct flist **, size_t *); |
|
int flist_send(struct sess *, int, int, |
|
const struct flist *, size_t); |
|
int flist_gen_dels(struct sess *, const char *, |
|
struct flist **, size_t *, |
|
const struct flist *, size_t); |
|
|
|
|
const char *alt_base_mode(int); |
char **fargs_cmdline(struct sess *, const struct fargs *, size_t *); |
char **fargs_cmdline(struct sess *, const struct fargs *, size_t *); |
|
|
int io_read_buf(struct sess *, int, void *, size_t); |
int io_read_buf(struct sess *, int, void *, size_t); |
int io_read_byte(struct sess *, int, uint8_t *); |
int io_read_byte(struct sess *, int, uint8_t *); |
int io_read_check(int); |
int io_read_check(int); |
int io_read_flush(struct sess *, int); |
int io_read_flush(struct sess *, int); |
int io_read_int(struct sess *, int, int32_t *); |
int io_read_int(struct sess *, int, int32_t *); |
int io_read_uint(struct sess *, int, uint32_t *); |
int io_read_uint(struct sess *, int, uint32_t *); |
int io_read_long(struct sess *, int, int64_t *); |
int io_read_long(struct sess *, int, int64_t *); |
int io_read_size(struct sess *, int, size_t *); |
int io_read_size(struct sess *, int, size_t *); |
int io_read_ulong(struct sess *, int, uint64_t *); |
int io_read_ulong(struct sess *, int, uint64_t *); |
int io_write_buf(struct sess *, int, const void *, size_t); |
int io_write_buf(struct sess *, int, const void *, size_t); |
int io_write_byte(struct sess *, int, uint8_t); |
int io_write_byte(struct sess *, int, uint8_t); |
int io_write_int(struct sess *, int, int32_t); |
int io_write_int(struct sess *, int, int32_t); |
int io_write_uint(struct sess *, int, uint32_t); |
int io_write_uint(struct sess *, int, uint32_t); |
int io_write_line(struct sess *, int, const char *); |
int io_write_line(struct sess *, int, const char *); |
int io_write_long(struct sess *, int, int64_t); |
int io_write_long(struct sess *, int, int64_t); |
int io_write_ulong(struct sess *, int, uint64_t); |
int io_write_ulong(struct sess *, int, uint64_t); |
|
|
int io_lowbuffer_alloc(struct sess *, void **, |
int io_lowbuffer_alloc(struct sess *, void **, size_t *, size_t *, size_t); |
size_t *, size_t *, size_t); |
void io_lowbuffer_int(struct sess *, void *, size_t *, size_t, int32_t); |
void io_lowbuffer_int(struct sess *, void *, |
void io_lowbuffer_buf(struct sess *, void *, size_t *, size_t, const void *, |
size_t *, size_t, int32_t); |
size_t); |
void io_lowbuffer_buf(struct sess *, void *, |
|
size_t *, size_t, const void *, size_t); |
|
|
|
void io_buffer_int(void *, size_t *, size_t, int32_t); |
void io_buffer_int(void *, size_t *, size_t, int32_t); |
void io_buffer_buf(void *, size_t *, size_t, const void *, size_t); |
void io_buffer_buf(void *, size_t *, size_t, const void *, size_t); |
|
|
void io_unbuffer_int(const void *, |
void io_unbuffer_int(const void *, size_t *, size_t, int32_t *); |
size_t *, size_t, int32_t *); |
int io_unbuffer_size(const void *, size_t *, size_t, size_t *); |
int io_unbuffer_size(const void *, size_t *, size_t, size_t *); |
void io_unbuffer_buf(const void *, size_t *, size_t, void *, size_t); |
void io_unbuffer_buf(const void *, size_t *, size_t, void *, size_t); |
|
|
|
int rsync_receiver(struct sess *, int, int, const char *); |
int rsync_receiver(struct sess *, int, int, const char *); |
int rsync_sender(struct sess *, int, int, size_t, char **); |
int rsync_sender(struct sess *, int, int, size_t, char **); |
int rsync_client(const struct opts *, int, const struct fargs *); |
int rsync_client(const struct opts *, int, const struct fargs *); |
int rsync_connect(const struct opts *, int *, |
int rsync_connect(const struct opts *, int *, const struct fargs *); |
const struct fargs *); |
int rsync_socket(const struct opts *, int, const struct fargs *); |
int rsync_socket(const struct opts *, int, const struct fargs *); |
int rsync_server(const struct opts *, size_t, char *[]); |
int rsync_server(const struct opts *, size_t, char *[]); |
int rsync_downloader(struct download *, struct sess *, int *); |
int rsync_downloader(struct download *, struct sess *, int *); |
int rsync_set_metadata(struct sess *, int, int, const struct flist *, |
int rsync_set_metadata(struct sess *, int, int, |
const char *); |
const struct flist *, const char *); |
int rsync_set_metadata_at(struct sess *, int, int, const struct flist *, |
int rsync_set_metadata_at(struct sess *, int, int, |
const char *); |
const struct flist *, const char *); |
int rsync_uploader(struct upload *, int *, struct sess *, int *); |
int rsync_uploader(struct upload *, |
int rsync_uploader_tail(struct upload *, struct sess *); |
int *, struct sess *, int *); |
|
int rsync_uploader_tail(struct upload *, struct sess *); |
|
|
|
struct download *download_alloc(struct sess *, int, |
struct download *download_alloc(struct sess *, int, const struct flist *, |
const struct flist *, size_t, int); |
size_t, int); |
void download_free(struct download *); |
void download_free(struct download *); |
struct upload *upload_alloc(const char *, int, int, size_t, |
struct upload *upload_alloc(const char *, int, int, size_t, |
const struct flist *, size_t, mode_t); |
const struct flist *, size_t, mode_t); |
void upload_free(struct upload *); |
void upload_free(struct upload *); |
|
|
struct blktab *blkhash_alloc(void); |
struct blktab *blkhash_alloc(void); |
int blkhash_set(struct blktab *, const struct blkset *); |
int blkhash_set(struct blktab *, const struct blkset *); |
void blkhash_free(struct blktab *); |
void blkhash_free(struct blktab *); |
|
|
struct blkset *blk_recv(struct sess *, int, const char *); |
struct blkset *blk_recv(struct sess *, int, const char *); |
void blk_recv_ack(char [20], const struct blkset *, int32_t); |
void blk_recv_ack(char [20], const struct blkset *, int32_t); |
void blk_match(struct sess *, const struct blkset *, |
void blk_match(struct sess *, const struct blkset *, |
const char *, struct blkstat *); |
const char *, struct blkstat *); |
int blk_send(struct sess *, int, size_t, |
int blk_send(struct sess *, int, size_t, const struct blkset *, |
const struct blkset *, const char *); |
const char *); |
int blk_send_ack(struct sess *, int, struct blkset *); |
int blk_send_ack(struct sess *, int, struct blkset *); |
|
|
uint32_t hash_fast(const void *, size_t); |
uint32_t hash_fast(const void *, size_t); |
void hash_slow(const void *, size_t, |
void hash_slow(const void *, size_t, unsigned char *, |
unsigned char *, const struct sess *); |
const struct sess *); |
void hash_file(const void *, size_t, |
void hash_file(const void *, size_t, unsigned char *, |
unsigned char *, const struct sess *); |
const struct sess *); |
|
|
int mkpath(char *); |
void copy_file(int, const char *, const struct flist *); |
|
|
int mkstempat(int, char *); |
int mkpath(char *); |
char *mkstemplinkat(char*, int, char *); |
|
char *mkstempfifoat(int, char *); |
|
char *mkstempnodat(int, char *, mode_t, dev_t); |
|
char *mkstempsock(const char *, char *); |
|
int mktemplate(char **, const char *, int); |
|
|
|
char *symlink_read(const char *); |
int mkstempat(int, char *); |
char *symlinkat_read(int, const char *); |
char *mkstemplinkat(char*, int, char *); |
|
char *mkstempfifoat(int, char *); |
|
char *mkstempnodat(int, char *, mode_t, dev_t); |
|
char *mkstempsock(const char *, char *); |
|
int mktemplate(char **, const char *, int); |
|
|
int sess_stats_send(struct sess *, int); |
int parse_rule(char *line, enum rule_type); |
int sess_stats_recv(struct sess *, int); |
void parse_file(const char *, enum rule_type); |
|
void send_rules(struct sess *, int); |
|
void recv_rules(struct sess *, int); |
|
int rules_match(const char *, int); |
|
|
int idents_add(int, struct ident **, size_t *, int32_t); |
int rmatch(const char *, const char *, int); |
void idents_assign_gid(struct sess *, |
|
struct flist *, size_t, const struct ident *, size_t); |
char *symlink_read(const char *); |
void idents_assign_uid(struct sess *, |
char *symlinkat_read(int, const char *); |
struct flist *, size_t, const struct ident *, size_t); |
|
void idents_free(struct ident *, size_t); |
int sess_stats_send(struct sess *, int); |
int idents_recv(struct sess *, int, struct ident **, size_t *); |
int sess_stats_recv(struct sess *, int); |
void idents_remap(struct sess *, int, struct ident *, size_t); |
|
int idents_send(struct sess *, int, const struct ident *, size_t); |
int idents_add(int, struct ident **, size_t *, int32_t); |
|
void idents_assign_gid(struct sess *, struct flist *, size_t, |
|
const struct ident *, size_t); |
|
void idents_assign_uid(struct sess *, struct flist *, size_t, |
|
const struct ident *, size_t); |
|
void idents_free(struct ident *, size_t); |
|
int idents_recv(struct sess *, int, struct ident **, size_t *); |
|
void idents_remap(struct sess *, int, struct ident *, size_t); |
|
int idents_send(struct sess *, int, const struct ident *, size_t); |
|
|
#endif /*!EXTERN_H*/ |
#endif /*!EXTERN_H*/ |