Package com.sshtools.j2ssh.connection
Class ConnectionProtocol
java.lang.Object
com.sshtools.j2ssh.transport.Service
com.sshtools.j2ssh.transport.AsyncService
com.sshtools.j2ssh.connection.ConnectionProtocol
- All Implemented Interfaces:
Runnable
- Version:
- $Revision: 1.68 $
- Author:
- $author$
-
Field Summary
Fields inherited from class com.sshtools.j2ssh.transport.AsyncService
threadFields inherited from class com.sshtools.j2ssh.transport.Service
ACCEPTING_SERVICE, messageStore, REQUESTING_SERVICE, startMode, state, transport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChannelFactory(String channelName, ChannelFactory cf) voidallowGlobalRequest(String requestName, GlobalRequestHandler handler) protected voidcloseChannel(Channel channel) booleancontainsChannelFactory(String channelName) protected voidfreeChannel(Channel channel) protected int[]Implement this method by returning the message ids of the asyncrounous messages your implementation wants to receive.booleanprotected voidonGlobalRequest(String requestName, boolean wantReply, byte[] requestData) protected voidCalled by the service thread when an asyncronous message is received.protected voidCalled when the service is accepted by the remote server.protected voidonServiceInit(int startMode) Called when the service is intialized.protected voidprotected voidonStop()The service thread calls this method when the thread is exiting.booleanopenChannel(Channel channel) booleanopenChannel(Channel channel, ChannelEventListener eventListener) voidremoveChannelFactory(String channelName) voidsendChannelData(Channel channel, byte[] data) voidsendChannelEOF(Channel channel) voidsendChannelExtData(Channel channel, int extendedType, byte[] data) protected voidsendChannelFailure(Channel channel) protected voidsendChannelOpenConfirmation(Channel channel) protected voidsendChannelOpenFailure(long remoteChannelId, long reasonCode, String additionalInfo, String languageTag) booleansendChannelRequest(Channel channel, String requestType, boolean wantReply, byte[] requestData) voidsendChannelRequestFailure(Channel channel) voidsendChannelRequestSuccess(Channel channel) voidsendChannelWindowAdjust(Channel channel, long bytesToAdd) byte[]sendGlobalRequest(String requestName, boolean wantReply, byte[] requestData) protected voidprotected voidsendGlobalRequestSuccess(byte[] requestData) Methods inherited from class com.sshtools.j2ssh.transport.AsyncService
onStart, runMethods inherited from class com.sshtools.j2ssh.transport.Service
getServiceName, getState, init, sendServiceAccept, start, stop
-
Constructor Details
-
ConnectionProtocol
public ConnectionProtocol()Creates a new ConnectionProtocol object.
-
-
Method Details
-
addChannelFactory
- Parameters:
channelName-cf-- Throws:
IOException
-
removeChannelFactory
- Parameters:
channelName-
-
containsChannelFactory
- Parameters:
channelName-- Returns:
-
allowGlobalRequest
- Parameters:
requestName-handler-
-
openChannel
- Parameters:
channel-- Returns:
- Throws:
IOException
-
isConnected
public boolean isConnected()- Returns:
-
openChannel
- Parameters:
channel-eventListener-- Returns:
- Throws:
IOExceptionSshException
-
onStop
protected void onStop()Description copied from class:AsyncServiceThe service thread calls this method when the thread is exiting.
- Specified by:
onStopin classAsyncService
-
sendChannelData
- Parameters:
channel-data-- Throws:
IOException
-
sendChannelEOF
- Parameters:
channel-- Throws:
IOException
-
sendChannelExtData
- Parameters:
channel-extendedType-data-- Throws:
IOException
-
sendChannelRequest
public boolean sendChannelRequest(Channel channel, String requestType, boolean wantReply, byte[] requestData) throws IOException - Parameters:
channel-requestType-wantReply-requestData-- Returns:
- Throws:
IOExceptionSshException
-
sendChannelRequestFailure
- Parameters:
channel-- Throws:
IOException
-
sendChannelRequestSuccess
- Parameters:
channel-- Throws:
IOException
-
sendChannelWindowAdjust
- Parameters:
channel-bytesToAdd-- Throws:
IOException
-
sendGlobalRequest
public byte[] sendGlobalRequest(String requestName, boolean wantReply, byte[] requestData) throws IOException - Parameters:
requestName-wantReply-requestData-- Returns:
- Throws:
IOExceptionSshException
-
getAsyncMessageFilter
protected int[] getAsyncMessageFilter()Description copied from class:AsyncServiceImplement this method by returning the message ids of the asyncrounous messages your implementation wants to receive.
- Specified by:
getAsyncMessageFilterin classAsyncService- Returns:
-
closeChannel
- Parameters:
channel-- Throws:
IOException
-
onGlobalRequest
protected void onGlobalRequest(String requestName, boolean wantReply, byte[] requestData) throws IOException - Parameters:
requestName-wantReply-requestData-- Throws:
IOException
-
onMessageReceived
Description copied from class:AsyncServiceCalled by the service thread when an asyncronous message is received.
- Specified by:
onMessageReceivedin classAsyncService- Parameters:
msg-- Throws:
IOException
-
onServiceAccept
protected void onServiceAccept()Description copied from class:ServiceCalled when the service is accepted by the remote server.
- Specified by:
onServiceAcceptin classService
-
onServiceInit
Description copied from class:ServiceCalled when the service is intialized.
- Specified by:
onServiceInitin classService- Parameters:
startMode-- Throws:
IOException
-
onServiceRequest
protected void onServiceRequest()- Specified by:
onServiceRequestin classService
-
sendChannelFailure
- Parameters:
channel-- Throws:
IOException
-
sendChannelOpenConfirmation
- Parameters:
channel-- Throws:
IOException
-
sendChannelOpenFailure
protected void sendChannelOpenFailure(long remoteChannelId, long reasonCode, String additionalInfo, String languageTag) throws IOException - Parameters:
remoteChannelId-reasonCode-additionalInfo-languageTag-- Throws:
IOException
-
sendGlobalRequestFailure
- Throws:
IOException
-
sendGlobalRequestSuccess
- Parameters:
requestData-- Throws:
IOException
-
freeChannel
- Parameters:
channel-
-