com.mindbright.ssh2
Class SSH2TCPChannel

java.lang.Object
  extended by com.mindbright.ssh2.SSH2Channel
      extended by com.mindbright.ssh2.SSH2StreamChannel
          extended by com.mindbright.ssh2.SSH2TCPChannel
Direct Known Subclasses:
SSH2RetryingTCPChannel

public class SSH2TCPChannel
extends SSH2StreamChannel

This is a subclass of SSH2StreamChannel which implements channels which are connected to TCP streams at both ends.


Field Summary
protected  java.net.Socket endpoint
           
protected  java.lang.String originAddr
           
protected  int originPort
           
protected  java.lang.String remoteAddr
           
protected  int remotePort
           
 
Fields inherited from class com.mindbright.ssh2.SSH2StreamChannel
in, out, receiver, rxCounter, rxQueue, transmitter, txCounter
 
Fields inherited from class com.mindbright.ssh2.SSH2Channel
channelId, channelType, closeListeners, closeReceived, closeSent, connection, creator, deleted, eofReceived, eofSent, openMonitor, openStatus, peerChanId, rxCurrWinSz, rxInitWinSz, rxMaxPktSz, STATUS_CLOSED, STATUS_FAILED, STATUS_OPEN, STATUS_UNDEFINED, txCurrWinSz, txInitWinSz, txMaxPktSz
 
Constructor Summary
SSH2TCPChannel(int channelType, SSH2Connection connection, java.lang.Object creator, java.net.Socket endpoint, java.lang.String remoteAddr, int remotePort, java.lang.String originAddr, int originPort)
          Create a new tcp channel of the given type.
 
Method Summary
 java.net.InetAddress getAddress()
          Gets the address of the enpoint.
 java.lang.String getOriginAddress()
          Gets the origin address which was given in the constructor.
 int getOriginPort()
          Gets the origin port which was given in the constructor.
 int getPort()
          Gets the port of the enpoint.
 java.lang.String getRemoteAddress()
          Get the address the server is supposed to be connected to.
 int getRemotePort()
          Get the port the server is supposed to be connected to.
protected  boolean openFailureImpl(int reasonCode, java.lang.String reasonText, java.lang.String langTag)
          Channel specific handling of open failures.
protected  void outputClosed()
          Called when no more data can be written to the channel.
 java.lang.String toString()
          Create a string representation of this object.
 
Methods inherited from class com.mindbright.ssh2.SSH2StreamChannel
applyFilter, checkRxWindowSize, closeImpl, createStreams, data, eofImpl, handleRequestImpl, openConfirmationImpl, startStreams, waitUntilClosed, windowAdjustImpl
 
Methods inherited from class com.mindbright.ssh2.SSH2Channel
addCloseListener, close, extData, getChannelId, getConnection, getCreator, getPeerId, getType, handleRequest, init, openConfirmation, openFailure, openStatus, recvClose, recvEOF, removeCloseListener, requestFailure, requestSuccess, sendClose, sendEOF, transmit, windowAdjust
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

endpoint

protected java.net.Socket endpoint

originAddr

protected java.lang.String originAddr

originPort

protected int originPort

remoteAddr

protected java.lang.String remoteAddr

remotePort

protected int remotePort
Constructor Detail

SSH2TCPChannel

public SSH2TCPChannel(int channelType,
                      SSH2Connection connection,
                      java.lang.Object creator,
                      java.net.Socket endpoint,
                      java.lang.String remoteAddr,
                      int remotePort,
                      java.lang.String originAddr,
                      int originPort)
               throws java.io.IOException
Create a new tcp channel of the given type. The channel is associated with an ssh connection. Channel types are defined in SSH2Connection and starts with CH_TYPE.

Parameters:
channelType - Type of channel to create.
connection - The ssh connection to associate the channel with.
creator - The object the channel is created from.
endpoint - Socket the channel is connected to at the local end.
remoteAddr - Remote server to connect to.
remotePort - Remote port to connect to.
originAddr - Originating host of local connection.
originPort - Originating port of local connection.
Throws:
java.io.IOException
Method Detail

outputClosed

protected void outputClosed()
Description copied from class: SSH2StreamChannel
Called when no more data can be written to the channel.

Overrides:
outputClosed in class SSH2StreamChannel

openFailureImpl

protected boolean openFailureImpl(int reasonCode,
                                  java.lang.String reasonText,
                                  java.lang.String langTag)
Description copied from class: SSH2Channel
Channel specific handling of open failures.

Overrides:
openFailureImpl in class SSH2StreamChannel
Parameters:
reasonCode - Code which tells why the open failed. See the ssh protocol drafts for values.
reasonText - A text explaining why the open failed.
langTag - Tag identifying the language of the reason text.

getAddress

public java.net.InetAddress getAddress()
Gets the address of the enpoint. That is the address to which the local TCP socket is connected.


getPort

public int getPort()
Gets the port of the enpoint. That is the port to which the local TCP socket is connected.


getRemoteAddress

public java.lang.String getRemoteAddress()
Get the address the server is supposed to be connected to.


getRemotePort

public int getRemotePort()
Get the port the server is supposed to be connected to.


getOriginAddress

public java.lang.String getOriginAddress()
Gets the origin address which was given in the constructor. This should return the same address as returned by getAddress.


getOriginPort

public int getOriginPort()
Gets the origin port which was given in the constructor. This should return the same port as returned by getPort.


toString

public java.lang.String toString()
Create a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
A string describing this instance.