Crypto++ 8.9
Free C++ class library of cryptographic schemes
Classes | Public Member Functions | List of all members
BufferedTransformation Class Referenceabstract

Interface for buffered transformations. More...

#include <cryptlib.h>

+ Inheritance diagram for BufferedTransformation:

Classes

struct  BlockingInputOnly
 Exception thrown by objects that have not implemented nonblocking input processing. More...
 
struct  InvalidChannelName
 Exception thrown when a filter does not recognize a named channel. More...
 
struct  NoChannelSupport
 Exception thrown when a filter does not support named channels. More...
 

Public Member Functions

 BufferedTransformation ()
 Construct a BufferedTransformation.
 
BufferedTransformationRef ()
 Provides a reference to this object.
 
- Public Member Functions inherited from Algorithm
 Algorithm (bool checkSelfTestStatus=true)
 Interface for all crypto algorithms.
 
virtual std::string AlgorithmName () const
 Provides the name of this algorithm.
 
virtual std::string AlgorithmProvider () const
 Retrieve the provider of this algorithm.
 
- Public Member Functions inherited from Clonable
virtual ClonableClone () const
 Copies this object.
 
- Public Member Functions inherited from Waitable
bool Wait (unsigned long milliseconds, CallStack const &callStack)
 Wait on this object.
 

ATTACHMENT

Some BufferedTransformation objects (e.g. Filter objects) allow other BufferedTransformation objects to be attached. When this is done, the first object instead of buffering its output, sends that output to the attached object as input. The entire attachment chain is deleted when the anchor object is destructed.

virtual bool Attachable ()
 Determines whether the object allows attachment.
 
virtual BufferedTransformationAttachedTransformation ()
 Returns the object immediately attached to this object.
 
virtual const BufferedTransformationAttachedTransformation () const
 Returns the object immediately attached to this object.
 
virtual void Detach (BufferedTransformation *newAttachment=NULL)
 Delete the current attachment chain and attach a new one.
 
virtual void Attach (BufferedTransformation *newAttachment)
 Add newAttachment to the end of attachment chain.
 

INPUT

size_t Put (byte inByte, bool blocking=true)
 Input a byte for processing.
 
size_t Put (const byte *inString, size_t length, bool blocking=true)
 Input a byte buffer for processing.
 
size_t PutWord16 (word16 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true)
 Input a 16-bit word for processing.
 
size_t PutWord32 (word32 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true)
 Input a 32-bit word for processing.
 
size_t PutWord64 (word64 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true)
 Input a 64-bit word for processing.
 
virtual byteCreatePutSpace (size_t &size)
 Request space which can be written into by the caller.
 
virtual bool CanModifyInput () const
 Determines whether input can be modified by the callee.
 
size_t PutModifiable (byte *inString, size_t length, bool blocking=true)
 Input multiple bytes that may be modified by callee.
 
bool MessageEnd (int propagation=-1, bool blocking=true)
 Signals the end of messages to the object.
 
size_t PutMessageEnd (const byte *inString, size_t length, int propagation=-1, bool blocking=true)
 Input multiple bytes for processing and signal the end of a message.
 
virtual size_t Put2 (const byte *inString, size_t length, int messageEnd, bool blocking)=0
 Input multiple bytes for processing.
 
virtual size_t PutModifiable2 (byte *inString, size_t length, int messageEnd, bool blocking)
 Input multiple bytes that may be modified by callee.
 

WAITING

unsigned int GetMaxWaitObjectCount () const
 Retrieves the maximum number of waitable objects.
 
void GetWaitObjects (WaitObjectContainer &container, CallStack const &callStack)
 Retrieves waitable objects.
 

SIGNALS

virtual void IsolatedInitialize (const NameValuePairs &parameters)
 Initialize or reinitialize this object, without signal propagation.
 
virtual bool IsolatedFlush (bool hardFlush, bool blocking)=0
 Flushes data buffered by this object, without signal propagation.
 
virtual bool IsolatedMessageSeriesEnd (bool blocking)
 Marks the end of a series of messages, without signal propagation.
 
virtual void Initialize (const NameValuePairs &parameters=g_nullNameValuePairs, int propagation=-1)
 Initialize or reinitialize this object, with signal propagation.
 
virtual bool Flush (bool hardFlush, int propagation=-1, bool blocking=true)
 Flush buffered input and/or output, with signal propagation.
 
virtual bool MessageSeriesEnd (int propagation=-1, bool blocking=true)
 Marks the end of a series of messages, with signal propagation.
 
virtual void SetAutoSignalPropagation (int propagation)
 Set propagation of automatically generated and transferred signals.
 
virtual int GetAutoSignalPropagation () const
 Retrieve automatic signal propagation value.
 

RETRIEVAL OF ONE MESSAGE

virtual lword MaxRetrievable () const
 Provides the number of bytes ready for retrieval.
 
virtual bool AnyRetrievable () const
 Determines whether bytes are ready for retrieval.
 
virtual size_t Get (byte &outByte)
 Retrieve a 8-bit byte.
 
virtual size_t Get (byte *outString, size_t getMax)
 Retrieve a block of bytes.
 
virtual size_t Peek (byte &outByte) const
 Peek a 8-bit byte.
 
virtual size_t Peek (byte *outString, size_t peekMax) const
 Peek a block of bytes.
 
size_t GetWord16 (word16 &value, ByteOrder order=BIG_ENDIAN_ORDER)
 Retrieve a 16-bit word.
 
size_t GetWord32 (word32 &value, ByteOrder order=BIG_ENDIAN_ORDER)
 Retrieve a 32-bit word.
 
size_t GetWord64 (word64 &value, ByteOrder order=BIG_ENDIAN_ORDER)
 Retrieve a 64-bit word.
 
size_t PeekWord16 (word16 &value, ByteOrder order=BIG_ENDIAN_ORDER) const
 Peek a 16-bit word.
 
size_t PeekWord32 (word32 &value, ByteOrder order=BIG_ENDIAN_ORDER) const
 Peek a 32-bit word.
 
size_t PeekWord64 (word64 &value, ByteOrder order=BIG_ENDIAN_ORDER) const
 Peek a 64-bit word.
 
