Crypto++  5.6.3
Free C++ class library of cryptographic schemes
Public Member Functions | Static Public Attributes | List of all members
FilterWithInputQueue Class Referenceabstract

_ More...

+ Inheritance diagram for FilterWithInputQueue:

Public Member Functions

 FilterWithInputQueue (BufferedTransformation *attachment=NULL)
 
size_t Put2 (const byte *inString, size_t length, int messageEnd, bool blocking)
 Input multiple bytes for processing. More...
 
bool Attachable ()
 Determine if attachable. More...
 
BufferedTransformationAttachedTransformation ()
 Retrieve attached transformation. More...
 
const BufferedTransformationAttachedTransformation () const
 Retrieve attached transformation. More...
 
void Detach (BufferedTransformation *newAttachment=NULL)
 Replace an attached transformation. More...
 
size_t TransferTo2 (BufferedTransformation &target, lword &transferBytes, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)
 Transfer bytes from this object to another BufferedTransformation. More...
 
size_t CopyRangeTo2 (BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true) const
 Copy bytes from this object to another BufferedTransformation. More...
 
void Initialize (const NameValuePairs &parameters=g_nullNameValuePairs, int propagation=-1)
 Initialize or reinitialize this object, with signal propagation. More...
 
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...
 
BufferedTransformationRef ()
 Provides a reference to this object. More...
 
virtual std::string AlgorithmName () const
 Provides the name of this algorithm. More...
 
virtual ClonableClone () const
 Copies this object. More...
 
bool Wait (unsigned long milliseconds, CallStack const &callStack)
 wait on this object More...
 
INPUT
size_t Put (byte inByte, bool blocking=true)
 Input a byte for processing. More...
 
size_t Put (const byte *inString, size_t length, bool blocking=true)
 Input a byte buffer for processing. More...
 
size_t PutWord16 (word16 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true)
 Input a 16-bit word for processing. More...
 
size_t PutWord32 (word32 value, ByteOrder order=BIG_ENDIAN_ORDER, bool blocking=true)
 Input a 32-bit word for processing. More...
 
virtual byte * CreatePutSpace (size_t &size)
 Request space which can be written into by the caller. More...
 
virtual bool CanModifyInput () const
 Determines whether input can be modifed by the callee. More...
 
size_t PutModifiable (byte *inString, size_t length, bool blocking=true)
 Input multiple bytes that may be modified by callee. More...
 
bool MessageEnd (int propagation=-1, bool blocking=true)
 Signals the end of messages to the object. More...
 
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. More...
 
virtual size_t PutModifiable2 (byte *inString, size_t length, int messageEnd, bool blocking)
 Input multiple bytes that may be modified by callee. More...
 
WAITING
unsigned int GetMaxWaitObjectCount () const
 Retrieves the maximum number of waitable objects.
 
void GetWaitObjects (WaitObjectContainer &container, CallStack const &callStack)
 Retrieves waitable objects. More...
 
SIGNALS
virtual bool IsolatedFlush (bool hardFlush, bool blocking)=0
 Flushes data buffered by this object, without signal propagation. More...
 
virtual bool IsolatedMessageSeriesEnd (bool blocking)
 Marks the end of a series of messages, without signal propagation. More...
 
virtual void SetAutoSignalPropagation (int propagation)
 Set propagation of automatically generated and transferred signals. More...
 
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. More...
 
virtual bool AnyRetrievable () const
 Determines whether bytes are ready for retrieval. More...
 
virtual size_t Get (byte &outByte)
 Retrieve a 8-bit byte. More...
 
virtual size_t Get (byte *outString, size_t getMax)
 Retrieve a block of bytes. More...
 
virtual size_t Peek (byte &outByte) const
 Peek a 8-bit byte. More...
 
virtual size_t Peek (byte *outString, size_t peekMax) const
 Peek a block of bytes. More...
 
size_t GetWord16 (word16 &value, ByteOrder order=BIG_ENDIAN_ORDER)
 Retrieve a 16-bit word. More...
 
