public abstract class ConnectionProtocol<T extends SshContext> extends ExecutorOperationSupport<SshContext> implements Service
| Modifier and Type | Field and Description |
|---|---|
protected Connection<T> |
con |
protected java.util.LinkedList<GlobalRequest> |
outstandingRequests |
static java.lang.String |
SERVICE_NAME |
protected java.lang.String |
username |
CALLBACKS, EVENTS, MESSAGES_INCOMING, MESSAGES_OUTGOING| Constructor and Description |
|---|
ConnectionProtocol(TransportProtocol<T> transport,
java.lang.String username) |
| Modifier and Type | Method and Description |
|---|---|
void |
addGlobalRequestHandler(GlobalRequestHandler<T> handler) |
protected abstract ChannelNG<T> |
createChannel(java.lang.String channeltype,
Connection<T> con) |
void |
disconnect()
Disconnect the current connection.
|
java.util.List<ChannelNG<T>> |
getActiveChannels() |
Connection<T> |
getConnection() |
T |
getContext()
Get the connections
ConfigurationContext. |
int |
getIdleTimeoutSeconds()
How long does the service allow idle for?
|
java.net.SocketAddress |
getLocalAddress()
Get the local address to which the remote socket is connected.
|
int |
getLocalPort()
Get the local port ro which the remote socket is connected.
|
int |
getMaxChannels() |
int |
getQueueSize() |
java.net.SocketAddress |
getRemoteAddress()
Get the address of the remote client.
|
java.lang.String |
getSessionIdentifier() |
TransportProtocol<T> |
getTransport()
Get the underlying transport.
|
java.lang.String |
getUsername()
Get the username for the connected user.
|
java.lang.String |
getUUID() |
boolean |
idle()
The service has reached idle timeout seconds
|
protected abstract boolean |
isClient() |
protected abstract void |
onStart() |
protected abstract void |
onStop() |
void |
openChannel(ChannelNG<T> channel) |
protected void |
processGlobalRequestFailure(byte[] msg)
Process a global request failure
|
protected void |
processGlobalRequestSuccess(byte[] m)
Process a global request success response.
|
boolean |
processMessage(byte[] msg)
Process a transport message.
|
protected abstract boolean |
processTCPIPCancel(com.sshtools.common.util.ByteArrayReader bar,
com.sshtools.common.util.ByteArrayWriter msg) |
protected abstract boolean |
processTCPIPForward(com.sshtools.common.util.ByteArrayReader bar,
com.sshtools.common.util.ByteArrayWriter response) |
void |
sendChannelOpenConfirmation(ChannelNG<T> channel,
byte[] responsedata) |
void |
sendChannelOpenFailure(ChannelNG<T> channel,
int reason,
java.lang.String desc) |
void |
sendGlobalRequest(GlobalRequest request,
boolean wantReply) |
void |
start()
Start the service.
|
void |
stop()
Stop the service
|
addIncomingTask, addOutgoingTask, addTask, cleanupOperationspublic static final java.lang.String SERVICE_NAME
protected java.util.LinkedList<GlobalRequest> outstandingRequests
protected java.lang.String username
protected Connection<T extends SshContext> con
public ConnectionProtocol(TransportProtocol<T> transport, java.lang.String username)
public void addGlobalRequestHandler(GlobalRequestHandler<T> handler)
public java.net.SocketAddress getRemoteAddress()
public java.net.SocketAddress getLocalAddress()
public int getLocalPort()
public java.lang.String getUsername()
protected abstract void onStop()
public void stop()
Servicepublic java.lang.String getSessionIdentifier()
public int getMaxChannels()
public void disconnect()
public boolean processMessage(byte[] msg)
throws java.io.IOException
ServiceTransportProtocol that is not a transport level message the
message is passed onto the active service using this method. The service
processes the message and returns a value to indicate whether the message
was used.processMessage in interface Servicejava.io.IOExceptionprotected void processGlobalRequestSuccess(byte[] m)
protected void processGlobalRequestFailure(byte[] msg)
protected abstract boolean processTCPIPCancel(com.sshtools.common.util.ByteArrayReader bar,
com.sshtools.common.util.ByteArrayWriter msg)
throws java.io.IOException
java.io.IOExceptionprotected abstract boolean processTCPIPForward(com.sshtools.common.util.ByteArrayReader bar,
com.sshtools.common.util.ByteArrayWriter response)
throws java.io.IOException
java.io.IOExceptionprotected abstract ChannelNG<T> createChannel(java.lang.String channeltype, Connection<T> con) throws UnsupportedChannelException, PermissionDeniedException, ChannelOpenException
public void sendGlobalRequest(GlobalRequest request, boolean wantReply)
public int getQueueSize()
public void sendChannelOpenConfirmation(ChannelNG<T> channel, byte[] responsedata)
public void sendChannelOpenFailure(ChannelNG<T> channel, int reason, java.lang.String desc)
public T getContext()
ConfigurationContext.getContext in class ExecutorOperationSupport<SshContext>public TransportProtocol<T> getTransport()
public void start()
Serviceprotected abstract void onStart()
public java.lang.String getUUID()
public int getIdleTimeoutSeconds()
ServicegetIdleTimeoutSeconds in interface Servicepublic boolean idle()
Serviceprotected abstract boolean isClient()
public Connection<T> getConnection()
Copyright © 2021. All rights reserved.