public class

ChannelManager

extends Object
implements MessageHandler
java.lang.Object
   ↳ com.trilead.ssh2.channel.ChannelManager

Class Overview

ChannelManager. Please read the comments in Channel.java.

Besides the crypto part, this is the core of the library.

Summary

Fields
private Vector channels
private int globalFailedCounter
private int globalSuccessCounter
private Vector listenerThreads
private boolean listenerThreadsAllowed
private static final Logger log
private int nextLocalChannel
private HashMap remoteForwardings
private boolean shutdown
private GenericTransportManager tm
private HashMap x11_magic_cookies
Public Constructors
ChannelManager(GenericTransportManager tm)
Public Methods
X11ServerData checkX11Cookie(String hexFakeCookie)
void closeAllChannels()
void closeChannel(Channel c, String reason, boolean force)
int getAvailable(Channel c, boolean extended)
int getChannelData(Channel c, boolean extended, byte[] target, int off, int len)
void handleMessage(byte[] msg, int msglen)
void msgChannelClose(byte[] msg, int msglen)
void msgChannelData(byte[] msg, int msglen)
void msgChannelEOF(byte[] msg, int msglen)
void msgChannelExtendedData(byte[] msg, int msglen)
void msgChannelFailure(byte[] msg, int msglen)
void msgChannelOpen(byte[] msg, int msglen)
void msgChannelOpenConfirmation(byte[] msg, int msglen)
void msgChannelOpenFailure(byte[] msg, int msglen)
void msgChannelRequest(byte[] msg, int msglen)
void msgChannelSuccess(byte[] msg, int msglen)
void msgChannelWindowAdjust(byte[] msg, int msglen)
void msgGlobalFailure()
void msgGlobalRequest(byte[] msg, int msglen)
void msgGlobalSuccess()
Channel openDirectTCPIPChannel(String host_to_connect, int port_to_connect, String originator_IP_address, int originator_port)
Channel openSessionChannel()
void registerThread(IChannelWorkerThread thr)
void registerX11Cookie(String hexFakeCookie, X11ServerData data)
void requestCancelGlobalForward(int bindPort)
void requestChannelTrileadPing(Channel c)
void requestExecCommand(Channel c, String cmd)
int requestGlobalForward(String bindAddress, int bindPort, String targetAddress, int targetPort)
void requestGlobalTrileadPing()
void requestPTY(Channel c, String term, int term_width_characters, int term_height_characters, int term_width_pixels, int term_height_pixels, byte[] terminal_modes)
void requestShell(Channel c)
void requestSubSystem(Channel c, String subSystemName)
void requestWindowSizeChange(Channel c, int term_width_characters, int term_height_characters, int term_width_pixels, int term_height_pixels)
void requestX11(Channel c, boolean singleConnection, String x11AuthenticationProtocol, String x11AuthenticationCookie, int x11ScreenNumber)
void sendData(Channel c, byte[] buffer, int pos, int len)
void sendEOF(Channel c)
void sendOpenConfirmation(Channel c)
void unRegisterX11Cookie(String hexFakeCookie, boolean killChannels)
int waitForCondition(Channel c, long timeout, int condition_mask)
Wait until for a condition.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.trilead.ssh2.transport.MessageHandler

Fields

private Vector channels

private int globalFailedCounter

private int globalSuccessCounter

private Vector listenerThreads

private boolean listenerThreadsAllowed

private static final Logger log

private int nextLocalChannel

private HashMap remoteForwardings

private boolean shutdown

private HashMap x11_magic_cookies

Public Constructors

public ChannelManager (GenericTransportManager tm)

Parameters
tm

Public Methods

public X11ServerData checkX11Cookie (String hexFakeCookie)

Parameters
hexFakeCookie

public void closeAllChannels ()

public void closeChannel (Channel c, String reason, boolean force)

Parameters
c
reason
force
Throws
IOException

public int getAvailable (Channel c, boolean extended)

Parameters
c
extended
Throws
IOException

public int getChannelData (Channel c, boolean extended, byte[] target, int off, int len)

Parameters
c
extended
target
off
len
Throws
IOException

public void handleMessage (byte[] msg, int msglen)

