48 if (rs_trace_enabled()) {
49 char hexbuf[RS_MAX_STRONG_SUM_LENGTH * 2 + 2];
51 rs_trace(
"got block: weak=" FMT_WEAKSUM
", strong=%s", job->
weak_sig,
64 if ((result = rs_suck_n4(job, &l)) !=
RS_DONE) {
70 job->
statefn = rs_loadsig_s_strong;
77 rs_strong_sum_t *strongsum;
81 (
void **)&strongsum)) !=
RS_DONE)
83 job->
statefn = rs_loadsig_s_weak;
92 if ((result = rs_suck_n4(job, &l)) !=
RS_DONE)
94 if (l < 0 || l > RS_MAX_STRONG_SUM_LENGTH) {
95 rs_error(
"strong sum length %d is implausible", l);
98 rs_trace(
"got strong sum length %d", l);
99 job->sig_strong_len = l;
102 rs_signature_init(job->
signature, job->sig_magic, job->sig_block_len,
105 job->
statefn = rs_loadsig_s_weak;
114 if ((result = rs_suck_n4(job, &l)) !=
RS_DONE)
117 rs_error(
"block length of %d is bogus", l);
120 rs_trace(
"got block length %d", l);
121 job->sig_block_len = l;
122 job->
stats.block_len = l;
123 job->
statefn = rs_loadsig_s_stronglen;
132 if ((result = rs_suck_n4(job, &l)) !=
RS_DONE)
134 rs_trace(
"got signature magic %#x", l);
136 job->
statefn = rs_loadsig_s_blocklen;
144 job = rs_job_new(
"loadsig", rs_loadsig_s_magic);
rs_job_t * rs_loadsig_begin(rs_signature_t **signature)
Read a signature from a file into an rs_signature structure in memory.
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.
static rs_result rs_loadsig_add_sum(rs_job_t *job, rs_strong_sum_t *strong)
Add a just-read-in checksum pair to the signature block.
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...
Unbelievable value in stream.
rs_weak_sum_t weak_sig
The weak signature digest used by readsums.c.
int strong_sum_len
The block strong sum length.
rs_result(* statefn)(rs_job_t *)
Callback for each processing step.
rs_stats_t stats
Encoding statistics.
rs_long_t sig_fsize
The size of the signature file if available.
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.
The job is still running, and not yet finished or blocked.
of this structure are private.