A channel connected to a remotely executing program. More...
Public Member Functions | |
void | start () throws JSchException |
void | setCommand (String command) |
sets the command to be executed. | |
void | setCommand (byte[] command) |
sets the command to be executed. | |
void | setErrStream (java.io.OutputStream out) |
Sets the error stream. | |
void | setErrStream (java.io.OutputStream out, boolean dontclose) |
Sets the error stream. | |
java.io.InputStream | getErrStream () throws java.io.IOException |
Gets the error stream. | |
void | setAgentForwarding (boolean enable) |
Enable the agent forwarding. | |
void | setXForwarding (boolean enable) |
Enable the X11 forwarding. | |
void | setEnv (Hashtable env) |
void | setEnv (String name, String value) |
Set the environment variable. | |
void | setEnv (byte[] name, byte[] value) |
Set the environment variable. | |
void | setPty (boolean enable) |
Allocate a Pseudo-Terminal. | |
void | setTerminalMode (byte[] terminal_mode) |
Set the terminal mode. | |
void | setPtySize (int col, int row, int wp, int hp) |
Change the window dimension interactively. | |
void | setPtyType (String ttype) |
Set the terminal type. | |
void | setPtyType (String ttype, int col, int row, int wp, int hp) |
Set the terminal type. | |
void | run () |
not to be called by the application. | |
void | connect () throws JSchException |
Opens the channel without any timeout. | |
Protected Member Functions | |
void | sendRequests () throws Exception |
creates and sends all requests indicated by the properties agentForwarding, xForwarding, pty (and ptyType) and env. | |
Protected Attributes | |
boolean | agent_forwarding = false |
boolean | xforwading = false |
Hashtable | env = null |
boolean | pty = false |
String | ttype = "vt100" |
int | tcol = 80 |
int | trow = 24 |
int | twp = 640 |
int | thp = 480 |
byte[] | terminal_mode = null |
byte[] | type = Util.str2byte("foo") |
Package Functions | |
void | init () throws JSchException |
synchronized void | setRecipient (int foo) |
int | getRecipient () |
Static Package Functions | |
static Channel | getChannel (String type) |
Creates a new Channel of specified type. | |
static Channel | getChannel (int id, Session session) |
Retrieves a channel from the channel pool. | |
static void | del (Channel c) |
Removes a channel from the channel pool. | |
Package Attributes | |
byte[] | command = new byte[0] |
int | id |
volatile int | recipient = -1 |
volatile int | lwsize_max = 0x100000 |
volatile int | lwsize = lwsize_max |
volatile int | lmpsize = 0x4000 |
volatile long | rwsize = 0 |
volatile int | rmpsize = 0 |
IO | io = null |
Thread | thread = null |
volatile boolean | eof_local = false |
volatile boolean | eof_remote = false |
volatile boolean | close = false |
volatile boolean | connected = false |
volatile boolean | open_confirmation = false |
volatile int | exitstatus = -1 |
volatile int | reply = 0 |
volatile int | connectTimeout = 0 |
int | notifyme = 0 |
Static Package Attributes | |
static final int | SSH_MSG_CHANNEL_OPEN_CONFIRMATION = 91 |
static final int | SSH_MSG_CHANNEL_OPEN_FAILURE = 92 |
static final int | SSH_MSG_CHANNEL_WINDOW_ADJUST = 93 |
static final int | SSH_OPEN_ADMINISTRATIVELY_PROHIBITED = 1 |
static final int | SSH_OPEN_CONNECT_FAILED = 2 |
static final int | SSH_OPEN_UNKNOWN_CHANNEL_TYPE = 3 |
static final int | SSH_OPEN_RESOURCE_SHORTAGE = 4 |
static int | index = 0 |
A channel connected to a remotely executing program.
Such a channel is created with:
ChannelExec channel = (ChannelExec)session. openChannel("exec"); channel. setCommand(cmd);
Definition at line 46 of file ChannelExec.java.
void com.jcraft.jsch.Channel.connect | ( | ) | throws JSchException [inherited] |
Opens the channel without any timeout.
This is equivalent to connect(0) if not overridden in subclasses.
Reimplemented in com.jcraft.jsch.ChannelDirectTCPIP.
Definition at line 174 of file Channel.java.
Referenced by edu.rice.cs.hpc.remote.tunnel.SSHManager.sendCommand().
static void com.jcraft.jsch.Channel.del | ( | Channel | c | ) | [static, package, inherited] |
Removes a channel from the channel pool.
Definition at line 116 of file Channel.java.
References com.jcraft.jsch.Channel.pool.
static Channel com.jcraft.jsch.Channel.getChannel | ( | int | id, | |
Session | session | |||
) | [static, package, inherited] |
Retrieves a channel from the channel pool.
id | the session-specific identifier of the channel | |
session | the session with which the channel is associated. |
Definition at line 103 of file Channel.java.
References com.jcraft.jsch.Channel.id, com.jcraft.jsch.Channel.pool, and com.jcraft.jsch.Channel.session.
static Channel com.jcraft.jsch.Channel.getChannel | ( | String | type | ) | [static, package, inherited] |
Creates a new Channel of specified type.
This factory method is used by Session#openChannel to create channels.
Definition at line 67 of file Channel.java.
java.io.InputStream com.jcraft.jsch.ChannelExec.getErrStream | ( | ) | throws java.io.IOException |
Gets the error stream.
The standard error output of the remote process can be read from this stream.
This method is a polling alternative to setErrStream.
Definition at line 124 of file ChannelExec.java.
int com.jcraft.jsch.Channel.getRecipient | ( | ) | [package, inherited] |
Definition at line 162 of file Channel.java.
References com.jcraft.jsch.Channel.recipient.
Referenced by com.jcraft.jsch.ChannelDirectTCPIP.connect(), com.jcraft.jsch.RequestX11.request(), com.jcraft.jsch.RequestWindowChange.request(), com.jcraft.jsch.RequestSubsystem.request(), com.jcraft.jsch.RequestSignal.request(), com.jcraft.jsch.RequestShell.request(), com.jcraft.jsch.RequestSftp.request(), com.jcraft.jsch.RequestPtyReq.request(), com.jcraft.jsch.RequestExec.request(), com.jcraft.jsch.RequestEnv.request(), and com.jcraft.jsch.RequestAgentForwarding.request().
void com.jcraft.jsch.ChannelExec.init | ( | ) | throws JSchException [package] |
Reimplemented from com.jcraft.jsch.Channel.
Definition at line 92 of file ChannelExec.java.
References com.jcraft.jsch.Channel.io, com.jcraft.jsch.IO.setInputStream(), and com.jcraft.jsch.IO.setOutputStream().
void com.jcraft.jsch.ChannelSession.run | ( | ) | [inherited] |
not to be called by the application.
Runs the main data transfer loop.
Definition at line 252 of file ChannelSession.java.
References com.jcraft.jsch.Buffer.buffer, com.jcraft.jsch.Channel.close, com.jcraft.jsch.IO.in, com.jcraft.jsch.Channel.io, com.jcraft.jsch.Buffer.putByte(), com.jcraft.jsch.Channel.recipient, com.jcraft.jsch.Packet.reset(), com.jcraft.jsch.Channel.rmpsize, and com.jcraft.jsch.Channel.thread.
void com.jcraft.jsch.ChannelSession.sendRequests | ( | ) | throws Exception [protected, inherited] |
creates and sends all requests indicated by the properties agentForwarding, xForwarding, pty (and ptyType) and env.
Definition at line 205 of file ChannelSession.java.
References com.jcraft.jsch.ChannelSession._session, com.jcraft.jsch.ChannelSession.agent_forwarding, com.jcraft.jsch.ChannelSession.env, com.jcraft.jsch.ChannelSession.pty, com.jcraft.jsch.Request.request(), com.jcraft.jsch.ChannelSession.tcol, com.jcraft.jsch.ChannelSession.terminal_mode, com.jcraft.jsch.ChannelSession.thp, com.jcraft.jsch.ChannelSession.toByteArray(), com.jcraft.jsch.ChannelSession.trow, com.jcraft.jsch.ChannelSession.ttype, com.jcraft.jsch.ChannelSession.twp, and com.jcraft.jsch.ChannelSession.xforwading.
Referenced by com.jcraft.jsch.ChannelShell.start(), and com.jcraft.jsch.ChannelExec.start().
void com.jcraft.jsch.ChannelSession.setAgentForwarding | ( | boolean | enable | ) | [inherited] |
Enable the agent forwarding.
enable |
Definition at line 67 of file ChannelSession.java.
References com.jcraft.jsch.ChannelSession.agent_forwarding.
void com.jcraft.jsch.ChannelExec.setCommand | ( | byte[] | command | ) |
sets the command to be executed.
command | the command to be executed. |
Definition at line 88 of file ChannelExec.java.
void com.jcraft.jsch.ChannelExec.setCommand | ( | String | command | ) |
sets the command to be executed.
command | the command to be executed. We will use the platform's default encoding to encode this string. |
Definition at line 81 of file ChannelExec.java.
void com.jcraft.jsch.ChannelSession.setEnv | ( | byte[] | name, | |
byte[] | value | |||
) | [inherited] |
Set the environment variable.
name | A name of environment variable. | |
value | A value of environment variable. |
Definition at line 114 of file ChannelSession.java.
References com.jcraft.jsch.ChannelSession.getEnv().
void com.jcraft.jsch.ChannelSession.setEnv | ( | String | name, | |
String | value | |||
) | [inherited] |
Set the environment variable.
If name
and value
are needed to be passed to the remote in your faivorite encoding,use setEnv(byte[], byte[]).
name | A name for environment variable. | |
value | A value for environment variable. |
Definition at line 102 of file ChannelSession.java.
References com.jcraft.jsch.ChannelSession.setEnv().
void com.jcraft.jsch.ChannelSession.setEnv | ( | Hashtable | env | ) | [inherited] |
Definition at line 86 of file ChannelSession.java.
Referenced by com.jcraft.jsch.ChannelSession.setEnv().
void com.jcraft.jsch.ChannelExec.setErrStream | ( | java.io.OutputStream | out, | |
boolean | dontclose | |||
) |
Sets the error stream.
The standard error output of the remote process will be sent to this stream.
dontclose | if true, we do not close the stream on disconnect. |
Definition at line 114 of file ChannelExec.java.
void com.jcraft.jsch.ChannelExec.setErrStream | ( | java.io.OutputStream | out | ) |
Sets the error stream.
The standard error output of the remote process will be sent to this stream.
The stream will be closed on disconnect.
Definition at line 103 of file ChannelExec.java.
void com.jcraft.jsch.ChannelSession.setPty | ( | boolean | enable | ) | [inherited] |
Allocate a Pseudo-Terminal.
enable |
Reimplemented in com.jcraft.jsch.ChannelSubsystem.
Definition at line 132 of file ChannelSession.java.
References com.jcraft.jsch.ChannelSession.pty.
void com.jcraft.jsch.ChannelSession.setPtySize | ( | int | col, | |
int | row, | |||
int | wp, | |||
int | hp | |||
) | [inherited] |
Change the window dimension interactively.
col | terminal width, columns | |
row | terminal height, rows | |
wp | terminal width, pixels | |
hp | terminal height, pixels |
Definition at line 154 of file ChannelSession.java.
References com.jcraft.jsch.ChannelSession.pty, com.jcraft.jsch.RequestWindowChange.request(), com.jcraft.jsch.ChannelSession.setPtyType(), com.jcraft.jsch.RequestWindowChange.setSize(), and com.jcraft.jsch.ChannelSession.ttype.
void com.jcraft.jsch.ChannelSession.setPtyType | ( | String | ttype, | |
int | col, | |||
int | row, | |||
int | wp, | |||
int | hp | |||
) | [inherited] |
Set the terminal type.
This method is not effective after Channel.connect().
ttype | terminal type(for example, "vt100") | |
col | terminal width, columns | |
row | terminal height, rows | |
wp | terminal width, pixels | |
hp | terminal height, pixels |
Definition at line 190 of file ChannelSession.java.
References com.jcraft.jsch.ChannelSession.tcol, com.jcraft.jsch.ChannelSession.thp, com.jcraft.jsch.ChannelSession.trow, and com.jcraft.jsch.ChannelSession.twp.
void com.jcraft.jsch.ChannelSession.setPtyType | ( | String | ttype | ) | [inherited] |
Set the terminal type.
This method is not effective after Channel.connect().
ttype | terminal type(for example, "vt100") |
Definition at line 176 of file ChannelSession.java.
Referenced by com.jcraft.jsch.ChannelSession.setPtySize().
synchronized void com.jcraft.jsch.Channel.setRecipient | ( | int | foo | ) | [package, inherited] |
Definition at line 157 of file Channel.java.
References com.jcraft.jsch.Channel.notifyme, and com.jcraft.jsch.Channel.recipient.
Referenced by com.jcraft.jsch.ChannelForwardedTCPIP.getData().
void com.jcraft.jsch.ChannelSession.setTerminalMode | ( | byte[] | terminal_mode | ) | [inherited] |
Set the terminal mode.
terminal_mode |
Definition at line 141 of file ChannelSession.java.
void com.jcraft.jsch.ChannelSession.setXForwarding | ( | boolean | enable | ) | [inherited] |
Enable the X11 forwarding.
enable |
Reimplemented in com.jcraft.jsch.ChannelSubsystem.
Definition at line 77 of file ChannelSession.java.
References com.jcraft.jsch.ChannelSession.xforwading.
void com.jcraft.jsch.ChannelExec.start | ( | ) | throws JSchException |
Definition at line 51 of file ChannelExec.java.
References com.jcraft.jsch.ChannelSession._session, com.jcraft.jsch.ChannelExec.command, com.jcraft.jsch.Session.daemon_thread, com.jcraft.jsch.IO.in, com.jcraft.jsch.Channel.io, com.jcraft.jsch.Request.request(), com.jcraft.jsch.ChannelSession.sendRequests(), and com.jcraft.jsch.Channel.thread.
boolean com.jcraft.jsch.ChannelSession.agent_forwarding = false [protected, inherited] |
Definition at line 43 of file ChannelSession.java.
Referenced by com.jcraft.jsch.ChannelSession.sendRequests(), and com.jcraft.jsch.ChannelSession.setAgentForwarding().
volatile boolean com.jcraft.jsch.Channel.close = false [package, inherited] |
Definition at line 138 of file Channel.java.
Referenced by com.jcraft.jsch.ChannelX11.run(), com.jcraft.jsch.ChannelSession.run(), com.jcraft.jsch.ChannelForwardedTCPIP.run(), com.jcraft.jsch.ChannelDirectTCPIP.run(), and com.jcraft.jsch.ChannelAgentForwarding.run().
byte [] com.jcraft.jsch.ChannelExec.command = new byte[0] [package] |
Definition at line 48 of file ChannelExec.java.
Referenced by com.jcraft.jsch.ChannelExec.start().
volatile boolean com.jcraft.jsch.Channel.connected = false [package, inherited] |
volatile int com.jcraft.jsch.Channel.connectTimeout = 0 [package, inherited] |
Definition at line 145 of file Channel.java.
Referenced by com.jcraft.jsch.ChannelDirectTCPIP.connect(), com.jcraft.jsch.Request.request(), and com.jcraft.jsch.Request.write().
Hashtable com.jcraft.jsch.ChannelSession.env = null [protected, inherited] |
Definition at line 45 of file ChannelSession.java.
Referenced by com.jcraft.jsch.ChannelSession.getEnv(), and com.jcraft.jsch.ChannelSession.sendRequests().
volatile boolean com.jcraft.jsch.Channel.eof_local = false [package, inherited] |
Definition at line 135 of file Channel.java.
volatile boolean com.jcraft.jsch.Channel.eof_remote = false [package, inherited] |
Definition at line 136 of file Channel.java.
volatile int com.jcraft.jsch.Channel.exitstatus = -1 [package, inherited] |
Definition at line 142 of file Channel.java.
Referenced by com.jcraft.jsch.PortWatcher.run().
int com.jcraft.jsch.Channel.id [package, inherited] |
Definition at line 122 of file Channel.java.
Referenced by com.jcraft.jsch.Channel.getChannel().
int com.jcraft.jsch.Channel.index = 0 [static, package, inherited] |
Definition at line 60 of file Channel.java.
Referenced by com.jcraft.jsch.Channel.Channel().
IO com.jcraft.jsch.Channel.io = null [package, inherited] |
Definition at line 132 of file Channel.java.
Referenced by com.jcraft.jsch.ChannelForwardedTCPIP.ChannelForwardedTCPIP(), com.jcraft.jsch.ChannelSession.ChannelSession(), com.jcraft.jsch.ChannelDirectTCPIP.connect(), com.jcraft.jsch.ChannelSubsystem.init(), com.jcraft.jsch.ChannelShell.init(), com.jcraft.jsch.ChannelExec.init(), com.jcraft.jsch.ChannelDirectTCPIP.init(), com.jcraft.jsch.ChannelX11.run(), com.jcraft.jsch.ChannelSession.run(), com.jcraft.jsch.ChannelForwardedTCPIP.run(), com.jcraft.jsch.ChannelDirectTCPIP.run(), com.jcraft.jsch.ChannelDirectTCPIP.setInputStream(), com.jcraft.jsch.ChannelDirectTCPIP.setOutputStream(), com.jcraft.jsch.ChannelSubsystem.start(), com.jcraft.jsch.ChannelShell.start(), com.jcraft.jsch.ChannelExec.start(), and com.jcraft.jsch.ChannelX11.write().
volatile int com.jcraft.jsch.Channel.lmpsize = 0x4000 [package, inherited] |
Definition at line 127 of file Channel.java.
Referenced by com.jcraft.jsch.ChannelDirectTCPIP.connect().
volatile int com.jcraft.jsch.Channel.lwsize = lwsize_max [package, inherited] |
Definition at line 126 of file Channel.java.
Referenced by com.jcraft.jsch.ChannelDirectTCPIP.connect().
volatile int com.jcraft.jsch.Channel.lwsize_max = 0x100000 [package, inherited] |
Definition at line 125 of file Channel.java.
int com.jcraft.jsch.Channel.notifyme = 0 [package, inherited] |
Definition at line 149 of file Channel.java.
Referenced by com.jcraft.jsch.ChannelDirectTCPIP.connect(), and com.jcraft.jsch.Channel.setRecipient().
volatile boolean com.jcraft.jsch.Channel.open_confirmation = false [package, inherited] |
Definition at line 140 of file Channel.java.
Referenced by com.jcraft.jsch.ChannelDirectTCPIP.connect().
boolean com.jcraft.jsch.ChannelSession.pty = false [protected, inherited] |
Reimplemented in com.jcraft.jsch.ChannelSubsystem.
Definition at line 47 of file ChannelSession.java.
Referenced by com.jcraft.jsch.ChannelShell.ChannelShell(), com.jcraft.jsch.ChannelSession.sendRequests(), com.jcraft.jsch.ChannelSession.setPty(), and com.jcraft.jsch.ChannelSession.setPtySize().
volatile int com.jcraft.jsch.Channel.recipient = -1 [package, inherited] |
Definition at line 123 of file Channel.java.
Referenced by com.jcraft.jsch.Channel.getRecipient(), com.jcraft.jsch.ChannelX11.run(), com.jcraft.jsch.ChannelSession.run(), com.jcraft.jsch.ChannelForwardedTCPIP.run(), com.jcraft.jsch.ChannelDirectTCPIP.run(), com.jcraft.jsch.ChannelAgentForwarding.send(), and com.jcraft.jsch.Channel.setRecipient().
volatile int com.jcraft.jsch.Channel.reply = 0 [package, inherited] |
Definition at line 144 of file Channel.java.
Referenced by com.jcraft.jsch.Request.write().
volatile int com.jcraft.jsch.Channel.rmpsize = 0 [package, inherited] |
Definition at line 130 of file Channel.java.
Referenced by com.jcraft.jsch.ChannelX11.run(), com.jcraft.jsch.ChannelSession.run(), com.jcraft.jsch.ChannelForwardedTCPIP.run(), com.jcraft.jsch.ChannelDirectTCPIP.run(), and com.jcraft.jsch.ChannelAgentForwarding.write().
volatile long com.jcraft.jsch.Channel.rwsize = 0 [package, inherited] |
Definition at line 129 of file Channel.java.
final int com.jcraft.jsch.Channel.SSH_MSG_CHANNEL_OPEN_CONFIRMATION = 91 [static, package, inherited] |
Definition at line 51 of file Channel.java.
final int com.jcraft.jsch.Channel.SSH_MSG_CHANNEL_OPEN_FAILURE = 92 [static, package, inherited] |
Definition at line 52 of file Channel.java.
final int com.jcraft.jsch.Channel.SSH_MSG_CHANNEL_WINDOW_ADJUST = 93 [static, package, inherited] |
Definition at line 53 of file Channel.java.
final int com.jcraft.jsch.Channel.SSH_OPEN_ADMINISTRATIVELY_PROHIBITED = 1 [static, package, inherited] |
Definition at line 55 of file Channel.java.
Referenced by com.jcraft.jsch.ChannelX11.run(), and com.jcraft.jsch.ChannelForwardedTCPIP.run().
final int com.jcraft.jsch.Channel.SSH_OPEN_CONNECT_FAILED = 2 [static, package, inherited] |
Definition at line 56 of file Channel.java.
final int com.jcraft.jsch.Channel.SSH_OPEN_RESOURCE_SHORTAGE = 4 [static, package, inherited] |
Definition at line 58 of file Channel.java.
final int com.jcraft.jsch.Channel.SSH_OPEN_UNKNOWN_CHANNEL_TYPE = 3 [static, package, inherited] |
Definition at line 57 of file Channel.java.
int com.jcraft.jsch.ChannelSession.tcol = 80 [protected, inherited] |
Definition at line 50 of file ChannelSession.java.
Referenced by com.jcraft.jsch.ChannelSession.sendRequests(), and com.jcraft.jsch.ChannelSession.setPtyType().
byte [] com.jcraft.jsch.ChannelSession.terminal_mode = null [protected, inherited] |
Definition at line 54 of file ChannelSession.java.
Referenced by com.jcraft.jsch.ChannelSession.sendRequests().
int com.jcraft.jsch.ChannelSession.thp = 480 [protected, inherited] |
Definition at line 53 of file ChannelSession.java.
Referenced by com.jcraft.jsch.ChannelSession.sendRequests(), and com.jcraft.jsch.ChannelSession.setPtyType().
Thread com.jcraft.jsch.Channel.thread = null [package, inherited] |
Definition at line 133 of file Channel.java.
Referenced by com.jcraft.jsch.ChannelDirectTCPIP.connect(), com.jcraft.jsch.ChannelX11.run(), com.jcraft.jsch.ChannelSession.run(), com.jcraft.jsch.ChannelForwardedTCPIP.run(), com.jcraft.jsch.ChannelDirectTCPIP.run(), com.jcraft.jsch.ChannelSubsystem.start(), com.jcraft.jsch.ChannelShell.start(), com.jcraft.jsch.ChannelExec.start(), and com.jcraft.jsch.ChannelX11.write().
int com.jcraft.jsch.ChannelSession.trow = 24 [protected, inherited] |
Definition at line 51 of file ChannelSession.java.
Referenced by com.jcraft.jsch.ChannelSession.sendRequests(), and com.jcraft.jsch.ChannelSession.setPtyType().
String com.jcraft.jsch.ChannelSession.ttype = "vt100" [protected, inherited] |
Definition at line 49 of file ChannelSession.java.
Referenced by com.jcraft.jsch.ChannelSession.sendRequests(), and com.jcraft.jsch.ChannelSession.setPtySize().
int com.jcraft.jsch.ChannelSession.twp = 640 [protected, inherited] |
Definition at line 52 of file ChannelSession.java.
Referenced by com.jcraft.jsch.ChannelSession.sendRequests(), and com.jcraft.jsch.ChannelSession.setPtyType().
byte [] com.jcraft.jsch.Channel.type = Util.str2byte("foo") [protected, inherited] |
Definition at line 124 of file Channel.java.
Referenced by com.jcraft.jsch.ChannelAgentForwarding.ChannelAgentForwarding(), com.jcraft.jsch.ChannelSession.ChannelSession(), and com.jcraft.jsch.ChannelX11.ChannelX11().
boolean com.jcraft.jsch.ChannelSession.xforwading = false [protected, inherited] |
Reimplemented in com.jcraft.jsch.ChannelSubsystem.
Definition at line 44 of file ChannelSession.java.
Referenced by com.jcraft.jsch.ChannelSession.sendRequests(), and com.jcraft.jsch.ChannelSession.setXForwarding().