35#define RS_MAX_INT_BYTES 8
45 rs_byte_t buf[RS_MAX_INT_BYTES];
48 assert(len <= RS_MAX_INT_BYTES);
50 for (i = len - 1; i >= 0; i--) {
51 buf[i] = (rs_byte_t)val;
60 return rs_squirt_netint(job, val, 4);
79 assert(len <= RS_MAX_INT_BYTES);
82 for (i = 0; i < len; i++)
83 *val = (*val << 8) | (rs_long_t)buf[i];
93 if ((result = rs_suck_netint(job, &buf, 4)) ==
RS_DONE)
98int rs_int_len(rs_long_t val)
101 if (!(val & ~(rs_long_t)0xff))
103 if (!(val & ~(rs_long_t)0xffff))
105 if (!(val & ~(rs_long_t)0xffffffff))
107 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_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.