Parameters
msg
msglen
Throws
IOException

public void msgChannelClose (byte[] msg, int msglen)

Parameters
msg
msglen
Throws
IOException

public void msgChannelData (byte[] msg, int msglen)

Parameters
msg
msglen
Throws
IOException

public void msgChannelEOF (byte[] msg, int msglen)

Parameters
msg
msglen
Throws
IOException

public void msgChannelExtendedData (byte[] msg, int msglen)

Parameters
msg
msglen
Throws
IOException

public void msgChannelFailure (byte[] msg, int msglen)

Parameters
msg
msglen
Throws
IOException

public void msgChannelOpen (byte[] msg, int msglen)

Parameters
msg
msglen
Throws
IOException

public void msgChannelOpenConfirmation (byte[] msg, int msglen)

Parameters
msg
msglen
Throws
IOException

public void msgChannelOpenFailure (byte[] msg, int msglen)

Parameters
msg
msglen
Throws
IOException

public void msgChannelRequest (byte[] msg, int msglen)

Parameters
msg
msglen
Throws
IOException

public void msgChannelSuccess (byte[] msg, int msglen)

Parameters
msg
msglen
Throws
IOException

public void msgChannelWindowAdjust (byte[] msg, int msglen)

Parameters
msg
msglen
Throws
IOException

public void msgGlobalFailure ()

Throws
IOException

public void msgGlobalRequest (byte[] msg, int msglen)

Parameters
msg
msglen
Throws
IOException

public void msgGlobalSuccess ()

Throws
IOException

public Channel openDirectTCPIPChannel (String host_to_connect, int port_to_connect, String originator_IP_address, int originator_port)

Parameters
host_to_connect
port_to_connect
originator_IP_address
originator_port
Throws
IOException

public Channel openSessionChannel ()

Throws
IOException

public void registerThread (IChannelWorkerThread thr)

Parameters
thr
Throws
IOException

public void registerX11Cookie (String hexFakeCookie, X11ServerData data)

Parameters
hexFakeCookie
data

public void requestCancelGlobalForward (int bindPort)

Parameters
bindPort
Throws
IOException

public void requestChannelTrileadPing (Channel c)

Parameters
c
Throws
IOException

public void requestExecCommand (Channel c, String cmd)

Parameters
c
cmd
Throws
IOException

public int requestGlobalForward (String bindAddress, int bindPort, String targetAddress, int targetPort)

Parameters
bindAddress
bindPort
targetAddress
targetPort
Throws
IOException

public void requestGlobalTrileadPing ()

Throws
IOException

public void requestPTY (Channel c, String term, int term_width_characters, int term_height_characters, int term_width_pixels, int term_height_pixels, byte[] terminal_modes)

Parameters
c
term
term_width_characters
term_height_characters
term_width_pixels
term_height_pixels
terminal_modes
Throws
IOException

public void requestShell (Channel c)

Parameters
c
Throws
IOException

public void requestSubSystem (Channel c, String subSystemName)

Parameters
c
subSystemName
Throws
IOException

public void requestWindowSizeChange (Channel c, int term_width_characters, int term_height_characters, int term_width_pixels, int term_height_pixels)

Parameters
c
term_width_characters
term_height_characters
term_width_pixels
term_height_pixels
Throws
IOException

public void requestX11 (Channel c, boolean singleConnection, String x11AuthenticationProtocol, String x11AuthenticationCookie, int x11ScreenNumber)

Parameters
c
singleConnection
x11AuthenticationProtocol
x11AuthenticationCookie
x11ScreenNumber
Throws
IOException

public void sendData (Channel c, byte[] buffer, int pos, int len)

Parameters
c
buffer
pos
len
Throws
IOException

public void sendEOF (Channel c)

Parameters
c
Throws
IOException

public void sendOpenConfirmation (Channel c)

Parameters
c
Throws
IOException

public void unRegisterX11Cookie (String hexFakeCookie, boolean killChannels)

Parameters
hexFakeCookie
killChannels

public int waitForCondition (Channel c, long timeout, int condition_mask)

Wait until for a condition.

Parameters
c Channel
timeout In ms, 0 means no timeout.
condition_mask Minimum event mask
Returns
  • all current events