Cipherpack v1.2.0-dirty
A Cryprographic Stream Processor
Public Member Functions | Public Attributes | List of all members
LoggingCipherpackListener Class Reference
Inheritance diagram for LoggingCipherpackListener:
Collaboration diagram for LoggingCipherpackListener:

Public Member Functions

 LoggingCipherpackListener (const bool verbose_) noexcept
 
bool contentProcessed (const bool decrypt_mode, const content_type ctype, cipherpack::secure_vector< uint8_t > &data, const bool is_final) noexcept override
 User callback to receive the actual processed content, either the generated cipherpack or plaintext content depending on decrypt_mode. More...
 
bool getSendContent (const bool decrypt_mode) const noexcept override
 User provided information whether process shall send the processed content via contentProcessed() or not. More...
 
void notifyEnd (const bool decrypt_mode, const cipherpack::PackHeader &header) noexcept override
 User notification of successful completion. More...
 
void notifyError (const bool decrypt_mode, const cipherpack::PackHeader &header, const std::string &msg) noexcept override
 User notification about an error via text message and preliminary PackHeader. More...
 
bool notifyHeader (const bool decrypt_mode, const cipherpack::PackHeader &header) noexcept override
 User notification of preliminary PackHeader w/o optional hash of the plaintext message. More...
 
bool notifyProgress (const bool decrypt_mode, const uint64_t plaintext_size, const uint64_t bytes_processed) noexcept override
 User notification about content streaming progress. More...
 
std::string toString () const noexcept override
 
- Public Member Functions inherited from cipherpack::CipherpackListener
 ~CipherpackListener () noexcept override
 
virtual bool contentProcessed (const bool decrypt_mode, const content_type ctype, cipherpack::secure_vector< uint8_t > &data, const bool is_final) noexcept
 User callback to receive the actual processed content, either the generated cipherpack or plaintext content depending on decrypt_mode. More...
 
std::string get_java_class () const noexcept override
 
virtual bool getSendContent (const bool decrypt_mode) const noexcept
 User provided information whether process shall send the processed content via contentProcessed() or not. More...
 
virtual void notifyEnd (const bool decrypt_mode, const PackHeader &header) noexcept
 User notification of successful completion. More...
 
virtual void notifyError (const bool decrypt_mode, const PackHeader &header, const std::string &msg) noexcept
 User notification about an error via text message and preliminary PackHeader. More...
 
virtual bool notifyHeader (const bool decrypt_mode, const PackHeader &header) noexcept
 User notification of preliminary PackHeader w/o optional hash of the plaintext message. More...
 
virtual bool notifyProgress (const bool decrypt_mode, const uint64_t plaintext_size, const uint64_t bytes_processed) noexcept
 User notification about content streaming progress. More...
 
bool operator!= (const CipherpackListener &rhs) const noexcept
 
virtual bool operator== (const CipherpackListener &rhs) const noexcept
 Default comparison operator, merely testing for same memory reference. More...
 
std::string toString () const noexcept override
 

Public Attributes

jau::relaxed_atomic_uint64 count_content
 
jau::relaxed_atomic_int count_end
 
jau::relaxed_atomic_int count_error
 
jau::relaxed_atomic_int count_header
 
jau::relaxed_atomic_int count_progress
 

Additional Inherited Members

- Public Types inherited from cipherpack::CipherpackListener
enum class  content_type : uint8_t { header = 0 , message = 1 }
 
- Static Public Member Functions inherited from cipherpack::CipherpackListener
static std::string java_class () noexcept
 

Detailed Description

Examples
commandline.cpp, and test_01_cipherpack.cpp.

Definition at line 22 of file commandline.cpp.

Constructor & Destructor Documentation

◆ LoggingCipherpackListener()

LoggingCipherpackListener::LoggingCipherpackListener ( const bool  verbose_)
inlinenoexcept
Examples
commandline.cpp.

Definition at line 32 of file commandline.cpp.

Member Function Documentation

◆ notifyError()

void LoggingCipherpackListener::notifyError ( const bool  decrypt_mode,
const cipherpack::PackHeader header,
const std::string &  msg 
)
inlineoverridevirtualnoexcept

User notification about an error via text message and preliminary PackHeader.

This message will be send without a subsequent notifyHeader() or notifyEnd() to indicate an error and hence aborts processing.

Parameters
decrypt_modetrue if sender is decrypting, otherwise sender is encrypting
headerthe preliminary PackHeader
msgthe error message

Reimplemented from cipherpack::CipherpackListener.

Examples
commandline.cpp.

