com.mindbright.ssh2
public final class SSH2SessionChannel extends SSH2InternalChannel
newSession
methods found in
SSH2Connection
.SSH2Channel
,
SSH2Connection
Modifier and Type | Field and Description |
---|---|
protected boolean |
blocking |
static int |
EXIT_ON_CLOSE |
static int |
EXIT_ON_FAILURE |
protected boolean |
exited |
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 |
rxPipe, txPipe
in, log, nbin, nbout, out, receiver, rxCounter, rxQueue, transmitter, txCounter
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
Modifier | Constructor and Description |
---|---|
protected |
SSH2SessionChannel(SSH2Connection connection) |
protected |
SSH2SessionChannel(SSH2Connection connection,
boolean pty) |
protected |
SSH2SessionChannel(SSH2Connection connection,
NonBlockingInput in,
NonBlockingOutput out,
NonBlockingOutput err) |
protected |
SSH2SessionChannel(SSH2Connection connection,
NonBlockingInput in,
NonBlockingOutput out,
NonBlockingOutput err,
boolean pty) |
Modifier and Type | Method and Description |
---|---|
void |
changeStdErr(java.io.OutputStream stderrW) |
void |
changeStdIn(java.io.InputStream in) |
void |
changeStdOut(NonBlockingOutput out) |
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.
|
NonBlockingOutput |
getNBStdIn() |
NonBlockingInput |
getNBStdOut() |
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.
|
getInputStream, getOutputStream
applyFilter, checkRxWindowSize, completed, connected, connectionFailed, createStreams, data, eofImpl, openConfirmationImpl, outputClosed, readFailed, startStreams, waitUntilClosed, waitUntilClosed, windowAdjustImpl, writeFailed
addCloseListener, close, getChannelId, getConnection, getCreator, getPeerId, getType, handleRequest, init, openConfirmation, openFailure, openStatus, recvClose, recvEOF, removeCloseListener, sendClose, sendEOF, transmit, windowAdjust
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 int exitStatus
protected int reqStatus
protected boolean x11Mapping
protected InputStreamPipe stderr
protected java.io.OutputStream stderrW
protected SSH2SessionChannel(SSH2Connection connection)
protected SSH2SessionChannel(SSH2Connection connection, boolean pty)
protected SSH2SessionChannel(SSH2Connection connection, NonBlockingInput in, NonBlockingOutput out, NonBlockingOutput err)
protected SSH2SessionChannel(SSH2Connection connection, NonBlockingInput in, NonBlockingOutput out, NonBlockingOutput err, boolean pty)
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 millisecondsisFinished()
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 changeStdOut(NonBlockingOutput out)
public void enableStdErr()
public java.io.InputStream getStdOut()
public java.io.OutputStream getStdIn()
public java.io.InputStream getStdErr()
public NonBlockingOutput getNBStdIn()
public NonBlockingInput getNBStdOut()
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.