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
thread
Fields inherited from class com.sshtools.j2ssh.transport.Service
ACCEPTING_SERVICE, messageStore, REQUESTING_SERVICE, startMode, state, transport
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChannelFactory
(String channelName, ChannelFactory cf) void
allowGlobalRequest
(String requestName, GlobalRequestHandler handler) protected void
closeChannel
(Channel channel) boolean
containsChannelFactory
(String channelName) protected void
freeChannel
(Channel channel) protected int[]
Implement this method by returning the message ids of the asyncrounous messages your implementation wants to receive.boolean
protected void
onGlobalRequest
(String requestName, boolean wantReply, byte[] requestData) protected void
Called by the service thread when an asyncronous message is received.protected void
Called when the service is accepted by the remote server.protected void
onServiceInit
(int startMode) Called when the service is intialized.protected void
protected void
onStop()
The service thread calls this method when the thread is exiting.boolean
openChannel
(Channel channel) boolean
openChannel
(Channel channel, ChannelEventListener eventListener) void
removeChannelFactory
(String channelName) void
sendChannelData
(Channel channel, byte[] data) void
sendChannelEOF
(Channel channel) void
sendChannelExtData
(Channel channel, int extendedType, byte[] data) protected void
sendChannelFailure
(Channel channel) protected void
sendChannelOpenConfirmation
(Channel channel) protected void
sendChannelOpenFailure
(long remoteChannelId, long reasonCode, String additionalInfo, String languageTag) boolean
sendChannelRequest
(Channel channel, String requestType, boolean wantReply, byte[] requestData) void
sendChannelRequestFailure
(Channel channel) void
sendChannelRequestSuccess
(Channel channel) void
sendChannelWindowAdjust
(Channel channel, long bytesToAdd) byte[]
sendGlobalRequest
(String requestName, boolean wantReply, byte[] requestData) protected void
protected void
sendGlobalRequestSuccess
(byte[] requestData) Methods inherited from class com.sshtools.j2ssh.transport.AsyncService
onStart, run
Methods 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:
IOException
SshException
-
onStop
protected void onStop()Description copied from class:AsyncService
The service thread calls this method when the thread is exiting.
- Specified by:
onStop
in 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:
IOException
SshException
-
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:
IOException
SshException
-
getAsyncMessageFilter
protected int[] getAsyncMessageFilter()Description copied from class:AsyncService
Implement this method by returning the message ids of the asyncrounous messages your implementation wants to receive.
- Specified by:
getAsyncMessageFilter
in 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:AsyncService
Called by the service thread when an asyncronous message is received.
- Specified by:
onMessageReceived
in classAsyncService
- Parameters:
msg
-- Throws:
IOException
-
onServiceAccept
protected void onServiceAccept()Description copied from class:Service
Called when the service is accepted by the remote server.
- Specified by:
onServiceAccept
in classService
-
onServiceInit
Description copied from class:Service
Called when the service is intialized.
- Specified by:
onServiceInit
in classService
- Parameters:
startMode
-- Throws:
IOException
-
onServiceRequest
protected void onServiceRequest()- Specified by:
onServiceRequest
in 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
-
-