|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sshtools.j2ssh.transport.Service
com.sshtools.j2ssh.transport.AsyncService
com.sshtools.j2ssh.connection.ConnectionProtocol
public class ConnectionProtocol
Field Summary | |
---|---|
private java.util.Map |
activeChannels
|
private java.util.Map |
allowedChannels
|
private java.util.Map |
globalRequests
|
private static org.apache.commons.logging.Log |
log
|
private long |
nextChannelId
|
private java.util.HashSet |
reusableChannels
|
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 | |
---|---|
ConnectionProtocol()
Creates a new ConnectionProtocol object. |
Method Summary | |
---|---|
void |
addChannelFactory(java.lang.String channelName,
ChannelFactory cf)
|
void |
allowGlobalRequest(java.lang.String requestName,
GlobalRequestHandler handler)
|
protected void |
closeChannel(Channel channel)
|
boolean |
containsChannelFactory(java.lang.String channelName)
|
protected void |
freeChannel(Channel channel)
|
protected int[] |
getAsyncMessageFilter()
Implement this method by returning the message ids of the asyncrounous messages your implementation wants to receive. |
private Channel |
getChannel(long channelId)
|
private java.lang.Long |
getChannelId()
|
boolean |
isConnected()
|
protected void |
onGlobalRequest(java.lang.String requestName,
boolean wantReply,
byte[] requestData)
|
protected void |
onMessageReceived(SshMessage msg)
Called by the service thread when an asyncronous message is received. |
private void |
onMsgChannelClose(SshMsgChannelClose msg)
|
private void |
onMsgChannelData(SshMsgChannelData msg)
|
private void |
onMsgChannelEOF(SshMsgChannelEOF msg)
|
private void |
onMsgChannelExtendedData(SshMsgChannelExtendedData msg)
|
private void |
onMsgChannelOpen(SshMsgChannelOpen msg)
|
private void |
onMsgChannelRequest(SshMsgChannelRequest msg)
|
private void |
onMsgChannelWindowAdjust(SshMsgChannelWindowAdjust msg)
|
private void |
onMsgGlobalRequest(SshMsgGlobalRequest msg)
|
protected void |
onServiceAccept()
Called when the service is accepted by the remote server. |
protected void |
onServiceInit(int startMode)
Called when the service is intialized. |
protected void |
onServiceRequest()
|
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(java.lang.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,
java.lang.String additionalInfo,
java.lang.String languageTag)
|
boolean |
sendChannelRequest(Channel channel,
java.lang.String requestType,
boolean wantReply,
byte[] requestData)
|
void |
sendChannelRequestFailure(Channel channel)
|
void |
sendChannelRequestSuccess(Channel channel)
|
void |
sendChannelWindowAdjust(Channel channel,
long bytesToAdd)
|
byte[] |
sendGlobalRequest(java.lang.String requestName,
boolean wantReply,
byte[] requestData)
|
protected void |
sendGlobalRequestFailure()
|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static org.apache.commons.logging.Log log
private java.util.HashSet reusableChannels
private java.util.Map activeChannels
private java.util.Map allowedChannels
private java.util.Map globalRequests
private long nextChannelId
Constructor Detail |
---|
public ConnectionProtocol()
Method Detail |
---|
public void addChannelFactory(java.lang.String channelName, ChannelFactory cf) throws java.io.IOException
channelName
- cf
-
java.io.IOException
public void removeChannelFactory(java.lang.String channelName)
channelName
- public boolean containsChannelFactory(java.lang.String channelName)
channelName
-
public void allowGlobalRequest(java.lang.String requestName, GlobalRequestHandler handler)
requestName
- handler
- public boolean openChannel(Channel channel) throws java.io.IOException
channel
-
java.io.IOException
public boolean isConnected()
private java.lang.Long getChannelId()
public boolean openChannel(Channel channel, ChannelEventListener eventListener) throws java.io.IOException
channel
- eventListener
-
java.io.IOException
SshException
protected void onStop()
AsyncService
The service thread calls this method when the thread is exiting.
onStop
in class AsyncService
public void sendChannelData(Channel channel, byte[] data) throws java.io.IOException
channel
- data
-
java.io.IOException
public void sendChannelEOF(Channel channel) throws java.io.IOException
channel
-
java.io.IOException
public void sendChannelExtData(Channel channel, int extendedType, byte[] data) throws java.io.IOException
channel
- extendedType
- data
-
java.io.IOException
public boolean sendChannelRequest(Channel channel, java.lang.String requestType, boolean wantReply, byte[] requestData) throws java.io.IOException
channel
- requestType
- wantReply
- requestData
-
java.io.IOException
SshException
public void sendChannelRequestFailure(Channel channel) throws java.io.IOException
channel
-
java.io.IOException
public void sendChannelRequestSuccess(Channel channel) throws java.io.IOException
channel
-
java.io.IOException
public void sendChannelWindowAdjust(Channel channel, long bytesToAdd) throws java.io.IOException
channel
- bytesToAdd
-
java.io.IOException
public byte[] sendGlobalRequest(java.lang.String requestName, boolean wantReply, byte[] requestData) throws java.io.IOException
requestName
- wantReply
- requestData
-
java.io.IOException
SshException
protected int[] getAsyncMessageFilter()
AsyncService
Implement this method by returning the message ids of the asyncrounous messages your implementation wants to receive.
getAsyncMessageFilter
in class AsyncService
protected void closeChannel(Channel channel) throws java.io.IOException
channel
-
java.io.IOException
protected void onGlobalRequest(java.lang.String requestName, boolean wantReply, byte[] requestData) throws java.io.IOException
requestName
- wantReply
- requestData
-
java.io.IOException
protected void onMessageReceived(SshMessage msg) throws java.io.IOException
AsyncService
Called by the service thread when an asyncronous message is received.
onMessageReceived
in class AsyncService
msg
-
java.io.IOException
protected void onServiceAccept()
Service
Called when the service is accepted by the remote server.
onServiceAccept
in class Service
protected void onServiceInit(int startMode) throws java.io.IOException
Service
Called when the service is intialized.
onServiceInit
in class Service
startMode
-
java.io.IOException
protected void onServiceRequest()
onServiceRequest
in class Service
protected void sendChannelFailure(Channel channel) throws java.io.IOException
channel
-
java.io.IOException
protected void sendChannelOpenConfirmation(Channel channel) throws java.io.IOException
channel
-
java.io.IOException
protected void sendChannelOpenFailure(long remoteChannelId, long reasonCode, java.lang.String additionalInfo, java.lang.String languageTag) throws java.io.IOException
remoteChannelId
- reasonCode
- additionalInfo
- languageTag
-
java.io.IOException
protected void sendGlobalRequestFailure() throws java.io.IOException
java.io.IOException
protected void sendGlobalRequestSuccess(byte[] requestData) throws java.io.IOException
requestData
-
java.io.IOException
private Channel getChannel(long channelId) throws java.io.IOException
java.io.IOException
private void onMsgChannelClose(SshMsgChannelClose msg) throws java.io.IOException
java.io.IOException
private void onMsgChannelData(SshMsgChannelData msg) throws java.io.IOException
java.io.IOException
private void onMsgChannelEOF(SshMsgChannelEOF msg) throws java.io.IOException
java.io.IOException
private void onMsgChannelExtendedData(SshMsgChannelExtendedData msg) throws java.io.IOException
java.io.IOException
private void onMsgChannelOpen(SshMsgChannelOpen msg) throws java.io.IOException
java.io.IOException
private void onMsgChannelRequest(SshMsgChannelRequest msg) throws java.io.IOException
java.io.IOException
private void onMsgChannelWindowAdjust(SshMsgChannelWindowAdjust msg) throws java.io.IOException
java.io.IOException
private void onMsgGlobalRequest(SshMsgGlobalRequest msg) throws java.io.IOException
java.io.IOException
protected void freeChannel(Channel channel)
channel
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |