<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>Crypto++: channels.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.1 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <h1>channels.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef CRYPTOPP_CHANNELS_H</span> <a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_CHANNELS_H</span> <a name="l00003"></a>00003 <span class="preprocessor"></span> <a name="l00004"></a>00004 <span class="preprocessor">#include "<a class="code" href="simple_8h.html">simple.h</a>"</span> <a name="l00005"></a>00005 <span class="preprocessor">#include "smartptr.h"</span> <a name="l00006"></a>00006 <span class="preprocessor">#include <map></span> <a name="l00007"></a>00007 <span class="preprocessor">#include <list></span> <a name="l00008"></a>00008 <a name="l00009"></a>00009 NAMESPACE_BEGIN(CryptoPP) <a name="l00010"></a>00010 <a name="l00011"></a>00011 <span class="preprocessor">#if 0</span><span class="comment"></span> <a name="l00012"></a>00012 <span class="comment">//! Route input on default channel to different and/or multiple channels based on message sequence number</span> <a name="l00013"></a>00013 <span class="comment"></span>class MessageSwitch : public Sink <a name="l00014"></a>00014 { <a name="l00015"></a>00015 <span class="keyword">public</span>: <a name="l00016"></a>00016 <span class="keywordtype">void</span> AddDefaultRoute(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &destination, <span class="keyword">const</span> std::string &channel); <a name="l00017"></a>00017 <span class="keywordtype">void</span> AddRoute(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> begin, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> end, <a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &destination, <span class="keyword">const</span> std::string &channel); <a name="l00018"></a>00018 <a name="l00019"></a>00019 <span class="keywordtype">void</span> Put(byte inByte); <a name="l00020"></a>00020 <span class="keywordtype">void</span> Put(<span class="keyword">const</span> byte *inString, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length); <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="keywordtype">void</span> Flush(<span class="keywordtype">bool</span> completeFlush, <span class="keywordtype">int</span> propagation=-1); <a name="l00023"></a>00023 <span class="keywordtype">void</span> MessageEnd(<span class="keywordtype">int</span> propagation=-1); <a name="l00024"></a>00024 <span class="keywordtype">void</span> PutMessageEnd(<span class="keyword">const</span> byte *inString, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length, <span class="keywordtype">int</span> propagation=-1); <a name="l00025"></a>00025 <span class="keywordtype">void</span> MessageSeriesEnd(<span class="keywordtype">int</span> propagation=-1); <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="keyword">private</span>: <a name="l00028"></a>00028 <span class="keyword">typedef</span> std::pair<BufferedTransformation *, std::string> Route; <a name="l00029"></a>00029 <span class="keyword">struct </span>RangeRoute <a name="l00030"></a>00030 { <a name="l00031"></a>00031 RangeRoute(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> begin, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> end, <span class="keyword">const</span> Route &route) <a name="l00032"></a>00032 : begin(begin), end(end), route(route) {} <a name="l00033"></a>00033 <span class="keywordtype">bool</span> <a class="code" href="gf2n_8h.html#abe7b3406821884ed8df76bf9e8266efb" title="compares degree">operator<</a>(<span class="keyword">const</span> RangeRoute &rhs)<span class="keyword"> const </span>{<span class="keywordflow">return</span> begin < rhs.begin;} <a name="l00034"></a>00034 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> begin, end; <a name="l00035"></a>00035 Route route; <a name="l00036"></a>00036 }; <a name="l00037"></a>00037 <a name="l00038"></a>00038 <span class="keyword">typedef</span> std::list<RangeRoute> RouteList; <a name="l00039"></a>00039 <span class="keyword">typedef</span> std::list<Route> DefaultRouteList; <a name="l00040"></a>00040 <a name="l00041"></a>00041 RouteList m_routes; <a name="l00042"></a>00042 DefaultRouteList m_defaultRoutes; <a name="l00043"></a>00043 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_nCurrentMessage; <a name="l00044"></a>00044 }; <a name="l00045"></a>00045 <span class="preprocessor">#endif</span> <a name="l00046"></a>00046 <span class="preprocessor"></span> <a name="l00047"></a><a class="code" href="class_channel_switch_typedefs.html">00047</a> <span class="keyword">class </span><a class="code" href="class_channel_switch_typedefs.html">ChannelSwitchTypedefs</a> <a name="l00048"></a>00048 { <a name="l00049"></a>00049 <span class="keyword">public</span>: <a name="l00050"></a>00050 <span class="keyword">typedef</span> std::pair<BufferedTransformation *, std::string> Route; <a name="l00051"></a>00051 <span class="keyword">typedef</span> std::multimap<std::string, Route> RouteMap; <a name="l00052"></a>00052 <a name="l00053"></a>00053 <span class="keyword">typedef</span> std::pair<BufferedTransformation *, value_ptr<std::string> > DefaultRoute; <a name="l00054"></a>00054 <span class="keyword">typedef</span> std::list<DefaultRoute> DefaultRouteList; <a name="l00055"></a>00055 <a name="l00056"></a>00056 <span class="comment">// SunCC workaround: can't use const_iterator here</span> <a name="l00057"></a>00057 <span class="keyword">typedef</span> RouteMap::iterator MapIterator; <a name="l00058"></a>00058 <span class="keyword">typedef</span> DefaultRouteList::iterator ListIterator; <a name="l00059"></a>00059 }; <a name="l00060"></a>00060 <a name="l00061"></a>00061 <span class="keyword">class </span><a class="code" href="class_channel_switch.html" title="Route input to different and/or multiple channels based on channel ID.">ChannelSwitch</a>; <a name="l00062"></a>00062 <a name="l00063"></a><a class="code" href="class_channel_route_iterator.html">00063</a> <span class="keyword">class </span><a class="code" href="class_channel_route_iterator.html">ChannelRouteIterator</a> : <span class="keyword">public</span> <a class="code" href="class_channel_switch_typedefs.html">ChannelSwitchTypedefs</a> <a name="l00064"></a>00064 { <a name="l00065"></a>00065 <span class="keyword">public</span>: <a name="l00066"></a>00066 <a class="code" href="class_channel_switch.html" title="Route input to different and/or multiple channels based on channel ID.">ChannelSwitch</a>& m_cs; <a name="l00067"></a>00067 std::string m_channel; <a name="l00068"></a>00068 <span class="keywordtype">bool</span> m_useDefault; <a name="l00069"></a>00069 MapIterator m_itMapCurrent, m_itMapEnd; <a name="l00070"></a>00070 ListIterator m_itListCurrent, m_itListEnd; <a name="l00071"></a>00071 <a name="l00072"></a>00072 <a class="code" href="class_channel_route_iterator.html">ChannelRouteIterator</a>(<a class="code" href="class_channel_switch.html" title="Route input to different and/or multiple channels based on channel ID.">ChannelSwitch</a> &cs) : m_cs(cs) {} <a name="l00073"></a>00073 <span class="keywordtype">void</span> Reset(<span class="keyword">const</span> std::string &channel); <a name="l00074"></a>00074 <span class="keywordtype">bool</span> End() <span class="keyword">const</span>; <a name="l00075"></a>00075 <span class="keywordtype">void</span> Next(); <a name="l00076"></a>00076 <a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> & Destination(); <a name="l00077"></a>00077 <span class="keyword">const</span> std::string & Channel(); <a name="l00078"></a>00078 }; <a name="l00079"></a>00079 <span class="comment"></span> <a name="l00080"></a>00080 <span class="comment">//! Route input to different and/or multiple channels based on channel ID</span> <a name="l00081"></a><a class="code" href="class_channel_switch.html">00081</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL <a class="code" href="class_channel_switch.html" title="Route input to different and/or multiple channels based on channel ID.">ChannelSwitch</a> : <span class="keyword">public</span> <a class="code" href="class_multichannel.html" title="_">Multichannel</a><Sink>, <span class="keyword">public</span> <a class="code" href="class_channel_switch_typedefs.html">ChannelSwitchTypedefs</a> <a name="l00082"></a>00082 { <a name="l00083"></a>00083 <span class="keyword">public</span>: <a name="l00084"></a>00084 <a class="code" href="class_channel_switch.html" title="Route input to different and/or multiple channels based on channel ID.">ChannelSwitch</a>() : m_it(*<span class="keyword">this</span>), m_blocked(<span class="keyword">false</span>) {} <a name="l00085"></a>00085 <a class="code" href="class_channel_switch.html" title="Route input to different and/or multiple channels based on channel ID.">ChannelSwitch</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &destination) : m_it(*<span class="keyword">this</span>), m_blocked(<span class="keyword">false</span>) <a name="l00086"></a>00086 { <a name="l00087"></a>00087 AddDefaultRoute(destination); <a name="l00088"></a>00088 } <a name="l00089"></a>00089 <a class="code" href="class_channel_switch.html" title="Route input to different and/or multiple channels based on channel ID.">ChannelSwitch</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &destination, <span class="keyword">const</span> std::string &outChannel) : m_it(*<span class="keyword">this</span>), m_blocked(<span class="keyword">false</span>) <a name="l00090"></a>00090 { <a name="l00091"></a>00091 AddDefaultRoute(destination, outChannel); <a name="l00092"></a>00092 } <a name="l00093"></a>00093 <a name="l00094"></a>00094 <span class="keywordtype">void</span> IsolatedInitialize(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &parameters=g_nullNameValuePairs); <a name="l00095"></a>00095 <a name="l00096"></a>00096 <span class="keywordtype">size_t</span> ChannelPut2(<span class="keyword">const</span> std::string &channel, <span class="keyword">const</span> byte *begin, <span class="keywordtype">size_t</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking); <a name="l00097"></a>00097 <span class="keywordtype">size_t</span> ChannelPutModifiable2(<span class="keyword">const</span> std::string &channel, byte *begin, <span class="keywordtype">size_t</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking); <a name="l00098"></a>00098 <a name="l00099"></a>00099 <span class="keywordtype">bool</span> ChannelFlush(<span class="keyword">const</span> std::string &channel, <span class="keywordtype">bool</span> completeFlush, <span class="keywordtype">int</span> propagation=-1, <span class="keywordtype">bool</span> blocking=<span class="keyword">true</span>); <a name="l00100"></a>00100 <span class="keywordtype">bool</span> ChannelMessageSeriesEnd(<span class="keyword">const</span> std::string &channel, <span class="keywordtype">int</span> propagation=-1, <span class="keywordtype">bool</span> blocking=<span class="keyword">true</span>); <a name="l00101"></a>00101 <a name="l00102"></a>00102 byte * ChannelCreatePutSpace(<span class="keyword">const</span> std::string &channel, <span class="keywordtype">size_t</span> &size); <a name="l00103"></a>00103 <a name="l00104"></a>00104 <span class="keywordtype">void</span> AddDefaultRoute(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &destination); <a name="l00105"></a>00105 <span class="keywordtype">void</span> RemoveDefaultRoute(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &destination); <a name="l00106"></a>00106 <span class="keywordtype">void</span> AddDefaultRoute(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &destination, <span class="keyword">const</span> std::string &outChannel); <a name="l00107"></a>00107 <span class="keywordtype">void</span> RemoveDefaultRoute(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &destination, <span class="keyword">const</span> std::string &outChannel); <a name="l00108"></a>00108 <span class="keywordtype">void</span> AddRoute(<span class="keyword">const</span> std::string &inChannel, <a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &destination, <span class="keyword">const</span> std::string &outChannel); <a name="l00109"></a>00109 <span class="keywordtype">void</span> RemoveRoute(<span class="keyword">const</span> std::string &inChannel, <a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &destination, <span class="keyword">const</span> std::string &outChannel); <a name="l00110"></a>00110 <a name="l00111"></a>00111 <span class="keyword">private</span>: <a name="l00112"></a>00112 RouteMap m_routeMap; <a name="l00113"></a>00113 DefaultRouteList m_defaultRoutes; <a name="l00114"></a>00114 <a name="l00115"></a>00115 <a class="code" href="class_channel_route_iterator.html">ChannelRouteIterator</a> m_it; <a name="l00116"></a>00116 <span class="keywordtype">bool</span> m_blocked; <a name="l00117"></a>00117 <a name="l00118"></a>00118 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_channel_route_iterator.html">ChannelRouteIterator</a>; <a name="l00119"></a>00119 }; <a name="l00120"></a>00120 <a name="l00121"></a>00121 NAMESPACE_END <a name="l00122"></a>00122 <a name="l00123"></a>00123 <span class="preprocessor">#endif</span> </pre></div></div> <hr size="1"/><address style="text-align: right;"><small>Generated on 9 Dec 2009 for Crypto++ by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> </body> </html>