lword TransferTo (BufferedTransformation &target, lword transferMax=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL)
 move transferMax bytes of the buffered output to target as input
 
virtual lword Skip (lword skipMax=LWORD_MAX)
 Discard skipMax bytes from the output buffer.
 
lword CopyTo (BufferedTransformation &target, lword copyMax=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL) const
 Copy bytes from this object to another BufferedTransformation.
 
lword CopyRangeTo (BufferedTransformation &target, lword position, lword copyMax=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL) const
 Copy bytes from this object using an index to another BufferedTransformation.
 

RETRIEVAL OF MULTIPLE MESSAGES

virtual lword TotalBytesRetrievable () const
 Provides the number of bytes ready for retrieval.
 
virtual unsigned int NumberOfMessages () const
 Provides the number of meesages processed by this object.
 
virtual bool AnyMessages () const
 Determines if any messages are available for retrieval.
 
virtual bool GetNextMessage ()
 Start retrieving the next message.
 
virtual unsigned int SkipMessages (unsigned int count=UINT_MAX)
 Skip a number of meessages.
 
unsigned int TransferMessagesTo (BufferedTransformation &target, unsigned int count=UINT_MAX, const std::string &channel=DEFAULT_CHANNEL)
 Transfer messages from this object to another BufferedTransformation.
 
unsigned int CopyMessagesTo (BufferedTransformation &target, unsigned int count=UINT_MAX, const std::string &channel=DEFAULT_CHANNEL) const
 Copy messages from this object to another BufferedTransformation.
 
virtual void SkipAll ()
 Skip all messages in the series.
 
void TransferAllTo (BufferedTransformation &target, const std::string &channel=DEFAULT_CHANNEL)
 Transfer all bytes from this object to another BufferedTransformation.
 
void CopyAllTo (BufferedTransformation &target, const std::string &channel=DEFAULT_CHANNEL) const
 Copy messages from this object to another BufferedTransformation.
 
virtual bool GetNextMessageSeries ()
 Retrieve the next message in a series.
 
virtual unsigned int NumberOfMessagesInThisSeries () const
 Provides the number of messages in a series.
 
virtual unsigned int NumberOfMessageSeries () const
 Provides the number of messages in a series.
 

NON-BLOCKING TRANSFER OF OUTPUT

virtual size_t TransferTo2 (BufferedTransformation &target, lword &byteCount, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)=0
 Transfer bytes from this object to another BufferedTransformation.
 
