<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>DTN Reference Implementation: TCPTunnel.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.6 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="main.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> <h1>TCPTunnel.h</h1><a href="TCPTunnel_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> * Copyright 2006 Intel Corporation</span> <a name="l00003"></a>00003 <span class="comment"> * </span> <a name="l00004"></a>00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span> <a name="l00005"></a>00005 <span class="comment"> * you may not use this file except in compliance with the License.</span> <a name="l00006"></a>00006 <span class="comment"> * You may obtain a copy of the License at</span> <a name="l00007"></a>00007 <span class="comment"> * </span> <a name="l00008"></a>00008 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span> <a name="l00009"></a>00009 <span class="comment"> * </span> <a name="l00010"></a>00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span> <a name="l00011"></a>00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span> <a name="l00012"></a>00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span> <a name="l00013"></a>00013 <span class="comment"> * See the License for the specific language governing permissions and</span> <a name="l00014"></a>00014 <span class="comment"> * limitations under the License.</span> <a name="l00015"></a>00015 <span class="comment"> */</span> <a name="l00016"></a>00016 <a name="l00017"></a>00017 <span class="preprocessor">#ifndef _TCPTUNNEL_H_</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _TCPTUNNEL_H_</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include <map></span> <a name="l00021"></a>00021 <span class="preprocessor">#include <<a class="code" href="dtn__api_8h.html">dtn_api.h</a>></span> <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="preprocessor">#include <oasys/debug/Log.h></span> <a name="l00024"></a>00024 <span class="preprocessor">#include <oasys/io/TCPClient.h></span> <a name="l00025"></a>00025 <span class="preprocessor">#include <oasys/io/TCPServer.h></span> <a name="l00026"></a>00026 <span class="preprocessor">#include <oasys/thread/MsgQueue.h></span> <a name="l00027"></a>00027 <span class="preprocessor">#include <oasys/thread/Thread.h></span> <a name="l00028"></a>00028 <span class="preprocessor">#include <oasys/util/ExpandableBuffer.h></span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#include "<a class="code" href="IPTunnel_8h.html">IPTunnel.h</a>"</span> <a name="l00031"></a>00031 <a name="l00032"></a>00032 <span class="keyword">namespace </span>dtntunnel { <a name="l00033"></a>00033 <a name="l00037"></a><a class="code" href="classdtntunnel_1_1TCPTunnel.html">00037</a> <span class="keyword">class </span><a class="code" href="classdtntunnel_1_1TCPTunnel.html" title="Class to manage TCP &lt;-&gt; DTN tunnels.">TCPTunnel</a> : <span class="keyword">public</span> <a class="code" href="classdtntunnel_1_1IPTunnel.html" title="Pure virtual base class for tunneling of IP protocols.">IPTunnel</a> { <a name="l00038"></a>00038 <span class="keyword">public</span>: <a name="l00040"></a>00040 <a class="code" href="classdtntunnel_1_1TCPTunnel.html#8f4e4626553a95f87b10ff8dc087dd0f" title="Constructor.">TCPTunnel</a>(); <a name="l00041"></a>00041 <a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classdtntunnel_1_1TCPTunnel.html#17e855174e6624b2426e2b175dc72b13" title="Add a new listening to from the given listening address/port to the given remote...">add_listener</a>(in_addr_t listen_addr, u_int16_t listen_port, <a name="l00045"></a>00045 in_addr_t remote_addr, u_int16_t remote_port); <a name="l00046"></a>00046 <a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classdtntunnel_1_1TCPTunnel.html#9edfdd42b7d3de85e4cebd37af4793ed" title="Handle a newly arriving bundle.">handle_bundle</a>(<a class="code" href="structdtn_1_1APIBundle.html" title="Small encapsulating structure for API bundles.">dtn::APIBundle</a>* bundle); <a name="l00049"></a>00049 <a name="l00050"></a>00050 <span class="keyword">protected</span>: <a name="l00052"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Listener.html">00052</a> <span class="keyword">class </span><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Listener.html" title="Helper class to accept incoming TCP connections.">Listener</a> : <span class="keyword">public</span> oasys::TCPServerThread { <a name="l00053"></a>00053 <span class="keyword">public</span>: <a name="l00054"></a>00054 <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Listener.html#f463be6797d9f72634b957f4802d683a">Listener</a>(<a class="code" href="classdtntunnel_1_1TCPTunnel.html" title="Class to manage TCP &lt;-&gt; DTN tunnels.">TCPTunnel</a>* t, <a name="l00055"></a>00055 in_addr_t listen_addr, u_int16_t listen_port, <a name="l00056"></a>00056 in_addr_t remote_addr, u_int16_t remote_port); <a name="l00057"></a>00057 <a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Listener.html#d8d268f8fa69af3cdd2965ffe1c104e1">accepted</a>(<span class="keywordtype">int</span> <a class="code" href="dtnperf-client_8c.html#6f8059414f0228f0256115e024eeed4b">fd</a>, in_addr_t addr, u_int16_t port); <a name="l00059"></a>00059 <a name="l00060"></a>00060 <span class="keyword">protected</span>: <a name="l00061"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Listener.html#107114e6e476b3d898cb5bd892aba9dc">00061</a> <a class="code" href="classdtntunnel_1_1TCPTunnel.html" title="Class to manage TCP &lt;-&gt; DTN tunnels.">TCPTunnel</a>* <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Listener.html#107114e6e476b3d898cb5bd892aba9dc">tcptun_</a>; <a name="l00062"></a>00062 <a name="l00065"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Listener.html#f21ae69213e42b9b75a72362696324d2">00065</a> in_addr_t <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Listener.html#f21ae69213e42b9b75a72362696324d2">listen_addr_</a>; <a name="l00066"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Listener.html#83675089940922dcf5e943d605ae1bdc">00066</a> u_int16_t <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Listener.html#83675089940922dcf5e943d605ae1bdc">listen_port_</a>; <a name="l00067"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Listener.html#6605e8f5f9226ad5a2f5cb216f5752ae">00067</a> in_addr_t <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Listener.html#6605e8f5f9226ad5a2f5cb216f5752ae">remote_addr_</a>; <a name="l00068"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Listener.html#ec03984e86337fee8291d08a7946ec2f">00068</a> u_int16_t <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Listener.html#ec03984e86337fee8291d08a7946ec2f">remote_port_</a>; <a name="l00070"></a>00070 }; <a name="l00071"></a>00071 <a name="l00073"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html">00073</a> <span class="keyword">class </span><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html" title="Helper class to handle an actively proxied connection.">Connection</a> : <span class="keyword">public</span> oasys::<a class="code" href="classoasys_1_1Formatter.html">Formatter</a>, <a name="l00074"></a>00074 <span class="keyword">public</span> oasys::Thread, <a name="l00075"></a>00075 <span class="keyword">public</span> oasys::<a class="code" href="classoasys_1_1Logger.html">Logger</a> <a name="l00076"></a>00076 { <a name="l00077"></a>00077 <span class="keyword">public</span>: <a name="l00080"></a>00080 <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#c851a89fcc81172fb1e52a2a57bbd812" title="Constructor called to initiate a connection due to an arriving bundle request.">Connection</a>(<a class="code" href="classdtntunnel_1_1TCPTunnel.html" title="Class to manage TCP &lt;-&gt; DTN tunnels.">TCPTunnel</a>* t, <a class="code" href="structdtn__endpoint__id__t.html" title="Specification of a dtn endpoint id, i.e.">dtn_endpoint_id_t</a>* dest_eid, <a name="l00081"></a>00081 in_addr_t client_addr, u_int16_t client_port, <a name="l00082"></a>00082 in_addr_t remote_addr, u_int16_t remote_port, <a name="l00083"></a>00083 u_int32_t connection_id); <a name="l00084"></a>00084 <a name="l00086"></a>00086 <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#c851a89fcc81172fb1e52a2a57bbd812" title="Constructor called to initiate a connection due to an arriving bundle request.">Connection</a>(<a class="code" href="classdtntunnel_1_1TCPTunnel.html" title="Class to manage TCP &lt;-&gt; DTN tunnels.">TCPTunnel</a>* t, <a class="code" href="structdtn__endpoint__id__t.html" title="Specification of a dtn endpoint id, i.e.">dtn_endpoint_id_t</a>* dest_eid, <span class="keywordtype">int</span> <a class="code" href="dtnperf-client_8c.html#6f8059414f0228f0256115e024eeed4b">fd</a>, <a name="l00087"></a>00087 in_addr_t client_addr, u_int16_t client_port, <a name="l00088"></a>00088 in_addr_t remote_addr, u_int16_t remote_port, <a name="l00089"></a>00089 u_int32_t connection_id); <a name="l00090"></a>00090 <a name="l00092"></a>00092 <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#149fb926313fa0ab74d8e2b042027260" title="Destructor.">~Connection</a>(); <a name="l00093"></a>00093 <a name="l00095"></a>00095 <span class="keywordtype">int</span> <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#7d07185d139618810c9bb391ca1f2142" title="Virtual from Formatter.">format</a>(<span class="keywordtype">char</span>* <a class="code" href="num2sdnv_8c.html#a81cdcc7ff6987bc85c073253e32715f">buf</a>, <span class="keywordtype">size_t</span> sz) <span class="keyword">const</span>; <a name="l00096"></a>00096 <a name="l00098"></a>00098 <span class="keywordtype">void</span> <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#bef0512b296583765ffe23cb62f1cb4f" title="Handle a newly arriving bundle.">handle_bundle</a>(<a class="code" href="structdtn_1_1APIBundle.html" title="Small encapsulating structure for API bundles.">dtn::APIBundle</a>* bundle); <a name="l00099"></a>00099 <a name="l00100"></a>00100 <span class="keyword">protected</span>: <a name="l00101"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#5399c674e34e35d8c833cd307cf83d75">00101</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classdtntunnel_1_1TCPTunnel.html" title="Class to manage TCP &lt;-&gt; DTN tunnels.">TCPTunnel</a>; <a name="l00102"></a>00102 <a name="l00104"></a>00104 <span class="keywordtype">void</span> <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#c17a636befae707260d594865202131e" title="virtual run method">run</a>(); <a name="l00105"></a>00105 <a name="l00107"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#a40ddd3cb2883d71daf9bcdb0ce92fb6">00107</a> <a class="code" href="classdtntunnel_1_1TCPTunnel.html" title="Class to manage TCP &lt;-&gt; DTN tunnels.">TCPTunnel</a>* <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#a40ddd3cb2883d71daf9bcdb0ce92fb6" title="The tcp tunnel object.">tcptun_</a>; <a name="l00108"></a>00108 <a name="l00110"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#4208675d1906a75329b3b8e295b15c81">00110</a> oasys::TCPClient <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#4208675d1906a75329b3b8e295b15c81" title="The tcp socket.">sock_</a>; <a name="l00111"></a>00111 <a name="l00113"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#02b35b9b24d6a8a7ea13ca2c400decc6">00113</a> <a class="code" href="namespacedtn.html#3b449eea73ff25be3bf284318ee5230d" title="Type definition of an oasys blocking message queue that stores APIBundle structures...">dtn::APIBundleQueue</a> <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#02b35b9b24d6a8a7ea13ca2c400decc6" title="Queue for bundles on this connection.">queue_</a>; <a name="l00114"></a>00114 <a name="l00116"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#0b78fbea5321e15a980f38980d6ebe62">00116</a> <span class="keyword">typedef</span> std::map<u_int32_t, dtn::APIBundle*> <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#0b78fbea5321e15a980f38980d6ebe62" title="Table for out-of-order bundles.">ReorderTable</a>; <a name="l00117"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#61af9fb63888673cd711b8516530f3bd">00117</a> <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#0b78fbea5321e15a980f38980d6ebe62" title="Table for out-of-order bundles.">ReorderTable</a> <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#61af9fb63888673cd711b8516530f3bd">reorder_table_</a>; <a name="l00118"></a>00118 <a name="l00120"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#f8c13fc77332438aa9ed29f8b2920bd5">00120</a> u_int32_t <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#f8c13fc77332438aa9ed29f8b2920bd5" title="Running sequence number counter.">next_seqno_</a>; <a name="l00121"></a>00121 <a name="l00123"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#609580e4c5c933ab375d6b468833328f">00123</a> <a class="code" href="structdtn__endpoint__id__t.html" title="Specification of a dtn endpoint id, i.e.">dtn_endpoint_id_t</a> <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#609580e4c5c933ab375d6b468833328f" title="Parameters for the connection.">dest_eid_</a>; <a name="l00124"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#9de6ed519209d4cf4942346ab20d9792">00124</a> in_addr_t <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#9de6ed519209d4cf4942346ab20d9792">client_addr_</a>; <a name="l00125"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#1034762ab823de416f60248bec5ec855">00125</a> u_int16_t <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#1034762ab823de416f60248bec5ec855">client_port_</a>; <a name="l00126"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#4db16a51f248a340aea30fc86e11470e">00126</a> in_addr_t <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#4db16a51f248a340aea30fc86e11470e">remote_addr_</a>; <a name="l00127"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#d8689f274daaf328773e210d13b3c7e3">00127</a> u_int16_t <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#d8689f274daaf328773e210d13b3c7e3">remote_port_</a>; <a name="l00128"></a><a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#c0551500d9a2ea4f84f191f9ec2c0adc">00128</a> u_int32_t <a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html#c0551500d9a2ea4f84f191f9ec2c0adc">connection_id_</a>; <a name="l00129"></a>00129 }; <a name="l00130"></a>00130 <a name="l00132"></a>00132 u_int32_t <a class="code" href="classdtntunnel_1_1TCPTunnel.html#a400a9b8c4fda2a4b72352220ab58900" title="Return the next connection id.">next_connection_id</a>(); <a name="l00133"></a>00133 <a name="l00135"></a>00135 <span class="keywordtype">void</span> <a class="code" href="classdtntunnel_1_1TCPTunnel.html#82b6c2ff15a1cc137ec0d8df781e8c0a" title="Hook called by the listener when a new connection comes in.">new_connection</a>(<a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html" title="Helper class to handle an actively proxied connection.">Connection</a>* c); <a name="l00136"></a>00136 <a name="l00138"></a>00138 <span class="keywordtype">void</span> <a class="code" href="classdtntunnel_1_1TCPTunnel.html#722f77fa0b3727e267010a619ad17734" title="Hook called when a new connection dies.">kill_connection</a>(<a class="code" href="classdtntunnel_1_1TCPTunnel_1_1Connection.html" title="Helper class to handle an actively proxied connection.">Connection</a>* c); <a name="l00139"></a>00139 <a name="l00141"></a><a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html">00141</a> <span class="keyword">struct </span><a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html" title="Helper struct used as the index key into the connection table.">ConnKey</a> { <a name="l00142"></a><a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#3c4c981fd26e48830024869daf1f2129">00142</a> <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#3c4c981fd26e48830024869daf1f2129">ConnKey</a>() <a name="l00143"></a>00143 : <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#6d141c9a51d6fbaf3fac0ea2169e328a">endpoint_id_</a>(<span class="stringliteral">""</span>), <a name="l00144"></a>00144 <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#5f3e56d0aae4220aa690d1dab12ce6cd">client_addr_</a>(INADDR_NONE), <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#0c62f3a20a990213a7bbb6cb9262672d">client_port_</a>(0), <a name="l00145"></a>00145 <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#7ed1e662b42b93b3c2e91f7f6b8e04a3">remote_addr_</a>(INADDR_NONE), <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#0f6d65775eb5d8c9dff9551b47eefc0f">remote_port_</a>(0), <a name="l00146"></a>00146 <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#70fb5fdb605fd927aebb9d56607e64da">connection_id_</a>(0) {} <a name="l00147"></a>00147 <a name="l00148"></a><a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#f368ca27c6bb156ee1b520fd443c2938">00148</a> <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#3c4c981fd26e48830024869daf1f2129">ConnKey</a>(<span class="keyword">const</span> <a class="code" href="structdtn__endpoint__id__t.html" title="Specification of a dtn endpoint id, i.e.">dtn_endpoint_id_t</a>& eid, <a name="l00149"></a>00149 in_addr_t client_addr, u_int16_t client_port, <a name="l00150"></a>00150 in_addr_t remote_addr, u_int16_t remote_port, <a name="l00151"></a>00151 u_int32_t connection_id) <a name="l00152"></a>00152 : <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#6d141c9a51d6fbaf3fac0ea2169e328a">endpoint_id_</a>(eid.uri), <a name="l00153"></a>00153 <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#5f3e56d0aae4220aa690d1dab12ce6cd">client_addr_</a>(client_addr), <a name="l00154"></a>00154 <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#0c62f3a20a990213a7bbb6cb9262672d">client_port_</a>(client_port), <a name="l00155"></a>00155 <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#7ed1e662b42b93b3c2e91f7f6b8e04a3">remote_addr_</a>(remote_addr), <a name="l00156"></a>00156 <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#0f6d65775eb5d8c9dff9551b47eefc0f">remote_port_</a>(remote_port), <a name="l00157"></a>00157 <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#70fb5fdb605fd927aebb9d56607e64da">connection_id_</a>(connection_id) {} <a name="l00158"></a>00158 <a name="l00159"></a><a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#209046cfb6c6f824cda24e1a1cfb7b10">00159</a> <span class="keywordtype">bool</span> <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#209046cfb6c6f824cda24e1a1cfb7b10">operator<</a>(<span class="keyword">const</span> <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html" title="Helper struct used as the index key into the connection table.">ConnKey</a>& other)<span class="keyword"> const</span> <a name="l00160"></a>00160 <span class="keyword"> </span>{ <a name="l00161"></a>00161 <span class="preprocessor"> #define COMPARE(_x) if (_x != other._x) return _x < other._x;</span> <a name="l00162"></a>00162 <span class="preprocessor"></span> <a class="code" href="TCPTunnel_8h.html#de82d452f9013ada423defd040203af6">COMPARE</a>(<a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#70fb5fdb605fd927aebb9d56607e64da">connection_id_</a>); <a name="l00163"></a>00163 <a class="code" href="TCPTunnel_8h.html#de82d452f9013ada423defd040203af6">COMPARE</a>(<a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#5f3e56d0aae4220aa690d1dab12ce6cd">client_addr_</a>); <a name="l00164"></a>00164 <a class="code" href="TCPTunnel_8h.html#de82d452f9013ada423defd040203af6">COMPARE</a>(<a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#0c62f3a20a990213a7bbb6cb9262672d">client_port_</a>); <a name="l00165"></a>00165 <a class="code" href="TCPTunnel_8h.html#de82d452f9013ada423defd040203af6">COMPARE</a>(<a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#7ed1e662b42b93b3c2e91f7f6b8e04a3">remote_addr_</a>); <a name="l00166"></a>00166 <a class="code" href="TCPTunnel_8h.html#de82d452f9013ada423defd040203af6">COMPARE</a>(<a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#0f6d65775eb5d8c9dff9551b47eefc0f">remote_port_</a>); <a name="l00167"></a>00167 <span class="preprocessor"> #undef COMPARE</span> <a name="l00168"></a>00168 <span class="preprocessor"></span> <a name="l00169"></a>00169 <span class="keywordflow">return</span> <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#6d141c9a51d6fbaf3fac0ea2169e328a">endpoint_id_</a> < other.<a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#6d141c9a51d6fbaf3fac0ea2169e328a">endpoint_id_</a>; <a name="l00170"></a>00170 } <a name="l00171"></a>00171 <a name="l00172"></a><a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#6d141c9a51d6fbaf3fac0ea2169e328a">00172</a> std::string <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#6d141c9a51d6fbaf3fac0ea2169e328a">endpoint_id_</a>; <a name="l00173"></a><a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#5f3e56d0aae4220aa690d1dab12ce6cd">00173</a> in_addr_t <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#5f3e56d0aae4220aa690d1dab12ce6cd">client_addr_</a>; <a name="l00174"></a><a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#0c62f3a20a990213a7bbb6cb9262672d">00174</a> u_int16_t <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#0c62f3a20a990213a7bbb6cb9262672d">client_port_</a>; <a name="l00175"></a><a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#7ed1e662b42b93b3c2e91f7f6b8e04a3">00175</a> in_addr_t <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#7ed1e662b42b93b3c2e91f7f6b8e04a3">remote_addr_</a>; <a name="l00176"></a><a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#0f6d65775eb5d8c9dff9551b47eefc0f">00176</a> u_int16_t <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#0f6d65775eb5d8c9dff9551b47eefc0f">remote_port_</a>; <a name="l00177"></a><a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#70fb5fdb605fd927aebb9d56607e64da">00177</a> u_int32_t <a class="code" href="structdtntunnel_1_1TCPTunnel_1_1ConnKey.html#70fb5fdb605fd927aebb9d56607e64da">connection_id_</a>; <a name="l00178"></a>00178 }; <a name="l00179"></a>00179 <a name="l00181"></a><a class="code" href="classdtntunnel_1_1TCPTunnel.html#68aab7171556c6a29bdb5f369804f51f">00181</a> <span class="keyword">typedef</span> std::map<ConnKey, Connection*> <a class="code" href="classdtntunnel_1_1TCPTunnel.html#68aab7171556c6a29bdb5f369804f51f" title="Table of connection classes indexed by the remote address/port.">ConnTable</a>; <a name="l00182"></a><a class="code" href="classdtntunnel_1_1TCPTunnel.html#94b9f9bc1e134be44f6dd942d4398b60">00182</a> <a class="code" href="classdtntunnel_1_1TCPTunnel.html#68aab7171556c6a29bdb5f369804f51f" title="Table of connection classes indexed by the remote address/port.">ConnTable</a> <a class="code" href="classdtntunnel_1_1TCPTunnel.html#94b9f9bc1e134be44f6dd942d4398b60">connections_</a>; <a name="l00183"></a>00183 <a name="l00186"></a><a class="code" href="classdtntunnel_1_1TCPTunnel.html#84a4aadbaa3d0e61d03ee453c6639588">00186</a> <span class="keyword">typedef</span> std::map<ConnKey, dtn::APIBundleVector*> <a class="code" href="classdtntunnel_1_1TCPTunnel.html#84a4aadbaa3d0e61d03ee453c6639588" title="Table of bundles that arrive out of order before the connection is set up.">NoConnBundleTable</a>; <a name="l00187"></a><a class="code" href="classdtntunnel_1_1TCPTunnel.html#9d330834f0141da1002e3e005f217854">00187</a> <a class="code" href="classdtntunnel_1_1TCPTunnel.html#84a4aadbaa3d0e61d03ee453c6639588" title="Table of bundles that arrive out of order before the connection is set up.">NoConnBundleTable</a> <a class="code" href="classdtntunnel_1_1TCPTunnel.html#9d330834f0141da1002e3e005f217854">no_conn_bundles_</a>; <a name="l00188"></a>00188 <a name="l00190"></a><a class="code" href="classdtntunnel_1_1TCPTunnel.html#72bf262d24541e93bd5bbf24612b9a44">00190</a> oasys::SpinLock <a class="code" href="classdtntunnel_1_1TCPTunnel.html#72bf262d24541e93bd5bbf24612b9a44" title="Lock to protect the connections table.">lock_</a>; <a name="l00191"></a>00191 <a name="l00193"></a><a class="code" href="classdtntunnel_1_1TCPTunnel.html#a57571781241fb2284c83e093cc557d5">00193</a> u_int32_t <a class="code" href="classdtntunnel_1_1TCPTunnel.html#a57571781241fb2284c83e093cc557d5" title="Increasing counter for connection identifiers.">next_connection_id_</a>; <a name="l00194"></a>00194 }; <a name="l00195"></a>00195 <a name="l00196"></a>00196 } <span class="comment">// namespace dtntunnel</span> <a name="l00197"></a>00197 <a name="l00198"></a>00198 <span class="preprocessor">#endif </span><span class="comment">/* _TCPTUNNEL_H_ */</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Mon Jul 21 14:09:47 2008 for DTN Reference Implementation by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> </body> </html>