blob: a501b23b2023085f2ccc969d1b294c1273bc9710 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*-
*
* librsync -- the library for network deltas
* $Id$
*
* Copyright (C) 1999, 2000, 2001 by Martin Pool <mbp@samba.org>
* Copyright (C) 1999 by Andrew Tridgell <tridge@samba.org>
*
* 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 */
};
|