virtual size_t CopyRangeTo2 (BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const =0
 Copy bytes from this object to another BufferedTransformation.
 
size_t TransferMessagesTo2 (BufferedTransformation &target, unsigned int &messageCount, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)
 Transfer messages from this object to another BufferedTransformation.
 
size_t TransferAllTo2 (BufferedTransformation &target, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)
 Transfer all bytes from this object to another BufferedTransformation.
 

CHANNELS

size_t ChannelPut (const std::string &channel, byte inByte, bool blocking=true)
 Input a byte for processing on a channel.
 
size_t ChannelPut (const std::string &channel, const byte *inString, size_t length, bool blocking=true)
 Input a byte buffer for processing on a channel.
 
size_t ChannelPutModifiable (const std::string &channel, byte *inString, size_t length, bool blocking=true)
 Input multiple bytes that may be modified by callee on a channel.
 
size_t ChannelPutWord16 (const std::string &channel, word16 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true)
 Input a 16-bit word for processing on a channel.
 
size_t ChannelPutWord32 (const std::string &channel, word32 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true)
 Input a 32-bit word for processing on a channel.
 
size_t ChannelPutWord64 (const std::string &channel, word64 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true)
 Input a 64-bit word for processing on a channel.
 
bool ChannelMessageEnd (const std::string &channel, int propagation=-1, bool blocking=true)
 Signal the end of a message.
 
size_t ChannelPutMessageEnd (const std::string &channel, const byte *inString, size_t length, int propagation=-1, bool blocking=true)
 Input multiple bytes for processing and signal the end of a message.
 
virtual byteChannelCreatePutSpace (const std::string &channel, size_t &size)
 Request space which can be written into by the caller.
 
virtual size_t ChannelPut2 (const std::string &channel, const byte *inString, size_t length, int messageEnd, bool blocking)
 Input multiple bytes for processing on a channel.
 
virtual size_t ChannelPutModifiable2 (const std::string &channel, byte *inString, size_t length, int messageEnd, bool blocking)
 Input multiple bytes that may be modified by callee on a channel.
 
virtual bool ChannelFlush (const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true)
 Flush buffered input and/or output on a channel.
 
virtual bool ChannelMessageSeriesEnd (const std::string &channel, int propagation=-1, bool blocking=true)
 Marks the end of a series of messages on a channel.
 
virtual void SetRetrievalChannel (const std::string &channel)
 Sets the default retrieval channel.
 

Detailed Description

Interface for buffered transformations.

BufferedTransformation is a generalization of BlockTransformation, StreamTransformation and HashTransformation.

A buffered transformation is an object that takes a stream of bytes as input (this may be done in stages), does some computation on them, and then places the result into an internal buffer for later retrieval. Any partial result already in the output buffer is not modified by further input.

If a method takes a "blocking" parameter, and you pass false for it, then the method will return before all input has been processed if the input cannot be processed without waiting (for network buffers to become available, for example). In this case the method will return true or a non-zero integer value. When this happens you must continue to call the method with the same parameters until it returns false or zero, before calling any other method on it or attached BufferedTransformation. The integer return value in this case is approximately the number of bytes left to be processed, and can be used to implement a progress bar.

For functions that take a "propagation" parameter, propagation != 0 means pass on the signal to attached BufferedTransformation objects, with propagation decremented at each step until it reaches 0. -1 means unlimited propagation.

All of the retrieval functions, like Get() and GetWord32(), return the actual number of bytes retrieved, which is the lesser of the request number and MaxRetrievable().

Most of the input functions, like Put() and PutWord32(), return the number of bytes remaining to be processed. A 0 value means all bytes were processed, and a non-0 value means bytes remain to be processed.

Definition at line 1656 of file cryptlib.h.

Constructor & Destructor Documentation

◆ ~BufferedTransformation()

virtual BufferedTransformation::~BufferedTransformation ( )
inlinevirtual

Definition at line 1659 of file cryptlib.h.

◆ BufferedTransformation()

BufferedTransformation::BufferedTransformation ( )
inline

Construct a BufferedTransformation.

Definition at line 1662 of file cryptlib.h.

Member Function Documentation

◆ Ref()

BufferedTransformation & BufferedTransformation::Ref ( )
inline

Provides a reference to this object.

Returns
A reference to this object

Useful for passing a temporary object to a function that takes a non-const reference

Definition at line 1667 of file cryptlib.h.

◆ Put() [1/2]

size_t BufferedTransformation::Put ( byte inByte,
bool blocking = true )
inline

Input a byte for processing.

Parameters
inBytethe 8-bit byte (octet) to be processed.
blockingspecifies whether the object should block when processing input.
Returns
the number of bytes that remain to be processed (i.e., bytes not processed). 0 indicates all bytes were processed.

Put(byte) calls Put(byte*, size_t).

Definition at line 1678 of file cryptlib.h.

◆ Put() [2/2]

size_t BufferedTransformation::Put ( const byte * inString,
size_t length,
bool blocking = true )
inline

Input a byte buffer for processing.

Parameters
inStringthe byte buffer to process
lengththe size of the string, in bytes
blockingspecifies whether the object should block when processing input
Returns
the number of bytes that remain to be processed (i.e., bytes not processed). 0 indicates all bytes were processed.

Internally, Put() calls Put2().

Definition at line 1688 of file cryptlib.h.

◆ PutWord16()

size_t BufferedTransformation::PutWord16 ( word16 value,
ByteOrder order = BIG_ENDIAN_ORDER,
bool blocking = true )

Input a 16-bit word for processing.

Parameters
valuethe 16-bit value to be processed
orderthe ByteOrder of the value to be processed.
blockingspecifies whether the object should block when processing input
Returns
the number of bytes that remain to be processed (i.e., bytes not processed). 0 indicates all bytes were processed.

◆ PutWord32()

size_t BufferedTransformation::PutWord32 ( word32 value,
ByteOrder order = BIG_ENDIAN_ORDER,
bool blocking = true )

Input a 32-bit word for processing.

Parameters
valuethe 32-bit value to be processed.
orderthe ByteOrder of the value to be processed.
blockingspecifies whether the object should block when processing input.
Returns
the number of bytes that remain to be processed (i.e., bytes not processed). 0 indicates all bytes were processed.

◆ PutWord64()

size_t BufferedTransformation::PutWord64 ( word64 value,
ByteOrder order = BIG_ENDIAN_ORDER,
bool blocking = true )

Input a 64-bit word for processing.

Parameters
valuethe 64-bit value to be processed.
orderthe ByteOrder of the value to be processed.
blockingspecifies whether the object should block when processing input.
Returns
the number of bytes that remain to be processed (i.e., bytes not processed). 0 indicates all bytes were processed.

◆ CreatePutSpace()

virtual byte * BufferedTransformation::CreatePutSpace ( size_t & size)
inlinevirtual

Request space which can be written into by the caller.

Parameters
sizethe requested size of the buffer
Returns
byte pointer to the space to input data

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.

Reimplemented in MeterFilter, HashFilter, ArraySink, ArrayXorSink, and ByteQueue.

Definition at line 1725 of file cryptlib.h.

◆ CanModifyInput()

virtual bool BufferedTransformation::CanModifyInput ( ) const
inlinevirtual

Determines whether input can be modified by the callee.

Returns
true if input can be modified, false otherwise

The base class implementation returns false.

Definition at line 1731 of file cryptlib.h.

◆ PutModifiable()

size_t BufferedTransformation::PutModifiable ( byte * inString,
size_t length,
bool blocking = true )
inline

Input multiple bytes that may be modified by callee.

Parameters
inStringthe byte buffer to process
lengththe size of the string, in bytes
blockingspecifies whether the object should block when processing input
Returns
the number of bytes that remain to be processed (i.e., bytes not processed). 0 indicates all bytes were processed.

Definition at line 1740 of file cryptlib.h.

◆ MessageEnd()

bool BufferedTransformation::MessageEnd ( int propagation = -1,
bool blocking = true )
inline

Signals the end of messages to the object.

Parameters
propagationthe number of attached transformations the MessageEnd() 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.

Definition at line 1748 of file cryptlib.h.

◆ PutMessageEnd()

size_t BufferedTransformation::PutMessageEnd ( const byte * inString,
size_t length,
int propagation = -1,
bool blocking = true )
inline

Input multiple bytes for processing and signal the end of a message.

Parameters
inStringthe byte buffer to process
lengththe size of the string, in bytes
propagationthe number of attached transformations the MessageEnd() signal should be passed
blockingspecifies whether the object should block when processing input
Returns
the number of bytes that remain to be processed (i.e., bytes not processed). 0 indicates all bytes were processed.

Internally, PutMessageEnd() calls Put2() with a modified propagation to ensure all attached transformations finish processing the message.

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

Definition at line 1762 of file cryptlib.h.

◆ Put2()

virtual size_t BufferedTransformation::Put2 ( const byte * inString,
size_t length,
int messageEnd,
bool blocking )
pure virtual

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). 0 indicates all bytes were processed.

Derived classes must implement Put2().

Implemented in BaseN_Encoder, BaseN_Decoder, Grouper, SecretSharing, InformationDispersal, PaddingRemover, MessageQueue, FileSink, MeterFilter, FilterWithBufferedInput, FilterWithInputQueue, HashFilter, SignerFilter, StringSinkTemplate< T >, StringSinkTemplate< std::string >, StringSinkTemplate< std::vector< byte > >, RandomNumberSink, ArraySink, ArrayXorSink, ByteQueue, MaurerRandomnessTest, InputRejecting< BufferedTransformation >, InputRejecting< Filter >, BitBucket, Deflator, and Inflator.

◆ PutModifiable2()

virtual size_t BufferedTransformation::PutModifiable2 ( byte * inString,
size_t length,
int messageEnd,
bool blocking )
inlinevirtual

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). 0 indicates all bytes were processed.

