com.mindbright.ssh2
Class SSH2SessionChannel
java.lang.Object
com.mindbright.ssh2.SSH2Channel
com.mindbright.ssh2.SSH2StreamChannel
com.mindbright.ssh2.SSH2InternalChannel
com.mindbright.ssh2.SSH2SessionChannel
- public final class SSH2SessionChannel
- extends SSH2InternalChannel
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
.
- See Also:
SSH2Channel
,
SSH2Connection
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 |
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()
|
boolean |
doSingleCommand(java.lang.String command)
|
boolean |
doSubsystem(java.lang.String 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. |
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(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()
|
int |
waitForExit(long timeout)
|
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 |
EXIT_ON_CLOSE
public static final int EXIT_ON_CLOSE
- See Also:
- Constant Field Values
EXIT_ON_FAILURE
public static final int EXIT_ON_FAILURE
- See Also:
- Constant Field Values
started
protected boolean started
blocking
protected boolean blocking
exited
protected boolean exited
exitMonitor
protected java.lang.Object exitMonitor
reqMonitor
protected java.lang.Object reqMonitor
exitedOnSignal
protected boolean exitedOnSignal
exitStatus
protected int exitStatus
reqStatus
protected int reqStatus
x11Mapping
protected boolean x11Mapping
stderr
protected InputStreamPipe stderr
stderrW
protected java.io.OutputStream stderrW
SSH2SessionChannel
protected SSH2SessionChannel(SSH2Connection connection)
doShell
public boolean doShell()
doSingleCommand
public boolean doSingleCommand(java.lang.String command)
doSubsystem
public boolean doSubsystem(java.lang.String subsystem)
doBreak
public boolean doBreak(int length)
waitForExit
public int waitForExit()
waitForExit
public int waitForExit(long timeout)
changeStdOut
public void changeStdOut(java.io.OutputStream out)
changeStdIn
public void changeStdIn(java.io.InputStream in)
changeStdErr
public void changeStdErr(java.io.OutputStream stderrW)
enableStdErr
public void enableStdErr()
getStdOut
public java.io.InputStream getStdOut()
getStdIn
public java.io.OutputStream getStdIn()
getStdErr
public java.io.InputStream getStdErr()
stdinWriteNoLatency
public void stdinWriteNoLatency(java.lang.String str)
stdinWriteNoLatency
public void stdinWriteNoLatency(byte[] buf,
int off,
int len)
stdinWriteNoLatency
public void stdinWriteNoLatency(int c)
setBlocking
public void setBlocking(boolean value)
requestPTY
public boolean requestPTY(java.lang.String termType,
int rows,
int cols,
byte[] terminalModes)
requestX11Forward
public boolean requestX11Forward(java.lang.String localAddr,
int localPort,
byte[] cookie,
boolean single,
int screen)
requestX11Forward
public boolean requestX11Forward(boolean single,
int screen)
setEnvironment
public boolean setEnvironment(java.lang.String name,
java.lang.String value)
sendWindowChange
public void sendWindowChange(int rows,
int cols)
sendSignal
public void sendSignal(java.lang.String signal)
doExit
public void doExit(int status)
doExit
public void doExit(int status,
boolean onSignal)
doExit
public void doExit(int status,
boolean onSignal,
java.lang.String signal)
extData
protected void extData(SSH2TransportPDU pdu)
- Description copied from class:
SSH2Channel
- Handle incoming extended data on the channel.
- Overrides:
extData
in class SSH2Channel
- Parameters:
pdu
- The data packet.
closeImpl
protected void closeImpl()
- Description copied from class:
SSH2Channel
- Channel specific handler for the recipent of a channel close message.
- Overrides:
closeImpl
in class SSH2StreamChannel
openFailureImpl
protected boolean openFailureImpl(int reasonCode,
java.lang.String reasonText,
java.lang.String langTag)
- Description copied from class:
SSH2Channel
- Channel specific handling of open failures.
- Overrides:
openFailureImpl
in class SSH2StreamChannel
requestSuccess
protected void requestSuccess(SSH2TransportPDU pdu)
- Description copied from class:
SSH2Channel
- Handle positive request response.
- Overrides:
requestSuccess
in class SSH2Channel
- Parameters:
pdu
- The response packet.
requestFailure
protected void requestFailure(SSH2TransportPDU pdu)
- Description copied from class:
SSH2Channel
- Handle negative request response.
- Overrides:
requestFailure
in class SSH2Channel
- Parameters:
pdu
- The response packet.
handleRequestImpl
protected void handleRequestImpl(java.lang.String type,
boolean wantReply,
SSH2TransportPDU pdu)
- Description copied from class:
SSH2Channel
- Channel specific handler for incoming channel requests.
- Overrides:
handleRequestImpl
in class SSH2StreamChannel