size_t GetWord32 (word32 &value, ByteOrder order=BIG_ENDIAN_ORDER)
 Retrieve a 32-bit word. More...
 
size_t PeekWord16 (word16 &value, ByteOrder order=BIG_ENDIAN_ORDER) const
 Peek a 16-bit word. More...
 
size_t PeekWord32 (word32 &value, ByteOrder order=BIG_ENDIAN_ORDER) const
 Peek a 32-bit word. More...
 
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 More...
 
virtual lword Skip (lword skipMax=LWORD_MAX)
 Discard skipMax bytes from the output buffer. More...
 
lword CopyTo (BufferedTransformation &target, lword copyMax=LWORD_MAX, const std::string &channel=DEFAULT_CHANNEL) const
 copy copyMax bytes of the buffered output to target as input More...
 
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. More...
 
RETRIEVAL OF MULTIPLE MESSAGES
virtual lword TotalBytesRetrievable () const
 Provides the number of bytes ready for retrieval. More...
 
virtual unsigned int NumberOfMessages () const
 Provides the number of meesages processed by this object. More...
 
virtual bool AnyMessages () const
 Determines if any messages are available for retrieval. More...
 
virtual bool GetNextMessage ()
 Start retrieving the next message. More...
 
virtual unsigned int SkipMessages (unsigned int count=UINT_MAX)
 Skip a number of meessages. More...
 
unsigned int TransferMessagesTo (BufferedTransformation &target, unsigned int count=UINT_MAX, const std::string &channel=DEFAULT_CHANNEL)
 Transfer messages from this object to another BufferedTransformation. More...
 
unsigned int CopyMessagesTo (BufferedTransformation &target, unsigned int count=UINT_MAX, const std::string &channel=DEFAULT_CHANNEL) const
 Copies messages from this object to another BufferedTransformation. More...
 
virtual void SkipAll ()
 
void TransferAllTo (BufferedTransformation &target, const std::string &channel=DEFAULT_CHANNEL)
 
void CopyAllTo (BufferedTransformation &target, const std::string &channel=DEFAULT_CHANNEL) const
 
virtual bool GetNextMessageSeries ()
 
virtual unsigned int NumberOfMessagesInThisSeries () const
 
virtual unsigned int NumberOfMessageSeries () const
 
NON-BLOCKING TRANSFER OF OUTPUT
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. More...
 
size_t TransferAllTo2 (BufferedTransformation &target, const std::string &channel=DEFAULT_CHANNEL, bool blocking=true)
 Transfer all bytes from this object to another BufferedTransformation. More...
 
CHANNELS
size_t ChannelPut (const std::string &channel, byte inByte, bool blocking=true)
 Input a byte for processing on a channel. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
bool ChannelMessageEnd (const std::string &channel, int propagation=-1, bool blocking=true)
 Signal the end of a message. More...
 
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. More...
 
virtual byte * ChannelCreatePutSpace (const std::string &channel, size_t &size)
 Request space which can be written into by the caller. More...
 
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. More...
 
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. More...
 
virtual bool ChannelFlush (const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true)
 Flush buffered input and/or output on a channel. More...
 
virtual bool ChannelMessageSeriesEnd (const std::string &channel, int propagation=-1, bool blocking=true)
 Marks the end of a series of messages on a channel. More...
 
virtual void SetRetrievalChannel (const std::string &channel)
 Sets the default retrieval channel. More...
 
ATTACHMENT
virtual void Attach (BufferedTransformation *newAttachment)
 Add newAttachment to the end of attachment chain. More...
 

Static Public Attributes

static const std::string & NULL_CHANNEL = DEFAULT_CHANNEL
 

Detailed Description

_

Definition at line 345 of file filters.h.

Member Function Documentation

size_t FilterWithInputQueue::Put2 ( const byte *  inString,
size_t  length,
int  messageEnd,
bool  blocking 
)
inlinevirtual

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

Derived classes must implement Put2().

Implements BufferedTransformation.

