36#define RS_MAX_INT_BYTES 8
46 rs_byte_t buf[RS_MAX_INT_BYTES];
49 assert(len <= RS_MAX_INT_BYTES);
51 for (i = len - 1; i >= 0; i--) {
52 buf[i] = (rs_byte_t)val;
80 assert(len <= RS_MAX_INT_BYTES);
83 for (i = 0; i < len; i++)
84 *val = (*val << 8) | (rs_long_t)buf[i];
94 if ((result = rs_suck_netint(job, &buf, 4)) ==
RS_DONE)
99int rs_int_len(rs_long_t val)
102 if (!(val & ~(rs_long_t)0xff))
104 if (!(val & ~(rs_long_t)0xffff))
106 if (!(val & ~(rs_long_t)0xffffffff))
108 assert(!(val & ~(rs_long_t)0xffffffffffffffff));
Public header for librsync.
rs_result
Return codes from nonblocking rsync operations.
@ RS_DONE
Completed successfully.
Network-byte-order output to the tube.
rs_result rs_squirt_byte(rs_job_t *job, rs_byte_t val)
Write a single byte to a stream output.
rs_result rs_squirt_netint(rs_job_t *job, rs_long_t val, int len)
Write a variable-length integer to a stream.
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.
Manage librsync streams of IO.
void rs_tube_write(rs_job_t *job, void const *buf, size_t len)
Push some data into the tube for storage.
The contents of this structure are private.