37#include "librsync_export.h"
43 int inbuflen,
int outbuflen)
51 outbuflen = rs_outbuflen ? rs_outbuflen : outbuflen;
53 in_fb = rs_filebuf_new(in_file, inbuflen);
55 out_fb = rs_filebuf_new(out_file, outbuflen);
57 rs_job_drive(job, &buf, in_fb ? rs_infilebuf_fill : NULL, in_fb,
58 out_fb ? rs_outfilebuf_drain : NULL, out_fb);
60 rs_filebuf_free(in_fb);
62 rs_filebuf_free(out_fb);
72 rs_long_t old_fsize = rs_file_size(old_file);
80 r = rs_whole_run(job, old_file, sig_file, 4 * (
int)block_len,
81 12 + 4 * (4 + (
int)strong_len));
83 memcpy(stats, &job->
stats,
sizeof *stats);
99 r = rs_whole_run(job, sig_file, NULL, 1024 * 16, 0);
101 memcpy(stats, &job->
stats,
sizeof *stats);
115 r = rs_whole_run(job, new_file, delta_file,
118 memcpy(stats, &job->
stats,
sizeof *stats);
134 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_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_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.
rs_magic_number
A uint32 magic number, emitted in bigendian/network order at the start of librsync files.
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.