Definition at line 350 of file filters.h.

bool Filter::Attachable ( )
inlinevirtualinherited

Determine if attachable.

Returns
true if the object allows attached transformations, false otherwise.
Note
Source and Filter offer attached transformations; while Sink does not.

Reimplemented from BufferedTransformation.

Definition at line 50 of file filters.h.

References DEFAULT_CHANNEL, and g_nullNameValuePairs.

BufferedTransformation * Filter::AttachedTransformation ( )
virtualinherited
const BufferedTransformation * Filter::AttachedTransformation ( ) const
virtualinherited

Retrieve attached transformation.

Returns
pointer to a BufferedTransformation if there is an attached transformation, NULL otherwise.

Reimplemented from BufferedTransformation.

Definition at line 43 of file filters.cpp.

void Filter::Detach ( BufferedTransformation newAttachment = NULL)
virtualinherited

Replace an attached transformation.

Parameters
newAttachmentpointer to a new BufferedTransformation

newAttachment cab ne a single filter, a chain of filters or NULL. Pass NULL to remove an existing BufferedTransformation or chain of filters

Reimplemented from BufferedTransformation.

Definition at line 50 of file filters.cpp.

Referenced by Inflator::Inflator(), and ArrayXorSink::Put2().

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

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)

TransferTo 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.

Implements BufferedTransformation.

Definition at line 66 of file filters.cpp.

References Filter::AttachedTransformation(), and BufferedTransformation::TransferTo2().

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

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 tahn end). begin can be used for subsequent calls to CopyRangeTo2.

Implements BufferedTransformation.

Definition at line 61 of file filters.cpp.

References Filter::AttachedTransformation(), and BufferedTransformation::CopyRangeTo2().

Referenced by StringStore::TransferTo2().

void Filter::Initialize ( const NameValuePairs parameters = g_nullNameValuePairs,
int  propagation = -1 
)
virtualinherited

Initialize or reinitialize this object, with signal propagation.

Parameters
parametersa set of NameValuePairs used to initialize or reinitialize this object and attached transformations
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 constuctors 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 from BufferedTransformation.

Definition at line 71 of file filters.cpp.

References BufferedTransformation::IsolatedInitialize().

Referenced by AuthenticatedDecryptionFilter::AuthenticatedDecryptionFilter(), HuffmanEncoder::HuffmanEncoder(), HexEncoder::IsolatedInitialize(), Base64Encoder::IsolatedInitialize(), Base32Encoder::IsolatedInitialize(), and Base32Decoder::IsolatedInitialize().

bool Filter::Flush ( bool  hardFlush,
int  propagation = -1,
bool  blocking = true 
)
virtualinherited

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.

Reimplemented from BufferedTransformation.

Reimplemented in InformationDispersal, and SecretSharing.

Definition at line 78 of file filters.cpp.

References BufferedTransformation::IsolatedFlush().

Referenced by TestDataNameValuePairs::GetVoidValue().

bool Filter::MessageSeriesEnd ( int  propagation = -1,
bool  blocking = true 
)
virtualinherited

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

Reimplemented from BufferedTransformation.

Definition at line 95 of file filters.cpp.

References Filter::AttachedTransformation(), BufferedTransformation::ChannelFlush(), BufferedTransformation::ChannelMessageSeriesEnd(), BufferedTransformation::ChannelPut2(), BufferedTransformation::ChannelPutModifiable2(), BufferedTransformation::Initialize(), BufferedTransformation::IsolatedMessageSeriesEnd(), and SaturatingSubtract().

BufferedTransformation& BufferedTransformation::Ref ( )
inlineinherited

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 1258 of file cryptlib.h.

Referenced by TestDataNameValuePairs::GetVoidValue().

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

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 in the block (i.e., bytes not processed)

Internally, Put() calls Put2().

Definition at line 1277 of file cryptlib.h.

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

Input a 16-bit word for processing.

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

Definition at line 717 of file cryptlib.cpp.

