Crypto++  8.6
Free C++ class library of cryptographic schemes
Public Member Functions | List of all members
Multichannel< T > Class Template Referenceabstract

Multiple channels support for custom signal processing. More...

+ Inheritance diagram for Multichannel< T >:

Public Member Functions

bool Flush (bool hardFlush, int propagation=-1, bool blocking=true)
 Flush buffered input and/or output, with signal propagation. More...
 
bool MessageSeriesEnd (int propagation=-1, bool blocking=true)
 Marks the end of a series of messages, with signal propagation. More...
 
byteCreatePutSpace (size_t &size)
 Request space which can be written into by the caller. More...
 
size_t Put2 (const byte *inString, size_t length, int messageEnd, bool blocking)
 Input multiple bytes for processing. More...
 
size_t PutModifiable2 (byte *inString, size_t length, int messageEnd, bool blocking)
 Input multiple bytes that may be modified by callee. More...
 
byteChannelCreatePutSpace (const std::string &channel, size_t &size)
 Request space which can be written into by the caller. More...
 
bool ChannelPutModifiable (const std::string &channel, byte *inString, size_t length)
 Input multiple bytes that may be modified by callee on a channel. More...
 
virtual size_t ChannelPut2 (const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking)=0
 Input multiple bytes for processing on a channel. More...
 
size_t ChannelPutModifiable2 (const std::string &channel, byte *begin, size_t length, int messageEnd, bool blocking)
 Input multiple bytes that may be modified by callee on a channel. More...
 
virtual bool ChannelFlush (const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true)=0
 Flush buffered input and/or output on a channel. More...
 
- Public Member Functions inherited from CustomFlushPropagation< T >

Detailed Description

template<class T>
class Multichannel< T >

Multiple channels support for custom signal processing.

Template Parameters
Tthe class or type

T should be a BufferedTransformation derived class

Definition at line 315 of file simple.h.

Member Function Documentation

◆ Flush()

template<class T >
bool Multichannel< T >::Flush ( bool  hardFlush,
int  propagation = -1,
bool  blocking = true 
)
inlinevirtual

Flush buffered input and/or output, with signal propagation.

Parameters
hardFlushis used to indicate whether all data should be flushed
propagationthe number of attached transformations the Flush() signal should be passed
blockingspecifies whether the object should block when processing input

propagation count includes this object. Setting propagation to 1 means this object only. Setting propagation to -1 means unlimited propagation.

Note
Hard flushes must be used with care. It means try to process and output everything, even if there may not be enough data to complete the action. For example, hard flushing a HexDecoder would cause an error if you do it after inputing an odd number of hex encoded characters.
For some types of filters, like ZlibDecompressor, hard flushes can only be done at "synchronization points". These synchronization points are positions in the data stream that are created by hard flushes on the corresponding reverse filters, in this example ZlibCompressor. This is useful when zlib compressed data is moved across a network in packets and compression state is preserved across packets, as in the SSH2 protocol.

Implements CustomFlushPropagation< T >.

Definition at line 318 of file simple.h.

◆ MessageSeriesEnd()

template<class T >
bool Multichannel< T >::MessageSeriesEnd ( int  propagation = -1,
bool  blocking = true 
)
inline

Marks the end of a series of messages, with signal propagation.

Parameters
propagationthe number of attached transformations the MessageSeriesEnd() signal should be passed
blockingspecifies whether the object should block when processing input

Each object that receives the signal will perform its processing, decrement propagation, and then pass the signal on to attached transformations if the value is not 0.

propagation count includes this object. Setting propagation to 1 means this object only. Setting propagation to -1 means unlimited propagation.

Note
There should be a MessageEnd() immediately before MessageSeriesEnd().

Definition at line 329 of file simple.h.

◆ CreatePutSpace()

template<class T >
byte* Multichannel< T >::CreatePutSpace ( size_t &  size)
inline

Request space which can be written into by the caller.

Parameters
sizethe requested size of the buffer

The purpose of this method is to help avoid extra memory allocations.

size is an IN and OUT parameter and used as a hint. When the call is made, size is the requested size of the buffer. When the call returns, size is the size of the array returned to the caller.

The base class implementation sets size to 0 and returns NULL.

Note
Some objects, like ArraySink, cannot create a space because its fixed. In the case of an ArraySink, the pointer to the array is returned and the size is remaining size.

Definition at line 341 of file simple.h.