Definition at line 38 of file commandline.cpp.

◆ notifyHeader()

bool LoggingCipherpackListener::notifyHeader ( const bool  decrypt_mode,
const cipherpack::PackHeader header 
)
inlineoverridevirtualnoexcept

User notification of preliminary PackHeader w/o optional hash of the plaintext message.

Parameters
decrypt_modetrue if sender is decrypting, otherwise sender is encrypting
headerthe preliminary PackHeader
Returns
true to continue processing (default), false to abort.

Reimplemented from cipherpack::CipherpackListener.

Examples
commandline.cpp.

Definition at line 44 of file commandline.cpp.

◆ notifyProgress()

bool LoggingCipherpackListener::notifyProgress ( const bool  decrypt_mode,
const uint64_t  plaintext_size,
const uint64_t  bytes_processed 
)
inlineoverridevirtualnoexcept

User notification about content streaming progress.

In case contentProcessed() gets called, notifyProgress() is called thereafter.

Parameters
decrypt_modetrue if sender is decrypting, otherwise sender is encrypting
plaintext_sizethe plaintext message size, zero if not determined yet
bytes_processedthe number of unencrypted bytes processed
Returns
true to continue processing (default), false to abort.
See also
contentProcessed()

Reimplemented from cipherpack::CipherpackListener.

Examples
commandline.cpp.

Definition at line 54 of file commandline.cpp.

◆ notifyEnd()

void LoggingCipherpackListener::notifyEnd ( const bool  decrypt_mode,
const cipherpack::PackHeader header 
)
inlineoverridevirtualnoexcept

User notification of successful completion.

Parameters
decrypt_modetrue if sender is decrypting, otherwise sender is encrypting
headerthe final PackHeader

Reimplemented from cipherpack::CipherpackListener.

Examples
commandline.cpp.

Definition at line 62 of file commandline.cpp.

◆ getSendContent()

bool LoggingCipherpackListener::getSendContent ( const bool  decrypt_mode) const
inlineoverridevirtualnoexcept

User provided information whether process shall send the processed content via contentProcessed() or not.

Parameters
decrypt_modetrue if sender is decrypting, otherwise sender is encrypting
Returns
true if process shall call contentProcessed(), otherwise false (default)
See also
contentProcessed()

Reimplemented from cipherpack::CipherpackListener.

Examples
commandline.cpp.

Definition at line 71 of file commandline.cpp.

◆ contentProcessed()

bool LoggingCipherpackListener::contentProcessed ( const bool  decrypt_mode,
const content_type  ctype,
cipherpack::secure_vector< uint8_t > &  data,
const bool  is_final 
)
inlineoverridevirtualnoexcept

User callback to receive the actual processed content, either the generated cipherpack or plaintext content depending on decrypt_mode.

This callback is only enabled if getSendContent() returns true.

In case contentProcessed() gets called, notifyProgress() is called thereafter.

Parameters
decrypt_modetrue if sender is decrypting, otherwise sender is encrypting
ctypecontent_type of passed data. Always content_type::message if decrypt_mode is true.
datathe processed content, either the generated cipherpack or plaintext content depending on decrypt_mode.
is_finaltrue if this is the last content call, otherwise false
Returns
true to continue processing (default), false to abort.
See also
getSendContent()

Reimplemented from cipherpack::CipherpackListener.

Examples
commandline.cpp.

Definition at line 76 of file commandline.cpp.

◆ toString()

std::string LoggingCipherpackListener::toString ( ) const
inlineoverridenoexcept
Examples
commandline.cpp.

Definition at line 84 of file commandline.cpp.

Member Data Documentation

◆ count_error

jau::relaxed_atomic_int LoggingCipherpackListener::count_error
Examples
commandline.cpp.

Definition at line 26 of file commandline.cpp.

◆ count_header

jau::relaxed_atomic_int LoggingCipherpackListener::count_header
Examples
commandline.cpp.

Definition at line 27 of file commandline.cpp.

◆ count_progress

jau::relaxed_atomic_int LoggingCipherpackListener::count_progress
Examples
commandline.cpp.

Definition at line 28 of file commandline.cpp.

◆ count_end

jau::relaxed_atomic_int LoggingCipherpackListener::count_end
Examples
commandline.cpp.

Definition at line 29 of file commandline.cpp.

◆ count_content

jau::relaxed_atomic_uint64 LoggingCipherpackListener::count_content
Examples
commandline.cpp.

Definition at line 30 of file commandline.cpp.


The documentation for this class was generated from the following file: