28 #ifndef TRONCONNEUSE_HPP
29 #define TRONCONNEUSE_HPP
31 #include "../my_config.h"
67 std::unique_ptr<crypto_module> & ptr);
179 void nullifyptr() noexcept;
180 void detruit() noexcept;
infinint buf_offset
offset of the first byte in buf
virtual void inherited_flush_read() override
this protected inherited method is now private for inherited classes of tronconneuse ...
virtual bool truncatable(const infinint &pos) const override
inherited from generic_file
bool check_current_position()
return true if a there is a byte of information at the given offset
virtual void inherited_write(const char *a, U_I size) override
inherited from generic_file
virtual ~tronconneuse() noexcept override
destructor
virtual bool skip_relative(S_I x) override
inherited from generic_file
void position_crypt2clear(const infinint &pos, infinint &clear_pos)
virtual void inherited_terminate() override
this protected inherited method is now private for inherited classes of tronconneuse ...
this is a partial implementation of the generic_file interface to cypher/decypher data block by block...
tronconneuse(U_32 block_size, generic_file &encrypted_side, const archive_version &reading_ver, std::unique_ptr< crypto_module > &ptr)
This is the constructor.
virtual void inherited_read_ahead(const infinint &amount) override
inherited from generic_file
std::unique_ptr< crypto_module > crypto
wraps the per block encryption/decryption routines
bool weof
whether write_end_of_file() has been called
U_32 clear_block_size
max amount of data that will be encrypted at once (must stay less than buf_size)
tronconneuse(tronconneuse &&ref) noexcept
move constructor
infinint initial_shift
the initial_shift first bytes of the underlying file are not encrypted
U_32 buf_byte_data
number of byte of information in buf (buf_byte_data <= buf_size)
infinint block_num
block number we next read or write
char * buf
decrypted data (or data to encrypt)
infinint current_position
position of the next character to read or write from the upper layer perspective, offset zero is the ...
bool is_terminated() const
virtual void set_callback_trailing_clear_data(trailing_clear_data_callback callback) override
generic_file * encrypted
generic_file where is put / get the encrypted data
virtual U_I inherited_read(char *a, U_I size) override
this protected inherited method is now private for inherited classes of tronconneuse ...
U_32 extra_buf_size
allocated size of extra_buf
infinint extra_buf_offset
offset of the first byte of extra_buf
virtual U_32 get_clear_block_size() const override
returns the block size give to constructor
infinint(* trailing_clear_data_callback)(generic_file &below, const archive_version &reading_ver)
the trailing_clear_data_callback call back is a mean by which the upper layer cat tell when encrypted...
archive_version reading_ver
archive format we currently read
virtual void inherited_truncate(const infinint &pos) override
this prorected inherited method is now private for inherited classed of tronconneuse ...
trailing_clear_data_callback trailing_clear_data
callback function that gives the amount of clear data found at the end of the given file ...
void remove_trailing_clear_data_from_encrypted_buf(const infinint &crypt_offset)
tronconneuse & operator=(const tronconneuse &ref)
assignment operator
switch module to limitint (32 ou 64 bits integers) or infinint
virtual void set_initial_shift(const infinint &x) override
this method to modify the initial shift. This overrides the constructor "no_initial_shift" of the con...
virtual void write_end_of_file() override
in write_only mode indicate that end of file is reached
per block cryptography implementationused for strong encryption.
void position_clear2crypt(const infinint &pos, infinint &file_buf_start, infinint &clear_buf_start, infinint &pos_in_buf, infinint &block_num)
convert clear position to corresponding position in the encrypted data
this is the interface class from which all other data transfer classes inherit
U_32 encrypted_buf_size
allocated size of encrypted_buf
virtual bool skip_to_eof() override
inherited from generic_file
U_32 fill_buf()
returns the position (of the next read op) inside the buffer and fill the buffer with clear data ...
U_32 buf_size
size of allocated memory for clear data in buf
class archive_version that rules which archive format to follow
defines common interface for tronconneuse and parallel_tronconneuse
void init_buf()
initialize if necessary the various buffers that relies on inherited method values ...
the arbitrary large positive integer class
virtual bool skippable(skippability direction, const infinint &amount) override
inherited from generic_file
class archive_version manages the version of the archive format
U_32 extra_buf_data
amount of byte of information in extra_buf
bool reof
whether we reached eof while reading
char * extra_buf
additional read encrypted that follow what is in encrypted_buf used to check for clear data after enc...
tronconneuse(const tronconneuse &ref)
copy constructor
U_32 encrypted_buf_data
amount of byte of information in encrypted_buf
void flush()
flush any pending data (write mode only) to encrypted device
virtual bool skip(const infinint &pos) override
inherited from generic_file
char * encrypted_buf
buffer of encrypted data (read or to write)
libdar namespace encapsulate all libdar symbols
virtual void inherited_sync_write() override
this protected inherited method is now private for inherited classes of tronconneuse ...
virtual infinint get_position() const override
inherited from generic_file