summaryrefslogtreecommitdiff
path: root/rsync/job.h
authorkergoth <kergoth>2002-01-25 22:14:26 (UTC)
committer kergoth <kergoth>2002-01-25 22:14:26 (UTC)
commit15318cad33835e4e2dc620d033e43cd930676cdd (patch) (unidiff)
treec2fa0399a2c47fda8e2cd0092c73a809d17f68eb /rsync/job.h
downloadopie-15318cad33835e4e2dc620d033e43cd930676cdd.zip
opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz
opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2
Initial revision
Diffstat (limited to 'rsync/job.h') (more/less context) (ignore whitespace changes)
-rw-r--r--rsync/job.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/rsync/job.h b/rsync/job.h
new file mode 100644
index 0000000..33c0cd7
--- a/dev/null
+++ b/rsync/job.h
@@ -0,0 +1,99 @@
1/*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*-
2 *
3 * librsync -- the library for network deltas
4 * $Id$
5 *
6 * Copyright (C) 2000, 2001 by Martin Pool <mbp@samba.org>
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
24struct rs_job {
25 int dogtag;
26
27 /** Human-readable job operation name. */
28 const char *job_name;
29
30 rs_buffers_t *stream;
31
32 /** Callback for each processing step. */
33 rs_result (*statefn)(rs_job_t *);
34
35 /** Final result of processing job. Used by rs_job_s_failed(). */
36 rs_result final_result;
37
38 /* XXX: These next two are redundant with their equivalents in the
39 * signature field. Perhaps we should get rid of them, but
40 * they're also used in the mksum operation. */
41 int block_len;
42 int strong_sum_len;
43
44 /** Signature that's either being read in, or used for
45 * generating a delta. */
46 rs_signature_t *signature;
47
48 /** Command byte currently being processed, if any. */
49 unsigned char op;
50
51 /** If in the middle of reading a signature (rs_loadsig_s_weak()),
52 * or generating a delta, this contains the weak signature. */
53 rs_weak_sum_t weak_sig;
54
55 /** If generating a delta, this is true if we have a valid weak signature and
56 * can roll it forward. */
57 int have_weak_sig;
58
59 /** Lengths of expected parameters. */
60 rs_long_t param1, param2;
61
62 struct rs_prototab_ent const *cmd;
63 rs_mdfour_t output_md4;
64
65 /** Encoding statistics. */
66 rs_stats_t stats;
67
68 /** Buffer of data left over in the scoop. Allocation is
69 * scoop_buf..scoop_alloc, and scoop_next[0..scoop_avail]
70 * contains valid data. */
71 char *scoop_buf;
72 char *scoop_next;
73 size_t scoop_alloc;
74 size_t scoop_avail;
75
76 /** If USED is >0, then buf contains that much write data to
77 * be sent out. */
78 char write_buf[16];
79 int write_len;
80
81 /** If \p copy_len is >0, then that much data should be copied
82 * through from the input. */
83 rs_long_t copy_len;
84
85 /** Copy from the basis position. */
86 rs_long_t basis_pos, basis_len;
87
88 /** Callback used to copy data from the basis into the output. */
89 rs_copy_cb *copy_cb;
90 void *copy_arg;
91};
92
93
94rs_job_t * rs_job_new(const char *, rs_result (*statefn)(rs_job_t *));
95
96void rs_job_check(rs_job_t *job);
97const rs_stats_t *rs_job_statistics(rs_job_t *);
98
99int rs_job_input_is_ending(rs_job_t *job);