e16db56580
Implement rsync-style delta transfer using rolling checksums (Adler-32 + xxHash32). When a file exists on both sides but has changed, only the changed blocks are transmitted instead of the entire file. - New status codes: STATUS_DELTA_SIGNATURE, STATUS_DELTA_DATA - Protocol version bumped to 1.2.0 - Server generates block signature, client computes delta - Auto-fallback to whole-file when delta >= 70% of file size - Works with zstd compression on delta stream - Configurable block size (default 8KB, --delta-block flag) - 13 unit tests covering hashing, signature roundtrip, delta compute/apply, file growth/shrink, and decision logic
30 lines
1000 B
C
30 lines
1000 B
C
#ifndef PROTOCOL_H
|
|
#define PROTOCOL_H
|
|
|
|
#include "data.h"
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
|
|
typedef struct ssl_st SSL;
|
|
|
|
typedef int Status;
|
|
enum NET_STATUS { STATUS_OK, STATUS_ERROR, STATUS_FINISHED, STATUS_NEXT, STATUS_CHUNK, STATUS_MANIFEST, STATUS_CHECK, STATUS_DELTA_SIGNATURE, STATUS_DELTA_DATA };
|
|
|
|
void io_set_fds(int read_fd, int write_fd);
|
|
void io_set_bwlimit(unsigned long long bytes_per_sec);
|
|
typedef struct ssl_st SSL;
|
|
void io_set_ssl(SSL *ssl);
|
|
bool send_n_data(int file_descriptor, void *data, size_t data_size);
|
|
bool receive_n_data(int file_descriptor, void *data, size_t data_size);
|
|
|
|
bool send_str(int file_descriptor, char *data);
|
|
char *receive_str(int file_descriptor);
|
|
bool send_data(int file_descriptor, Data *data);
|
|
Data *receive_data(int file_descriptor);
|
|
bool send_int(int file_descriptor, int data);
|
|
bool receive_int(int file_descriptor, int *data);
|
|
bool send_status(int file_descriptor, Status status);
|
|
bool receive_status(int file_descriptor, Status *status);
|
|
|
|
#endif
|