28 #ifndef TRONCONNEUSE_HPP
29 #define TRONCONNEUSE_HPP
31 #include "../my_config.h"
117 void inherited_read_ahead(
const infinint & amount);
120 U_I inherited_read(
char *a, U_I size);
125 void inherited_write(
const char *a, U_I size);
128 void inherited_sync_write() { flush(); };
131 void inherited_flush_read() { buf_byte_data = 0; };
134 void inherited_terminate() {};
167 const char *clear_buf,
const U_32 clear_size,
const U_32 clear_allocated,
168 char *crypt_buf, U_32 crypt_size) = 0;
179 const char *crypt_buf,
const U_32 crypt_size,
180 char *clear_buf, U_32 clear_size) = 0;
184 infinint initial_shift;
191 U_32 clear_block_size;
192 infinint current_position;
196 U_32 encrypted_buf_size;
197 U_32 encrypted_buf_data;
200 infinint extra_buf_offset;
207 archive_version reading_ver;
208 infinint (*trailing_clear_data)(
generic_file & below,
const archive_version & reading_ver);
225 void position_clear2crypt(
const infinint & pos,
226 infinint & file_buf_start,
227 infinint & clear_buf_start,
228 infinint & pos_in_buf,
229 infinint & block_num);
231 void position_crypt2clear(
const infinint & pos, infinint & clear_pos);
235 bool check_current_position() {
return fill_buf() < buf_byte_data; };
241 void remove_trailing_clear_data_from_encrypted_buf(
const infinint & crypt_offset);
bool skip_relative(S_I x)
inherited from generic_file
bool skip_to_eof()
inherited from generic_file
virtual ~tronconneuse()
destructor
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 set_callback_trailing_clear_data(infinint(*call_back)(generic_file &below, const archive_version &reading_ver))
this is a partial implementation of the generic_file interface to cypher/decypher data block by block...
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
class generic_file is defined here as well as class fichierthe generic_file interface is widely used ...
const tronconneuse & operator=(const tronconneuse &ref)
assignment operator
bool skip(const infinint &pos)
inherited from generic_file
void write_end_of_file()
in write_only mode indicate that end of file is reached
bool is_terminated() const
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...
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
infinint get_position() const
inherited from generic_file
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
generic_file(gf_mode m)
main constructor
tronconneuse(U_32 block_size, generic_file &encrypted_side, bool no_initial_shift, const archive_version &reading_ver)
This is the constructor.
switch module to limitint (32 ou 64 bits integers) or infinint
this is the interface class from which all other data transfer classes inherit
class archive_version that rules which archive format to follow
the arbitrary large positive integer class
class archive_version manages the version of the archive format
tronconneuse(const tronconneuse &ref)
copy constructor
bool skippable(skippability direction, const infinint &amount)
inherited from generic_file