librsync  2.3.0
stream.h
1 /*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*-
2  *
3  * librsync -- library for network deltas
4  *
5  * Copyright (C) 2000, 2001 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  /*=
23  | Two wars in a lifetime bear hard on the little places.
24  | In winter when storms come rushing out of the dark,
25  | And the bay boils like a cauldron of sharks,
26  | The old remember the trenches at Paschendale
27  | And sons who died on the Burma Railway.
28  */
29 
30 int rs_buffers_is_empty(rs_buffers_t *stream);
31 int rs_buffers_copy(rs_buffers_t *stream, int len);
32 
34 void rs_tube_write(rs_job_t *, void const *buf, size_t len);
35 void rs_tube_copy(rs_job_t *, int len);
36 int rs_tube_is_idle(rs_job_t const *);
37 void rs_check_tube(rs_job_t *);
38 
40 
41 void rs_scoop_advance(rs_job_t *, size_t len);
42 rs_result rs_scoop_readahead(rs_job_t *, size_t len, void **ptr);
43 rs_result rs_scoop_read(rs_job_t *, size_t len, void **ptr);
44 rs_result rs_scoop_read_rest(rs_job_t *, size_t *len, void **ptr);
45 size_t rs_scoop_total_avail(rs_job_t *job);
46 void rs_scoop_input(rs_job_t *job, size_t len);
rs_scoop_input
void rs_scoop_input(rs_job_t *job, size_t len)
Try to accept a from the input buffer to get LEN bytes in the scoop.
Definition: scoop.c:67
rs_result
rs_result
Return codes from nonblocking rsync operations.
Definition: librsync.h:180
rs_buffers_copy
int rs_buffers_copy(rs_buffers_t *stream, int max_len)
Copy up to max_len bytes from input of stream to its output.
Definition: stream.c:96
rs_job
The contents of this structure are private.
Definition: job.h:26
rs_scoop_read_rest
rs_result rs_scoop_read_rest(rs_job_t *job, size_t *len, void **ptr)
Read whatever data remains in the input stream.
Definition: scoop.c:212
rs_tube_catchup
int rs_tube_catchup(rs_job_t *job)
Put whatever will fit from the tube into the output of the stream.
Definition: tube.c:136
rs_scoop_readahead
rs_result rs_scoop_readahead(rs_job_t *job, size_t len, void **ptr)
Read from scoop without advancing.
Definition: scoop.c:148
rs_buffers_check_exit
void rs_buffers_check_exit(rs_buffers_t const *stream)
Assert input is empty or output is full.
Definition: stream.c:134
rs_tube_write
void rs_tube_write(rs_job_t *job, const void *buf, size_t len)
Push some data into the tube for storage.
Definition: tube.c:192
rs_scoop_total_avail
size_t rs_scoop_total_avail(rs_job_t *job)
Return the total number of bytes available including the scoop and input buffer.
Definition: scoop.c:227
rs_scoop_read
rs_result rs_scoop_read(rs_job_t *job, size_t len, void **ptr)
Read LEN bytes if possible, and remove them from the input scoop.
Definition: scoop.c:192
rs_tube_copy
void rs_tube_copy(rs_job_t *job, int len)
Queue up a request to copy through len bytes from the input to the output of the stream.
Definition: tube.c:178
rs_scoop_advance
void rs_scoop_advance(rs_job_t *job, size_t len)
Advance the input cursor forward len bytes.
Definition: scoop.c:117
rs_buffers_s
Description of input and output buffers.
Definition: librsync.h:322