Internally, PutModifiable2() calls Put2().

Reimplemented in MeterFilter, and FilterWithBufferedInput.

Definition at line 1783 of file cryptlib.h.

◆ GetMaxWaitObjectCount()

unsigned int BufferedTransformation::GetMaxWaitObjectCount ( ) const
virtual

Retrieves the maximum number of waitable objects.

Implements Waitable.

◆ GetWaitObjects()

void BufferedTransformation::GetWaitObjects ( WaitObjectContainer & container,
CallStack const & callStack )
virtual

Retrieves waitable objects.

Parameters
containerthe wait container to receive the references to the objects
callStackCallStack() object used to select waitable objects

GetWaitObjects is usually called in one of two ways. First, it can be called like something.GetWaitObjects(c, CallStack("my func after X", 0));. Second, if in an outer GetWaitObjects() method that itself takes a callStack parameter, it can be called like innerThing.GetWaitObjects(c, CallStack("MyClass::GetWaitObjects at X", &callStack));.

Implements Waitable.

◆ IsolatedInitialize()

virtual void BufferedTransformation::IsolatedInitialize ( const NameValuePairs & parameters)
inlinevirtual

Initialize or reinitialize this object, without signal propagation.

Parameters
parametersa set of NameValuePairs to initialize this object
Exceptions
NotImplemented

IsolatedInitialize() is used to initialize or reinitialize an object using a variable number of arbitrarily typed arguments. The function avoids the need for multiple constructors providing all possible combintations of configurable parameters.

IsolatedInitialize() does not call Initialize() on attached transformations. If initialization should be propagated, then use the Initialize() function.

If a derived class does not override IsolatedInitialize(), then the base class throws NotImplemented.

Reimplemented in Base32Encoder, Base32Decoder, Base32HexEncoder, Base32HexDecoder, Base64Encoder, Base64Decoder, Base64URLEncoder, Base64URLDecoder, BaseN_Encoder, BaseN_Decoder, Grouper, FileSink, MeterFilter, FilterWithBufferedInput, HashFilter, AuthenticatedEncryptionFilter, SignerFilter, StringSinkTemplate< T >, StringSinkTemplate< std::string >, StringSinkTemplate< std::vector< byte > >, RandomNumberSink, ArraySink, SourceTemplate< T >, SourceTemplate< FileStore >, SourceTemplate< RandomNumberStore >, SourceTemplate< StringStore >, Gzip, HexEncoder, HexDecoder, PaddingRemover, MessageQueue, ByteQueue, ByteQueue::Walker, Store, Deflator, Inflator, SecretSharing, InformationDispersal, and BitBucket.

Definition at line 1821 of file cryptlib.h.

◆ IsolatedFlush()

virtual bool BufferedTransformation::IsolatedFlush ( bool hardFlush,
bool blocking )
pure virtual

Flushes data buffered by this object, without signal propagation.

Parameters
hardFlushindicates whether all data should be flushed
blockingspecifies whether the object should block when processing input
Returns
true if the flush was successful, false otherwise
Note
hardFlush must be used with care

Implemented in FileSink, FilterWithBufferedInput, ProxyFilter, MessageQueue, Bufferless< BufferedTransformation >, Bufferless< Filter >, Bufferless< Sink >, Unflushable< Filter >, InputRejecting< BufferedTransformation >, InputRejecting< Filter >, Deflator, and Inflator.

◆ IsolatedMessageSeriesEnd()

virtual bool BufferedTransformation::IsolatedMessageSeriesEnd ( bool blocking)
inlinevirtual

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

Parameters
blockingspecifies whether the object should block when completing the processing on the current series of messages
Returns
true if the message was successful, false otherwise

Reimplemented in MeterFilter, MessageQueue, InputRejecting< BufferedTransformation >, and InputRejecting< Filter >.

Definition at line 1837 of file cryptlib.h.

◆ Initialize()

virtual void BufferedTransformation::Initialize ( const NameValuePairs & parameters = g_nullNameValuePairs,
int propagation = -1 )
virtual

Initialize or reinitialize this object, with signal propagation.

Parameters
parametersa set of NameValuePairs to initialize or reinitialize this object
propagationthe number of attached transformations the Initialize() signal should be passed

Initialize() is used to initialize or reinitialize an object using a variable number of arbitrarily typed arguments. The function avoids the need for multiple constructors providing all possible combintations of configurable parameters.

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

Reimplemented in Filter.

◆ Flush()

virtual bool BufferedTransformation::Flush ( bool hardFlush,
int propagation = -1,
bool blocking = true )
virtual

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
Returns
true if the flush was successful, false otherwise

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.

Reimplemented in Unflushable< Filter >, Filter, SecretSharing, InformationDispersal, CustomFlushPropagation< Filter >, and CustomFlushPropagation< Sink >.

◆ MessageSeriesEnd()

virtual bool BufferedTransformation::MessageSeriesEnd ( int propagation = -1,
bool blocking = true )
virtual

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
Returns
true if the message was successful, false otherwise

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().

Reimplemented in Filter.

◆ SetAutoSignalPropagation()

virtual void BufferedTransformation::SetAutoSignalPropagation ( int propagation)
inlinevirtual

Set propagation of automatically generated and transferred signals.

Parameters
propagationthen new value

Setting propagation to 0 means do not automatically generate signals. Setting propagation to -1 means unlimited propagation.

Reimplemented in SourceTemplate< T >, SourceTemplate< FileStore >, SourceTemplate< RandomNumberStore >, SourceTemplate< StringStore >, AutoSignaling< BufferedTransformation >, AutoSignaling< Filter >, and AutoSignaling< InputRejecting< BufferedTransformation > >.

Definition at line 1886 of file cryptlib.h.

◆ GetAutoSignalPropagation()

virtual int BufferedTransformation::GetAutoSignalPropagation ( ) const
inlinevirtual

Retrieve automatic signal propagation value.

Returns
the number of attached transformations the signal is propagated to. 0 indicates the signal is only witnessed by this object

Reimplemented in SourceTemplate< T >, SourceTemplate< FileStore >, SourceTemplate< RandomNumberStore >, SourceTemplate< StringStore >, AutoSignaling< BufferedTransformation >, AutoSignaling< Filter >, and AutoSignaling< InputRejecting< BufferedTransformation > >.

