Go to the documentation of this file.
42 rs_trace(
"emit DELTA magic");
50 int param_len = len <= 64 ? 0 : rs_int_len(len);
54 rs_trace(
"emit LITERAL_%d, cmd_byte=%#04x", len, cmd);
55 }
else if (param_len == 1) {
56 cmd = RS_OP_LITERAL_N1;
57 rs_trace(
"emit LITERAL_N1(len=%d), cmd_byte=%#04x", len, cmd);
58 }
else if (param_len == 2) {
59 cmd = RS_OP_LITERAL_N2;
60 rs_trace(
"emit LITERAL_N2(len=%d), cmd_byte=%#04x", len, cmd);
62 assert(param_len == 4);
63 cmd = RS_OP_LITERAL_N4;
64 rs_trace(
"emit LITERAL_N4(len=%d), cmd_byte=%#04x", len, cmd);
84 const int where_bytes = rs_int_len(where);
85 const int len_bytes = rs_int_len(len);
89 cmd = RS_OP_COPY_N8_N1;
90 else if (where_bytes == 4)
91 cmd = RS_OP_COPY_N4_N1;
92 else if (where_bytes == 2)
93 cmd = RS_OP_COPY_N2_N1;
95 assert(where_bytes == 1);
96 cmd = RS_OP_COPY_N1_N1;
99 else if (len_bytes == 2)
101 else if (len_bytes == 4)
104 assert(len_bytes == 8);
108 rs_trace(
"emit COPY_N%d_N%d(where=" FMT_LONG
", len=" FMT_LONG
109 "), cmd_byte=%#04x", where_bytes, len_bytes, where, len, cmd);
115 stats->copy_bytes += len;
116 stats->copy_cmdbytes += 1 + where_bytes + len_bytes;
124 rs_trace(
"emit END, cmd_byte=%#04x", cmd);
rs_result rs_squirt_byte(rs_job_t *job, rs_byte_t val)
Write a single byte to a stream output.
void rs_emit_literal_cmd(rs_job_t *job, int len)
Write a LITERAL command.
How to emit commands to the client.
Public header for librsync.
The contents of this structure are private.
Types of commands present in the encoding stream.
@ RS_DELTA_MAGIC
A delta file.
void rs_emit_end_cmd(rs_job_t *job)
Write an END command.
int lit_cmds
Number of literal commands.
rs_stats_t stats
Encoding statistics.
rs_long_t lit_bytes
Number of literal bytes.
rs_result rs_squirt_netint(rs_job_t *job, rs_long_t val, int len)
Write a variable-length integer to a stream.
void rs_emit_delta_header(rs_job_t *job)
Write the magic for the start of a delta.
Performance statistics from a librsync encoding or decoding operation.
rs_long_t lit_cmdbytes
Number of bytes used in literal command headers.
void rs_emit_copy_cmd(rs_job_t *job, rs_long_t where, rs_long_t len)
Write a COPY command for given offset and length.