com.sshtools.j2ssh.connection

Class ConnectionProtocol

Implemented Interfaces:
Runnable

public class ConnectionProtocol
extends AsyncService

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, REQUESTING_SERVICE, messageStore, startMode, state, transport

Constructor Summary

ConnectionProtocol()
Creates a new ConnectionProtocol object.

Method Summary

void
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[]
getAsyncMessageFilter()
boolean
isConnected()
protected void
onGlobalRequest(String requestName, boolean wantReply, byte[] requestData)
protected void
onMessageReceived(SshMessage msg)
protected void
onServiceAccept()
protected void
onServiceInit(int startMode)
protected void
onServiceRequest()
protected void
onStop()
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
sendGlobalRequestFailure()
protected void
sendGlobalRequestSuccess(byte[] requestData)

Methods inherited from class com.sshtools.j2ssh.transport.AsyncService

getAsyncMessageFilter, onMessageReceived, onStart, onStop, run

Methods inherited from class com.sshtools.j2ssh.transport.Service

getServiceName, getState, init, onServiceAccept, onServiceInit, onServiceRequest, onStart, sendServiceAccept, start, stop

Constructor Details

ConnectionProtocol

public ConnectionProtocol()
Creates a new ConnectionProtocol object.

Method Details

addChannelFactory

public void addChannelFactory(String channelName,
                              ChannelFactory cf)
            throws IOException
Parameters:
channelName -
cf -

allowGlobalRequest

public void allowGlobalRequest(String requestName,
                               GlobalRequestHandler handler)
Parameters:
requestName -
handler -

closeChannel

protected void closeChannel(Channel channel)
            throws IOException
Parameters:
channel -

containsChannelFactory

public boolean containsChannelFactory(String channelName)
Parameters:
channelName -
Returns:

freeChannel

protected void freeChannel(Channel channel)
Parameters:
channel -

getAsyncMessageFilter

protected int[] getAsyncMessageFilter()
Overrides:
getAsyncMessageFilter in interface AsyncService
Returns:

isConnected

public boolean isConnected()
Returns:

onGlobalRequest

protected void onGlobalRequest(String requestName,
                               boolean wantReply,
                               byte[] requestData)
            throws IOException
Parameters:
requestName -
wantReply -
requestData -

onMessageReceived

protected void onMessageReceived(SshMessage msg)
            throws IOException
Overrides:
onMessageReceived in interface AsyncService
Parameters:
msg -

onServiceAccept

protected void onServiceAccept()
Overrides:
onServiceAccept in interface Service

onServiceInit

protected void onServiceInit(int startMode)
            throws IOException
Overrides:
onServiceInit in interface Service
Parameters:
startMode -

onServiceRequest

protected void onServiceRequest()
Overrides:
onServiceRequest in interface Service

onStop

protected void onStop()
Overrides:
onStop in interface AsyncService

openChannel

public boolean openChannel(Channel channel)
            throws IOException
Parameters:
channel -
Returns:

openChannel

public boolean openChannel(Channel channel,
                           ChannelEventListener eventListener)
            throws IOException
Parameters:
channel -
eventListener -
Returns:

removeChannelFactory

public void removeChannelFactory(String channelName)
Parameters:
channelName -

sendChannelData

public void sendChannelData(Channel channel,
                            byte[] data)
            throws IOException
Parameters:
channel -
data -

sendChannelEOF

public void sendChannelEOF(Channel channel)
            throws IOException
Parameters:
channel -

sendChannelExtData

public void sendChannelExtData(Channel channel,
                               int extendedType,
                               byte[] data)
            throws IOException
Parameters:
channel -
extendedType -
data -

sendChannelFailure

protected void sendChannelFailure(Channel channel)
            throws IOException
Parameters:
channel -

sendChannelOpenConfirmation

protected void sendChannelOpenConfirmation(Channel channel)
            throws IOException
Parameters:
channel -

sendChannelOpenFailure

protected void sendChannelOpenFailure(long remoteChannelId,
                                      long reasonCode,
                                      String additionalInfo,
                                      String languageTag)
            throws IOException
Parameters:
remoteChannelId -
reasonCode -
additionalInfo -
languageTag -

sendChannelRequest

public boolean sendChannelRequest(Channel channel,
                                  String requestType,
                                  boolean wantReply,
                                  byte[] requestData)
            throws IOException
Parameters:
channel -
requestType -
wantReply -
requestData -
Returns:

sendChannelRequestFailure

public void sendChannelRequestFailure(Channel channel)
            throws IOException
Parameters:
channel -

sendChannelRequestSuccess

public void sendChannelRequestSuccess(Channel channel)
            throws IOException
Parameters:
channel -

sendChannelWindowAdjust

public void sendChannelWindowAdjust(Channel channel,
                                    long bytesToAdd)
            throws IOException
Parameters:
channel -
bytesToAdd -

sendGlobalRequest

public byte[] sendGlobalRequest(String requestName,
                                boolean wantReply,
                                byte[] requestData)
            throws IOException
Parameters:
requestName -
wantReply -
requestData -
Returns:

sendGlobalRequestFailure

protected void sendGlobalRequestFailure()
            throws IOException

sendGlobalRequestSuccess

protected void sendGlobalRequestSuccess(byte[] requestData)
            throws IOException
Parameters:
requestData -

Copyright © 2002-2003 Lee David Painter & Contributors. All Rights Reserved.