Definition at line 1892 of file cryptlib.h.

◆ MaxRetrievable()

virtual lword BufferedTransformation::MaxRetrievable ( ) const
virtual

Provides the number of bytes ready for retrieval.

Returns
the number of bytes ready for retrieval

The number of bytes available are dependent on the source. If an exact value is available, then the exact value is returned. The exact value can include 0 if the source is exhausted.

Some stream-based sources do not allow seeking() on the underlying stream, such as some FileSource(). If the stream does not allow seeking() then MaxRetrievable() returns LWORD_MAX to indicate there are still bytes to be retrieved.

Reimplemented in FileStore, RandomNumberStore, NullStore, MessageQueue, ByteQueue, and ByteQueue::Walker.

◆ AnyRetrievable()

virtual bool BufferedTransformation::AnyRetrievable ( ) const
virtual

Determines whether bytes are ready for retrieval.

Returns
true if bytes are available for retrieval, false otherwise

Reimplemented in RandomNumberStore, MessageQueue, and ByteQueue.

◆ Get() [1/2]

virtual size_t BufferedTransformation::Get ( byte & outByte)
virtual

Retrieve a 8-bit byte.

Parameters
outBytethe 8-bit value to be retrieved
Returns
the number of bytes consumed during the call.

Use the return value of Get to detect short reads.

Reimplemented in ByteQueue, and ByteQueue::Walker.

◆ Get() [2/2]

virtual size_t BufferedTransformation::Get ( byte * outString,
size_t getMax )
virtual

Retrieve a block of bytes.

Parameters
outStringa block of bytes
getMaxthe number of bytes to Get
Returns
the number of bytes consumed during the call.

Use the return value of Get to detect short reads.

Reimplemented in ByteQueue, and ByteQueue::Walker.

◆ Peek() [1/2]

virtual size_t BufferedTransformation::Peek ( byte & outByte) const
virtual

Peek a 8-bit byte.

Parameters
outBytethe 8-bit value to be retrieved
Returns
the number of bytes read during the call.

Peek does not remove bytes from the object. Use the return value of Get() to detect short reads.

Reimplemented in ByteQueue, and ByteQueue::Walker.

◆ Peek() [2/2]

virtual size_t BufferedTransformation::Peek ( byte * outString,
size_t peekMax ) const
virtual

Peek a block of bytes.

Parameters
outStringa block of bytes
peekMaxthe number of bytes to Peek
Returns
the number of bytes read during the call.

Peek does not remove bytes from the object. Use the return value of Peek() to detect short reads.

Reimplemented in ByteQueue, and ByteQueue::Walker.

◆ GetWord16()

size_t BufferedTransformation::GetWord16 ( word16 & value,
ByteOrder order = BIG_ENDIAN_ORDER )

Retrieve a 16-bit word.

Parameters
valuethe 16-bit value to be retrieved
orderthe ByteOrder of the value to be processed.
Returns
the number of bytes consumed during the call.

Use the return value of GetWord16() to detect short reads.

◆ GetWord32()

size_t BufferedTransformation::GetWord32 ( word32 & value,
ByteOrder order = BIG_ENDIAN_ORDER )

Retrieve a 32-bit word.

Parameters
valuethe 32-bit value to be retrieved
orderthe ByteOrder of the value to be processed.
Returns
the number of bytes consumed during the call.

Use the return value of GetWord32() to detect short reads.

◆ GetWord64()

size_t BufferedTransformation::GetWord64 ( word64 & value,
ByteOrder order = BIG_ENDIAN_ORDER )

Retrieve a 64-bit word.

Parameters
valuethe 64-bit value to be retrieved
orderthe ByteOrder of the value to be processed.
Returns
the number of bytes consumed during the call.

Use the return value of GetWord64() to detect short reads.

Since
Crypto++ 8.3

◆ PeekWord16()

size_t BufferedTransformation::PeekWord16 ( word16 & value,
ByteOrder order = BIG_ENDIAN_ORDER ) const

Peek a 16-bit word.

Parameters
valuethe 16-bit value to be retrieved
orderthe ByteOrder of the value to be processed.
Returns
the number of bytes consumed during the call.

Peek does not consume bytes in the stream. Use the return value of PeekWord16() to detect short reads.

◆ PeekWord32()

size_t BufferedTransformation::PeekWord32 ( word32 & value,
ByteOrder order = BIG_ENDIAN_ORDER ) const

Peek a 32-bit word.

Parameters
valuethe 32-bit value to be retrieved
orderthe ByteOrder of the value to be processed.
Returns
the number of bytes consumed during the call.

Peek does not consume bytes in the stream. Use the return value of PeekWord32() to detect short reads.

◆ PeekWord64()

size_t BufferedTransformation::PeekWord64 ( word64 & value,
ByteOrder order = BIG_ENDIAN_ORDER ) const

Peek a 64-bit word.

Parameters
valuethe 64-bit value to be retrieved
orderthe ByteOrder of the value to be processed.
Returns
the number of bytes consumed during the call.

Peek does not consume bytes in the stream. Use the return value of PeekWord64() to detect short reads.

Since
Crypto++ 8.3

◆ TransferTo()

lword BufferedTransformation::TransferTo ( BufferedTransformation & target,
lword transferMax = LWORD_MAX,
const std::string & channel = DEFAULT_CHANNEL )
inline

move transferMax bytes of the buffered output to target as input

Transfer bytes from this object to another BufferedTransformation

Parameters
targetthe destination BufferedTransformation
transferMaxthe number of bytes to transfer
channelthe channel on which the transfer should occur
Returns
the number of bytes transferred during the call.

TransferTo removes bytes from this object and moves them to the destination.

The function always returns transferMax. If an accurate count is needed, then use TransferTo2().

Definition at line 1996 of file cryptlib.h.

◆ Skip()

virtual lword BufferedTransformation::Skip ( lword skipMax = LWORD_MAX)
virtual

Discard skipMax bytes from the output buffer.

Parameters
skipMaxthe number of bytes to discard

