public abstract class TransportProtocolCommon extends java.lang.Object implements TransportProtocol, java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
protected TransportProtocolAlgorithmSync |
algorithmsIn |
protected TransportProtocolAlgorithmSync |
algorithmsOut |
protected java.lang.String |
clientIdent |
protected SshMsgKexInit |
clientKexInit |
protected java.lang.Boolean |
completeOnNewKeys |
static int |
EOL_CRLF |
static int |
EOL_LF |
protected byte[] |
hostKey |
protected HostKeyVerification |
hosts |
protected java.math.BigInteger |
k |
protected java.util.Map |
kexs |
protected static org.apache.commons.logging.Log |
log |
protected SshMessageStore |
messageStore |
protected SshConnectionProperties |
properties |
static java.lang.String |
PROTOCOL_VERSION |
protected java.lang.String |
serverIdent |
protected SshMsgKexInit |
serverKexInit |
protected byte[] |
sessionIdentifier |
protected byte[] |
signature |
static java.lang.String |
SOFTWARE_VERSION_COMMENTS |
protected com.sshtools.j2ssh.transport.TransportProtocolInputStream |
sshIn |
protected com.sshtools.j2ssh.transport.TransportProtocolOutputStream |
sshOut |
protected TransportProtocolState |
state |
Constructor and Description |
---|
TransportProtocolCommon()
Creates a new TransportProtocolCommon object.
|
Modifier and Type | Method and Description |
---|---|
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) |
protected static org.apache.commons.logging.Log log
public static final int EOL_CRLF
public static final int EOL_LF
public static final java.lang.String PROTOCOL_VERSION
public static java.lang.String SOFTWARE_VERSION_COMMENTS
protected java.math.BigInteger k
protected java.lang.Boolean completeOnNewKeys
protected HostKeyVerification hosts
protected java.util.Map kexs
protected SshConnectionProperties properties
protected SshMessageStore messageStore
protected SshMsgKexInit clientKexInit
protected SshMsgKexInit serverKexInit
protected java.lang.String clientIdent
protected java.lang.String serverIdent
protected TransportProtocolAlgorithmSync algorithmsIn
protected TransportProtocolAlgorithmSync algorithmsOut
protected TransportProtocolState state
protected byte[] sessionIdentifier
protected byte[] hostKey
protected byte[] signature
protected com.sshtools.j2ssh.transport.TransportProtocolInputStream sshIn
protected com.sshtools.j2ssh.transport.TransportProtocolOutputStream sshOut
public TransportProtocolCommon()
public int getConnectionId()
getConnectionId
in interface TransportProtocol
public int getRemoteEOL()
public TransportProtocolState getState()
getState
in interface TransportProtocol
public SshConnectionProperties getProperties()
protected abstract void onDisconnect()
public void disconnect(java.lang.String description)
disconnect
in interface TransportProtocol
description
- public void setSendIgnore(boolean sendIgnore)
sendIgnore
- public void setKexTimeout(long seconds) throws TransportProtocolException
seconds
- TransportProtocolException
public void setKexTransferLimit(long kilobytes) throws TransportProtocolException
kilobytes
- TransportProtocolException
public long getOutgoingByteCount()
public long getIncomingByteCount()
public void addEventHandler(TransportProtocolEventHandler eventHandler)
eventHandler
- public abstract void registerTransportMessages() throws MessageAlreadyRegisteredException
public byte[] getSessionIdentifier()
getSessionIdentifier
in interface TransportProtocol
public void run()
run
in interface java.lang.Runnable
public void sendMessage(SshMessage msg, java.lang.Object sender) throws java.io.IOException
sendMessage
in interface TransportProtocol
msg
- sender
- java.io.IOException
TransportProtocolException
protected abstract void onStartTransportProtocol() throws java.io.IOException
java.io.IOException
public void startTransportProtocol(TransportProvider provider, SshConnectionProperties properties) throws java.io.IOException
provider
- properties
- java.io.IOException
public java.lang.String getUnderlyingProviderDetail()
getUnderlyingProviderDetail
in interface TransportProtocol
public void unregisterMessage(java.lang.Integer messageId, SshMessageStore store) throws MessageNotRegisteredException
messageId
- store
- MessageNotRegisteredException
protected abstract java.lang.String getDecryptionAlgorithm() throws AlgorithmNotAgreedException
AlgorithmNotAgreedException
protected abstract java.lang.String getEncryptionAlgorithm() throws AlgorithmNotAgreedException
AlgorithmNotAgreedException
protected abstract java.lang.String getInputStreamCompAlgortihm() throws AlgorithmNotAgreedException
AlgorithmNotAgreedException
protected abstract java.lang.String getInputStreamMacAlgorithm() throws AlgorithmNotAgreedException
AlgorithmNotAgreedException
protected abstract void setLocalIdent()
public abstract java.lang.String getLocalId()
protected abstract void setLocalKexInit(SshMsgKexInit msg)
msg
- protected abstract SshMsgKexInit getLocalKexInit()
protected abstract java.lang.String getOutputStreamCompAlgorithm() throws AlgorithmNotAgreedException
AlgorithmNotAgreedException
protected abstract java.lang.String getOutputStreamMacAlgorithm() throws AlgorithmNotAgreedException
AlgorithmNotAgreedException
protected abstract void setRemoteIdent(java.lang.String ident)
ident
- public abstract java.lang.String getRemoteId()
protected abstract void setRemoteKexInit(SshMsgKexInit msg)
msg
- protected abstract SshMsgKexInit getRemoteKexInit()
protected abstract void performKeyExchange(SshKeyExchange kex) throws java.io.IOException, KeyExchangeException
kex
- java.io.IOException
KeyExchangeException
protected java.lang.String getKexAlgorithm() throws AlgorithmNotAgreedException
AlgorithmNotAgreedException
public boolean isConnected()
isConnected
in interface TransportProtocol
protected void beginKeyExchange() throws java.io.IOException, KeyExchangeException
java.io.IOException
KeyExchangeException
protected SshMsgKexInit createLocalKexInit() throws java.io.IOException
java.io.IOException
protected void onCorruptMac()
protected abstract void onMessageReceived(SshMessage msg) throws java.io.IOException
msg
- java.io.IOException
protected void sendDisconnect(int reason, java.lang.String description)
reason
- description
- protected void sendDisconnect(int reason, java.lang.String description, java.io.IOException error)
reason
- description
- error
- protected void sendKeyExchangeInit() throws java.io.IOException
java.io.IOException
protected void sendNewKeys() throws java.io.IOException
java.io.IOException
protected abstract void setupNewKeys(byte[] encryptCSKey, byte[] encryptCSIV, byte[] encryptSCKey, byte[] encryptSCIV, byte[] macCSKey, byte[] macSCKey) throws AlgorithmNotAgreedException, AlgorithmOperationException, AlgorithmNotSupportedException, AlgorithmInitializationException
encryptCSKey
- encryptCSIV
- encryptSCKey
- encryptSCIV
- macCSKey
- macSCKey
- AlgorithmNotAgreedException
AlgorithmOperationException
AlgorithmNotSupportedException
AlgorithmInitializationException
protected void completeKeyExchange() throws java.io.IOException
java.io.IOException
TransportProtocolException
protected java.util.List getEventHandlers()
protected java.lang.String determineAlgorithm(java.util.List clientAlgorithms, java.util.List serverAlgorithms) throws AlgorithmNotAgreedException
clientAlgorithms
- serverAlgorithms
- AlgorithmNotAgreedException
protected void startBinaryPacketProtocol() throws java.io.IOException
java.io.IOException
protected final void stop()
public SshMessage readMessage(int[] filter) throws java.io.IOException
readMessage
in interface TransportProtocol
filter
- java.io.IOException
protected SshMessage processMessages() throws java.io.IOException
java.io.IOException
public void addMessageStore(SshMessageStore store) throws MessageAlreadyRegisteredException
addMessageStore
in interface TransportProtocol
store
- MessageAlreadyRegisteredException
public void removeMessageStore(SshMessageStore ms)
ms
- Copyright © 2002-2003 Lee David Painter & Contributors. All Rights Reserved.