Package com.sshtools.server.vsession
Class VirtualShellNG
java.lang.Object
com.sshtools.synergy.ssh.ChannelNG<SshServerContext>
com.sshtools.server.SessionChannelNG
com.sshtools.server.vsession.VirtualShellNG
- All Implemented Interfaces:
com.sshtools.common.nio.IdleStateListener
,com.sshtools.common.ssh.Channel
,com.sshtools.common.ssh.SessionChannel
,com.sshtools.common.ssh.SessionChannelServer
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.sshtools.synergy.ssh.ChannelNG
com.sshtools.synergy.ssh.ChannelNG.ChannelInputStream
-
Field Summary
FieldsFields inherited from class com.sshtools.server.SessionChannelNG
command, environment, SSH_EXTENDED_DATA_STDERR, subsystem
Fields inherited from class com.sshtools.synergy.ssh.ChannelNG
cache, con, connection, localWindow, remoteWindow
-
Constructor Summary
ConstructorsConstructorDescriptionVirtualShellNG
(com.sshtools.common.ssh.SshConnection con, ShellCommandFactory commandFactory) VirtualShellNG
(com.sshtools.common.ssh.SshConnection con, ShellCommandFactory commandFactory, String shellCommand) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
protected boolean
allocatePseudoTerminal
(String term, int cols, int rows, int width, int height, byte[] modes) If the client requests a pseudo terminal for the session this method will be invoked before the shell, exec or subsystem is started.protected void
changeWindowDimensions
(int cols, int rows, int width, int height) When the window (terminal) size changes on the client side, it MAY send notification in which case this method will be invoked to notify the session that a change has occurred.protected RootShell
createShell
(com.sshtools.common.ssh.SshConnection con) void
void
protected boolean
executeCommand
(String cmd) protected void
protected void
void
protected void
processSignal
(String signal) A signal can be delivered to the process by the client.void
protected boolean
requestAgentForwarding
(String requestType) Implement this method to support agent forwarding.boolean
setEnvironmentVariable
(String name, String value) If the client requests that an environment variable be set this method will be invoked.protected boolean
Invoked when the user wants to start a shell.Methods inherited from class com.sshtools.server.SessionChannelNG
createChannel, executeCommand, getErrorStream, getMaximumWindowSpace, getMinimumWindowSpace, getSubsystem, idle, isAgentForwardingRequested, isIncomingDataHalted, isSingleSession, onChannelClosed, onChannelClosing, onChannelData, onChannelFree, onChannelOpen, onChannelOpenConfirmation, onChannelRequest, onExtendedData, onRemoteEOF, openChannel, sendStderrData, sendStderrData, sendStdoutData, sendStdoutData, setSingleSession, startSubsystem
Methods inherited from class com.sshtools.synergy.ssh.ChannelNG
addEventListener, canClose, checkWindowSpace, clearIdleState, close, close, close, createCache, disposeCache, evaluateWindowSpace, getChannelType, getCloseFuture, getConnection, getConnectionProtocol, getContext, getInputStream, getLastActivity, getLocalId, getLocalPacket, getLocalWindow, getMaxiumRemotePacketSize, getMaxiumRemoteWindowSize, getOpenFuture, getOutputStream, getRemoteId, getRemotePacket, getRemoteWindow, getSessionIdentifier, getTimeout, haltIncomingData, isAutoConsume, isClosed, isClosing, isConnected, isLocalEOF, isOpen, isRemoteEOF, log, log, log, log, logMessage, logMessage, onChannelError, onRemoteClose, onWindowAdjust, processChannelRequestResponse, registerExtendedDataType, resetIdleState, resumeIncomingData, sendChannelDataAndBlock, sendChannelDataAndBlock, sendChannelDataAndBlock, sendChannelDataAndBlock, sendChannelDataAndBlock, sendChannelDataAndBlock, sendChannelRequest, sendChannelRequest, sendData, sendEOF, sendExtendedData, sendExtendedData, sendRequestResponse, sendWindowAdjust, sendWindowAdjust, setTimeout
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sshtools.common.ssh.Channel
addEventListener, close, getChannelType, getContext, getLocalPacket, getLocalWindow, getRemoteWindow, isClosed, isLocalEOF, isRemoteEOF, sendChannelRequest, sendChannelRequest, sendData, sendWindowAdjust
Methods inherited from interface com.sshtools.common.ssh.SessionChannel
getConnection, getInputStream, getOutputStream, haltIncomingData, resumeIncomingData
-
Field Details
-
console
-
commandFactory
-
-
Constructor Details
-
VirtualShellNG
public VirtualShellNG(com.sshtools.common.ssh.SshConnection con, ShellCommandFactory commandFactory, String shellCommand) -
VirtualShellNG
public VirtualShellNG(com.sshtools.common.ssh.SshConnection con, ShellCommandFactory commandFactory)
-
-
Method Details
-
addWindowSizeChangeListener
-
removeWindowSizeChangeListener
-
addProtectedEnvironmentVar
-
executeCommand
-
changeWindowDimensions
protected void changeWindowDimensions(int cols, int rows, int width, int height) Description copied from class:SessionChannelNG
When the window (terminal) size changes on the client side, it MAY send notification in which case this method will be invoked to notify the session that a change has occurred.- Specified by:
changeWindowDimensions
in classSessionChannelNG
-
onSessionOpen
public void onSessionOpen()- Specified by:
onSessionOpen
in interfacecom.sshtools.common.ssh.SessionChannel
- Overrides:
onSessionOpen
in classSessionChannelNG
-
startShell
protected boolean startShell()Description copied from class:SessionChannelNG
Invoked when the user wants to start a shell.- Specified by:
startShell
in classSessionChannelNG
- Returns:
- true if the shell has been started, otherwise false
-
createShell
protected RootShell createShell(com.sshtools.common.ssh.SshConnection con) throws com.sshtools.common.permissions.PermissionDeniedException, IOException - Throws:
com.sshtools.common.permissions.PermissionDeniedException
IOException
-
requestAgentForwarding
Description copied from class:SessionChannelNG
Implement this method to support agent forwarding.- Overrides:
requestAgentForwarding
in classSessionChannelNG
- Returns:
-
allocatePseudoTerminal
protected boolean allocatePseudoTerminal(String term, int cols, int rows, int width, int height, byte[] modes) Description copied from class:SessionChannelNG
If the client requests a pseudo terminal for the session this method will be invoked before the shell, exec or subsystem is started.- Specified by:
allocatePseudoTerminal
in classSessionChannelNG
- Returns:
- boolean
-
setEnvironmentVariable
Description copied from class:SessionChannelNG
If the client requests that an environment variable be set this method will be invoked.- Specified by:
setEnvironmentVariable
in interfacecom.sshtools.common.ssh.SessionChannelServer
- Specified by:
setEnvironmentVariable
in classSessionChannelNG
- Returns:
- true if the variable has been set, otherwise false
-
onChannelOpenFailure
protected void onChannelOpenFailure()- Overrides:
onChannelOpenFailure
in classcom.sshtools.synergy.ssh.ChannelNG<SshServerContext>
-
processSignal
Description copied from class:SessionChannelNG
A signal can be delivered to the process by the client. If a signal is received this method will be invoked so that the session may evaluate and take the required action.- Specified by:
processSignal
in classSessionChannelNG
-
onLocalEOF
protected void onLocalEOF()- Specified by:
onLocalEOF
in classcom.sshtools.synergy.ssh.ChannelNG<SshServerContext>
-
enableRawMode
public void enableRawMode()- Specified by:
enableRawMode
in interfacecom.sshtools.common.ssh.SessionChannelServer
- Overrides:
enableRawMode
in classSessionChannelNG
-
disableRawMode
public void disableRawMode()- Specified by:
disableRawMode
in interfacecom.sshtools.common.ssh.SessionChannelServer
- Overrides:
disableRawMode
in classSessionChannelNG
-