Skip() discards bytes from the output buffer, which is the AttachedTransformation(), if present. The function always returns the parameter skipMax.

If you want to skip bytes from a Source, then perform the following.

  StringSource ss(str, false, new Redirector(TheBitBucket()));
  ss.Pump(10);    // Skip 10 bytes from Source
  ss.Detach(new FilterChain(...));
  ss.PumpAll();

Reimplemented in FileStore.

◆ CopyTo()

lword BufferedTransformation::CopyTo ( BufferedTransformation & target,
lword copyMax = LWORD_MAX,
const std::string & channel = DEFAULT_CHANNEL ) const
inline

Copy bytes from this object to another BufferedTransformation.

Parameters
targetthe destination BufferedTransformation
copyMaxthe number of bytes to copy
channelthe channel on which the transfer should occur
Returns
the number of bytes copied during the call.

CopyTo copies bytes from this object to the destination. The bytes are not removed from this object.

The function always returns copyMax. If an accurate count is needed, then use CopyRangeTo2().

Definition at line 2018 of file cryptlib.h.

◆ CopyRangeTo()

lword BufferedTransformation::CopyRangeTo ( BufferedTransformation & target,
lword position,
lword copyMax = LWORD_MAX,
const std::string & channel = DEFAULT_CHANNEL ) const
inline

Copy bytes from this object using an index to another BufferedTransformation.

Parameters
targetthe destination BufferedTransformation
positionthe 0-based index of the byte stream to begin the copying
copyMaxthe number of bytes to copy
channelthe channel on which the transfer should occur
Returns
the number of bytes copied during the call.

CopyTo copies bytes from this object to the destination. The bytes remain in this object. Copying begins at the index position in the current stream, and not from an absolute position in the stream.

The function returns the new position in the stream after transferring the bytes starting at the index.

Definition at line 2031 of file cryptlib.h.

◆ TotalBytesRetrievable()

virtual lword BufferedTransformation::TotalBytesRetrievable ( ) const
virtual

Provides the number of bytes ready for retrieval.

Returns
the number of bytes ready for retrieval

Reimplemented in MessageQueue.

◆ NumberOfMessages()

virtual unsigned int BufferedTransformation::NumberOfMessages ( ) const
virtual

Provides the number of meesages processed by this object.

Returns
the number of meesages processed by this object

NumberOfMessages returns number of times MessageEnd() has been received minus messages retrieved or skipped

Reimplemented in MessageQueue, and Store.

◆ AnyMessages()

virtual bool BufferedTransformation::AnyMessages ( ) const
virtual

Determines if any messages are available for retrieval.

Returns
true if NumberOfMessages() > 0, false otherwise

AnyMessages returns true if NumberOfMessages() > 0

◆ GetNextMessage()

virtual bool BufferedTransformation::GetNextMessage ( )
virtual

Start retrieving the next message.

Returns
true if a message is ready for retrieval

GetNextMessage() returns true if a message is ready for retrieval; false if no more messages exist or this message is not completely retrieved.

Reimplemented in MessageQueue, and Store.

◆ SkipMessages()

virtual unsigned int BufferedTransformation::SkipMessages ( unsigned int count = UINT_MAX)
virtual

Skip a number of meessages.

Parameters
countnumber of messages to skip
Returns
0 if the requested number of messages was skipped, non-0 otherwise

SkipMessages() skips count number of messages. If there is an AttachedTransformation() then SkipMessages() is called on the attached transformation. If there is no attached transformation, then count number of messages are sent to TheBitBucket() using TransferMessagesTo().

◆ TransferMessagesTo()

unsigned int BufferedTransformation::TransferMessagesTo ( BufferedTransformation & target,
unsigned int count = UINT_MAX,
const std::string & channel = DEFAULT_CHANNEL )
inline

Transfer messages from this object to another BufferedTransformation.

Parameters
targetthe destination BufferedTransformation
countthe number of messages to transfer
channelthe channel on which the transfer should occur
Returns
the number of bytes that remain in the current transfer block (i.e., bytes not transferred)

TransferMessagesTo2() removes messages from this object and moves them to the destination. If all bytes are not transferred for a message, then processing stops and the number of remaining bytes is returned. TransferMessagesTo() does not proceed to the next message.

A return value of 0 indicates all messages were successfully transferred.

Definition at line 2076 of file cryptlib.h.

◆ CopyMessagesTo()

unsigned int BufferedTransformation::CopyMessagesTo ( BufferedTransformation & target,
unsigned int count = UINT_MAX,
const std::string & channel = DEFAULT_CHANNEL ) const

Copy messages from this object to another BufferedTransformation.

Parameters
targetthe destination BufferedTransformation
countthe number of messages to copy
channelthe channel on which the copy should occur
Returns
the number of bytes that remain in the current transfer block (i.e., bytes not transferred)

CopyMessagesTo copies messages from this object to the destination. If all bytes are not transferred for a message, then processing stops and the number of remaining bytes is returned. CopyMessagesTo() does not proceed to the next message.

A return value of 0 indicates all messages were successfully copied.

◆ TransferAllTo()

void BufferedTransformation::TransferAllTo ( BufferedTransformation & target,
const std::string & channel = DEFAULT_CHANNEL )
inline

Transfer all bytes from this object to another BufferedTransformation.

Parameters
targetthe destination BufferedTransformation
channelthe channel on which the transfer should occur

TransferMessagesTo2() removes messages from this object and moves them to the destination. Internally TransferAllTo() calls TransferAllTo2().

Definition at line 2098 of file cryptlib.h.

◆ CopyAllTo()

void BufferedTransformation::CopyAllTo ( BufferedTransformation & target,
const std::string & channel = DEFAULT_CHANNEL ) const

Copy messages from this object to another BufferedTransformation.

Parameters
targetthe destination BufferedTransformation
channelthe channel on which the transfer should occur

CopyAllTo copies messages from this object and copies them to the destination.

◆ GetNextMessageSeries()

virtual bool BufferedTransformation::GetNextMessageSeries ( )
inlinevirtual

Retrieve the next message in a series.

Returns
true if a message was retrieved, false otherwise

Internally, the base class implementation returns false.

Definition at line 2110 of file cryptlib.h.

