598e4e7514
- Fix rolling adler32: add missing -1 in s2 update formula (was producing wrong checksums, causing zero block matches) - Fix file_send_sendfile signature to match typedef (add unused compression_level param) - Extract receive_delta_file() from receive_incremental_check() to reduce nesting depth - Extract send_file_incremental() helper in client_send.c - Add delta_max_file_size to Config, serialized over wire - Add --delta-max CLI flag - Add test_large_file_delta (200KB) and extra delta_should_attempt cases - Remove unused pos_in_block variable from delta_compute
62 lines
1.6 KiB
C
62 lines
1.6 KiB
C
#ifndef CONFIG_H
|
|
#define CONFIG_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
typedef enum {
|
|
TRANSPORT_TCP,
|
|
TRANSPORT_SSH
|
|
} TransportType;
|
|
|
|
typedef struct Config {
|
|
char *version;
|
|
char *send_directory;
|
|
char *receive_root_directory;
|
|
bool save_to_disk;
|
|
bool use_multithreading;
|
|
bool use_chunk_serialization;
|
|
bool use_compression;
|
|
bool use_sendfile;
|
|
bool use_metadata;
|
|
bool show_progress;
|
|
bool dry_run;
|
|
bool use_delete;
|
|
int compression_level;
|
|
unsigned long long chunk_size;
|
|
int ssh_port;
|
|
TransportType transport;
|
|
char *ssh_destination;
|
|
char **exclude_patterns;
|
|
int exclude_count;
|
|
char **include_patterns;
|
|
int include_count;
|
|
unsigned long long max_size;
|
|
unsigned long long min_size;
|
|
bool use_incremental;
|
|
bool use_delta;
|
|
uint32_t delta_block_size;
|
|
unsigned long long delta_max_file_size;
|
|
bool use_tls;
|
|
char *tls_cert;
|
|
char *tls_key;
|
|
char *tls_ca;
|
|
} Config;
|
|
|
|
#define PROTOCOL_VERSION "1.2.0"
|
|
#define DEFAULT_CHUNK_SIZE (10 * 1024 * 1024)
|
|
|
|
Config *config_create(char *version, char *send_directory,
|
|
char *receive_directory, bool save_to_disk,
|
|
bool use_multithreading, bool use_chunk_serialization,
|
|
bool use_compression, bool use_metadata,
|
|
int compression_level, bool use_sendfile,
|
|
unsigned long long chunk_size);
|
|
void config_delete(Config *config);
|
|
bool config_send(int file_descriptor, Config *config);
|
|
Config *config_receive(int file_descriptor);
|
|
bool is_remote_dest(const char *s);
|
|
void config_parse_ssh_dest(Config *config);
|
|
|
|
#endif
|