summaryrefslogtreecommitdiff
path: root/rsync/sumset.h
Unidiff
Diffstat (limited to 'rsync/sumset.h') (more/less context) (ignore whitespace changes)
-rw-r--r--rsync/sumset.h67
1 files changed, 67 insertions, 0 deletions
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 @@
1/*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*-
2 *
3 * librsync -- the library for network deltas
4 * $Id$
5 *
6 * Copyright (C) 1999, 2000, 2001 by Martin Pool <mbp@samba.org>
7 * Copyright (C) 1999 by Andrew Tridgell <tridge@samba.org>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24
25/*
26 * TODO: These structures are not terribly useful. Perhaps we need a
27 * splay tree or something that will let us smoothly grow as data is
28 * read in.
29 */
30
31
32/**
33 * \brief Description of the match described by a signature.
34 */
35typedef struct rs_target {
36 unsigned short t;
37 int i;
38} rs_target_t;
39
40typedef struct rs_block_sig rs_block_sig_t;
41
42/*
43 * This structure describes all the sums generated for an instance of
44 * a file. It incorporates some redundancy to make it easier to
45 * search.
46 */
47struct rs_signature {
48 rs_long_t flength;/* total file length */
49 int count; /* how many chunks */
50 int remainder;/* flength % block_length */
51 int block_len;/* block_length */
52 int strong_sum_len;
53 rs_block_sig_t *block_sigs; /* points to info for each chunk */
54 int *tag_table;
55 rs_target_t *targets;
56};
57
58
59/*
60 * All blocks are the same length in the current algorithm except for
61 * the last block which may be short.
62 */
63struct rs_block_sig {
64 int i; /* index of this chunk */
65 rs_weak_sum_t weak_sum;/* simple checksum */
66 rs_strong_sum_t strong_sum;/* checksum */
67};