Multichannel< T > Class Template Referenceabstract

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

`#include <simple.h>`

Inheritance diagram for Multichannel< T >:

## Public Member Functions

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

## Detailed Description

template<class T>
class Multichannel< T >

Multiple channels support for custom signal processing.

Template Parameters

  T | the class or type

T should be a BufferedTransformation derived class

Definition at line 315 of file simple.h.

## Member Function Documentation

## Flush()

template<class T >

bool Multichannel< T >::Flush | ( | bool | hardFlush,
|  | int | propagation = `-1`,
|  | bool | blocking = `true`
| ) |  |

inline virtual

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

Parameters

  hardFlush | is used to indicate whether all data should be flushed
  propagation | the number of attached transformations the Flush() signal should be passed
  blocking | specifies whether the object should block when processing input

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

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

Implements CustomFlushPropagation< T >.

Reimplemented in Unflushable< Multichannel< Filter > >.

Definition at line 318 of file simple.h.

## MessageSeriesEnd()

template<class T >

bool Multichannel< T >::MessageSeriesEnd | ( | int | propagation = `-1`,
|  | bool | blocking = `true`
| ) |  |

inline

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

Parameters

  propagation | the number of attached transformations the MessageSeriesEnd() signal should be passed
  blocking | specifies whether the object should block when processing input

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

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

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

Definition at line 329 of file simple.h.

## CreatePutSpace()

template<class T >

byte * Multichannel< T >::CreatePutSpace | ( | size_t & | size | ) |

inline

Request space which can be written into by the caller.

Parameters

  size | the requested size of the buffer

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

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

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

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

Definition at line 341 of file simple.h.

## Put2()

template<class T >

size_t Multichannel< T >::Put2 | ( | const byte * | inString,
|  | size_t | length,
|  | int | messageEnd,
|  | bool | blocking
| ) |  |

inline

Input multiple bytes for processing.

Parameters

  inString | the byte buffer to process
  length | the size of the string, in bytes
  messageEnd | means how many filters to signal MessageEnd() to, including this one
  blocking | specifies whether the object should block when processing input

Returns
  the number of bytes that remain to be processed (i.e., bytes not processed)

Derived classes must implement Put2().

Definition at line 351 of file simple.h.

## PutModifiable2()

template<class T >

size_t Multichannel< T >::PutModifiable2 | ( | byte * | inString,
|  | size_t | length,
|  | int | messageEnd,
|  | bool | blocking
| ) |  |

inline

Input multiple bytes that may be modified by callee.

Parameters

  inString | the byte buffer to process.
  length | the size of the string, in bytes.
  messageEnd | means how many filters to signal MessageEnd() to, including this one.
  blocking | specifies whether the object should block when processing input.

Returns
  the number of bytes that remain to be processed (i.e., bytes not processed)

Internally, PutModifiable2() calls Put2().

Definition at line 361 of file simple.h.

## ChannelCreatePutSpace()

template<class T >

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

inline

Request space which can be written into by the caller.

Parameters

  channel | the channel to process the data
  size | the requested size of the buffer

Returns
  a pointer to a memory block with length size

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

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

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

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

Definition at line 378 of file simple.h.

## ChannelPutModifiable()

template<class T >

bool Multichannel< T >::ChannelPutModifiable | ( | const std::string & | channel,
|  | byte * | inString,
|  | size_t | length
| ) |  |

inline

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

Parameters

  channel | the channel to process the data.
  inString | the byte buffer to process
  length | the size of the string, in bytes

Returns
  true if all bytes were processed, false otherwise.

Definition at line 386 of file simple.h.

## ChannelPut2()

template<class T >

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

pure virtual

Input multiple bytes for processing on a channel.

Parameters

  channel | the channel to process the data.
  begin | the byte buffer to process.
  length | the size of the string, in bytes.
  messageEnd | means how many filters to signal MessageEnd() to, including this one.
  blocking | specifies whether the object should block when processing input.

Returns
  the number of bytes that remain to be processed (i.e., bytes not processed)

Implemented in ChannelSwitch, RawIDA, and EqualityComparisonFilter.

## ChannelPutModifiable2()

template<class T >

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

inline

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

Parameters

  channel | the channel to process the data
  begin | the byte buffer to process
  length | the size of the string, in bytes
  messageEnd | means how many filters to signal MessageEnd() to, including this one
  blocking | specifies whether the object should block when processing input

Returns
  the number of bytes that remain to be processed (i.e., bytes not processed)

Definition at line 405 of file simple.h.

## ChannelFlush()

template<class T >

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

pure virtual

Flush buffered input and/or output on a channel.

Parameters

  channel | the channel to flush the data
  hardFlush | is used to indicate whether all data should be flushed
  propagation | the number of attached transformations the ChannelFlush() signal should be passed
  blocking | specifies whether the object should block when processing input

Returns
  true of the Flush was successful

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

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

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

- simple.h