38#include "librsync_export.h"
44 int inbuflen,
int outbuflen)
52 outbuflen = rs_outbuflen ? rs_outbuflen : outbuflen;
54 in_fb = rs_filebuf_new(in_file, inbuflen);
56 out_fb = rs_filebuf_new(out_file, outbuflen);
58 rs_job_drive(job, &buf, in_fb ? rs_infilebuf_fill : NULL, in_fb,
59 out_fb ? rs_outfilebuf_drain : NULL, out_fb);
61 rs_filebuf_free(in_fb);
63 rs_filebuf_free(out_fb);
81 r =
rs_whole_run(job, old_file, sig_file, 4 * (
int)block_len,
82 12 + 4 * (4 + (
int)strong_len));
84 memcpy(stats, &job->
stats,
sizeof *stats);
102 memcpy(stats, &job->
stats,
sizeof *stats);
119 memcpy(stats, &job->
stats,
sizeof *stats);
135 memcpy(stats, &job->
stats,
sizeof *stats);
Buffers that map between stdio file streams and librsync streams.
rs_job_t * rs_delta_begin(rs_signature_t *sig)
Prepare to compute a streaming delta.
Generic state-machine interface.
#define MAX_DELTA_CMD
Max length of a singled delta command is including command bytes.
Public header for librsync.
LIBRSYNC_EXPORT 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.
LIBRSYNC_EXPORT rs_job_t * rs_sig_begin(size_t block_len, size_t strong_len, rs_magic_number sig_magic)
Start generating a signature.
LIBRSYNC_EXPORT rs_result rs_job_free(rs_job_t *)
Deallocate job state.
LIBRSYNC_EXPORT 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.
LIBRSYNC_EXPORT rs_result rs_sig_args(rs_long_t old_fsize, rs_magic_number *magic, size_t *block_len, size_t *strong_len)
Get or check signature arguments for a given file size.
LIBRSYNC_EXPORT rs_long_t rs_file_size(FILE *file)
Get the size of a file.
LIBRSYNC_EXPORT rs_job_t * rs_loadsig_begin(rs_signature_t **)
Read a signature from a file into an rs_signature structure in memory.
LIBRSYNC_EXPORT 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.
LIBRSYNC_EXPORT rs_result rs_loadsig_file(FILE *sig_file, rs_signature_t **sumset, rs_stats_t *stats)
Load signatures from a signature file into memory.
LIBRSYNC_EXPORT 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.
rs_result
Return codes from nonblocking rsync operations.
@ RS_DONE
Completed successfully.
LIBRSYNC_EXPORT 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.
rs_magic_number
A uint32 magic number, emitted in bigendian/network order at the start of librsync files.
LIBRSYNC_EXPORT 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.
LIBRSYNC_EXPORT int rs_inbuflen
Buffer sizes for file IO.
Description of input and output buffers.
The contents of this structure are private.
rs_long_t sig_fsize
The size of the signature file if available.
rs_stats_t stats
Encoding statistics.
Signature of a whole file.
int block_len
The block length.
Performance statistics from a librsync encoding or decoding operation.
The rs_signature class implementation of a file signature.
Whole-file API driver functions.
rs_result rs_whole_run(rs_job_t *job, FILE *in_file, FILE *out_file, int inbuflen, int outbuflen)
Run a job continuously, with input to/from the two specified files.