|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindbright.ssh2.SSH2Channel
com.mindbright.ssh2.SSH2StreamChannel
com.mindbright.ssh2.SSH2InternalChannel
com.mindbright.ssh2.SSH2SessionChannel
public final class SSH2SessionChannel
This class implements session channels as defined in the connection protocol
spec. It can be used to start shells, commands, and subsystems on
the server. An instance of this class is created with the
newSession
methods found in
SSH2Connection
.
SSH2Channel
,
SSH2Connection
Field Summary | |
---|---|
protected boolean |
blocking
|
static int |
EXIT_ON_CLOSE
|
static int |
EXIT_ON_FAILURE
|
protected boolean |
exited
|
protected boolean |
exitedOnSignal
|
protected java.lang.Object |
exitMonitor
|
protected int |
exitStatus
|
protected java.lang.Object |
reqMonitor
|
protected int |
reqStatus
|
protected boolean |
started
|
protected InputStreamPipe |
stderr
|
protected java.io.OutputStream |
stderrW
|
protected boolean |
x11Mapping
|
Fields inherited from class com.mindbright.ssh2.SSH2InternalChannel |
---|
rxPipe, txPipe |
Fields inherited from class com.mindbright.ssh2.SSH2StreamChannel |
---|
in, out, receiver, rxCounter, rxQueue, transmitter, txCounter |
Fields inherited from class com.mindbright.ssh2.SSH2Channel |
---|
channelId, channelType, closeListeners, closeReceived, closeSent, connection, creator, deleted, eofReceived, eofSent, openMonitor, openStatus, peerChanId, rxCurrWinSz, rxInitWinSz, rxMaxPktSz, STATUS_CLOSED, STATUS_FAILED, STATUS_OPEN, STATUS_UNDEFINED, txCurrWinSz, txInitWinSz, txMaxPktSz |
Constructor Summary | |
---|---|
protected |
SSH2SessionChannel(SSH2Connection connection)
|
Method Summary | |
---|---|
void |
changeStdErr(java.io.OutputStream stderrW)
|
void |
changeStdIn(java.io.InputStream in)
|
void |
changeStdOut(java.io.OutputStream out)
|
protected void |
closeImpl()
Channel specific handler for the recipent of a channel close message. |
boolean |
doBreak(int length)
|
void |
doExit(int status)
|
void |
doExit(int status,
boolean onSignal)
|
void |
doExit(int status,
boolean onSignal,
java.lang.String signal)
|
boolean |
doShell()
Launch the users shell in this session |
boolean |
doSingleCommand(java.lang.String command)
Launch a single command in this session |
boolean |
doSubsystem(java.lang.String subsystem)
Launch a subsystem |
void |
enableStdErr()
|
protected void |
extData(SSH2TransportPDU pdu)
Handle incoming extended data on the channel. |
java.io.InputStream |
getStdErr()
|
java.io.OutputStream |
getStdIn()
|
java.io.InputStream |
getStdOut()
|
protected void |
handleRequestImpl(java.lang.String type,
boolean wantReply,
SSH2TransportPDU pdu)
Channel specific handler for incoming channel requests. |
boolean |
isFinished()
Checks if the last command has already finished. |
protected boolean |
openFailureImpl(int reasonCode,
java.lang.String reasonText,
java.lang.String langTag)
Channel specific handling of open failures. |
protected void |
requestFailure(SSH2TransportPDU pdu)
Handle negative request response. |
boolean |
requestPTY(java.lang.String termType,
int rows,
int cols,
byte[] terminalModes)
|
protected void |
requestSuccess(SSH2TransportPDU pdu)
Handle positive request response. |
boolean |
requestX11Forward(boolean single,
int screen)
|
boolean |
requestX11Forward(boolean single,
int screen,
byte[] cookie)
|
boolean |
requestX11Forward(java.lang.String localAddr,
int localPort,
byte[] cookie,
boolean single,
int screen)
|
void |
sendSignal(java.lang.String signal)
|
void |
sendWindowChange(int rows,
int cols)
|
void |
setBlocking(boolean value)
|
boolean |
setEnvironment(java.lang.String name,
java.lang.String value)
|
void |
stdinWriteNoLatency(byte[] buf,
int off,
int len)
|
void |
stdinWriteNoLatency(int c)
|
void |
stdinWriteNoLatency(java.lang.String str)
|
int |
waitForExit()
Wait for the last command to finish. |
int |
waitForExit(long timeout)
Wait for the last command to exit but return after the specified time has passed even if the command has not exited. |
Methods inherited from class com.mindbright.ssh2.SSH2InternalChannel |
---|
getInputStream, getOutputStream |
Methods inherited from class com.mindbright.ssh2.SSH2StreamChannel |
---|
applyFilter, checkRxWindowSize, createStreams, data, eofImpl, openConfirmationImpl, outputClosed, startStreams, waitUntilClosed, windowAdjustImpl |
Methods inherited from class com.mindbright.ssh2.SSH2Channel |
---|
addCloseListener, close, getChannelId, getConnection, getCreator, getPeerId, getType, handleRequest, init, openConfirmation, openFailure, openStatus, recvClose, recvEOF, removeCloseListener, sendClose, sendEOF, transmit, windowAdjust |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int EXIT_ON_CLOSE
public static final int EXIT_ON_FAILURE
protected boolean started
protected boolean blocking
protected boolean exited
protected java.lang.Object exitMonitor
protected java.lang.Object reqMonitor
protected boolean exitedOnSignal
protected int exitStatus
protected int reqStatus
protected boolean x11Mapping
protected InputStreamPipe stderr
protected java.io.OutputStream stderrW
Constructor Detail |
---|
protected SSH2SessionChannel(SSH2Connection connection)
Method Detail |
---|
public boolean doShell()
public boolean doSingleCommand(java.lang.String command)
public boolean doSubsystem(java.lang.String subsystem)
public boolean doBreak(int length)
public int waitForExit()
public int waitForExit(long timeout)
timeout
- how long to wait in milliseconds
isFinished()
method to help
determine which is the case.public boolean isFinished()
public void changeStdOut(java.io.OutputStream out)
public void changeStdIn(java.io.InputStream in)
public void changeStdErr(java.io.OutputStream stderrW)
public void enableStdErr()
public java.io.InputStream getStdOut()
public java.io.OutputStream getStdIn()
public java.io.InputStream getStdErr()
public void stdinWriteNoLatency(java.lang.String str)
public void stdinWriteNoLatency(byte[] buf, int off, int len)
public void stdinWriteNoLatency(int c)
public void setBlocking(boolean value)
public boolean requestPTY(java.lang.String termType, int rows, int cols, byte[] terminalModes)
public boolean requestX11Forward(java.lang.String localAddr, int localPort, byte[] cookie, boolean single, int screen)
public boolean requestX11Forward(boolean single, int screen)
public boolean requestX11Forward(boolean single, int screen, byte[] cookie)
public boolean setEnvironment(java.lang.String name, java.lang.String value)
public void sendWindowChange(int rows, int cols)
public void sendSignal(java.lang.String signal)
public void doExit(int status)
public void doExit(int status, boolean onSignal)
public void doExit(int status, boolean onSignal, java.lang.String signal)
protected void extData(SSH2TransportPDU pdu)
SSH2Channel
extData
in class SSH2Channel
pdu
- The data packet.protected void closeImpl()
SSH2Channel
closeImpl
in class SSH2StreamChannel
protected boolean openFailureImpl(int reasonCode, java.lang.String reasonText, java.lang.String langTag)
SSH2Channel
openFailureImpl
in class SSH2StreamChannel
reasonCode
- Code which tells why the open failed. See the
ssh protocol drafts for values.reasonText
- A text explaining why the open failed.langTag
- Tag identifying the language of the reason text.protected void requestSuccess(SSH2TransportPDU pdu)
SSH2Channel
requestSuccess
in class SSH2Channel
pdu
- The response packet.protected void requestFailure(SSH2TransportPDU pdu)
SSH2Channel
requestFailure
in class SSH2Channel
pdu
- The response packet.protected void handleRequestImpl(java.lang.String type, boolean wantReply, SSH2TransportPDU pdu)
SSH2Channel
handleRequestImpl
in class SSH2StreamChannel
type
- The type of request.wantReply
- True if an reply is expected.pdu
- The actual channel request.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |