ch.ethz.ssh2.transport
Class TransportManager

java.lang.Object
  extended by ch.ethz.ssh2.transport.TransportManager

public class TransportManager
extends java.lang.Object

TransportManager.

Version:
$Id: TransportManager.java,v 1.16 2006/08/11 12:24:00 cplattne Exp $
Author:
Christian Plattner, plattner@inf.ethz.ch

Nested Class Summary
(package private)  class TransportManager.AsynchronousWorker
           
(package private)  class TransportManager.HandlerEntry
           
 
Field Summary
private  java.util.Vector asynchronousQueue
           
private  java.lang.Thread asynchronousThread
           
(package private)  boolean connectionClosed
           
(package private)  java.util.Vector connectionMonitors
           
(package private)  java.lang.Object connectionSemaphore
           
(package private)  boolean flagKexOngoing
           
(package private)  java.lang.String hostname
           
(package private)  KexManager km
           
private static Logger log
           
(package private)  java.util.Vector messageHandlers
           
(package private)  boolean monitorsWereInformed
           
(package private)  int port
           
(package private)  java.lang.Throwable reasonClosedCause
           
(package private)  java.lang.Thread receiveThread
           
(package private)  java.net.Socket sock
           
(package private)  TransportConnection tc
           
 
Constructor Summary
TransportManager(java.lang.String host, int port)
           
 
Method Summary
 void changeRecvCipher(BlockCipher bc, MAC mac)
           
 void changeSendCipher(BlockCipher bc, MAC mac)
           
 void close(java.lang.Throwable cause, boolean useDisconnectPacket)
           
private  java.net.InetAddress createInetAddress(java.lang.String host)
          There were reports that there are JDKs which use the resolver even though one supplies a dotted IP address in the Socket constructor.
private  void establishConnection(ProxyData proxyData, int connectTimeout)
           
 void forceKeyExchange(CryptoWishList cwl, DHGexParameters dhgex)
           
 ConnectionInfo getConnectionInfo(int kexNumber)
           
 int getPacketOverheadEstimate()
           
 java.lang.Throwable getReasonClosedCause()
           
 byte[] getSessionIdentifier()
           
 void initialize(CryptoWishList cwl, ServerHostKeyVerifier verifier, DHGexParameters dhgex, int connectTimeout, java.security.SecureRandom rnd, ProxyData proxyData)
           
 void kexFinished()
           
private  java.net.InetAddress parseIPv4Address(java.lang.String host)
           
 void receiveLoop()
           
 void registerMessageHandler(MessageHandler mh, int low, int high)
           
 void removeMessageHandler(MessageHandler mh, int low, int high)
           
 void sendAsynchronousMessage(byte[] msg)
           
 void sendKexMessage(byte[] msg)
           
 void sendMessage(byte[] msg)
           
 void setConnectionMonitors(java.util.Vector monitors)
           
 void setSoTimeout(int timeout)
           
 void setTcpNoDelay(boolean state)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final Logger log

asynchronousQueue

private final java.util.Vector asynchronousQueue

asynchronousThread

private java.lang.Thread asynchronousThread

hostname

java.lang.String hostname

port

int port

sock

final java.net.Socket sock

connectionSemaphore

java.lang.Object connectionSemaphore

flagKexOngoing

boolean flagKexOngoing

connectionClosed

boolean connectionClosed

reasonClosedCause

java.lang.Throwable reasonClosedCause

tc

TransportConnection tc

km

KexManager km

messageHandlers

java.util.Vector messageHandlers

receiveThread

java.lang.Thread receiveThread

connectionMonitors

java.util.Vector connectionMonitors

monitorsWereInformed

boolean monitorsWereInformed
Constructor Detail

TransportManager

public TransportManager(java.lang.String host,
                        int port)
                 throws java.io.IOException
Throws:
java.io.IOException
Method Detail

createInetAddress

private java.net.InetAddress createInetAddress(java.lang.String host)
                                        throws java.net.UnknownHostException
There were reports that there are JDKs which use the resolver even though one supplies a dotted IP address in the Socket constructor. That is why we try to generate the InetAdress "by hand".

Parameters:
host -
Returns:
the InetAddress
Throws:
java.net.UnknownHostException

parseIPv4Address

private java.net.InetAddress parseIPv4Address(java.lang.String host)
                                       throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException

getPacketOverheadEstimate

public int getPacketOverheadEstimate()

setTcpNoDelay

public void setTcpNoDelay(boolean state)
                   throws java.io.IOException
Throws:
java.io.IOException

setSoTimeout

public void setSoTimeout(int timeout)
                  throws java.io.IOException
Throws:
java.io.IOException

getConnectionInfo

public ConnectionInfo getConnectionInfo(int kexNumber)
                                 throws java.io.IOException
Throws:
java.io.IOException

getReasonClosedCause

public java.lang.Throwable getReasonClosedCause()

getSessionIdentifier

public byte[] getSessionIdentifier()

close

public void close(java.lang.Throwable cause,
                  boolean useDisconnectPacket)

establishConnection

private void establishConnection(ProxyData proxyData,
                                 int connectTimeout)
                          throws java.io.IOException
Throws:
java.io.IOException

initialize

public void initialize(CryptoWishList cwl,
                       ServerHostKeyVerifier verifier,
                       DHGexParameters dhgex,
                       int connectTimeout,
                       java.security.SecureRandom rnd,
                       ProxyData proxyData)
                throws java.io.IOException
Throws:
java.io.IOException

registerMessageHandler

public void registerMessageHandler(MessageHandler mh,
                                   int low,
                                   int high)

removeMessageHandler

public void removeMessageHandler(MessageHandler mh,
                                 int low,
                                 int high)

sendKexMessage

public void sendKexMessage(byte[] msg)
                    throws java.io.IOException
Throws:
java.io.IOException

kexFinished

public void kexFinished()
                 throws java.io.IOException
Throws:
java.io.IOException

forceKeyExchange

public void forceKeyExchange(CryptoWishList cwl,
                             DHGexParameters dhgex)
                      throws java.io.IOException
Throws:
java.io.IOException

changeRecvCipher

public void changeRecvCipher(BlockCipher bc,
                             MAC mac)

changeSendCipher

public void changeSendCipher(BlockCipher bc,
                             MAC mac)

sendAsynchronousMessage

public void sendAsynchronousMessage(byte[] msg)
                             throws java.io.IOException
Throws:
java.io.IOException

setConnectionMonitors

public void setConnectionMonitors(java.util.Vector monitors)

sendMessage

public void sendMessage(byte[] msg)
                 throws java.io.IOException
Throws:
java.io.IOException

receiveLoop

public void receiveLoop()
                 throws java.io.IOException
Throws:
java.io.IOException