Package com.trilead.ssh2.transport
Class TransportManager
- java.lang.Object
-
- com.trilead.ssh2.transport.TransportManager
-
public class TransportManager extends java.lang.ObjectTransportManager.- Version:
- $Id: TransportManager.java,v 1.2 2008/04/01 12:38:09 cplattne Exp $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classTransportManager.AsynchronousWorker(package private) classTransportManager.HandlerEntry
-
Field Summary
Fields Modifier and Type Field Description private java.util.VectorasynchronousQueueprivate java.lang.ThreadasynchronousThread(package private) java.util.VectorconnectionMonitors(package private) java.lang.ObjectconnectionSemaphore(package private) booleanflagKexOngoing(package private) java.lang.Stringhostname(package private) KexManagerkmprivate static Loggerlogstatic intMAX_PACKET_SIZEAdvertised maximum SSH packet size that the other side can send to us.(package private) java.util.VectormessageHandlers(package private) booleanmonitorsWereInformed(package private) intport(package private) java.lang.ThrowablereasonClosedCause(package private) java.lang.ThreadreceiveThread(package private) java.net.Socketsock(package private) TransportConnectiontcprivate ClientServerHelloversions
-
Constructor Summary
Constructors Constructor Description TransportManager(java.lang.String host, int port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangeRecvCipher(BlockCipher bc, MAC mac)voidchangeSendCipher(BlockCipher bc, MAC mac)voidclose(java.lang.Throwable cause, boolean useDisconnectPacket)private java.net.InetAddresscreateInetAddress(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 voidensureConnected()private voidestablishConnection(ProxyData proxyData, int connectTimeout, int readTimeout)voidforceKeyExchange(CryptoWishList cwl, DHGexParameters dhgex)ConnectionInfogetConnectionInfo(int kexNumber)intgetPacketOverheadEstimate()java.lang.ThrowablegetReasonClosedCause()If the socket connection is lost (either by this side closing down or the other side closing down), return a non-null object indicating the cause of the connection loss.byte[]getSessionIdentifier()ClientServerHellogetVersionInfo()voidinitialize(CryptoWishList cwl, ServerHostKeyVerifier verifier, DHGexParameters dhgex, int connectTimeout, int readTimeout, java.security.SecureRandom rnd, ProxyData proxyData)voidinitialize(CryptoWishList cwl, ServerHostKeyVerifier verifier, DHGexParameters dhgex, int connectTimeout, java.security.SecureRandom rnd, ProxyData proxyData)booleanisConnectionClosed()voidkexFinished()private java.net.InetAddressparseIPv4Address(java.lang.String host)voidreceiveLoop()voidregisterMessageHandler(MessageHandler mh, int low, int high)voidremoveMessageHandler(MessageHandler mh, int low, int high)voidsendAsynchronousMessage(byte[] msg)voidsendKexMessage(byte[] msg)voidsendMessage(byte[] msg)voidsetConnectionMonitors(java.util.Vector monitors)voidsetSoTimeout(int timeout)voidsetTcpNoDelay(boolean state)
-
-
-
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
final java.lang.Object connectionSemaphore
-
flagKexOngoing
boolean flagKexOngoing
-
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
-
versions
private ClientServerHello versions
-
MAX_PACKET_SIZE
public static final int MAX_PACKET_SIZE
Advertised maximum SSH packet size that the other side can send to us.
-
-
Method Detail
-
createInetAddress
private java.net.InetAddress createInetAddress(java.lang.String host) throws java.net.UnknownHostExceptionThere 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
-
getVersionInfo
public ClientServerHello getVersionInfo()
-
getReasonClosedCause
public java.lang.Throwable getReasonClosedCause()
If the socket connection is lost (either by this side closing down or the other side closing down), return 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
-
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
-
initialize
public void initialize(CryptoWishList cwl, ServerHostKeyVerifier verifier, DHGexParameters dhgex, int connectTimeout, int readTimeout, 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
-
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
-
-