$treeview $search $mathjax $extrastylesheet
librsync
2.3.1
$projectbrief
|
$projectbrief
|
$searchbox |
00001 /*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- 00002 * 00003 * librsync -- library for network deltas 00004 * 00005 * Copyright 2000, 2001, 2014, 2015 by Martin Pool <mbp@sourcefrog.net> 00006 * Copyright (C) 2003 by Donovan Baarda <abo@minkirri.apana.org.au> 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation; either version 2.1 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00021 */ 00022 00023 /*= 00024 | You should never wear your best 00025 | trousers when you go out to fight for 00026 | freedom and liberty. 00027 | -- Henrik Ibsen 00028 */ 00029 00030 /** \file librsync.h 00031 * Public header for librsync. */ 00032 #ifndef _RSYNC_H 00033 # define _RSYNC_H 00034 00035 # include <stdio.h> 00036 # include <stdint.h> 00037 # include <time.h> 00038 # include "librsync_export.h" 00039 00040 # ifdef __cplusplus 00041 extern "C" { 00042 # endif 00043 00044 /** Library version string. 00045 * 00046 * \sa \ref versioning */ 00047 LIBRSYNC_EXPORT extern char const rs_librsync_version[]; 00048 00049 typedef uint8_t rs_byte_t; 00050 typedef intmax_t rs_long_t; 00051 00052 /*= 00053 | "The IETF already has more than enough 00054 | RFCs that codify the obvious, make 00055 | stupidity illegal, support truth, 00056 | justice, and the IETF way, and generally 00057 | demonstrate the author is a brilliant and 00058 | valuable Contributor to The Standards 00059 | Process." 00060 | -- Vernon Schryver 00061 */ 00062 00063 /** A uint32 magic number, emitted in bigendian/network order at the start of 00064 * librsync files. */ 00065 typedef enum { 00066 /** A delta file. 00067 * 00068 * At present, there's only one delta format. 00069 * 00070 * The four-byte literal \c "rs\x026". */ 00071 RS_DELTA_MAGIC = 0x72730236, 00072 00073 /** A signature file with MD4 signatures. 00074 * 00075 * Backward compatible with librsync < 1.0, but strongly deprecated because 00076 * it creates a security vulnerability on files containing partly untrusted 00077 * data. See <https://github.com/librsync/librsync/issues/5>. 00078 * 00079 * The four-byte literal \c "rs\x016". 00080 * 00081 * \sa rs_sig_begin() */ 00082 RS_MD4_SIG_MAGIC = 0x72730136, 00083 00084 /** A signature file using the BLAKE2 hash. Supported from librsync 1.0. 00085 * 00086 * The four-byte literal \c "rs\x017". 00087 * 00088 * \sa rs_sig_begin() */ 00089 RS_BLAKE2_SIG_MAGIC = 0x72730137, 00090 00091 /** A signature file with RabinKarp rollsum and MD4 hash. 00092 * 00093 * Uses a faster/safer rollsum, but still strongly discouraged because of 00094 * MD4's security vulnerability. Supported since librsync 2.2.0. 00095 * 00096 * The four-byte literal \c "rs\x01F". 00097 * 00098 * \sa rs_sig_begin() */ 00099 RS_RK_MD4_SIG_MAGIC = 0x72730146, 00100 00101 /** A signature file with RabinKarp rollsum and BLAKE2 hash. 00102 * 00103 * Uses a faster/safer rollsum together with the safer BLAKE2 hash. This is 00104 * the recommended default supported since librsync 2.2.0. 00105 * 00106 * The four-byte literal \c "rs\x01G". 00107 * 00108 * \sa rs_sig_begin() */ 00109 RS_RK_BLAKE2_SIG_MAGIC = 0x72730147, 00110 00111 } rs_magic_number; 00112 00113 /** Log severity levels. 00114 * 00115 * These are the same as syslog, at least in glibc. 00116 * 00117 * \sa rs_trace_set_level() \sa \ref api_trace */ 00118 typedef enum { 00119 RS_LOG_EMERG = 0, /**< System is unusable */ 00120 RS_LOG_ALERT = 1, /**< Action must be taken immediately */ 00121 RS_LOG_CRIT = 2, /**< Critical conditions */ 00122 RS_LOG_ERR = 3, /**< Error conditions */ 00123 RS_LOG_WARNING = 4, /**< Warning conditions */ 00124 RS_LOG_NOTICE = 5, /**< Normal but significant condition */ 00125 RS_LOG_INFO = 6, /**< Informational */ 00126 RS_LOG_DEBUG = 7 /**< Debug-level messages */ 00127 } rs_loglevel; 00128 00129 /** Callback to write out log messages. 00130 * 00131 * \param level a syslog level. 00132 * 00133 * \param msg message to be logged. 00134 * 00135 * \sa \ref api_trace */ 00136 typedef void rs_trace_fn_t(rs_loglevel level, char const *msg); 00137 00138 /** Set the least important message severity that will be output. 00139 * 00140 * \sa \ref api_trace */ 00141 LIBRSYNC_EXPORT void rs_trace_set_level(rs_loglevel level); 00142 00143 /** Set trace callback. 00144 * 00145 * \sa \ref api_trace */ 00146 LIBRSYNC_EXPORT void rs_trace_to(rs_trace_fn_t *); 00147 00148 /** Default trace callback that writes to stderr. 00149 * 00150 * Implements ::rs_trace_fn_t, and may be passed to rs_trace_to(). 00151 * 00152 * \sa \ref api_trace */ 00153 LIBRSYNC_EXPORT void rs_trace_stderr(rs_loglevel level, char const *msg); 00154 00155 /** Check whether the library was compiled with debugging trace. 00156 * 00157 * \returns True if the library contains trace code; otherwise false. 00158 * 00159 * If this returns false, then trying to turn trace on will achieve nothing. 00160 * 00161 * \sa \ref api_trace */ 00162 LIBRSYNC_EXPORT int rs_supports_trace(void); 00163 00164 /** Convert \p from_len bytes at \p from_buf into a hex representation in \p 00165 * to_buf, which must be twice as long plus one byte for the null terminator. */ 00166 LIBRSYNC_EXPORT void rs_hexify(char *to_buf, void const *from_buf, 00167 int from_len); 00168 00169 /** Decode a base64 buffer in place. 00170 * 00171 * \returns The number of binary bytes. */ 00172 LIBRSYNC_EXPORT size_t rs_unbase64(char *s); 00173 00174 /** Encode a buffer as base64. */ 00175 LIBRSYNC_EXPORT void rs_base64(unsigned char const *buf, int n, char *out); 00176 00177 /** Return codes from nonblocking rsync operations. 00178 * 00179 * \sa rs_strerror() \sa api_callbacks */ 00180 typedef enum rs_result { 00181 RS_DONE = 0, /**< Completed successfully. */ 00182 RS_BLOCKED = 1, /**< Blocked waiting for more data. */ 00183 RS_RUNNING = 2, /**< The job is still running, and not yet 00184 * finished or blocked. (This value should 00185 * never be seen by the application.) */ 00186 RS_TEST_SKIPPED = 77, /**< Test neither passed or failed. */ 00187 RS_IO_ERROR = 100, /**< Error in file or network IO. */ 00188 RS_SYNTAX_ERROR = 101, /**< Command line syntax error. */ 00189 RS_MEM_ERROR = 102, /**< Out of memory. */ 00190 RS_INPUT_ENDED = 103, /**< Unexpected end of input file, perhaps due 00191 * to a truncated file or dropped network 00192 * connection. */ 00193 RS_BAD_MAGIC = 104, /**< Bad magic number at start of stream. 00194 * Probably not a librsync file, or possibly 00195 * the wrong kind of file or from an 00196 * incompatible library version. */ 00197 RS_UNIMPLEMENTED = 105, /**< Author is lazy. */ 00198 RS_CORRUPT = 106, /**< Unbelievable value in stream. */ 00199 RS_INTERNAL_ERROR = 107, /**< Probably a library bug. */ 00200 RS_PARAM_ERROR = 108 /**< Bad value passed in to library, probably 00201 * an application bug. */ 00202 } rs_result; 00203 00204 /** Return an English description of a ::rs_result value. */ 00205 LIBRSYNC_EXPORT char const *rs_strerror(rs_result r); 00206 00207 /** Performance statistics from a librsync encoding or decoding operation. 00208 * 00209 * \sa api_stats \sa rs_format_stats() \sa rs_log_stats() */ 00210 typedef struct rs_stats { 00211 char const *op; /**< Human-readable name of current operation. 00212 * For example, "delta". */ 00213 int lit_cmds; /**< Number of literal commands. */ 00214 rs_long_t lit_bytes; /**< Number of literal bytes. */ 00215 rs_long_t lit_cmdbytes; /**< Number of bytes used in literal command 00216 * headers. */ 00217 00218 rs_long_t copy_cmds, copy_bytes, copy_cmdbytes; 00219 rs_long_t sig_cmds, sig_bytes; 00220 int false_matches; 00221 00222 rs_long_t sig_blocks; /**< Number of blocks described by the 00223 * signature. */ 00224 00225 size_t block_len; 00226 00227 rs_long_t in_bytes; /**< Total bytes read from input. */ 00228 rs_long_t out_bytes; /**< Total bytes written to output. */ 00229 00230 time_t start, end; 00231 } rs_stats_t; 00232 00233 /** MD4 message-digest accumulator. 00234 * 00235 * \sa rs_mdfour(), rs_mdfour_begin(), rs_mdfour_update(), rs_mdfour_result() */ 00236 typedef struct rs_mdfour rs_mdfour_t; 00237 00238 LIBRSYNC_EXPORT extern const int RS_MD4_SUM_LENGTH, RS_BLAKE2_SUM_LENGTH; 00239 00240 # define RS_MAX_STRONG_SUM_LENGTH 32 00241 00242 typedef uint32_t rs_weak_sum_t; 00243 typedef unsigned char rs_strong_sum_t[RS_MAX_STRONG_SUM_LENGTH]; 00244 00245 LIBRSYNC_EXPORT void rs_mdfour(unsigned char *out, void const *in, size_t); 00246 LIBRSYNC_EXPORT void rs_mdfour_begin( /* @out@ */ rs_mdfour_t *md); 00247 00248 /** Feed some data into the MD4 accumulator. 00249 * 00250 * \param md MD4 accumulator. 00251 * 00252 * \param in_void Data to add. 00253 * 00254 * \param n Number of bytes fed in. */ 00255 LIBRSYNC_EXPORT void rs_mdfour_update(rs_mdfour_t *md, void const *in_void, 00256 size_t n); 00257 LIBRSYNC_EXPORT void rs_mdfour_result(rs_mdfour_t *md, unsigned char *out); 00258 00259 /** Return a human-readable representation of statistics. 00260 * 00261 * The string is truncated if it does not fit. 100 characters should be 00262 * sufficient space. 00263 * 00264 * \param stats Statistics from an encoding or decoding operation. 00265 * 00266 * \param buf Buffer to receive result. 00267 * 00268 * \param size Size of buffer. 00269 * 00270 * \return \p buf. 00271 * 00272 * \sa \ref api_stats */ 00273 LIBRSYNC_EXPORT char *rs_format_stats(rs_stats_t const *stats, char *buf, 00274 size_t size); 00275 00276 /** Write statistics into the current log as text. 00277 * 00278 * \sa \ref api_stats \sa \ref api_trace */ 00279 LIBRSYNC_EXPORT int rs_log_stats(rs_stats_t const *stats); 00280 00281 /** The signature datastructure type. */ 00282 typedef struct rs_signature rs_signature_t; 00283 00284 /** Log the rs_signature_delta match stats. */ 00285 LIBRSYNC_EXPORT void rs_signature_log_stats(rs_signature_t const *sig); 00286 00287 /** Deep deallocation of checksums. */ 00288 LIBRSYNC_EXPORT void rs_free_sumset(rs_signature_t *); 00289 00290 /** Dump signatures to the log. */ 00291 LIBRSYNC_EXPORT void rs_sumset_dump(rs_signature_t const *); 00292 00293 /** Description of input and output buffers. 00294 * 00295 * On each call to ::rs_job_iter(), the caller can make available 00296 * 00297 * - #avail_in bytes of input data at #next_in 00298 * 00299 * - #avail_out bytes of output space at #next_out 00300 * 00301 * - or some of both 00302 * 00303 * Buffers must be allocated and passed in by the caller. 00304 * 00305 * On input, the buffers structure must contain the address and length of the 00306 * input and output buffers. The library updates these values to indicate the 00307 * amount of \b remaining buffer. So, on return, #avail_out is not the amount 00308 * of output data produced, but rather the amount of output buffer space still 00309 * available. 00310 * 00311 * This means that the values on return are consistent with the values on 00312 * entry, and suitable to be passed in on a second call, but they don't 00313 * directly tell you how much output data was produced. 00314 * 00315 * Note also that if *#avail_in is nonzero on return, then not all of the input 00316 * data has been consumed. The caller should either provide more output buffer 00317 * space and call ::rs_job_iter() again passing the same #next_in and 00318 * #avail_in, or put the remaining input data into some persistent buffer and 00319 * call rs_job_iter() with it again when there is more output space. 00320 * 00321 * \sa rs_job_iter() */ 00322 struct rs_buffers_s { 00323 /** Next input byte. 00324 * 00325 * References a pointer which on entry should point to the start of the 00326 * data to be encoded. Updated to point to the byte after the last one 00327 * consumed. */ 00328 char *next_in; 00329 00330 /** Number of bytes available at next_in. 00331 * 00332 * References the length of available input. Updated to be the number of 00333 * unused data bytes, which will be zero if all the input was consumed. May 00334 * be zero if there is no new input, but the caller just wants to drain 00335 * output. */ 00336 size_t avail_in; 00337 00338 /** True if there is no more data after this. */ 00339 int eof_in; 00340 00341 /** Next output byte should be put there. 00342 * 00343 * References a pointer which on entry points to the start of the output 00344 * buffer. Updated to point to the byte after the last one filled. */ 00345 char *next_out; 00346 00347 /** Remaining free space at next_out. 00348 * 00349 * References the size of available output buffer. Updated to the size of 00350 * unused output buffer. */ 00351 size_t avail_out; 00352 }; 00353 00354 /** \sa ::rs_buffers_s */ 00355 typedef struct rs_buffers_s rs_buffers_t; 00356 00357 /** Default block length, if not determined by any other factors. 00358 * 00359 * The 2K default assumes a typical file is about 4MB and should be OK for 00360 * files up to 32G with more than 1GB ram. */ 00361 # define RS_DEFAULT_BLOCK_LEN 2048 00362 00363 /** Default minimum strong sum length, if the filesize is unknown. 00364 * 00365 * This is conservative, and should be safe for files less than 45TB with a 2KB 00366 * block_len, assuming no collision attack with crafted data. */ 00367 # define RS_DEFAULT_MIN_STRONG_LEN 12 00368 00369 /** Job of work to be done. 00370 * 00371 * Created by functions such as rs_sig_begin(), and then iterated over by 00372 * rs_job_iter(). 00373 * 00374 * The contents are opaque to the application, and instances are always 00375 * allocated by the library. 00376 * 00377 * \sa \ref api_streaming \sa rs_job */ 00378 typedef struct rs_job rs_job_t; 00379 00380 /** Run a ::rs_job state machine until it blocks (::RS_BLOCKED), returns an 00381 * error, or completes (::RS_DONE). 00382 * 00383 * \param job Description of job state. 00384 * 00385 * \param buffers Pointer to structure describing input and output buffers. 00386 * 00387 * \return The ::rs_result that caused iteration to stop. 00388 * 00389 * \c buffers->eof_in should be true if there is no more data after what's in 00390 * the input buffer. The final block checksum will run across whatever's in 00391 * there, without trying to accumulate anything else. 00392 * 00393 * \sa \ref api_streaming */ 00394 LIBRSYNC_EXPORT rs_result rs_job_iter(rs_job_t *job, rs_buffers_t *buffers); 00395 00396 /** Type of application-supplied function for rs_job_drive(). 00397 * 00398 * \sa \ref api_pull */ 00399 typedef rs_result rs_driven_cb(rs_job_t *job, rs_buffers_t *buf, 00400 void *opaque); 00401 00402 /** Actively process a job, by making callbacks to fill and empty the buffers 00403 * until the job is done. */ 00404 LIBRSYNC_EXPORT rs_result rs_job_drive(rs_job_t *job, rs_buffers_t *buf, 00405 rs_driven_cb in_cb, void *in_opaque, 00406 rs_driven_cb out_cb, void *out_opaque); 00407 00408 /** Return a pointer to the statistics in a job. */ 00409 LIBRSYNC_EXPORT const rs_stats_t *rs_job_statistics(rs_job_t *job); 00410 00411 /** Deallocate job state. */ 00412 LIBRSYNC_EXPORT rs_result rs_job_free(rs_job_t *); 00413 00414 /** Get or check signature arguments for a given file size. 00415 * 00416 * This can be used to get the recommended arguments for generating a 00417 * signature. On calling, old_fsize should be set to the old file size or -1 00418 * for "unknown". The magic and block_len arguments should be set to a valid 00419 * value or 0 for "recommended". The strong_len input should be set to a valid 00420 * value, 0 for "maximum", or -1 for "miniumum". Use strong_len=0 for the best 00421 * protection against active hash collision attacks for the given magic type. 00422 * Use strong_len=-1 for the smallest signature size that is safe against 00423 * random hash collisions for the block_len and old_fsize. Use strong_len=20 00424 * for something probably good enough against attacks with smaller signatures. 00425 * On return the 0 or -1 input args will be set to recommended values and the 00426 * returned result will indicate if any inputs were invalid. 00427 * 00428 * \param old_fsize - the original file size (-1 for "unknown"). 00429 * 00430 * \param *magic - the magic type to use (0 for "recommended"). 00431 * 00432 * \param *block_len - the block length to use (0 for "recommended"). 00433 * 00434 * \param *strong_len - the strongsum length to use (0 for "maximum", -1 for 00435 * "minimum"). 00436 * 00437 * \return RS_DONE if all arguments are valid, otherwise an error code. */ 00438 LIBRSYNC_EXPORT rs_result rs_sig_args(rs_long_t old_fsize, 00439 rs_magic_number * magic, 00440 size_t *block_len, size_t *strong_len); 00441 00442 /** Start generating a signature. 00443 * 00444 * It's recommended you use rs_sig_args() to get the recommended arguments for 00445 * this based on the original file size. 00446 * 00447 * \return A new rs_job_t into which the old file data can be passed. 00448 * 00449 * \param sig_magic Signature file format to generate (0 for "recommended"). 00450 * See ::rs_magic_number. 00451 * 00452 * \param block_len Checksum block size to use (0 for "recommended"). Larger 00453 * values make the signature shorter, and the delta longer. 00454 * 00455 * \param strong_len Strongsum length in bytes to use (0 for "maximum", -1 for 00456 * "minimum"). Smaller values make the signature shorter but increase the risk 00457 * of corruption from hash collisions. 00458 * 00459 * \sa rs_sig_file() */ 00460 LIBRSYNC_EXPORT rs_job_t *rs_sig_begin(size_t block_len, size_t strong_len, 00461 rs_magic_number sig_magic); 00462 00463 /** Prepare to compute a streaming delta. 00464 * 00465 * \todo Add a version of this that takes a ::rs_magic_number controlling the 00466 * delta format. */ 00467 LIBRSYNC_EXPORT rs_job_t *rs_delta_begin(rs_signature_t *); 00468 00469 /** Read a signature from a file into an ::rs_signature structure in memory. 00470 * 00471 * Once there, it can be used to generate a delta to a newer version of the 00472 * file. 00473 * 00474 * \note After loading the signatures, you must call \ref rs_build_hash_table() 00475 * before you can use them. */ 00476 LIBRSYNC_EXPORT rs_job_t *rs_loadsig_begin(rs_signature_t **); 00477 00478 /** Call this after loading a signature to index it. 00479 * 00480 * Use rs_free_sumset() to release it after use. */ 00481 LIBRSYNC_EXPORT rs_result rs_build_hash_table(rs_signature_t *sums); 00482 00483 /** Callback used to retrieve parts of the basis file. 00484 * 00485 * \param pos Position where copying should begin. 00486 * 00487 * \param len On input, the amount of data that should be retrieved. Updated to 00488 * show how much is actually available, but should not be greater than the 00489 * input value. 00490 * 00491 * \param buf On input, a buffer of at least \p *len bytes. May be updated to 00492 * point to a buffer allocated by the callback if it prefers. */ 00493 typedef rs_result rs_copy_cb(void *opaque, rs_long_t pos, size_t *len, 00494 void **buf); 00495 00496 /** Apply a \a delta to a \a basis file to recreate the \a new file. 00497 * 00498 * This gives you back a ::rs_job_t object, which can be cranked by calling 00499 * rs_job_iter() and updating the stream pointers. When finished, call 00500 * rs_job_free() to dispose of it. 00501 * 00502 * \param copy_cb Callback used to retrieve content from the basis file. 00503 * 00504 * \param copy_arg Opaque environment pointer passed through to the callback. 00505 * 00506 * \todo As output is produced, accumulate the MD4 checksum of the output. Then 00507 * if we find a CHECKSUM command we can check it's contents against the output. 00508 * 00509 * \todo Implement COPY commands. 00510 * 00511 * \sa rs_patch_file() \sa \ref api_streaming */ 00512 LIBRSYNC_EXPORT rs_job_t *rs_patch_begin(rs_copy_cb * copy_cb, void *copy_arg); 00513 00514 # ifndef RSYNC_NO_STDIO_INTERFACE 00515 # include <stdio.h> 00516 00517 /** Open a file with special handling for stdin or stdout. 00518 * 00519 * This provides a platform independent way to open large binary files. A 00520 * filename "" or "-" means use stdin for reading, or stdout for writing. 00521 * 00522 * \param filename - The filename to open. 00523 * 00524 * \param mode - fopen style mode string. 00525 * 00526 * \param force - bool to force overwriting of existing files. */ 00527 LIBRSYNC_EXPORT FILE *rs_file_open(char const *filename, char const *mode, 00528 int force); 00529 00530 /** Close a file with special handling for stdin or stdout. 00531 * 00532 * This will not actually close the file if it is stdin or stdout. 00533 * 00534 * \param file - the stdio file to close. */ 00535 LIBRSYNC_EXPORT int rs_file_close(FILE *file); 00536 00537 /** Get the size of a file. 00538 * 00539 * This provides a platform independent way to get the size of large files. It 00540 * will return -1 if the size cannot be determined because it is not a regular 00541 * file. 00542 * 00543 * \param file - the stdio file to get the size of. */ 00544 LIBRSYNC_EXPORT rs_long_t rs_file_size(FILE *file); 00545 00546 /** ::rs_copy_cb that reads from a stdio file. */ 00547 LIBRSYNC_EXPORT rs_result rs_file_copy_cb(void *arg, rs_long_t pos, size_t *len, 00548 void **buf); 00549 00550 /** Buffer sizes for file IO. 00551 * 00552 * The default 0 means use the recommended buffer size for the operation being 00553 * performed, any other value will override the recommended sizes. You probably 00554 * only need to change these in testing. */ 00555 LIBRSYNC_EXPORT extern int rs_inbuflen, rs_outbuflen; 00556 00557 /** Generate the signature of a basis file, and write it out to another. 00558 * 00559 * It's recommended you use rs_sig_args() to get the recommended arguments for 00560 * this based on the original file size. 00561 * 00562 * \param old_file Stdio readable file whose signature will be generated. 00563 * 00564 * \param sig_file Writable stdio file to which the signature will be written./ 00565 * 00566 * \param block_len Checksum block size to use (0 for "recommended"). Larger 00567 * values make the signature shorter, and the delta longer. 00568 * 00569 * \param strong_len Strongsum length in bytes to use (0 for "maximum", -1 for 00570 * "minimum"). Smaller values make the signature shorter but increase the risk 00571 * of corruption from hash collisions. 00572 * 00573 * \param sig_magic Signature file format to generate (0 for "recommended"). 00574 * See ::rs_magic_number. 00575 * 00576 * \param stats Optional pointer to receive statistics. 00577 * 00578 * \sa \ref api_whole */ 00579 LIBRSYNC_EXPORT rs_result rs_sig_file(FILE *old_file, FILE *sig_file, 00580 size_t block_len, size_t strong_len, 00581 rs_magic_number sig_magic, 00582 rs_stats_t *stats); 00583 00584 /** Load signatures from a signature file into memory. 00585 * 00586 * \param sig_file Readable stdio file from which the signature will be read. 00587 * 00588 * \param sumset on return points to the newly allocated structure. 00589 * 00590 * \param stats Optional pointer to receive statistics. 00591 * 00592 * \sa \ref api_whole */ 00593 LIBRSYNC_EXPORT rs_result rs_loadsig_file(FILE *sig_file, 00594 rs_signature_t **sumset, 00595 rs_stats_t *stats); 00596 00597 /** Generate a delta between a signature and a new file into a delta file. 00598 * 00599 * \sa \ref api_whole */ 00600 LIBRSYNC_EXPORT rs_result rs_delta_file(rs_signature_t *, FILE *new_file, 00601 FILE *delta_file, rs_stats_t *); 00602 00603 /** Apply a patch, relative to a basis, into a new file. 00604 * 00605 * \sa \ref api_whole */ 00606 LIBRSYNC_EXPORT rs_result rs_patch_file(FILE *basis_file, FILE *delta_file, 00607 FILE *new_file, rs_stats_t *); 00608 # endif /* !RSYNC_NO_STDIO_INTERFACE */ 00609 00610 # ifdef __cplusplus 00611 } /* extern "C" */ 00612 # endif 00613 00614 #endif /* !_RSYNC_H */