7ecba4e0d5
CI / lint (pull_request) Failing after 3s
CI / build-and-test (pull_request) Has been skipped
CI / sanitizers (address) (pull_request) Has been skipped
CI / sanitizers (undefined) (pull_request) Has been skipped
CI / fuzz-build (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / valgrind (pull_request) Has been skipped
- Fix transport_tcp.c: initialize server->ssl_ctx to NULL (prevents SSL_CTX_free on garbage when server_create_tls fails) - Fix test_transport_tcp.c: client_create now sets fd=-1, family=AF_UNSPEC - Fix test_transport_tcp.c: server address family may be AF_INET or AF_INET6 - Fix test_file_sendfile.c: send_path=false protocol includes file_type prefix
44 lines
1.3 KiB
C
44 lines
1.3 KiB
C
#ifndef FILE_H
|
|
#define FILE_H
|
|
|
|
#include "config.h"
|
|
#include "data.h"
|
|
#include <stdbool.h>
|
|
#include <sys/stat.h>
|
|
|
|
typedef enum { FILE_TYPE_REGULAR, FILE_TYPE_SYMLINK, FILE_TYPE_DIR } FileType;
|
|
|
|
typedef struct {
|
|
mode_t mode;
|
|
uid_t uid;
|
|
gid_t gid;
|
|
time_t mtime_sec;
|
|
long mtime_nsec;
|
|
} FileMetadata;
|
|
|
|
typedef struct {
|
|
char* path;
|
|
Data* data;
|
|
FileMetadata* metadata;
|
|
FileType type;
|
|
char* link_target;
|
|
} File;
|
|
|
|
File* file_create(const char* path);
|
|
void file_destroy(void* item);
|
|
bool file_load_data(File* file);
|
|
File* file_receive(const Config* config, int file_descriptor);
|
|
bool file_send_single_calls(File* file, int file_descriptor, bool use_metadata,
|
|
int compression_level, bool send_path);
|
|
bool file_send_sendfile(File* file, int file_descriptor, bool use_metadata, int compression_level,
|
|
bool send_path);
|
|
size_t file_content_to_buffer(File* file);
|
|
FileMetadata* file_metadata_create(const struct stat* stats);
|
|
void file_metadata_destroy(void* metadata);
|
|
bool to_disk(const char* path, const void* data, unsigned long long data_size);
|
|
bool file_save_to_disk(const char* root_directory, File* file);
|
|
File* receive_incremental_check(int fd, const Config* config, bool* skipped);
|
|
int receive_manifest(int fd, const Config* config, int* next_status);
|
|
|
|
#endif
|