librsync  2.3.4
netint.h
Go to the documentation of this file.
1 /*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*-
2  *
3  * librsync -- library for network deltas
4  *
5  * Copyright (C) 1999, 2000, 2001 by Martin Pool <mbp@sourcefrog.net>
6  * Copyright (C) 1999 by Andrew Tridgell <tridge@samba.org>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 2.1 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22 
23 /** \file netint.h
24  * Network-byte-order output to the tube.
25  *
26  * All the `suck' routines return a result code. The most common values are
27  * RS_DONE if they have enough data, or RS_BLOCKED if there is not enough input
28  * to proceed.
29  *
30  * The `squirt` routines also return a result code which in theory could be
31  * RS_BLOCKED if there is not enough output space to proceed, but in practice
32  * is always RS_DONE. */
33 #ifndef NETINT_H
34 # define NETINT_H
35 
36 # include "librsync.h"
37 
38 /** Write a single byte to a stream output. */
39 rs_result rs_squirt_byte(rs_job_t *job, rs_byte_t val);
40 
41 /** Write a variable-length integer to a stream.
42  *
43  * \param job - Job of data.
44  *
45  * \param val - Value to write out.
46  *
47  * \param len - Length of integer, in bytes. */
48 rs_result rs_squirt_netint(rs_job_t *job, rs_long_t val, int len);
49 
50 rs_result rs_squirt_n4(rs_job_t *job, int val);
51 
52 rs_result rs_suck_byte(rs_job_t *job, rs_byte_t *val);
53 
54 rs_result rs_suck_netint(rs_job_t *job, rs_long_t *val, int len);
55 
56 rs_result rs_suck_n4(rs_job_t *job, int *val);
57 
58 int rs_int_len(rs_long_t val);
59 
60 #endif /* !NETINT_H */
rs_result rs_squirt_netint(rs_job_t *job, rs_long_t val, int len)
Write a variable-length integer to a stream.
Definition: netint.c:44
Public header for librsync.
rs_result
Return codes from nonblocking rsync operations.
Definition: librsync.h:180
rs_result rs_squirt_byte(rs_job_t *job, rs_byte_t val)
Write a single byte to a stream output.
Definition: netint.c:38
The contents of this structure are private.
Definition: job.h:47