Referenced by Deflator::IsolatedFlush(), and Integer::OpenPGPEncode().

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

Input a 32-bit word for processing.

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

Definition at line 722 of file cryptlib.cpp.

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

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.

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

Definition at line 1303 of file cryptlib.h.

Referenced by AuthenticatedEncryptionFilter::ChannelCreatePutSpace(), AuthenticatedDecryptionFilter::ChannelCreatePutSpace(), and ArrayXorSink::CreatePutSpace().

virtual bool BufferedTransformation::CanModifyInput ( ) const
inlinevirtualinherited

Determines whether input can be modifed by the callee.

Returns
true if input can be modified, false otherwise

The base class implementation returns false.

Reimplemented in Redirector.

Definition at line 1309 of file cryptlib.h.

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

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
0 indicates all bytes were processed during the call. Non-0 indicates the number of bytes that were not processed

Definition at line 1318 of file cryptlib.h.

Referenced by ArrayXorSink::Put2().

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

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 1326 of file cryptlib.h.

Referenced by EqualityComparisonFilter::ChannelPut2(), AuthenticatedEncryptionFilter::ChannelPut2(), AuthenticatedDecryptionFilter::ChannelPut2(), TestDataNameValuePairs::GetVoidValue(), and FilterTester::Put2().

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

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

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 1338 of file cryptlib.h.

Referenced by AuthenticatedDecryptionFilter::ChannelPut2(), and IntegrityCheckModule().

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

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.

Internally, PutModifiable2() calls Put2().

Reimplemented in OutputProxy, FilterWithBufferedInput, and MeterFilter.

Definition at line 1355 of file cryptlib.h.

Referenced by NetworkSource::GetWaitObjects().

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

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.

Reimplemented in Redirector, NetworkSink, and NetworkSource.

Definition at line 431 of file cryptlib.cpp.

References BufferedTransformation::GetWaitObjects().

Referenced by BufferedTransformation::GetWaitObjects().

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

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
Note
hardFlush must be used with care

Implemented in ProxyFilter, FilterWithBufferedInput, NonblockingSink, Inflator, FileSink, Deflator, and MessageQueue.

Referenced by Filter::Flush().

virtual bool BufferedTransformation::IsolatedMessageSeriesEnd ( bool  blocking)
inlinevirtualinherited

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

Reimplemented in MeterFilter, and MessageQueue.

Definition at line 1407 of file cryptlib.h.

References g_nullNameValuePairs.

Referenced by Filter::MessageSeriesEnd().

virtual void BufferedTransformation::SetAutoSignalPropagation ( int  propagation)
inlinevirtualinherited

Set propagation of automatically generated and transferred signals.

Parameters
propagationthen new value

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

Reimplemented in SourceTemplate< T >, SourceTemplate< FileStore >, SourceTemplate< RandomNumberStore >, and SourceTemplate< StringStore >.

Definition at line 1451 of file cryptlib.h.

lword BufferedTransformation::MaxRetrievable ( ) const
virtualinherited

Provides the number of bytes ready for retrieval.

Returns
the number of bytes ready for retrieval

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

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

Definition at line 499 of file cryptlib.cpp.

References TheBitBucket().

Referenced by Integer::BERDecode(), Integer::Decode(), Integer::OpenPGPDecode(), and FilterTester::Put2().

bool BufferedTransformation::AnyRetrievable ( ) const
virtualinherited

Determines whether bytes are ready for retrieval.

Returns
true if bytes are available for retrieval, false otherwise

Reimplemented in RandomNumberStore, MessageQueue, and ByteQueue.

Definition at line 507 of file cryptlib.cpp.

Referenced by Store::GetNextMessage().

size_t BufferedTransformation::Get ( byte &  outByte)
virtualinherited

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::Walker, and ByteQueue.

Definition at line 518 of file cryptlib.cpp.

Referenced by BERDecodeUnsigned(), Integer::Decode(), DefaultDecryptor::DefaultDecryptor(), DEREncodeBitString(), DEREncodeOctetString(), DERLengthEncode(), PolynomialMod2::Encode(), and FilterTester::Put2().

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

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::Walker, and ByteQueue.

