|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.maverick.ssh.message.SshAbstractChannel
com.maverick.ssh2.Ssh2Channel
com.maverick.ssh2.Ssh2Session
This class implements the SSH2 session channel, unlike SSH1 multiple sessions can be opened on the same SSH connection.
Field Summary |
Fields inherited from class com.maverick.ssh2.Ssh2Channel |
SESSION_CHANNEL |
Fields inherited from class com.maverick.ssh.message.SshAbstractChannel |
CHANNEL_CLOSED, CHANNEL_OPEN, CHANNEL_UNINITIALIZED, channelid, manager, ms, state |
Fields inherited from interface com.maverick.ssh.SshSession |
EXITCODE_NOT_RECEIVED |
Constructor Summary | |
Ssh2Session(int windowsize,
int packetsize,
Ssh2Client client)
Contruct a session channel. |
Method Summary | |
void |
changeTerminalDimensions(int cols,
int rows,
int width,
int height)
Change the dimensions of the terminal window. |
protected void |
channelRequest(java.lang.String requesttype,
boolean wantreply,
byte[] requestdata)
This overidden method handles the "exit-status", "exit-signal" and "xon-xoff" channel requests. |
boolean |
executeCommand(java.lang.String cmd)
Execute a command. |
boolean |
executeCommand(java.lang.String cmd,
java.lang.String charset)
Execute a command. |
int |
exitCode()
Return the exit code of the process once complete. |
SshClient |
getClient()
Get the client that created this session. |
java.lang.String |
getExitSignalInfo()
Get the exit signal information, may be an empty string. |
java.io.InputStream |
getStderrInputStream()
Get an InputStream to read the process stderr. |
boolean |
hasExitSignal()
Determine whether the remote process was signalled. |
boolean |
isFlowControlEnabled()
On many systems it is possible to determine whether a pseudo-terminal is using control-S/ control-Q flow control. |
protected void |
processExtendedData(int typecode,
byte[] buf,
int offset,
int len)
Called when extended data arrives. |
boolean |
requestPseudoTerminal(java.lang.String term,
int cols,
int rows,
int width,
int height)
The remote process may require a pseudo terminal. |
boolean |
requestPseudoTerminal(java.lang.String term,
int cols,
int rows,
int width,
int height,
byte[] modes)
The remote process may require a pseudo terminal. |
boolean |
requestPseudoTerminal(java.lang.String term,
int cols,
int rows,
int width,
int height,
PseudoTerminalModes terminalModes)
The remote process may require a pseudo terminal. |
boolean |
setEnvironmentVariable(java.lang.String name,
java.lang.String value)
The SSH2 session supports the setting of environments variables however in our experiance no server to date allows unconditional setting of variables. |
void |
signal(java.lang.String signal)
Send a signal to the remote process. |
boolean |
startShell()
Start the users default shell. |
boolean |
startSubsystem(java.lang.String subsystem)
SSH2 supports special subsystems that are identified by a name rather than a command string, an example of an SSH2 subsystem is SFTP. |
Methods inherited from class com.maverick.ssh2.Ssh2Channel |
addChannelEventListener, channelEOF, close, create, createExtendedDataStream, equals, getInputStream, getMessageStore, getName, getOutputStream, getStickyMessageIds, open, open, processChannelMessage, processStandardData, sendRequest, setAutoConsumeInput |
Methods inherited from class com.maverick.ssh.message.SshAbstractChannel |
getChannelId, init, isClosed |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.maverick.ssh.SshSession |
close, getInputStream, getOutputStream, isClosed |
Methods inherited from interface com.maverick.ssh.SshChannel |
addChannelEventListener, getChannelId, setAutoConsumeInput |
Constructor Detail |
public Ssh2Session(int windowsize, int packetsize, Ssh2Client client)
windowsize
- the initial/maximum window space availablepacketsize
- the maximum packet sizeMethod Detail |
public SshClient getClient()
SshSession
getClient
in interface SshSession
protected void processExtendedData(int typecode, byte[] buf, int offset, int len) throws SshException
Ssh2Channel
com.maverick.ssh.ChannelEventListener#extendedDataReceived(com.maverick.ssh.Channel, byte[], int, int, int)
event so to maintain code compatibility always call the
super method in any overidden method.
processExtendedData
in class Ssh2Channel
typecode
- the type of extended databuf
- the data bufferoffset
- the offsetlen
- the length
SshException
public java.io.InputStream getStderrInputStream()
SshSession
getStderrInputStream
in interface SshSession
public boolean requestPseudoTerminal(java.lang.String term, int cols, int rows, int width, int height) throws SshException
SshSession
requestPseudoTerminal
in interface SshSession
term
- the terminal type e.g "vt100"cols
- the number of columnsrows
- the number of rowswidth
- the width of the terminal (informational only, can be zero)height
- the height of the terminal (informational only, can be zero)
true
if the pty was allocated, otherwise false
SshException
public boolean requestPseudoTerminal(java.lang.String term, int cols, int rows, int width, int height, PseudoTerminalModes terminalModes) throws SshException
SshSession
requestPseudoTerminal
in interface SshSession
term
- the terminal type e.g "vt100"cols
- the number of columnsrows
- the number of rowswidth
- the width of the terminal (informational only, can be zero)height
- the height of the terminal (informational only, can be zero)terminalModes
- the known terminal modes
true
if the pty was allocated, otherwise false
SshException
public boolean requestPseudoTerminal(java.lang.String term, int cols, int rows, int width, int height, byte[] modes) throws SshException
SshSession
requestPseudoTerminal
in interface SshSession
term
- the terminal type e.g "vt100"cols
- the number of columnsrows
- the number of rowswidth
- the width of the terminal (informational only, can be zero)height
- the height of the terminal (informational only, can be zero)modes
- an array of encoded terminal modes as described in the
SSH protocol specifications.
true
if the pty was allocated, otherwise false
SshException
public boolean startShell() throws SshException
SshSession
startShell
in interface SshSession
true
if the shell was started, otherwise
false
SshException
public boolean executeCommand(java.lang.String cmd) throws SshException
SshSession
executeCommand
in interface SshSession
cmd
-
true
if the command was accepted, otherwise
false
. This may not return false if the
command is incorrect, it should only be used as an
indication that the command was accepted and that the
server will attempt to execute it.
SshException
public boolean executeCommand(java.lang.String cmd, java.lang.String charset) throws SshException
SshSession
executeCommand
in interface SshSession
cmd
-
true
if the command was accepted, otherwise
false
. This may not return false if the
command is incorrect, it should only be used as an
indication that the command was accepted and that the
server will attempt to execute it.
SshException
public boolean startSubsystem(java.lang.String subsystem) throws SshException
subsystem
- the name of the subsystem, for example "sftp"
true
if the subsystem was started, otherwise false
SshException
public boolean setEnvironmentVariable(java.lang.String name, java.lang.String value) throws SshException
SshException
public void changeTerminalDimensions(int cols, int rows, int width, int height) throws SshException
SshSession
changeTerminalDimensions
in interface SshSession
cols
- rows
- width
- height
-
SshException
public boolean isFlowControlEnabled()
true
the
client is allowed to do flow control using control-S and control-Q
public void signal(java.lang.String signal) throws SshException
ABRT ALRM FPE HUP ILL INT KILL PIPE QUIT SEGV TERM USR1 USR2
signal
-
java.io.IOException
SshException
protected void channelRequest(java.lang.String requesttype, boolean wantreply, byte[] requestdata) throws SshException
channelRequest
in class Ssh2Channel
requesttype
- the name of the requestwantreply
- specifies whether the remote side requires a success/failure messagerequestdata
- the request data
SshException
public int exitCode()
SshSession
exitCode
in interface SshSession
public boolean hasExitSignal()
true
if a signal was received, otherwise false
public java.lang.String getExitSignalInfo()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |