public abstract class ConnectionProtocol<T extends SshContext> extends ExecutorOperationSupport<T> implements Service
Modifier and Type | Field and Description |
---|---|
protected Connection<T> |
con |
static String |
SERVICE_NAME |
protected String |
username |
CALLBACKS, EVENTS, MESSAGES_INCOMING, MESSAGES_OUTGOING
Constructor and Description |
---|
ConnectionProtocol(TransportProtocol<T> transport,
String username) |
Modifier and Type | Method and Description |
---|---|
void |
addGlobalRequestHandler(GlobalRequestHandler<T> handler) |
protected abstract Channel<T> |
createChannel(String channeltype,
Connection<T> con) |
void |
disconnect()
Disconnect the current connection.
|
List<Channel<T>> |
getActiveChannels() |
Connection<T> |
getConnection() |
T |
getContext()
Get the connections
ConfigurationContext . |
int |
getIdleTimeoutSeconds()
How long does the service allow idle for?
|
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() |
SocketAddress |
getRemoteAddress()
Get the address of the remote client.
|
String |
getSessionIdentifier() |
TransportProtocol<T> |
getTransport()
Get the underlying transport.
|
String |
getUsername()
Get the username for the connected user.
|
String |
getUUID() |
protected abstract void |
onStart() |
RequestFuture |
openChannel(Channel<T> channel) |
protected void |
processGlobalRequestFailure(byte[] msg) |
protected void |
processGlobalRequestSuccess(byte[] msg) |
boolean |
processMessage(byte[] msg)
Process a transport message.
|
protected abstract boolean |
processTCPIPCancel(ByteArrayReader bar,
ByteArrayWriter msg) |
protected abstract boolean |
processTCPIPForward(ByteArrayReader bar,
ByteArrayWriter response) |
void |
sendChannelOpenConfirmation(Channel<T> channel,
byte[] responsedata) |
void |
sendChannelOpenFailure(Channel<T> channel,
int reason,
String desc) |
void |
sendGlobalRequest(GlobalRequest request,
boolean wantReply) |
void |
start()
Start the service.
|
void |
stop()
Stop the service
|
addTask, cleanupOperations, getOperationsCount
public static final String SERVICE_NAME
protected String username
protected Connection<T extends SshContext> con
public ConnectionProtocol(TransportProtocol<T> transport, String username)
public void addGlobalRequestHandler(GlobalRequestHandler<T> handler)
public SocketAddress getRemoteAddress()
public SocketAddress getLocalAddress()
public int getLocalPort()
public String getUsername()
public void stop()
Service
public String getSessionIdentifier()
public RequestFuture openChannel(Channel<T> channel)
public int getMaxChannels()
public void disconnect()
public boolean processMessage(byte[] msg) throws IOException
Service
TransportProtocol
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 Service
IOException
protected void processGlobalRequestSuccess(byte[] msg)
protected void processGlobalRequestFailure(byte[] msg)
protected abstract boolean processTCPIPCancel(ByteArrayReader bar, ByteArrayWriter msg) throws IOException
IOException
protected abstract boolean processTCPIPForward(ByteArrayReader bar, ByteArrayWriter response) throws IOException
IOException
protected abstract Channel<T> createChannel(String channeltype, Connection<T> con) throws UnsupportedChannelException, PermissionDeniedException
public void sendGlobalRequest(GlobalRequest request, boolean wantReply)
public int getQueueSize()
public void sendChannelOpenConfirmation(Channel<T> channel, byte[] responsedata)
public void sendChannelOpenFailure(Channel<T> channel, int reason, String desc)
public T getContext()
ConfigurationContext
.getContext
in class ExecutorOperationSupport<T extends SshContext>
public TransportProtocol<T> getTransport()
public void start()
Service
protected abstract void onStart()
public String getUUID()
public int getIdleTimeoutSeconds()
Service
getIdleTimeoutSeconds
in interface Service
public Connection<T> getConnection()
Copyright © 2016. All rights reserved.