◆ NumberOfMessagesInThisSeries()

virtual unsigned int BufferedTransformation::NumberOfMessagesInThisSeries ( ) const
inlinevirtual

Provides the number of messages in a series.

Returns
the number of messages in this series

Reimplemented in MessageQueue.

Definition at line 2113 of file cryptlib.h.

◆ NumberOfMessageSeries()

virtual unsigned int BufferedTransformation::NumberOfMessageSeries ( ) const
inlinevirtual

Provides the number of messages in a series.

Returns
the number of messages in this series

Reimplemented in MessageQueue.

Definition at line 2116 of file cryptlib.h.

◆ TransferTo2()

virtual size_t BufferedTransformation::TransferTo2 ( BufferedTransformation & target,
lword & byteCount,
const std::string & channel = DEFAULT_CHANNEL,
bool blocking = true )
pure virtual

Transfer bytes from this object to another BufferedTransformation.

Parameters
targetthe destination BufferedTransformation
byteCountthe number of bytes to transfer
channelthe channel on which the transfer should occur
blockingspecifies whether the object should block when processing input
Returns
the number of bytes that remain in the transfer block (i.e., bytes not transferred)

TransferTo2() removes bytes from this object and moves them to the destination. Transfer begins at the index position in the current stream, and not from an absolute position in the stream.

byteCount is an IN and OUT parameter. When the call is made, byteCount is the requested size of the transfer. When the call returns, byteCount is the number of bytes that were transferred.

Implemented in BERGeneralDecoder, FileStore, Filter, StringStore, RandomNumberStore, NullStore, MessageQueue, ByteQueue, ByteQueue::Walker, and Sink.

◆ CopyRangeTo2()

virtual size_t BufferedTransformation::CopyRangeTo2 ( BufferedTransformation & target,
lword & begin,
lword end = LWORD_MAX,
const std::string & channel = DEFAULT_CHANNEL,
bool blocking = true ) const
pure virtual

Copy bytes from this object to another BufferedTransformation.

Parameters
targetthe destination BufferedTransformation
beginthe 0-based index of the first byte to copy in the stream
endthe 0-based index of the last byte to copy in the stream
channelthe channel on which the transfer should occur
blockingspecifies whether the object should block when processing input
Returns
the number of bytes that remain in the copy block (i.e., bytes not copied)

CopyRangeTo2 copies bytes from this object to the destination. The bytes are not removed from this object. Copying begins at the index position in the current stream, and not from an absolute position in the stream.

begin is an IN and OUT parameter. When the call is made, begin is the starting position of the copy. When the call returns, begin is the position of the first byte that was not copied (which may be different than end). begin can be used for subsequent calls to CopyRangeTo2().

Implemented in BERGeneralDecoder, FileStore, Filter, StringStore, RandomNumberStore, NullStore, MessageQueue, ByteQueue, ByteQueue::Walker, and Sink.

◆ TransferMessagesTo2()

size_t BufferedTransformation::TransferMessagesTo2 ( BufferedTransformation & target,
unsigned int & messageCount,
const std::string & channel = DEFAULT_CHANNEL,
bool blocking = true )

Transfer messages from this object to another BufferedTransformation.

Parameters
targetthe destination BufferedTransformation
messageCountthe number of messages to transfer
channelthe channel on which the transfer should occur
blockingspecifies whether the object should block when processing input
Returns
the number of bytes that remain in the current transfer block (i.e., bytes not transferred)

TransferMessagesTo2() removes messages from this object and moves them to the destination.

messageCount is an IN and OUT parameter. When the call is made, messageCount is the the number of messages requested to be transferred. When the call returns, messageCount is the number of messages actually transferred.

◆ TransferAllTo2()

size_t BufferedTransformation::TransferAllTo2 ( BufferedTransformation & target,
const std::string & channel = DEFAULT_CHANNEL,
bool blocking = true )

Transfer all bytes from this object to another BufferedTransformation.

Parameters
targetthe destination BufferedTransformation
channelthe channel on which the transfer should occur
blockingspecifies whether the object should block when processing input
Returns
the number of bytes that remain in the current transfer block (i.e., bytes not transferred)

TransferMessagesTo2() removes messages from this object and moves them to the destination.

◆ ChannelPut() [1/2]

size_t BufferedTransformation::ChannelPut ( const std::string & channel,
byte inByte,
bool blocking = true )
inline

Input a byte for processing on a channel.

Parameters
channelthe channel to process the data.
inBytethe 8-bit byte (octet) to be processed.
blockingspecifies whether the object should block when processing input.
Returns
0 indicates all bytes were processed during the call. Non-0 indicates the number of bytes that were not processed.

Definition at line 2199 of file cryptlib.h.

◆ ChannelPut() [2/2]

size_t BufferedTransformation::ChannelPut ( const std::string & channel,
const byte * inString,
size_t length,
bool blocking = true )
inline

Input a byte buffer for processing on a channel.

Parameters
channelthe channel to process the data
inStringthe byte buffer to process
lengththe size of the string, in bytes
blockingspecifies whether the object should block when processing input
Returns
0 indicates all bytes were processed during the call. Non-0 indicates the number of bytes that were not processed.

Definition at line 2209 of file cryptlib.h.

◆ ChannelPutModifiable()

size_t BufferedTransformation::ChannelPutModifiable ( const std::string & channel,
byte * inString,
size_t length,
bool blocking = true )
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
blockingspecifies whether the object should block when processing input
Returns
0 indicates all bytes were processed during the call. Non-0 indicates the number of bytes that were not processed.

Definition at line 2219 of file cryptlib.h.

◆ ChannelPutWord16()

size_t BufferedTransformation::ChannelPutWord16 ( const std::string & channel,
word16 value,
ByteOrder order = BIG_ENDIAN_ORDER,
bool blocking = true )

Input a 16-bit word for processing on a channel.

Parameters
channelthe channel to process the data.
valuethe 16-bit value to be processed.
orderthe ByteOrder of the value to be processed.
blockingspecifies whether the object should block when processing input.
Returns
0 indicates all bytes were processed during the call. Non-0 indicates the number of bytes that were not processed.

◆ ChannelPutWord32()

