/* SPDX-License-Identifier: Apache-2.0 */ /* Copyright 2026 Thorsten Töpper * * vim:ts=4:sw=4:expandtab */ #ifndef FILE_PROCESSOR_H #define FILE_PROCESSOR_H #include #define DF_BYTE_SIZE_256 32 #define DF_BYTE_SIZE_512 64 #define DF_STR_SIZE_256 64 #define DF_STR_SIZE_512 128 /* Aliases for convenience, currently all algorithms are part of the default * provider. */ #define DF_OSSL_BLAKE2 "BLAKE2B-512" #define DF_OSSL_SHA256 "SHA2-256" #define DF_OSSL_SHA512 "SHA2-512" /** * The hashes in human-readable strings */ struct df_hashstrings { char blake2[DF_STR_SIZE_512+1]; char sha256[DF_STR_SIZE_256+1]; char sha512[DF_STR_SIZE_512+1]; }; /** * information about a file * Contains filepath, stat() results, hash values of multiple algorithms. * TODO: Organize the paths in a global pool (list/tree/map) and only refer there * without any free() calls triggered through the pointer in the struct. */ struct df_fileinfo { char *path; /**< pointer to the path of the file */ char *name; /**< pointer to the name of the file */ #if 0 unsigned char blake2[DF_BYTE_SIZE_512]; /**< The BLAKE2-512 hash in binary form */ unsigned char sha256[DF_BYTE_SIZE_256]; /**< The SHA256 hash in binary form. */ unsigned char sha512[DF_BYTE_SIZE_512]; /**< The SHA512 hash in binary form. */ #endif struct df_hashstrings hashes; /**< The BLAKE2-512, SHA256 and SHA512 hash of the file */ struct stat statbuf; /**< Result of lstat() call. Symlinks are to be ignored and filtered out earlier. */ }; /*=========== FUNCTIONS ===========*/ int process_file(struct df_fileinfo *info); int process_gdbm_content(); #endif