From 15318cad33835e4e2dc620d033e43cd930676cdd Mon Sep 17 00:00:00 2001 From: kergoth Date: Fri, 25 Jan 2002 22:14:26 +0000 Subject: Initial revision --- (limited to 'rsync/sumset.h') diff --git a/rsync/sumset.h b/rsync/sumset.h new file mode 100644 index 0000000..a501b23 --- a/dev/null +++ b/rsync/sumset.h @@ -0,0 +1,67 @@ +/*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- + * + * librsync -- the library for network deltas + * $Id$ + * + * Copyright (C) 1999, 2000, 2001 by Martin Pool + * Copyright (C) 1999 by Andrew Tridgell + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* + * TODO: These structures are not terribly useful. Perhaps we need a + * splay tree or something that will let us smoothly grow as data is + * read in. + */ + + +/** + * \brief Description of the match described by a signature. + */ +typedef struct rs_target { + unsigned short t; + int i; +} rs_target_t; + +typedef struct rs_block_sig rs_block_sig_t; + +/* + * This structure describes all the sums generated for an instance of + * a file. It incorporates some redundancy to make it easier to + * search. + */ +struct rs_signature { + rs_long_t flength; /* total file length */ + int count; /* how many chunks */ + int remainder; /* flength % block_length */ + int block_len; /* block_length */ + int strong_sum_len; + rs_block_sig_t *block_sigs; /* points to info for each chunk */ + int *tag_table; + rs_target_t *targets; +}; + + +/* + * All blocks are the same length in the current algorithm except for + * the last block which may be short. + */ +struct rs_block_sig { + int i; /* index of this chunk */ + rs_weak_sum_t weak_sum; /* simple checksum */ + rs_strong_sum_t strong_sum; /* checksum */ +}; -- cgit v0.9.0.2