<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>ne7ssh.kdevelop: ne7ssh_channel.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.5.9 --> <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> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="dir_dd1c5291a9065b7545d10d656e7badb5.html">projects</a> » <a class="el" href="dir_0149abaf0c2b822b0c584e3b6dde2eae.html">ne7ssh</a> » <a class="el" href="dir_f38c3faaed4ee86c894d75645400fcb5.html">src</a> </div> </div> <div class="contents"> <h1>ne7ssh_channel.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/***************************************************************************</span> <a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2005-2007 by NetSieben Technologies INC *</span> <a name="l00003"></a>00003 <span class="comment"> * Author: Andrew Useckas *</span> <a name="l00004"></a>00004 <span class="comment"> * Email: andrew@netsieben.com *</span> <a name="l00005"></a>00005 <span class="comment"> * *</span> <a name="l00006"></a>00006 <span class="comment"> * Windows Port and bugfixes: Keef Aragon <keef@netsieben.com> *</span> <a name="l00007"></a>00007 <span class="comment"> * *</span> <a name="l00008"></a>00008 <span class="comment"> * This program may be distributed under the terms of the Q Public *</span> <a name="l00009"></a>00009 <span class="comment"> * License as defined by Trolltech AS of Norway and appearing in the *</span> <a name="l00010"></a>00010 <span class="comment"> * file LICENSE.QPL included in the packaging of this file. *</span> <a name="l00011"></a>00011 <span class="comment"> * *</span> <a name="l00012"></a>00012 <span class="comment"> * This program is distributed in the hope that it will be useful, *</span> <a name="l00013"></a>00013 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of *</span> <a name="l00014"></a>00014 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *</span> <a name="l00015"></a>00015 <span class="comment"> ***************************************************************************/</span> <a name="l00016"></a>00016 <a name="l00017"></a>00017 <span class="preprocessor">#ifndef NE7SSH_CHANNEL_H</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define NE7SSH_CHANNEL_H</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include "ne7ssh_types.h"</span> <a name="l00021"></a>00021 <span class="preprocessor">#include "ne7ssh_string.h"</span> <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="keyword">class </span><a class="code" href="classne7ssh__session.html">ne7ssh_session</a>; <a name="l00024"></a>00024 <a name="l00028"></a><a class="code" href="classne7ssh__channel.html">00028</a> <span class="keyword">class </span><a class="code" href="classne7ssh__channel.html">ne7ssh_channel</a> <a name="l00029"></a>00029 { <a name="l00030"></a>00030 <span class="keyword">private</span>: <a name="l00031"></a>00031 <span class="keywordtype">bool</span> eof, closed; <a name="l00032"></a>00032 <span class="keywordtype">bool</span> cmdComplete; <a name="l00033"></a>00033 <span class="keywordtype">bool</span> shellSpawned; <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="comment">// static uint32 channelCount;</span> <a name="l00036"></a>00036 <a class="code" href="classne7ssh__session.html">ne7ssh_session</a> *session; <a name="l00037"></a>00037 <a class="code" href="classne7ssh__string.html">ne7ssh_string</a> inBuffer; <a name="l00038"></a>00038 <a class="code" href="classne7ssh__string.html">ne7ssh_string</a> outBuffer; <a name="l00039"></a>00039 <a class="code" href="classne7ssh__string.html">ne7ssh_string</a> delayedBuffer; <a name="l00040"></a>00040 <a name="l00046"></a>00046 <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#ec28c7ca08840c27ef98650acb520a35">handleChannelConfirm</a> (); <a name="l00047"></a>00047 <a name="l00054"></a>00054 <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#bc8252b3f45175c8178d495f11c748a0">adjustWindow</a> (Botan::SecureVector<Botan::byte>& packet); <a name="l00055"></a>00055 <a name="l00062"></a>00062 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#5752552709e47b3693b393be19f69139">handleData</a> (Botan::SecureVector<Botan::byte>& packet); <a name="l00063"></a>00063 <a name="l00069"></a>00069 <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#fa9835e80a26e96ae733de123713e1db">handleExtendedData</a> (Botan::SecureVector<Botan::byte>& packet); <a name="l00070"></a>00070 <a name="l00076"></a>00076 <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#468c9ba36282ab97e535c9285fd00b79">handleEof</a> (Botan::SecureVector<Botan::byte>& packet); <a name="l00077"></a>00077 <a name="l00083"></a>00083 <span class="keywordtype">void</span> <a class="code" href="classne7ssh__channel.html#1fbc5d7d3f5f986a1a8921aecf5aaa2e">handleClose</a> (Botan::SecureVector<Botan::byte>& packet); <a name="l00084"></a>00084 <a name="l00090"></a>00090 <span class="keywordtype">void</span> <a class="code" href="classne7ssh__channel.html#195ca3cdebd29ea9285762bfc777eb64">handleRequest</a> (Botan::SecureVector<Botan::byte>& packet); <a name="l00091"></a>00091 <a name="l00097"></a>00097 <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#9145226f1b6b0d2e3c20154da81d0bac">handleDisconnect</a> (Botan::SecureVector<Botan::byte>& packet); <a name="l00098"></a>00098 <a name="l00099"></a>00099 <span class="keyword">protected</span>: <a name="l00100"></a>00100 uint32 windowRecv, windowSend; <a name="l00101"></a>00101 <a name="l00102"></a>00102 <span class="keywordtype">bool</span> channelOpened; <a name="l00103"></a>00103 <a name="l00107"></a>00107 <span class="keywordtype">void</span> <a class="code" href="classne7ssh__channel.html#959a7e3dc6162e4a7c3a30470728b835">sendAdjustWindow</a> (); <a name="l00108"></a>00108 <a name="l00109"></a>00109 <span class="keyword">public</span>: <a name="l00114"></a>00114 <a class="code" href="classne7ssh__channel.html#2ca4770827c460ade71f4f64e14c78d9">ne7ssh_channel</a>(<a class="code" href="classne7ssh__session.html">ne7ssh_session</a>* _session); <a name="l00115"></a>00115 <a name="l00119"></a>00119 <span class="keyword">virtual</span> <a class="code" href="classne7ssh__channel.html#59b4a174d73ee8cbdec676f6cbe69c5b">~ne7ssh_channel</a>(); <a name="l00120"></a>00120 <a name="l00126"></a>00126 uint32 <a class="code" href="classne7ssh__channel.html#d744609a8a3ee9c204eabfb87343808d">open</a> (uint32 channelID); <a name="l00127"></a>00127 <a name="l00131"></a>00131 <span class="keywordtype">void</span> <a class="code" href="classne7ssh__channel.html#08d6085ea4493092d483819cde904ef5">getShell</a> (); <a name="l00132"></a>00132 <a name="l00138"></a>00138 <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#1037fa89c4b81050b98209cc89e32188">execCmd</a> (<span class="keyword">const</span> <span class="keywordtype">char</span>* cmd); <a name="l00139"></a>00139 <a name="l00143"></a>00143 <span class="keywordtype">void</span> <a class="code" href="classne7ssh__channel.html#450654cc1a212b348b7ccadd5d83e4df">receive</a> (); <a name="l00144"></a>00144 <a name="l00150"></a>00150 <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#4cfe1bda6308751f6f89612b6ea6e5b8">handleReceived</a> (Botan::SecureVector<Botan::byte>& _packet); <a name="l00151"></a>00151 <a name="l00156"></a>00156 <span class="keywordtype">void</span> <a class="code" href="classne7ssh__channel.html#8154fdfcc75f63d71f6d4ebe29155590">write</a> (Botan::SecureVector<Botan::byte>& data); <a name="l00157"></a>00157 <a name="l00161"></a>00161 <span class="keywordtype">void</span> <a class="code" href="classne7ssh__channel.html#ad6c9e2d2ee39be1c0cd078d30f7b11b">sendAll</a> (); <a name="l00162"></a>00162 <a name="l00167"></a><a class="code" href="classne7ssh__channel.html#f12993833f77a6e0cf673133737a995c">00167</a> <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#f12993833f77a6e0cf673133737a995c">data2Send</a> () { <span class="keywordflow">if</span> (outBuffer.<a class="code" href="classne7ssh__string.html#0b70fd63fc4dd1d5badce895d318b117">length</a>() || delayedBuffer.<a class="code" href="classne7ssh__string.html#0b70fd63fc4dd1d5badce895d318b117">length</a>()) <span class="keywordflow">return</span> <span class="keyword">true</span>; <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; } <a name="l00168"></a>00168 <a name="l00173"></a><a class="code" href="classne7ssh__channel.html#d78ff7808101f1e577a8dcc6715df1e8">00173</a> <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#d78ff7808101f1e577a8dcc6715df1e8">isOpen</a> () { <span class="keywordflow">return</span> channelOpened; } <a name="l00174"></a>00174 <a name="l00179"></a>00179 <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#96400430e7b338389aab85a04ea9921e">sendClose</a> (); <a name="l00180"></a>00180 <a name="l00185"></a>00185 <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#5a4bed6a381e7c2521995015272ebb8b">sendEof</a> (); <a name="l00186"></a>00186 <a name="l00191"></a><a class="code" href="classne7ssh__channel.html#8a5aa42877d987be82de852804d64224">00191</a> Botan::SecureVector<Botan::byte>& <a class="code" href="classne7ssh__channel.html#8a5aa42877d987be82de852804d64224">getReceived</a> () { <span class="keywordflow">return</span> inBuffer.<a class="code" href="classne7ssh__string.html#b593c45799f28af90922b7a8332e1a9f">value</a>(); } <a name="l00192"></a>00192 <a name="l00197"></a><a class="code" href="classne7ssh__channel.html#19cecc814a558e70e692475a861b14b0">00197</a> <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#19cecc814a558e70e692475a861b14b0">getCmdComplete</a> () { <span class="keywordflow">return</span> cmdComplete; } <a name="l00198"></a>00198 <a name="l00203"></a><a class="code" href="classne7ssh__channel.html#bba1bcb1c5cf307707b55451cd399598">00203</a> <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#bba1bcb1c5cf307707b55451cd399598">isRemoteShell</a> () { <span class="keywordflow">return</span> shellSpawned; } <a name="l00204"></a>00204 <a name="l00210"></a>00210 <span class="keywordtype">bool</span> <a class="code" href="classne7ssh__channel.html#a2d5379bfc1884c3f12bd024bdb0ca9a">adjustRecvWindow</a> (<span class="keywordtype">int</span> bufferSize); <a name="l00211"></a>00211 <a name="l00216"></a><a class="code" href="classne7ssh__channel.html#acafeb21fdfe9bd9a6e805c51635a724">00216</a> uint32 <a class="code" href="classne7ssh__channel.html#acafeb21fdfe9bd9a6e805c51635a724">getRecvWindow</a> () { <span class="keywordflow">return</span> windowRecv; } <a name="l00217"></a>00217 <a name="l00222"></a><a class="code" href="classne7ssh__channel.html#af0b5ad2f382674b621d4b923f688e1f">00222</a> uint32 <a class="code" href="classne7ssh__channel.html#af0b5ad2f382674b621d4b923f688e1f">getSendWindow</a> () { <span class="keywordflow">return</span> windowSend; } <a name="l00223"></a>00223 }; <a name="l00224"></a>00224 <a name="l00225"></a>00225 <span class="preprocessor">#endif</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Tue May 5 14:10:41 2009 for ne7ssh.kdevelop by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> </body> </html>