 |
Disk ARchive
2.6.8
Full featured and portable backup and archiving tool
|
Go to the documentation of this file.
28 #ifndef TRONCONNEUSE_HPP
29 #define TRONCONNEUSE_HPP
31 #include "../my_config.h"
174 const char *clear_buf,
const U_32 clear_size,
const U_32 clear_allocated,
175 char *crypt_buf, U_32 crypt_size) = 0;
186 const char *crypt_buf,
const U_32 crypt_size,
187 char *clear_buf, U_32 clear_size) = 0;
221 void nullifyptr() noexcept;
222 void detruit() noexcept;
U_32 extra_buf_size
allocated size of extra_buf
virtual U_I inherited_read(char *a, U_I size) override
this protected inherited method is now private for inherited classes of tronconneuse
generic_file(gf_mode m)
main constructor
U_32 buf_size
size of allocated memory for clear data in buf
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
tronconneuse(U_32 block_size, generic_file &encrypted_side, bool no_initial_shift, const archive_version &reading_ver)
This is the constructor.
void init_buf()
initialize if necessary the various buffers that relies on inherited method values
tronconneuse & operator=(const tronconneuse &ref)
assignment operator
virtual U_32 clear_block_allocated_size_for(U_32 clear_block_size)=0
it may be necessary by the inherited class have few more bytes allocated after the clear data given f...
U_32 extra_buf_data
amount of byte of information in extra_buf
switch module to limitint (32 ou 64 bits integers) or infinint
the arbitrary large positive integer class
char * extra_buf
additional read encrypted that follow what is in encrypted_buf used to check for clear data after enc...
class archive_version that rules which archive format to follow
archive_version reading_ver
archive format we currently read
virtual bool skippable(skippability direction, const infinint &amount) override
inherited from generic_file
bool reof
whether we reached eof while reading
U_32 encrypted_buf_data
amount of byte of information in encrypted_buf
virtual bool skip_to_eof() override
inherited from generic_file
bool is_terminated() const
U_32 fill_buf()
returns the position (of the next read op) inside the buffer and fill the buffer with clear data
infinint(* trailing_clear_data)(generic_file &below, const archive_version &reading_ver)
callback function that gives the amount of clear data found at the end of the given file
class archive_version manages the version of the archive format
tronconneuse(const tronconneuse &ref)
copy constructor
U_32 encrypted_buf_size
allocated size of encrypted_buf
void position_crypt2clear(const infinint &pos, infinint &clear_pos)
char * encrypted_buf
buffer of encrypted data (read or to write)
virtual void inherited_flush_read() override
this protected inherited method is now private for inherited classes of tronconneuse
class generic_file is defined here as well as class fichier
virtual bool skip(const infinint &pos) override
inherited from generic_file
virtual void inherited_terminate() override
this protected inherited method is now private for inherited classes of tronconneuse
bool check_current_position()
return true if a there is a byte of information at the given offset
virtual bool skip_relative(S_I x) override
inherited from generic_file
void set_callback_trailing_clear_data(infinint(*call_back)(generic_file &below, const archive_version &reading_ver))
U_32 clear_block_size
max amount of data that will be encrypted at once (must stay less than buf_size)
bool weof
whether write_end_of_file() has been called
infinint initial_shift
the initial_shift first bytes of the underlying file are not encrypted
void flush()
flush any pending data (write mode only) to encrypted device
this is the interface class from which all other data transfer classes inherit
virtual void inherited_sync_write() override
this protected inherited method is now private for inherited classes of tronconneuse
virtual void inherited_write(const char *a, U_I size) override
inherited from generic_file
virtual infinint get_position() const override
inherited from generic_file
infinint buf_offset
offset of the first byte in buf
this is a partial implementation of the generic_file interface to cypher/decypher data block by block...
virtual ~tronconneuse() override
destructor
virtual U_32 encrypt_data(const infinint &block_num, const char *clear_buf, const U_32 clear_size, const U_32 clear_allocated, char *crypt_buf, U_32 crypt_size)=0
this method encrypts the clear data given
void set_initial_shift(const infinint &x)
this method to modify the initial shift. This overrides the constructor "no_initial_shift" of the con...
void write_end_of_file()
in write_only mode indicate that end of file is reached
U_32 get_clear_block_size() const
returns the block size give to constructor
virtual void inherited_read_ahead(const infinint &amount) override
inherited from generic_file
tronconneuse(tronconneuse &&ref) noexcept
move constructor
infinint extra_buf_offset
offset of the first byte of extra_buf
generic_file & operator=(const generic_file &ref)
assignment operator
char * buf
decrypted data (or data to encrypt)
infinint block_num
block number we next read or write
generic_file * encrypted
generic_file where is put / get the encrypted data
infinint current_position
position of the next character to read or write from the upper layer perspective, offset zero is the ...
virtual U_32 decrypt_data(const infinint &block_num, const char *crypt_buf, const U_32 crypt_size, char *clear_buf, U_32 clear_size)=0
this method decyphers data
void remove_trailing_clear_data_from_encrypted_buf(const infinint &crypt_offset)
virtual U_32 encrypted_block_size_for(U_32 clear_block_size)=0
defines the size necessary to encrypt a given amount of clear data
U_32 buf_byte_data
number of byte of information in buf (buf_byte_data <= buf_size)
libdar namespace encapsulate all libdar symbols