Definition at line 526 of file cryptlib.cpp.

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

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::Walker, and ByteQueue.

Definition at line 537 of file cryptlib.cpp.

Referenced by Integer::Decode(), DEREncodeBitString(), and DL_GroupParameters_EC< EC >::GenerateRandom().

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

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 Get to detect short reads.

Reimplemented in ByteQueue::Walker, and ByteQueue.

Definition at line 545 of file cryptlib.cpp.

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

Retrieve a 16-bit word.

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

Use the return value of GetWord16 to detect short reads.

Definition at line 753 of file cryptlib.cpp.

Referenced by Integer::OpenPGPDecode().

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

Retrieve a 32-bit word.

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

Use the return value of GetWord16 to detect short reads.

Definition at line 758 of file cryptlib.cpp.

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

Peek a 16-bit word.

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

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

Definition at line 727 of file cryptlib.cpp.

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

Peek a 32-bit word.

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

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

Definition at line 740 of file cryptlib.cpp.

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

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 1543 of file cryptlib.h.

Referenced by DEREncodeBitString(), DEREncodeOctetString(), ByteQueue::Get(), ByteQueue::Walker::Get(), MessageQueue::GetNextMessage(), IntegrityCheckModule(), and Inflator::IsolatedFlush().

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

Discard skipMax bytes from the output buffer.

Parameters
skipMaxthe number of bytes to discard

Skip always returns skipMax.

Reimplemented in FileStore.

Definition at line 556 of file cryptlib.cpp.

References TheBitBucket().

Referenced by ByteQueue::CopyRangeTo2(), ByteQueue::Walker::CopyRangeTo2(), Integer::Decode(), Inflator::IsolatedFlush(), and ByteQueue::TransferTo2().

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

copy copyMax bytes of the buffered output to target as input

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 1560 of file cryptlib.h.

Referenced by Store::GetNextMessage(), ByteQueue::Peek(), and ByteQueue::Walker::Peek().

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

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 1573 of file cryptlib.h.

lword BufferedTransformation::TotalBytesRetrievable ( ) const
virtualinherited

Provides the number of bytes ready for retrieval.

Returns
the number of bytes ready for retrieval

Reimplemented in MessageQueue.

Definition at line 564 of file cryptlib.cpp.

unsigned int BufferedTransformation::NumberOfMessages ( ) const
virtualinherited

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 Store, and MessageQueue.

Definition at line 572 of file cryptlib.cpp.

References TheBitBucket().

bool BufferedTransformation::AnyMessages ( ) const
virtualinherited

Determines if any messages are available for retrieval.

Returns
true if NumberOfMessages() > 0, false otherwise

AnyMessages returns true if NumberOfMessages() > 0

Definition at line 580 of file cryptlib.cpp.

bool BufferedTransformation::GetNextMessage ( )
virtualinherited

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 Store, and MessageQueue.

Definition at line 588 of file cryptlib.cpp.

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

Skip a number of meessages.

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

Definition at line 599 of file cryptlib.cpp.

References TheBitBucket().

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

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 1621 of file cryptlib.h.

References DEFAULT_CHANNEL.

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

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

CopyMessagesTo copies messages from this object and copies them 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.

Definition at line 637 of file cryptlib.cpp.

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

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.

Definition at line 607 of file cryptlib.cpp.

References BufferedTransformation::ChannelMessageEnd().

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

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.

Definition at line 656 of file cryptlib.cpp.

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

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 1725 of file cryptlib.h.

Referenced by FileStore::CopyRangeTo2(), RandomPool::GenerateIntoBufferedTransformation(), X917RNG::GenerateIntoBufferedTransformation(), RandomNumberGenerator::GenerateIntoBufferedTransformation(), and ByteQueue::TransferTo2().

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

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 1735 of file cryptlib.h.

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

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 1745 of file cryptlib.h.

