librsync  2.0.1
job.h
1 /*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*-
2  *
3  * librsync -- the library for network deltas
4  *
5  * Copyright (C) 2000, 2001, 2014 by Martin Pool <[email protected]>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this program; if not, write to the Free Software
19  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21 
22 #include "mdfour.h"
23 #include "rollsum.h"
24 
25 /**
26  * \struct rs_job
27  * The contents of this structure are private.
28  */
29 struct rs_job {
30  int dogtag;
31 
32  /** Human-readable job operation name. */
33  const char *job_name;
34 
35  rs_buffers_t *stream;
36 
37  /** Callback for each processing step. */
39 
40  /** Final result of processing job. Used by rs_job_s_failed(). */
42 
43  /* XXX: These next two are redundant with their equivalents in the
44  * signature field. Perhaps we should get rid of them, but
45  * they're also used in the mksum operation. */
46  int block_len;
47  int strong_sum_len;
48 
49  /** Signature that's either being read in, or used for
50  * generating a delta. */
52 
53  /** Command byte currently being processed, if any. */
54  unsigned char op;
55 
56  /** The weak signature digest used by readsums.c */
57  rs_weak_sum_t weak_sig;
58 
59  /** The rollsum weak signature accumulator used by delta.c */
60  Rollsum weak_sum;
61 
62  /** Lengths of expected parameters. */
63  rs_long_t param1, param2;
64 
65  struct rs_prototab_ent const *cmd;
66  rs_mdfour_t output_md4;
67 
68  /** Encoding statistics. */
70 
71  /**
72  * Buffer of data in the scoop. Allocation is
73  * scoop_buf[0..scoop_alloc], and scoop_next[0..scoop_avail] contains
74  * data yet to be processed. scoop_next[scoop_pos..scoop_avail] is the
75  * data yet to be scanned. */
76  rs_byte_t *scoop_buf; /* the allocation pointer */
77  rs_byte_t *scoop_next; /* the data pointer */
78  size_t scoop_alloc; /* the allocation size */
79  size_t scoop_avail; /* the data size */
80  size_t scoop_pos; /* the scan position */
81 
82  /** If USED is >0, then buf contains that much write data to
83  * be sent out. */
84  rs_byte_t write_buf[36];
85  int write_len;
86 
87  /** If \p copy_len is >0, then that much data should be copied
88  * through from the input. */
90 
91  /** Copy from the basis position. */
92  rs_long_t basis_pos, basis_len;
93 
94  /** Callback used to copy data from the basis into the output. */
96  void *copy_arg;
97 
98  int magic;
99 };
100 
101 
102 rs_job_t * rs_job_new(const char *, rs_result (*statefn)(rs_job_t *));
103 
104 void rs_job_check(rs_job_t *job);
105 
106 int rs_job_input_is_ending(rs_job_t *job);
Description of input and output buffers.
Definition: librsync.h:360
rs_copy_cb * copy_cb
Callback used to copy data from the basis into the output.
Definition: job.h:95
rs_long_t copy_len
If copy_len is >0, then that much data should be copied through from the input.
Definition: job.h:89
rs_result final_result
Final result of processing job.
Definition: job.h:41
rs_byte_t write_buf[36]
If USED is >0, then buf contains that much write data to be sent out.
Definition: job.h:84
unsigned char op
Command byte currently being processed, if any.
Definition: job.h:54
rs_signature_t * signature
Signature that&#39;s either being read in, or used for generating a delta.
Definition: job.h:51
long long rs_long_t
A long integer type that can handle the largest file offsets.
rs_long_t param1
Lengths of expected parameters.
Definition: job.h:63
rs_weak_sum_t weak_sig
The weak signature digest used by readsums.c.
Definition: job.h:57
rs_result rs_copy_cb(void *opaque, rs_long_t pos, size_t *len, void **buf)
Callback used to retrieve parts of the basis file.
Definition: librsync.h:531
rs_long_t basis_pos
Copy from the basis position.
Definition: job.h:92
rs_result(* statefn)(rs_job_t *)
Callback for each processing step.
Definition: job.h:38
rs_stats_t stats
Encoding statistics.
Definition: job.h:69
const char * job_name
Human-readable job operation name.
Definition: job.h:33
Performance statistics from a librsync encoding or decoding operation.
Definition: librsync.h:235
Rollsum weak_sum
The rollsum weak signature accumulator used by delta.c.
Definition: job.h:60
rs_result
Return codes from nonblocking rsync operations.
Definition: librsync.h:192
struct rs_mdfour rs_mdfour_t
MD4 message-digest accumulator.
Definition: librsync.h:266
rs_byte_t * scoop_buf
Buffer of data in the scoop.
Definition: job.h:76
The contents of this structure are private.
Definition: job.h:29