6#ifndef CRYPTOPP_CHANNELS_H
7#define CRYPTOPP_CHANNELS_H
14#if CRYPTOPP_MSC_VERSION
16# pragma warning(disable: 4355)
19NAMESPACE_BEGIN(CryptoPP)
23class MessageSwitch :
public Sink
27 void AddRoute(
unsigned int begin,
unsigned int end,
BufferedTransformation &destination,
const std::string &channel);
29 void Put(
byte inByte);
30 void Put(
const byte *inString,
unsigned int length);
32 void Flush(
bool completeFlush,
int propagation=-1);
34 void PutMessageEnd(
const byte *inString,
unsigned int length,
int propagation=-1);
38 typedef std::pair<BufferedTransformation *, std::string> Route;
41 RangeRoute(
unsigned int begin,
unsigned int end,
const Route &route)
42 : begin(begin), end(end), route(route) {}
43 bool operator<(
const RangeRoute &rhs)
const {
return begin < rhs.begin;}
44 unsigned int begin, end;
48 typedef std::list<RangeRoute> RouteList;
49 typedef std::list<Route> DefaultRouteList;
52 DefaultRouteList m_defaultRoutes;
53 unsigned int m_nCurrentMessage;
60 typedef std::pair<BufferedTransformation *, std::string> Route;
61 typedef std::multimap<std::string, Route> RouteMap;
63 typedef std::pair<BufferedTransformation *, value_ptr<std::string> > DefaultRoute;
64 typedef std::list<DefaultRoute> DefaultRouteList;
67 typedef RouteMap::iterator MapIterator;
68 typedef DefaultRouteList::iterator ListIterator;
78 void Reset(
const std::string &channel);
82 const std::string & Channel();
85 std::string m_channel;
87 MapIterator m_itMapCurrent, m_itMapEnd;
88 ListIterator m_itListCurrent, m_itListEnd;
102 AddDefaultRoute(destination);
106 AddDefaultRoute(destination, outChannel);
109 void IsolatedInitialize(
const NameValuePairs ¶meters=g_nullNameValuePairs);
111 size_t ChannelPut2(
const std::string &channel,
const byte *begin,
size_t length,
int messageEnd,
bool blocking);
112 size_t ChannelPutModifiable2(
const std::string &channel,
byte *begin,
size_t length,
int messageEnd,
bool blocking);
114 bool ChannelFlush(
const std::string &channel,
bool completeFlush,
int propagation=-1,
bool blocking=
true);
115 bool ChannelMessageSeriesEnd(
const std::string &channel,
int propagation=-1,
bool blocking=
true);
123 void AddRoute(
const std::string &inChannel,
BufferedTransformation &destination,
const std::string &outChannel);
124 void RemoveRoute(
const std::string &inChannel,
BufferedTransformation &destination,
const std::string &outChannel);
128 DefaultRouteList m_defaultRoutes;
138#if CRYPTOPP_MSC_VERSION
Route input to different and/or multiple channels based on channel ID.
Multiple channels support for custom signal processing.
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.
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 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.
byte * ChannelCreatePutSpace(const std::string &channel, size_t &size)
Request space which can be written into by the caller.
Interface for retrieving values given their names.
Implementation of BufferedTransformation's attachment interface.
Abstract base classes that provide a uniform interface to this library.
Classes providing basic library services.
Classes for automatic resource management.