Referenced by ByteQueue::TransferTo2().

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

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 in which the word should 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 705 of file cryptlib.cpp.

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

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 in which the word should 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 711 of file cryptlib.cpp.

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

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 1774 of file cryptlib.h.

Referenced by MessageQueue::GetNextMessage(), Store::GetNextMessage(), and BufferedTransformation::TransferMessagesTo2().

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

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
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 1787 of file cryptlib.h.

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

Request space which can be written into by the caller.

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

Reimplemented in OutputProxy, Redirector, AuthenticatedDecryptionFilter, AuthenticatedEncryptionFilter, and ChannelSwitch.

Definition at line 459 of file cryptlib.cpp.

Referenced by ChannelSwitch::ChannelCreatePutSpace().

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

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.

Reimplemented in OutputProxy, Redirector, AuthenticatedDecryptionFilter, AuthenticatedEncryptionFilter, ChannelSwitch, EqualityComparisonFilter, and RawIDA.

Definition at line 467 of file cryptlib.cpp.

Referenced by StringStore::CopyRangeTo2(), NullStore::CopyRangeTo2(), Filter::MessageSeriesEnd(), and ByteQueue::Walker::TransferTo2().

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

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

Reimplemented in OutputProxy, Redirector, and ChannelSwitch.

Definition at line 475 of file cryptlib.cpp.

Referenced by ChannelSwitch::ChannelPutModifiable2(), Filter::MessageSeriesEnd(), and FileStore::TransferTo2().

bool BufferedTransformation::ChannelFlush ( const std::string &  channel,
bool  hardFlush,
int  propagation = -1,
bool  blocking = true 
)
virtualinherited

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

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

Reimplemented in OutputProxy, Redirector, and ChannelSwitch.

Definition at line 483 of file cryptlib.cpp.

Referenced by Filter::MessageSeriesEnd().

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

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

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 OutputProxy, Redirector, ChannelSwitch, and EqualityComparisonFilter.

Definition at line 491 of file cryptlib.cpp.

Referenced by Filter::MessageSeriesEnd().

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

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.

Definition at line 699 of file cryptlib.cpp.

void BufferedTransformation::Attach ( BufferedTransformation newAttachment)
virtualinherited

Add newAttachment to the end of attachment chain.

Parameters
newAttachmentthe attachment to add to the end of the chain

Definition at line 763 of file cryptlib.cpp.

Referenced by FilterTester::Put2().

virtual std::string Algorithm::AlgorithmName ( ) const
inlinevirtualinherited

Provides the name of this algorithm.

Returns
the standard algorithm name

The standard algorithm name can be a name like AES or AES/GCM. Some algorithms do not have standard names yet. For example, there is no standard algorithm name for Shoup's ECIES.

Note
AlgorithmName is not universally implemented yet

Reimplemented in AuthenticatedSymmetricCipher, SignatureVerificationFilter, SignerFilter, AuthenticatedDecryptionFilter, HashVerificationFilter, HashFilter, StreamTransformationFilter, ClassNullRNG, BitBucket, RDSEED, DH_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >, HMAC< T >, RDRAND, CRC32, GCM_Base, Adler32, EAX_Base, CCM_Base, SHA3, and VMAC_Base.

Definition at line 488 of file cryptlib.h.

Referenced by VariableRounds< 6, 2 >::StaticGetDefaultRounds().

virtual Clonable* Clonable::Clone ( ) const
inlinevirtualinherited

Copies this object.

Returns
a copy of this object
Exceptions
NotImplemented
Note
this is not implemented by most classes
See also
NotCopyable

Definition at line 464 of file cryptlib.h.

bool Waitable::Wait ( unsigned long  milliseconds,
CallStack const &  callStack 
)
inherited

wait on this object

same as creating an empty container, calling GetWaitObjects(), and calling Wait() on the container

Definition at line 426 of file wait.cpp.

Referenced by NetworkSource::GetWaitObjects(), and NetworkSink::Put2().


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