$treeview $search $mathjax $extrastylesheet
librsync  2.0.2
$projectbrief
$projectbrief
$searchbox

netint.c File Reference

Network-byte-order output to the tube. More...

Go to the source code of this file.

Defines

#define RS_MAX_INT_BYTES   8

Functions

rs_result rs_squirt_byte (rs_job_t *job, unsigned char d)
 Write a single byte to a stream output.
rs_result rs_squirt_netint (rs_job_t *job, rs_long_t d, int len)
 Write a variable-length integer to a stream.
rs_result rs_squirt_n4 (rs_job_t *job, int val)
rs_result rs_suck_netint (rs_job_t *job, rs_long_t *v, int len)
rs_result rs_suck_byte (rs_job_t *job, unsigned char *v)
rs_result rs_suck_n4 (rs_job_t *job, int *v)
int rs_int_len (rs_long_t val)

Detailed Description

Network-byte-order output to the tube.

All the `suck' routines return a result code. The most common values are RS_DONE if they have enough data, or RS_BLOCKED if there is not enough input to proceed.

All the netint operations are done in a fairly simpleminded way, since we don't want to rely on stdint types that may not be available on some platforms.

Todo:
If we don't have <stdint.h> (or perhaps even if we do), determine endianness and integer size by hand and use that to do our own conversion routines. We possibly need this anyhow to do 64-bit integers, since there seems to be no ntohs() analog.

Definition in file netint.c.


Function Documentation

rs_result rs_squirt_byte ( rs_job_t job,
unsigned char  d 
)

Write a single byte to a stream output.

Definition at line 63 of file netint.c.

rs_result rs_squirt_netint ( rs_job_t job,
rs_long_t  d,
int  len 
)

Write a variable-length integer to a stream.

Parameters:
job Job of data.
d Datum to write out.
len Length of integer, in bytes.

Definition at line 76 of file netint.c.