35 # include <sys/types.h>
52 typedef uint8_t rs_byte_t;
53 typedef intmax_t rs_long_t;
118 typedef void rs_trace_fn_t(
rs_loglevel level,
char const *msg);
148 void rs_hexify(
char *to_buf,
void const *from_buf,
int from_len);
156 void rs_base64(
unsigned char const *buf,
int n,
char *out);
199 rs_long_t copy_cmds, copy_bytes, copy_cmdbytes;
200 rs_long_t sig_cmds, sig_bytes;
221 extern const int RS_MD4_SUM_LENGTH, RS_BLAKE2_SUM_LENGTH;
223 # define RS_MAX_STRONG_SUM_LENGTH 32
225 typedef uint32_t rs_weak_sum_t;
226 typedef unsigned char rs_strong_sum_t[RS_MAX_STRONG_SUM_LENGTH];
228 void rs_mdfour(
unsigned char *out,
void const *in,
size_t);
239 void rs_mdfour_result(
rs_mdfour_t *md,
unsigned char *out);
336 # define RS_DEFAULT_BLOCK_LEN 2048
374 void *in_opaque,
rs_driven_cb out_cb,
void *out_opaque);
451 # ifndef RSYNC_NO_STDIO_INTERFACE
Command line syntax error.
Description of input and output buffers.
rs_result rs_job_iter(rs_job_t *job, rs_buffers_t *buffers)
Run a rs_job state machine until it blocks (RS_BLOCKED), returns an error, or completes (RS_DONE)...
rs_copy_cb * copy_cb
Callback used to copy data from the basis into the output.
rs_result rs_build_hash_table(rs_signature_t *sums)
Call this after loading a signature to index it.
Action must be taken immediately.
rs_long_t lit_cmdbytes
Number of bytes used in literal command headers.
A signature file using the BLAKE2 hash.
Bad value passed in to library, probably an application bug.
Bad magic number at start of stream.
rs_long_t sig_blocks
Number of blocks described by the signature.
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...
size_t avail_out
Remaining free space at next_out.
void rs_trace_to(rs_trace_fn_t *)
Set trace callback.
Unbelievable value in stream.
rs_result rs_delta_file(rs_signature_t *, FILE *new_file, FILE *delta_file, rs_stats_t *)
Generate a delta between a signature and a new file into a delta file.
rs_job_t * rs_sig_begin(size_t new_block_len, size_t strong_sum_len, rs_magic_number sig_magic)
Start generating a signature.
rs_result rs_copy_cb(void *opaque, rs_long_t pos, size_t *len, void **buf)
Callback used to retrieve parts of the basis file.
int rs_inbuflen
Buffer sizes for file IO.
rs_result rs_loadsig_file(FILE *sig_file, rs_signature_t **sumset, rs_stats_t *stats)
Load signatures from a signature file into memory.
char * next_out
Next output byte should be put there.
Test neither passed or failed.
size_t avail_in
Number of bytes available at next_in.
rs_long_t out_bytes
Total bytes written to output.
void rs_free_sumset(rs_signature_t *)
Deep deallocation of checksums.
Error in file or network IO.
int rs_supports_trace(void)
Check whether the library was compiled with debugging trace.
char const rs_licence_string[]
Summary of the licence for librsync.
A signature file with MD4 signatures.
struct rs_stats rs_stats_t
Performance statistics from a librsync encoding or decoding operation.
rs_stats_t stats
Encoding statistics.
rs_long_t in_bytes
Total bytes read from input.
Signature of a whole file.
int lit_cmds
Number of literal commands.
rs_result rs_sig_file(FILE *old_file, FILE *sig_file, size_t block_len, size_t strong_len, rs_magic_number sig_magic, rs_stats_t *stats)
Generate the signature of a basis file, and write it out to another.
size_t rs_unbase64(char *s)
Decode a base64 buffer in place.
char const * op
Human-readable name of current operation.
rs_long_t lit_bytes
Number of literal bytes.
Performance statistics from a librsync encoding or decoding operation.
void rs_trace_stderr(rs_loglevel level, char const *msg)
Default trace callback that writes to stderr.
void rs_mdfour_update(rs_mdfour_t *md, void const *in_void, size_t n)
Feed some data into the MD4 accumulator.
char const * rs_strerror(rs_result r)
Return an English description of a rs_result value.
rs_job_t * rs_delta_begin(rs_signature_t *sig)
Prepare to compute a streaming delta.
char * next_in
Next input byte.
rs_job_t * rs_patch_begin(rs_copy_cb *copy_cb, void *copy_arg)
Apply a delta to a basis file to recreate the new file.
rs_result
Return codes from nonblocking rsync operations.
Unexpected end of input file, perhaps due to a truncated file or dropped network connection.
struct rs_mdfour rs_mdfour_t
MD4 message-digest accumulator.
rs_result rs_patch_file(FILE *basis_file, FILE *delta_file, FILE *new_file, rs_stats_t *)
Apply a patch, relative to a basis, into a new file.
Blocked waiting for more data.
rs_result rs_file_copy_cb(void *arg, rs_long_t pos, size_t *len, void **buf)
rs_copy_cb that reads from a stdio file.
const rs_stats_t * rs_job_statistics(rs_job_t *job)
Return a pointer to the statistics in a job.
void rs_sumset_dump(rs_signature_t const *)
Dump signatures to the log.
rs_magic_number
A uint32 magic number, emitted in bigendian/network order at the start of librsync files...
rs_result rs_job_free(rs_job_t *job)
Deallocate job state.
char const rs_librsync_version[]
Library version string.
The job is still running, and not yet finished or blocked.
void rs_trace_set_level(rs_loglevel level)
Set the least important message severity that will be output.
void rs_base64(unsigned char const *buf, int n, char *out)
Encode a buffer as base64.
Normal but significant condition.
int eof_in
True if there is no more data after this.
rs_result rs_job_drive(rs_job_t *job, rs_buffers_t *buf, rs_driven_cb in_cb, void *in_opaque, rs_driven_cb out_cb, void *out_opaque)
Actively process a job, by making callbacks to fill and empty the buffers until the job is done...
char * rs_format_stats(rs_stats_t const *stats, char *buf, size_t size)
Return a human-readable representation of statistics.
rs_job_t * rs_loadsig_begin(rs_signature_t **)
Read a signature from a file into an rs_signature structure in memory.
rs_loglevel
Log severity levels.
int rs_log_stats(rs_stats_t const *stats)
Write statistics into the current log as text.
rs_result rs_driven_cb(rs_job_t *job, rs_buffers_t *buf, void *opaque)
Type of application-supplied function for rs_job_drive().
of this structure are private.