com.sshtools.j2ssh.transport
Class TransportProtocolCommon
java.lang.Object
com.sshtools.j2ssh.transport.TransportProtocolCommon
- All Implemented Interfaces:
- TransportProtocol, java.lang.Runnable
- Direct Known Subclasses:
- TransportProtocolClient, TransportProtocolServer
public abstract class TransportProtocolCommon
- extends java.lang.Object
- implements TransportProtocol, java.lang.Runnable
- Version:
- $Revision: 1.2 $
- Author:
- $author$
Method Summary |
void |
addEventHandler(TransportProtocolEventHandler eventHandler)
|
void |
addMessageStore(SshMessageStore store)
|
protected void |
beginKeyExchange()
|
protected void |
completeKeyExchange()
|
protected SshMsgKexInit |
createLocalKexInit()
|
protected java.lang.String |
determineAlgorithm(java.util.List clientAlgorithms,
java.util.List serverAlgorithms)
|
void |
disconnect(java.lang.String description)
|
int |
getConnectionId()
|
protected abstract java.lang.String |
getDecryptionAlgorithm()
|
protected abstract java.lang.String |
getEncryptionAlgorithm()
|
protected java.util.List |
getEventHandlers()
|
long |
getIncomingByteCount()
|
protected abstract java.lang.String |
getInputStreamCompAlgortihm()
|
protected abstract java.lang.String |
getInputStreamMacAlgorithm()
|
protected java.lang.String |
getKexAlgorithm()
|
abstract java.lang.String |
getLocalId()
|
protected abstract SshMsgKexInit |
getLocalKexInit()
|
long |
getOutgoingByteCount()
|
protected abstract java.lang.String |
getOutputStreamCompAlgorithm()
|
protected abstract java.lang.String |
getOutputStreamMacAlgorithm()
|
SshConnectionProperties |
getProperties()
|
int |
getRemoteEOL()
|
abstract java.lang.String |
getRemoteId()
|
protected abstract SshMsgKexInit |
getRemoteKexInit()
|
byte[] |
getSessionIdentifier()
|
TransportProtocolState |
getState()
|
java.lang.String |
getUnderlyingProviderDetail()
|
boolean |
isConnected()
|
protected void |
onCorruptMac()
|
protected abstract void |
onDisconnect()
|
protected abstract void |
onMessageReceived(SshMessage msg)
|
protected abstract void |
onStartTransportProtocol()
|
protected abstract void |
performKeyExchange(SshKeyExchange kex)
|
protected SshMessage |
processMessages()
|
SshMessage |
readMessage(int[] filter)
|
abstract void |
registerTransportMessages()
|
void |
removeMessageStore(SshMessageStore ms)
|
void |
run()
|
protected void |
sendDisconnect(int reason,
java.lang.String description)
|
protected void |
sendDisconnect(int reason,
java.lang.String description,
java.io.IOException error)
|
protected void |
sendKeyExchangeInit()
|
void |
sendMessage(SshMessage msg,
java.lang.Object sender)
|
protected void |
sendNewKeys()
|
void |
setKexTimeout(long seconds)
|
void |
setKexTransferLimit(long kilobytes)
|
protected abstract void |
setLocalIdent()
|
protected abstract void |
setLocalKexInit(SshMsgKexInit msg)
|
protected abstract void |
setRemoteIdent(java.lang.String ident)
|
protected abstract void |
setRemoteKexInit(SshMsgKexInit msg)
|
void |
setSendIgnore(boolean sendIgnore)
|
protected abstract void |
setupNewKeys(byte[] encryptCSKey,
byte[] encryptCSIV,
byte[] encryptSCKey,
byte[] encryptSCIV,
byte[] macCSKey,
byte[] macSCKey)
|
protected void |
startBinaryPacketProtocol()
|
void |
startTransportProtocol(TransportProvider provider,
SshConnectionProperties properties)
|
protected void |
stop()
|
void |
unregisterMessage(java.lang.Integer messageId,
SshMessageStore store)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static org.apache.commons.logging.Log log
EOL_CRLF
public static final int EOL_CRLF
- See Also:
- Constant Field Values
EOL_LF
public static final int EOL_LF
- See Also:
- Constant Field Values
PROTOCOL_VERSION
public static final java.lang.String PROTOCOL_VERSION
- See Also:
- Constant Field Values
SOFTWARE_VERSION_COMMENTS
public static java.lang.String SOFTWARE_VERSION_COMMENTS
k
protected java.math.BigInteger k
completeOnNewKeys
protected java.lang.Boolean completeOnNewKeys
hosts
protected HostKeyVerification hosts
kexs
protected java.util.Map kexs
properties
protected SshConnectionProperties properties
messageStore
protected SshMessageStore messageStore
clientKexInit
protected SshMsgKexInit clientKexInit
serverKexInit
protected SshMsgKexInit serverKexInit
clientIdent
protected java.lang.String clientIdent
serverIdent
protected java.lang.String serverIdent
algorithmsIn
protected TransportProtocolAlgorithmSync algorithmsIn
algorithmsOut
protected TransportProtocolAlgorithmSync algorithmsOut
state
protected TransportProtocolState state
sessionIdentifier
protected byte[] sessionIdentifier
hostKey
protected byte[] hostKey
signature
protected byte[] signature
sshIn
protected com.sshtools.j2ssh.transport.TransportProtocolInputStream sshIn
sshOut
protected com.sshtools.j2ssh.transport.TransportProtocolOutputStream sshOut
TransportProtocolCommon
public TransportProtocolCommon()
- Creates a new TransportProtocolCommon object.
getConnectionId
public int getConnectionId()
- Specified by:
getConnectionId
in interface TransportProtocol
- Returns:
getRemoteEOL
public int getRemoteEOL()
- Returns:
getState
public TransportProtocolState getState()
- Specified by:
getState
in interface TransportProtocol
- Returns:
getProperties
public SshConnectionProperties getProperties()
- Returns:
onDisconnect
protected abstract void onDisconnect()
disconnect
public void disconnect(java.lang.String description)
- Specified by:
disconnect
in interface TransportProtocol
- Parameters:
description
-
setSendIgnore
public void setSendIgnore(boolean sendIgnore)
- Parameters:
sendIgnore
-
setKexTimeout
public void setKexTimeout(long seconds)
throws TransportProtocolException
- Parameters:
seconds
-
- Throws:
TransportProtocolException
setKexTransferLimit
public void setKexTransferLimit(long kilobytes)
throws TransportProtocolException
- Parameters:
kilobytes
-
- Throws:
TransportProtocolException
getOutgoingByteCount
public long getOutgoingByteCount()
getIncomingByteCount
public long getIncomingByteCount()
- Returns:
addEventHandler
public void addEventHandler(TransportProtocolEventHandler eventHandler)
- Parameters:
eventHandler
-
registerTransportMessages
public abstract void registerTransportMessages()
throws MessageAlreadyRegisteredException
- Throws:
MessageAlreadyRegisteredException
getSessionIdentifier
public byte[] getSessionIdentifier()
- Specified by:
getSessionIdentifier
in interface TransportProtocol
- Returns:
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
sendMessage
public void sendMessage(SshMessage msg,
java.lang.Object sender)
throws java.io.IOException
- Specified by:
sendMessage
in interface TransportProtocol
- Parameters:
msg
- sender
-
- Throws:
java.io.IOException
TransportProtocolException
onStartTransportProtocol
protected abstract void onStartTransportProtocol()
throws java.io.IOException
- Throws:
java.io.IOException
startTransportProtocol
public void startTransportProtocol(TransportProvider provider,
SshConnectionProperties properties)
throws java.io.IOException
- Parameters:
provider
- properties
-
- Throws:
java.io.IOException
getUnderlyingProviderDetail
public java.lang.String getUnderlyingProviderDetail()
- Specified by:
getUnderlyingProviderDetail
in interface TransportProtocol
- Returns:
unregisterMessage
public void unregisterMessage(java.lang.Integer messageId,
SshMessageStore store)
throws MessageNotRegisteredException
- Parameters:
messageId
- store
-
- Throws:
MessageNotRegisteredException
getDecryptionAlgorithm
protected abstract java.lang.String getDecryptionAlgorithm()
throws AlgorithmNotAgreedException
- Returns:
-
- Throws:
AlgorithmNotAgreedException
getEncryptionAlgorithm
protected abstract java.lang.String getEncryptionAlgorithm()
throws AlgorithmNotAgreedException
- Returns:
-
- Throws:
AlgorithmNotAgreedException
getInputStreamCompAlgortihm
protected abstract java.lang.String getInputStreamCompAlgortihm()
throws AlgorithmNotAgreedException
- Returns:
-
- Throws:
AlgorithmNotAgreedException
getInputStreamMacAlgorithm
protected abstract java.lang.String getInputStreamMacAlgorithm()
throws AlgorithmNotAgreedException
- Returns:
-
- Throws:
AlgorithmNotAgreedException
setLocalIdent
protected abstract void setLocalIdent()
getLocalId
public abstract java.lang.String getLocalId()
- Returns:
setLocalKexInit
protected abstract void setLocalKexInit(SshMsgKexInit msg)
- Parameters:
msg
-
getLocalKexInit
protected abstract SshMsgKexInit getLocalKexInit()
- Returns:
getOutputStreamCompAlgorithm
protected abstract java.lang.String getOutputStreamCompAlgorithm()
throws AlgorithmNotAgreedException
- Returns:
-
- Throws:
AlgorithmNotAgreedException
getOutputStreamMacAlgorithm
protected abstract java.lang.String getOutputStreamMacAlgorithm()
throws AlgorithmNotAgreedException
- Returns:
-
- Throws:
AlgorithmNotAgreedException
setRemoteIdent
protected abstract void setRemoteIdent(java.lang.String ident)
- Parameters:
ident
-
getRemoteId
public abstract java.lang.String getRemoteId()
- Returns:
setRemoteKexInit
protected abstract void setRemoteKexInit(SshMsgKexInit msg)
- Parameters:
msg
-
getRemoteKexInit
protected abstract SshMsgKexInit getRemoteKexInit()
- Returns:
performKeyExchange
protected abstract void performKeyExchange(SshKeyExchange kex)
throws java.io.IOException,
KeyExchangeException
- Parameters:
kex
-
- Throws:
java.io.IOException
KeyExchangeException
getKexAlgorithm
protected java.lang.String getKexAlgorithm()
throws AlgorithmNotAgreedException
- Returns:
-
- Throws:
AlgorithmNotAgreedException
isConnected
public boolean isConnected()
- Specified by:
isConnected
in interface TransportProtocol
beginKeyExchange
protected void beginKeyExchange()
throws java.io.IOException,
KeyExchangeException
- Throws:
java.io.IOException
KeyExchangeException
createLocalKexInit
protected SshMsgKexInit createLocalKexInit()
throws java.io.IOException
- Returns:
-
- Throws:
java.io.IOException
onCorruptMac
protected void onCorruptMac()
onMessageReceived
protected abstract void onMessageReceived(SshMessage msg)
throws java.io.IOException
- Parameters:
msg
-
- Throws:
java.io.IOException
sendDisconnect
protected void sendDisconnect(int reason,
java.lang.String description)
- Parameters:
reason
- description
-
sendDisconnect
protected void sendDisconnect(int reason,
java.lang.String description,
java.io.IOException error)
- Parameters:
reason
- description
- error
-
sendKeyExchangeInit
protected void sendKeyExchangeInit()
throws java.io.IOException
- Throws:
java.io.IOException
sendNewKeys
protected void sendNewKeys()
throws java.io.IOException
- Throws:
java.io.IOException
setupNewKeys
protected abstract void setupNewKeys(byte[] encryptCSKey,
byte[] encryptCSIV,
byte[] encryptSCKey,
byte[] encryptSCIV,
byte[] macCSKey,
byte[] macSCKey)
throws AlgorithmNotAgreedException,
AlgorithmOperationException,
AlgorithmNotSupportedException,
AlgorithmInitializationException
- Parameters:
encryptCSKey
- encryptCSIV
- encryptSCKey
- encryptSCIV
- macCSKey
- macSCKey
-
- Throws:
AlgorithmNotAgreedException
AlgorithmOperationException
AlgorithmNotSupportedException
AlgorithmInitializationException
completeKeyExchange
protected void completeKeyExchange()
throws java.io.IOException
- Throws:
java.io.IOException
TransportProtocolException
getEventHandlers
protected java.util.List getEventHandlers()
- Returns:
determineAlgorithm
protected java.lang.String determineAlgorithm(java.util.List clientAlgorithms,
java.util.List serverAlgorithms)
throws AlgorithmNotAgreedException
- Parameters:
clientAlgorithms
- serverAlgorithms
-
- Returns:
-
- Throws:
AlgorithmNotAgreedException
startBinaryPacketProtocol
protected void startBinaryPacketProtocol()
throws java.io.IOException
- Throws:
java.io.IOException
stop
protected final void stop()
readMessage
public SshMessage readMessage(int[] filter)
throws java.io.IOException
- Specified by:
readMessage
in interface TransportProtocol
- Parameters:
filter
-
- Returns:
-
- Throws:
java.io.IOException
processMessages
protected SshMessage processMessages()
throws java.io.IOException
- Returns:
-
- Throws:
java.io.IOException
addMessageStore
public void addMessageStore(SshMessageStore store)
throws MessageAlreadyRegisteredException
- Specified by:
addMessageStore
in interface TransportProtocol
- Parameters:
store
-
- Throws:
MessageAlreadyRegisteredException
removeMessageStore
public void removeMessageStore(SshMessageStore ms)
- Parameters:
ms
-
Copyright © 2002-2003 Lee David Painter & Contributors. All Rights Reserved.