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