diff options
author | dotdotisdead <dotdotisdead@a3eca27d-f21b-0410-9b4a-6511e771f64e> | 2006-09-30 04:47:47 +0000 |
---|---|---|
committer | dotdotisdead <dotdotisdead@a3eca27d-f21b-0410-9b4a-6511e771f64e> | 2006-09-30 04:47:47 +0000 |
commit | ad85653ca73c8126de516b9a4294e8f08577c00d (patch) | |
tree | 79fb4d644ccf6a4fe8dac146b801a21d63537b23 /xdelta1/xdeltapriv.h | |
parent | 5a7c245871879325d7b05c06e0b2011203986ee8 (diff) |
import 1.1.3
Diffstat (limited to 'xdelta1/xdeltapriv.h')
-rwxr-xr-x | xdelta1/xdeltapriv.h | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/xdelta1/xdeltapriv.h b/xdelta1/xdeltapriv.h new file mode 100755 index 0000000..9c75f09 --- /dev/null +++ b/xdelta1/xdeltapriv.h | |||
@@ -0,0 +1,131 @@ | |||
1 | /* -*- Mode: C;-*- | ||
2 | * | ||
3 | * This file is part of XDelta - A binary delta generator. | ||
4 | * | ||
5 | * Copyright (C) 1997, 1998, 1999 Josh MacDonald | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | * | ||
21 | * Author: Josh MacDonald <jmacd@CS.Berkeley.EDU> | ||
22 | * | ||
23 | * $Id: xdeltapriv.h 1.29 Sat, 03 Apr 1999 20:09:14 -0800 jmacd $ | ||
24 | */ | ||
25 | |||
26 | #ifndef _XDELTAPRIV_H_ | ||
27 | #define _XDELTAPRIV_H_ | ||
28 | |||
29 | #if 0 | ||
30 | #define DEBUG_CKSUM_UPDATE | ||
31 | #define DEBUG_MATCH_PRINT | ||
32 | #define DEBUG_CKSUM | ||
33 | #define DEBUG_HASH | ||
34 | #define DEBUG_INST | ||
35 | #define CLOBBER_ALGORITHM_C | ||
36 | #define DEBUG_MD5 | ||
37 | #define DEBUG_CONT | ||
38 | #define DEBUG_COPY | ||
39 | #define DEBUG_FIND | ||
40 | #define DEBUG_RSYNC_REQUEST | ||
41 | #define DEBUG_CONT | ||
42 | #define DEBUG_CONT2 | ||
43 | #define DEBUG_CHECK_CONTROL | ||
44 | #endif | ||
45 | |||
46 | typedef struct _XdeltaPos XdeltaPos; | ||
47 | typedef struct _RsyncHash RsyncHash; | ||
48 | |||
49 | #define XPOS(p) (((p).page * (p).page_size) + (p).off) | ||
50 | |||
51 | struct _XdeltaPos { | ||
52 | guint page; | ||
53 | guint page_size; | ||
54 | guint off; | ||
55 | |||
56 | const guint8* mem; | ||
57 | guint mem_page; | ||
58 | guint mem_rem; | ||
59 | }; | ||
60 | |||
61 | #define handle_length(x) ((* (x)->table->table_handle_length) (x)) | ||
62 | #define handle_pages(x) ((* (x)->table->table_handle_pages) (x)) | ||
63 | #define handle_pagesize(x) ((* (x)->table->table_handle_pagesize) (x)) | ||
64 | #define handle_map_page(x,y,z) ((* (x)->table->table_handle_map_page) ((x),(y),(z))) | ||
65 | #define handle_unmap_page(x,y,z) ((* (x)->table->table_handle_unmap_page) ((x),(y),(z))) | ||
66 | #define handle_checksum_md5(x) ((* (x)->table->table_handle_checksum_md5) (x)) | ||
67 | #define handle_close(x,y) ((* (x)->table->table_handle_close) ((x), (y))) | ||
68 | #define handle_write(x,y,z) ((* (x)->table->table_handle_write) ((x),(y),(z))) | ||
69 | #define handle_copy(x,y,z,a) ((* (x)->table->table_handle_copy) ((x),(y),(z),(a))) | ||
70 | |||
71 | struct _XdeltaGenerator | ||
72 | { | ||
73 | GPtrArray *sources; | ||
74 | |||
75 | const guint32 *table; | ||
76 | guint table_size; | ||
77 | |||
78 | guint to_output_pos; | ||
79 | guint data_output_pos; | ||
80 | |||
81 | XdeltaOutStream *data_out; | ||
82 | XdeltaOutStream *control_out; | ||
83 | |||
84 | XdeltaControl *control; | ||
85 | |||
86 | XdeltaSource *data_source; | ||
87 | |||
88 | #ifdef DEBUG_HASH | ||
89 | gint hash_conflicts; /* bucket already used. */ | ||
90 | gint hash_real_conflicts; /* bucket had different checksum. */ | ||
91 | gint hash_real_real_conflicts; /* bucket had same checksum, different region */ | ||
92 | gint hash_fill; | ||
93 | gint hash_entries; | ||
94 | #endif | ||
95 | |||
96 | EdsioMD5Ctx ctx; | ||
97 | }; | ||
98 | |||
99 | struct _XdeltaSource | ||
100 | { | ||
101 | XdeltaStream *source_in; | ||
102 | XdeltaPos source_pos; | ||
103 | |||
104 | gint ck_count; /* number of elts in cksums. */ | ||
105 | const XdeltaChecksum *cksums; /* array of cksums. */ | ||
106 | |||
107 | const char *name; | ||
108 | |||
109 | XdeltaStream *index_in; | ||
110 | XdeltaOutStream *index_out; | ||
111 | |||
112 | gint source_index; | ||
113 | gboolean used; | ||
114 | gboolean sequential; | ||
115 | guint32 position; | ||
116 | }; | ||
117 | |||
118 | #define CHEW(x) (single_hash[(guint)x]) | ||
119 | #define FLIP_FORWARD(p) if ((p).off == (p).page_size) { (p).page += 1; (p).off = 0; } | ||
120 | |||
121 | extern const guint16 single_hash[256]; | ||
122 | |||
123 | void init_pos (XdeltaStream* str, XdeltaPos* pos); | ||
124 | gboolean unmap_page (XdeltaStream* stream, XdeltaPos* pos); | ||
125 | gboolean map_page (XdeltaStream* stream, XdeltaPos* pos); | ||
126 | gboolean check_stream_integrity (XdeltaStream* str, const guint8* md5, guint len); | ||
127 | XdeltaControl* control_new (void); | ||
128 | |||
129 | guint c_hash (const XdeltaChecksum* c); | ||
130 | |||
131 | #endif /* _XDELTAPRIV_H_ */ | ||