public class ChannelSession extends AbstractServerChannel
| Modifier and Type | Class and Description |
|---|---|
class |
ChannelSession.CommandCloseable |
AbstractChannel.GracefulChannelCloseable, AbstractChannel.GracefulStateAbstractCloseable.StateAttributeRepository.AttributeKey<T>| Modifier and Type | Field and Description |
|---|---|
protected ChannelAsyncOutputStream |
asyncErr |
protected ChannelAsyncOutputStream |
asyncOut |
protected CloseFuture |
commandExitFuture |
protected Command |
commandInstance |
protected java.util.concurrent.atomic.AtomicBoolean |
commandStarted |
static java.util.List<ChannelRequestHandler> |
DEFAULT_HANDLERS |
protected StandardEnvironment |
env |
protected java.io.OutputStream |
err |
protected java.io.OutputStream |
out |
protected ChannelDataReceiver |
receiver |
protected Buffer |
tempBuffer |
protected java.lang.String |
type |
exitStatusSentchannelListenerProxy, channelListeners, eofReceived, eofSent, gracefulFuture, gracefulState, initialized, RESPONSE_BUFFER_GROWTH_FACTOR, servicecloseFuture, lock, statelogCHANNEL_EXEC, CHANNEL_SHELL, CHANNEL_SUBSYSTEMEMPTYNONECLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT| Constructor and Description |
|---|
ChannelSession() |
ChannelSession(java.util.Collection<? extends RequestHandler<Channel>> handlers) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addEnvVariable(java.lang.String name,
java.lang.String value) |
protected void |
closeImmediately0() |
protected void |
closeShell(int exitValue) |
protected void |
doWriteData(byte[] data,
int off,
long len) |
protected void |
doWriteExtendedData(byte[] data,
int off,
long len) |
StandardEnvironment |
getEnvironment() |
protected Closeable |
getInnerCloseable() |
protected int |
getPtyModeValue(PtyMode mode) |
ServerSession |
getSession() |
protected RequestHandler.Result |
handleAgentForwarding(java.lang.String requestType,
Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
handleBreak(Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
handleEnv(Buffer buffer,
boolean wantReply) |
void |
handleEof()
Invoked when
SSH_MSG_CHANNEL_EOF received |
protected RequestHandler.Result |
handleExec(java.lang.String request,
Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
handleInternalRequest(java.lang.String requestType,
boolean wantReply,
Buffer buffer)
Called by
AbstractChannel.handleUnknownChannelRequest(String, boolean, Buffer)
in order to allow channel request handling if none of the registered handlers
processed the request - last chance. |
protected RequestHandler.Result |
handlePtyReq(Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
handleShell(java.lang.String request,
Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
handleSignal(Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
handleSubsystem(java.lang.String request,
Buffer buffer,
boolean wantReply) |
void |
handleWindowAdjust(Buffer buffer)
Invoked when
SSH_MSG_CHANNEL_WINDOW_ADJUST received |
protected RequestHandler.Result |
handleWindowChange(Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
handleX11Forwarding(java.lang.String requestType,
Buffer buffer,
boolean wantReply) |
protected RequestHandler.Result |
prepareChannelCommand(java.lang.String request,
Command cmd) |
protected Command |
prepareCommand(java.lang.String requestType,
Command command)
Called by
prepareChannelCommand(String, Command) in order to set
up the command's streams, session, file-system, exit callback, etc.. |
protected IoWriteFuture |
sendResponse(Buffer buffer,
java.lang.String req,
RequestHandler.Result result,
boolean wantReply) |
void |
setDataReceiver(ChannelDataReceiver receiver)
For
Command to install ChannelDataReceiver. |
doInit, getServerSession, handleOpenFailure, handleOpenSuccess, open, sendExitStatusaddChannelListener, addPendingRequest, addRequestHandler, attributeKeys, clearAttributes, computeAttributeIfAbsent, configureWindow, getAttribute, getAttributesCount, getChannelListenerProxy, getChannelStreamPacketWriterResolver, getExecutorService, getId, getLocalWindow, getParentPropertyResolver, getProperties, getRecipient, getRemoteWindow, getRequestHandlers, handleChannelRequest, handleClose, handleData, handleExtendedData, handleFailure, handleRequest, handleSuccess, handleUnknownChannelRequest, init, invokeChannelSignaller, isEofSent, isEofSignalled, isInitialized, notifyStateChanged, notifyStateChanged, preClose, removeAttribute, removeChannelListener, removePendingRequest, removeRequestHandler, resolveChannelStreamPacketWriterResolver, sendEof, sendWindowAdjust, setAttribute, setChannelStreamPacketWriterResolver, setRecipient, signalChannelClosed, signalChannelClosed, signalChannelInitialized, signalChannelInitialized, signalChannelOpenFailure, signalChannelOpenFailure, signalChannelOpenSuccess, signalChannelOpenSuccess, toString, validateIncomingDataSize, writePacketdoCloseGracefully, doCloseImmediatelyaddCloseFutureListener, builder, close, isClosed, isClosing, removeCloseFutureListenergetSimplifiedLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddRequestHandler, addRequestHandlers, getId, getLocalWindow, getRecipient, getRemoteWindow, getRequestHandlers, handleClose, handleData, handleExtendedData, handleFailure, handleRequest, handleSuccess, init, isEofSignalled, isInitialized, removeRequestHandler, removeRequestHandlers, resolveAttribute, resolveAttributeaddChannelListener, getChannelListenerProxy, removeChannelListenergetBoolean, getBooleanProperty, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringPropertyclearAttributes, computeAttributeIfAbsent, removeAttribute, setAttributeattributeKeys, getAttribute, getAttributesCount, ofAttributesMap, ofKeyValuePairwritePacketgetChannelStreamPacketWriterResolver, resolveChannelStreamPacketWriter, resolveChannelStreamPacketWriterResolver, setChannelStreamPacketWriterResolveraddCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListenerpublic static final java.util.List<ChannelRequestHandler> DEFAULT_HANDLERS
protected java.lang.String type
protected ChannelAsyncOutputStream asyncOut
protected ChannelAsyncOutputStream asyncErr
protected java.io.OutputStream out
protected java.io.OutputStream err
protected Command commandInstance
protected ChannelDataReceiver receiver
protected Buffer tempBuffer
protected final java.util.concurrent.atomic.AtomicBoolean commandStarted
protected final StandardEnvironment env
protected final CloseFuture commandExitFuture
public ChannelSession()
public ChannelSession(java.util.Collection<? extends RequestHandler<Channel>> handlers)
public ServerSession getSession()
getSession in class AbstractChannelSessionpublic void handleWindowAdjust(Buffer buffer) throws java.io.IOException
ChannelSSH_MSG_CHANNEL_WINDOW_ADJUST receivedhandleWindowAdjust in class AbstractChannelbuffer - The rest of the message data Buffer after
decoding the channel identifiersjava.io.IOException - If failed to handle the messageprotected Closeable getInnerCloseable()
getInnerCloseable in class AbstractChannelprotected void closeImmediately0()
public void handleEof()
throws java.io.IOException
ChannelSSH_MSG_CHANNEL_EOF receivedhandleEof in class AbstractChanneljava.io.IOException - If failed to handle the messageprotected void doWriteData(byte[] data,
int off,
long len)
throws java.io.IOException
doWriteData in class AbstractChanneljava.io.IOExceptionprotected void doWriteExtendedData(byte[] data,
int off,
long len)
throws java.io.IOException
doWriteExtendedData in class AbstractChanneljava.io.IOExceptionprotected RequestHandler.Result handleInternalRequest(java.lang.String requestType, boolean wantReply, Buffer buffer) throws java.io.IOException
AbstractChannelAbstractChannel.handleUnknownChannelRequest(String, boolean, Buffer)
in order to allow channel request handling if none of the registered handlers
processed the request - last chance.handleInternalRequest in class AbstractChannelrequestType - The request typewantReply - Whether reply is requestedbuffer - The Buffer containing extra request-specific datanull or Unsupported
and reply is required then a failure message will be sentjava.io.IOException - If failed to process the request internallyprotected IoWriteFuture sendResponse(Buffer buffer, java.lang.String req, RequestHandler.Result result, boolean wantReply) throws java.io.IOException
sendResponse in class AbstractChanneljava.io.IOExceptionprotected RequestHandler.Result handleEnv(Buffer buffer, boolean wantReply) throws java.io.IOException
java.io.IOExceptionprotected RequestHandler.Result handlePtyReq(Buffer buffer, boolean wantReply) throws java.io.IOException
java.io.IOExceptionprotected RequestHandler.Result handleWindowChange(Buffer buffer, boolean wantReply) throws java.io.IOException
java.io.IOExceptionprotected RequestHandler.Result handleSignal(Buffer buffer, boolean wantReply) throws java.io.IOException
java.io.IOExceptionprotected RequestHandler.Result handleBreak(Buffer buffer, boolean wantReply) throws java.io.IOException
java.io.IOExceptionprotected RequestHandler.Result handleShell(java.lang.String request, Buffer buffer, boolean wantReply) throws java.io.IOException
java.io.IOExceptionprotected RequestHandler.Result handleExec(java.lang.String request, Buffer buffer, boolean wantReply) throws java.io.IOException
java.io.IOExceptionprotected RequestHandler.Result handleSubsystem(java.lang.String request, Buffer buffer, boolean wantReply) throws java.io.IOException
java.io.IOExceptionprotected RequestHandler.Result prepareChannelCommand(java.lang.String request, Command cmd) throws java.io.IOException
java.io.IOExceptionpublic void setDataReceiver(ChannelDataReceiver receiver)
Command to install ChannelDataReceiver.
When you do this, Command.setInputStream(java.io.InputStream) or
AsyncCommand.setIoInputStream(org.apache.sshd.common.io.IoInputStream)
will no longer be invoked. If you call this method from CommandLifecycle.start(Environment),
the input stream you received in Command.setInputStream(java.io.InputStream) will
not read any data.receiver - The ChannelDataReceiver instanceprotected Command prepareCommand(java.lang.String requestType, Command command) throws java.io.IOException
prepareChannelCommand(String, Command) in order to set
up the command's streams, session, file-system, exit callback, etc..requestType - The request that caused the command to be createdcommand - The created Command - may be nullnull then the request that
initially caused the creation of the command is failed and the original command
(if any) destroyed (eventually). Note: if a different command instance
than the input one is returned, then it is up to the implementor to take care
of the wrapping or destruction of the original command instance.java.io.IOException - If failed to prepare the commandprotected int getPtyModeValue(PtyMode mode)
protected RequestHandler.Result handleAgentForwarding(java.lang.String requestType, Buffer buffer, boolean wantReply) throws java.io.IOException
java.io.IOExceptionprotected RequestHandler.Result handleX11Forwarding(java.lang.String requestType, Buffer buffer, boolean wantReply) throws java.io.IOException
java.io.IOExceptionprotected void addEnvVariable(java.lang.String name,
java.lang.String value)
public StandardEnvironment getEnvironment()
protected void closeShell(int exitValue)
throws java.io.IOException
java.io.IOException