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 <mbp@sourcefrog.net>
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  /* Arguments for initializing the signature used by mksum.c and
44  * readsums.c. */
45  int sig_magic;
46  int sig_block_len;
47  int sig_strong_len;
48 
49  /** The size of the signature file if available. Used by loadsums.c
50  * when initializing the signature to preallocate memory. */
52 
53  /** Pointer to the signature that's being used by the operation. */
55 
56  /** Flag indicating signature should be destroyed with the job. */
58 
59  /** Command byte currently being processed, if any. */
60  unsigned char op;
61 
62  /** The weak signature digest used by readsums.c */
63  rs_weak_sum_t weak_sig;
64 
65  /** The rollsum weak signature accumulator used by delta.c */
66  Rollsum weak_sum;
67 
68  /** Lengths of expected parameters. */
69  rs_long_t param1, param2;
70 
71  struct rs_prototab_ent const *cmd;
72  rs_mdfour_t output_md4;
73 
74  /** Encoding statistics. */
76 
77  /**
78  * Buffer of data in the scoop. Allocation is
79  * scoop_buf[0..scoop_alloc], and scoop_next[0..scoop_avail] contains
80  * data yet to be processed. scoop_next[scoop_pos..scoop_avail] is the
81  * data yet to be scanned. */
82  rs_byte_t *scoop_buf; /* the allocation pointer */
83  rs_byte_t *scoop_next; /* the data pointer */
84  size_t scoop_alloc; /* the allocation size */
85  size_t scoop_avail; /* the data size */
86  size_t scoop_pos; /* the scan position */
87 
88  /** If USED is >0, then buf contains that much write data to
89  * be sent out. */
90  rs_byte_t write_buf[36];
91  int write_len;
92 
93  /** If \p copy_len is >0, then that much data should be copied
94  * through from the input. */
96 
97  /** Copy from the basis position. */
98  rs_long_t basis_pos, basis_len;
99 
100  /** Callback used to copy data from the basis into the output. */
102  void *copy_arg;
103 
104 };
105 
106 
107 rs_job_t * rs_job_new(const char *, rs_result (*statefn)(rs_job_t *));
108 
109 void rs_job_check(rs_job_t *job);
110 
111 int rs_job_input_is_ending(rs_job_t *job);
Description of input and output buffers.
Definition: librsync.h:361
rs_copy_cb * copy_cb
Callback used to copy data from the basis into the output.
Definition: job.h:101
rs_long_t copy_len
If copy_len is >0, then that much data should be copied through from the input.
Definition: job.h:95
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:90
unsigned char op
Command byte currently being processed, if any.
Definition: job.h:60
rs_signature_t * signature
Pointer to the signature that&#39;s being used by the operation.
Definition: job.h:54
int job_owns_sig
Flag indicating signature should be destroyed with the job.
Definition: job.h:57
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:69
rs_weak_sum_t weak_sig
The weak signature digest used by readsums.c.
Definition: job.h:63
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:532
rs_long_t basis_pos
Copy from the basis position.
Definition: job.h:98
rs_result(* statefn)(rs_job_t *)
Callback for each processing step.
Definition: job.h:38
rs_stats_t stats
Encoding statistics.
Definition: job.h:75
rs_long_t sig_fsize
The size of the signature file if available.
Definition: job.h:51
const char * job_name
Human-readable job operation name.
Definition: job.h:33
Signature of a whole file.
Definition: sumset.h:39
Performance statistics from a librsync encoding or decoding operation.
Definition: librsync.h:236
Rollsum weak_sum
The rollsum weak signature accumulator used by delta.c.
Definition: job.h:66
rs_result
Return codes from nonblocking rsync operations.
Definition: librsync.h:193
struct rs_mdfour rs_mdfour_t
MD4 message-digest accumulator.
Definition: librsync.h:267
rs_byte_t * scoop_buf
Buffer of data in the scoop.
Definition: job.h:82
The contents of this structure are private.
Definition: job.h:29