size_t BufferedTransformation::ChannelPutWord32 ( const std::string & channel,
word32 value,
ByteOrder order = BIG_ENDIAN_ORDER,
bool blocking = true )

Input a 32-bit word for processing on a channel.

Parameters
channelthe channel to process the data.
valuethe 32-bit value to be processed.
orderthe ByteOrder of the value to be processed.
blockingspecifies whether the object should block when processing input.
Returns
0 indicates all bytes were processed during the call. Non-0 indicates the number of bytes that were not processed.

◆ ChannelPutWord64()

size_t BufferedTransformation::ChannelPutWord64 ( const std::string & channel,
word64 value,
ByteOrder order = BIG_ENDIAN_ORDER,
bool blocking = true )

Input a 64-bit word for processing on a channel.

Parameters
channelthe channel to process the data.
valuethe 64-bit value to be processed.
orderthe ByteOrder of the value to be processed.
blockingspecifies whether the object should block when processing input.
Returns
0 indicates all bytes were processed during the call. Non-0 indicates the number of bytes that were not processed.

◆ ChannelMessageEnd()

bool BufferedTransformation::ChannelMessageEnd ( const std::string & channel,
int propagation = -1,
bool blocking = true )
inline

Signal the end of a message.

Parameters
channelthe channel to process the data.
propagationthe number of attached transformations the ChannelMessageEnd() signal should be passed
blockingspecifies whether the object should block when processing input
Returns
0 indicates all bytes were processed during the call. Non-0 indicates the number of bytes that were not processed.

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

Definition at line 2257 of file cryptlib.h.

◆ ChannelPutMessageEnd()

size_t BufferedTransformation::ChannelPutMessageEnd ( const std::string & channel,
const byte * inString,
size_t length,
int propagation = -1,
bool blocking = true )
inline

Input multiple bytes for processing and signal the end of a message.

Parameters
channelthe channel to process the data.
inStringthe byte buffer to process
lengththe size of the string, in bytes
propagationthe number of attached transformations the ChannelPutMessageEnd() signal should be passed
blockingspecifies whether the object should block when processing input
Returns
the number of bytes that remain to be processed (i.e., bytes not processed)

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

Definition at line 2269 of file cryptlib.h.

◆ ChannelCreatePutSpace()

virtual byte * BufferedTransformation::ChannelCreatePutSpace ( const std::string & channel,
size_t & size )
virtual

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.

Reimplemented in AuthenticatedEncryptionFilter, and AuthenticatedDecryptionFilter.

◆ ChannelPut2()

virtual size_t BufferedTransformation::ChannelPut2 ( const std::string & channel,
const byte * inString,
size_t length,
int messageEnd,
bool blocking )
virtual

Input multiple bytes for processing on a channel.

Parameters
channelthe channel to process the data.
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)

Reimplemented in AuthenticatedEncryptionFilter, AuthenticatedDecryptionFilter, InputRejecting< BufferedTransformation >, and InputRejecting< Filter >.

◆ ChannelPutModifiable2()

virtual size_t BufferedTransformation::ChannelPutModifiable2 ( const std::string & channel,
byte * inString,
size_t length,
int messageEnd,
bool blocking )
virtual

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
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)

Reimplemented in AuthenticatedDecryptionFilter.

◆ ChannelFlush()

virtual bool BufferedTransformation::ChannelFlush ( const std::string & channel,
bool hardFlush,
int propagation = -1,
bool blocking = true )
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.

Reimplemented in Unflushable< Filter >.

◆ ChannelMessageSeriesEnd()

virtual bool BufferedTransformation::ChannelMessageSeriesEnd ( const std::string & channel,
int propagation = -1,
bool blocking = true )
virtual

Marks the end of a series of messages on a channel.

Parameters
channelthe channel to signal the end of a series of messages
propagationthe number of attached transformations the ChannelMessageSeriesEnd() signal should be passed
blockingspecifies whether the object should block when processing input
Returns
true if the message was successful, false otherwise

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().

Reimplemented in InputRejecting< BufferedTransformation >, and InputRejecting< Filter >.

◆ SetRetrievalChannel()

virtual void BufferedTransformation::SetRetrievalChannel ( const std::string & channel)
virtual

Sets the default retrieval channel.

Parameters
channelthe channel to signal the end of a series of messages
Note
this function may not be implemented in all objects that should support it.

◆ Attachable()

virtual bool BufferedTransformation::Attachable ( )
inlinevirtual

Determines whether the object allows attachment.

Returns
true if the object allows an attachment, false otherwise

Sources and Filters will returns true, while Sinks and other objects will return false.

Reimplemented in Filter.

Definition at line 2340 of file cryptlib.h.

◆ AttachedTransformation() [1/2]

virtual BufferedTransformation * BufferedTransformation::AttachedTransformation ( )
inlinevirtual

Returns the object immediately attached to this object.

Returns
the attached transformation

AttachedTransformation() returns NULL if there is no attachment. The non-const version of AttachedTransformation() always returns NULL.

Reimplemented in Filter.

Definition at line 2346 of file cryptlib.h.

◆ AttachedTransformation() [2/2]

virtual const BufferedTransformation * BufferedTransformation::AttachedTransformation ( ) const
inlinevirtual

Returns the object immediately attached to this object.

Returns
the attached transformation

AttachedTransformation() returns NULL if there is no attachment. The non-const version of AttachedTransformation() always returns NULL.

Reimplemented in Filter.

Definition at line 2352 of file cryptlib.h.

◆ Detach()

virtual void BufferedTransformation::Detach ( BufferedTransformation * newAttachment = NULL)
inlinevirtual

Delete the current attachment chain and attach a new one.

Parameters
newAttachmentthe new BufferedTransformation to attach
Exceptions
NotImplemented

Detach() deletes the current attachment chain and replace it with an optional newAttachment

If a derived class does not override Detach(), then the base class throws NotImplemented.

Reimplemented in Filter.

Definition at line 2361 of file cryptlib.h.

◆ Attach()

virtual void BufferedTransformation::Attach ( BufferedTransformation * newAttachment)
virtual

Add newAttachment to the end of attachment chain.

Parameters
newAttachmentthe attachment to add to the end of the chain

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