52 rs_signature_init(sig, job->sig_magic, job->sig_block_len,
53 job->sig_strong_len, 0)) !=
RS_DONE)
55 rs_squirt_n4(job, sig->
magic);
58 rs_trace(
"sent header (magic %#x, block len = %d, strong sum len = %d)",
71 rs_weak_sum_t weak_sum;
72 rs_strong_sum_t strong_sum;
74 weak_sum = rs_signature_calc_weak_sum(sig, block, len);
75 rs_signature_calc_strong_sum(sig, block, len, &strong_sum);
76 rs_squirt_n4(job, weak_sum);
79 char strong_sum_hex[RS_MAX_STRONG_SUM_LENGTH * 2 + 1];
81 rs_trace(
"sent block: weak=" FMT_WEAKSUM
", strong=%s", weak_sum,
103 }
else if (result !=
RS_DONE) {
104 rs_trace(
"generate stopped: %s",
rs_strerror(result));
107 rs_trace(
"got " FMT_SIZE
" byte block", len);
108 return rs_sig_do_block(job, block, len);
119 job->sig_magic = sig_magic;
120 job->sig_block_len = block_len;
121 job->sig_strong_len = strong_len;
#define rs_trace_enabled()
Call this before putting too much effort into generating trace messages.
rs_result rs_scoop_read_rest(rs_job_t *job, size_t *len, void **ptr)
Read whatever data remains in the input stream.
int block_len
The block length.
rs_long_t sig_blocks
Number of blocks described by the signature.
rs_signature_t * signature
Pointer to the signature that's being used by the operation.
int job_owns_sig
Flag indicating signature should be destroyed with the job.
LIBRSYNC_EXPORT char const * rs_strerror(rs_result r)
Return an English description of a rs_result value.
int strong_sum_len
The block strong sum length.
rs_job_t * rs_sig_begin(size_t block_len, size_t strong_len, rs_magic_number sig_magic)
Start generating a signature.
static rs_result rs_sig_s_generate(rs_job_t *)
State of reading a block and trying to generate its sum.
rs_result(* statefn)(rs_job_t *)
Callback for each processing step.
rs_stats_t stats
Encoding statistics.
Public header for librsync.
Signature of a whole file.
rs_result
Return codes from nonblocking rsync operations.
Unexpected end of input file, perhaps due to a truncated file or dropped network connection.
rs_result rs_scoop_read(rs_job_t *job, size_t len, void **ptr)
Read LEN bytes if possible, and remove them from the input scoop.
int magic
The signature magic value.
rs_magic_number
A uint32 magic number, emitted in bigendian/network order at the start of librsync files...
The job is still running, and not yet finished or blocked.
void rs_tube_write(rs_job_t *job, const void *buf, size_t len)
Push some data into the tube for storage.
static rs_result rs_sig_s_header(rs_job_t *)
State of trying to send the signature header.
LIBRSYNC_EXPORT void rs_hexify(char *to_buf, void const *from_buf, int from_len)
Convert from_len bytes at from_buf into a hex representation in to_buf, which must be twice as long p...
The contents of this structure are private.