public interface Session extends Channel
session channel provides for execution of a remote command, shell or subsystem. Before this requests like starting X11 forwarding, setting environment variables, allocating a
PTY etc. can be made.
It is not legal to reuse a session channel for more than one of command, shell, or subsystem. Once one of
these has been started this instance's API is invalid and that of the specific targets
returned should be used.Session.Command,
Session.Shell,
Session.Subsystem| Modifier and Type | Interface and Description |
|---|---|
static interface |
Session.Command
Command API.
|
static interface |
Session.Shell
Shell API.
|
static interface |
Session.Subsystem
Subsystem API.
|
Channel.Direct, Channel.ForwardedErrorNotifiable.Util| Modifier and Type | Method and Description |
|---|---|
void |
allocateDefaultPTY()
Allocates a default PTY.
|
void |
allocatePTY(String term,
int cols,
int rows,
int width,
int height,
Map<PTYMode,Integer> modes)
Allocate a psuedo-terminal for this session.
|
Session.Command |
exec(String command)
Execute a remote command.
|
void |
reqX11Forwarding(String authProto,
String authCookie,
int screen)
Request X11 forwarding.
|
void |
setEnvVar(String name,
String value)
Set an enviornment variable.
|
Session.Shell |
startShell()
Request a shell.
|
Session.Subsystem |
startSubsystem(String name)
Request a subsystem.
|
close, getAutoExpand, getID, getInputStream, getLocalMaxPacketSize, getLocalWinSize, getOutputStream, getRecipient, getRemoteMaxPacketSize, getRemoteWinSize, getType, isOpen, join, join, setAutoExpandhandlenotifyErrorvoid allocateDefaultPTY()
throws ConnectionException,
TransportException
"vt100" with the echo modes disabled.void allocatePTY(String term, int cols, int rows, int width, int height, Map<PTYMode,Integer> modes) throws ConnectionException, TransportException
0 dimension parameters will be ignored by the server.term - TERM environment variable value (e.g., vt100)cols - terminal width, cols (e.g., 80)rows - terminal height, rows (e.g., 24)width - terminal width, pixels (e.g., 640)height - terminal height, pixels (e.g., 480)modes - ConnectionExceptionTransportExceptionSession.Command exec(String command) throws ConnectionException, TransportException
command - Session.Command instance which should now be usedConnectionException - if the request to execute the command failedTransportException - if there is an error sending the requestvoid reqX11Forwarding(String authProto, String authCookie, int screen) throws ConnectionException, TransportException
authProto - X11 authentication protocol nameauthCookie - X11 authentication cookiescreen - X11 screen numberConnectionException - if the request failedTransportException - if there was an error sending the requestvoid setEnvVar(String name, String value) throws ConnectionException, TransportException
name - name of the variablevalue - value to setConnectionException - if the request failedTransportException - if there was an error sending the requestSession.Shell startShell() throws ConnectionException, TransportException
Session.Shell instance which should now be usedConnectionException - if the request failedTransportException - if there was an error sending the requestSession.Subsystem startSubsystem(String name) throws ConnectionException, TransportException
name - subsystem nameSession.Subsystem instance which should now be usedConnectionException - if the request failedTransportException - if there was an error sending the requestCopyright © 2009–2014. All rights reserved.