Class TransportManager


  • public class TransportManager
    extends java.lang.Object
    TransportManager.
    Version:
    $Id: TransportManager.java,v 1.2 2008/04/01 12:38:09 cplattne Exp $
    • Field Detail

      • log

        private static final Logger log
      • asynchronousQueue

        private final java.util.Vector asynchronousQueue
      • asynchronousThread

        private java.lang.Thread asynchronousThread
      • sourceAddress

        private final java.lang.String sourceAddress
      • hostname

        java.lang.String hostname
      • port

        int port
      • sock

        final java.net.Socket sock
      • connectionSemaphore

        final java.lang.Object connectionSemaphore
      • flagKexOngoing

        boolean flagKexOngoing
      • reasonClosedCause

        java.lang.Throwable reasonClosedCause
      • messageHandlers

        java.util.Vector messageHandlers
      • receiveThread

        java.lang.Thread receiveThread
      • connectionMonitors

        java.util.Vector connectionMonitors
      • monitorsWereInformed

        boolean monitorsWereInformed
      • MAX_PACKET_SIZE

        public static final int MAX_PACKET_SIZE
        Advertised maximum SSH packet size that the other side can send to us.
    • Constructor Detail

      • TransportManager

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

        public TransportManager​(java.lang.String host,
                                int port,
                                java.lang.String sourceAddress)
                         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()
        If the socket connection is lost (either by this side closing down or the other side closing down),
        Returns:
        a non-null object indicating the cause of the connection loss.
      • isConnectionClosed

        public boolean isConnectionClosed()
      • getSessionIdentifier

        public byte[] getSessionIdentifier()
      • close

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

        private void establishConnection​(ProxyData proxyData,
                                         int connectTimeout,
                                         int readTimeout)
                                  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
      • ensureConnected

        private void ensureConnected()
                              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