◆ Put2()

template<class T >
size_t Multichannel< T >::Put2 ( const byte inString,
size_t  length,
int  messageEnd,
bool  blocking 
)
inline

Input multiple bytes for processing.

Parameters
inStringthe byte buffer to process
lengththe size of the string, in bytes
messageEndmeans how many filters to signal MessageEnd() to, including this one
blockingspecifies whether the object should block when processing input
Returns
the number of bytes that remain to be processed (i.e., bytes not processed)

Derived classes must implement Put2().

Definition at line 351 of file simple.h.

◆ PutModifiable2()

template<class T >
size_t Multichannel< T >::PutModifiable2 ( byte inString,
size_t  length,
int  messageEnd,
bool  blocking 
)
inline

Input multiple bytes that may be modified by callee.

Parameters
inStringthe byte buffer to process.
lengththe size of the string, in bytes.
messageEndmeans how many filters to signal MessageEnd() to, including this one.
blockingspecifies whether the object should block when processing input.
Returns
the number of bytes that remain to be processed (i.e., bytes not processed)

Internally, PutModifiable2() calls Put2().

Definition at line 361 of file simple.h.

◆ ChannelCreatePutSpace()

template<class T >
byte* Multichannel< T >::ChannelCreatePutSpace ( const std::string &  channel,
size_t &  size 
)
inline

Request space which can be written into by the caller.

Parameters
channelthe channel to process the data
sizethe requested size of the buffer
Returns
a pointer to a memory block with length size

The purpose of this method is to help avoid extra memory allocations.

size is an IN and OUT parameter and used as a hint. When the call is made, size is the requested size of the buffer. When the call returns, size is the size of the array returned to the caller.

The base class implementation sets size to 0 and returns NULL.

Note
Some objects, like ArraySink(), cannot create a space because its fixed. In the case of an ArraySink(), the pointer to the array is returned and the size is remaining size.

Definition at line 378 of file simple.h.

◆ ChannelPutModifiable()

template<class T >
bool Multichannel< T >::ChannelPutModifiable ( const std::string &  channel,
byte inString,
size_t  length 
)
inline

Input multiple bytes that may be modified by callee on a channel.

Parameters
channelthe channel to process the data.
inStringthe byte buffer to process
lengththe size of the string, in bytes
Returns
true if all bytes were processed, false otherwise.

Definition at line 386 of file simple.h.

◆ ChannelPut2()

template<class T >
virtual size_t Multichannel< T >::ChannelPut2 ( const std::string &  channel,
const byte begin,
size_t  length,
int  messageEnd,
bool  blocking 
)
pure virtual

Input multiple bytes for processing on a channel.

Parameters
channelthe channel to process the data.
beginthe byte buffer to process.
lengththe size of the string, in bytes.
messageEndmeans how many filters to signal MessageEnd() to, including this one.
blockingspecifies whether the object should block when processing input.
Returns
the number of bytes that remain to be processed (i.e., bytes not processed)

Implemented in EqualityComparisonFilter, ChannelSwitch, and RawIDA.

◆ ChannelPutModifiable2()

template<class T >
size_t Multichannel< T >::ChannelPutModifiable2 ( const std::string &  channel,
byte begin,
size_t  length,
int  messageEnd,
bool  blocking 
)
inline

Input multiple bytes that may be modified by callee on a channel.

Parameters
channelthe channel to process the data
beginthe byte buffer to process
lengththe size of the string, in bytes
messageEndmeans how many filters to signal MessageEnd() to, including this one
blockingspecifies whether the object should block when processing input
Returns
the number of bytes that remain to be processed (i.e., bytes not processed)

Definition at line 405 of file simple.h.

◆ ChannelFlush()

template<class T >
virtual bool Multichannel< T >::ChannelFlush ( const std::string &  channel,
bool  hardFlush,
int  propagation = -1,
bool  blocking = true 
)
pure virtual

Flush buffered input and/or output on a channel.

Parameters
channelthe channel to flush the data
hardFlushis used to indicate whether all data should be flushed
propagationthe number of attached transformations the ChannelFlush() signal should be passed
blockingspecifies whether the object should block when processing input
Returns
true of the Flush was successful

propagation count includes this object. Setting propagation to 1 means this object only. Setting propagation to -1 means unlimited propagation.

Implemented in Unflushable< Multichannel< Filter > >, and ChannelSwitch.


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