public class ChannelManager extends java.lang.Object implements MessageHandler
Besides the crypto part, this is the core of the library.
| Modifier and Type | Field and Description |
|---|---|
private java.util.Vector |
channels |
private int |
globalFailedCounter |
private int |
globalSuccessCounter |
private java.util.Vector |
listenerThreads |
private boolean |
listenerThreadsAllowed |
private static Logger |
log |
private int |
nextLocalChannel |
private java.util.HashMap |
remoteForwardings |
private boolean |
shutdown |
(package private) TransportManager |
tm |
private java.util.HashMap |
x11_magic_cookies |
| Constructor and Description |
|---|
ChannelManager(TransportManager tm) |
| Modifier and Type | Method and Description |
|---|---|
private int |
addChannel(Channel c) |
X11ServerData |
checkX11Cookie(java.lang.String hexFakeCookie) |
void |
closeAllChannels() |
void |
closeChannel(Channel c,
java.lang.String reason,
boolean force) |
int |
getAvailable(Channel c,
boolean extended) |
private Channel |
getChannel(int id) |
int |
getChannelData(Channel c,
boolean extended,
byte[] target,
int off,
int len) |
void |
handleEndMessage(java.lang.Throwable cause)
Called to inform that no more messages will be delivered.
|
void |
handleMessage(byte[] msg,
int msglen) |
private java.io.IOException |
ioException(java.lang.String msg,
Channel c) |
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(java.lang.String host_to_connect,
int port_to_connect,
java.lang.String originator_IP_address,
int originator_port) |
Channel |
openSessionChannel() |
void |
registerThread(IChannelWorkerThread thr) |
void |
registerX11Cookie(java.lang.String hexFakeCookie,
X11ServerData data) |
private void |
removeChannel(int id) |
void |
requestCancelGlobalForward(int bindPort) |
void |
requestChannelTrileadPing(Channel c) |
void |
requestExecCommand(Channel c,
java.lang.String cmd) |
int |
requestGlobalForward(java.lang.String bindAddress,
int bindPort,
java.lang.String targetAddress,
int targetPort) |
void |
requestGlobalTrileadPing() |
void |
requestPTY(Channel c,
java.lang.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,
java.lang.String subSystemName) |
void |
requestX11(Channel c,
boolean singleConnection,
java.lang.String x11AuthenticationProtocol,
java.lang.String x11AuthenticationCookie,
int x11ScreenNumber) |
void |
sendData(Channel c,
byte[] buffer,
int pos,
int len) |
void |
sendEOF(Channel c) |
void |
sendOpenConfirmation(Channel c) |
void |
unRegisterX11Cookie(java.lang.String hexFakeCookie,
boolean killChannels) |
private boolean |
waitForChannelRequestResult(Channel c) |
int |
waitForCondition(Channel c,
long timeout,
int condition_mask)
Wait until for a condition.
|
private boolean |
waitForGlobalRequestResult() |
private void |
waitUntilChannelOpen(Channel c) |
private static final Logger log
private java.util.HashMap x11_magic_cookies
TransportManager tm
private java.util.Vector channels
private int nextLocalChannel
private boolean shutdown
private int globalSuccessCounter
private int globalFailedCounter
private java.util.HashMap remoteForwardings
private java.util.Vector listenerThreads
private boolean listenerThreadsAllowed
public ChannelManager(TransportManager tm)
private Channel getChannel(int id)
private void removeChannel(int id)
private int addChannel(Channel c)
private void waitUntilChannelOpen(Channel c) throws java.io.IOException
java.io.IOExceptionprivate final boolean waitForGlobalRequestResult()
throws java.io.IOException
java.io.IOExceptionprivate final boolean waitForChannelRequestResult(Channel c) throws java.io.IOException
java.io.IOExceptionpublic void registerX11Cookie(java.lang.String hexFakeCookie,
X11ServerData data)
public void unRegisterX11Cookie(java.lang.String hexFakeCookie,
boolean killChannels)
public X11ServerData checkX11Cookie(java.lang.String hexFakeCookie)
public void closeAllChannels()
public void closeChannel(Channel c, java.lang.String reason, boolean force) throws java.io.IOException
java.io.IOExceptionpublic void sendEOF(Channel c) throws java.io.IOException
java.io.IOExceptionpublic void sendOpenConfirmation(Channel c) throws java.io.IOException
java.io.IOExceptionpublic void sendData(Channel c, byte[] buffer, int pos, int len) throws java.io.IOException
java.io.IOExceptionpublic int requestGlobalForward(java.lang.String bindAddress,
int bindPort,
java.lang.String targetAddress,
int targetPort)
throws java.io.IOException
java.io.IOExceptionpublic void requestCancelGlobalForward(int bindPort)
throws java.io.IOException
java.io.IOExceptionpublic void registerThread(IChannelWorkerThread thr) throws java.io.IOException
java.io.IOExceptionpublic Channel openDirectTCPIPChannel(java.lang.String host_to_connect, int port_to_connect, java.lang.String originator_IP_address, int originator_port) throws java.io.IOException
java.io.IOExceptionpublic Channel openSessionChannel() throws java.io.IOException
java.io.IOExceptionpublic void requestGlobalTrileadPing()
throws java.io.IOException
java.io.IOExceptionpublic void requestChannelTrileadPing(Channel c) throws java.io.IOException
java.io.IOExceptionpublic void requestPTY(Channel c, java.lang.String term, int term_width_characters, int term_height_characters, int term_width_pixels, int term_height_pixels, byte[] terminal_modes) throws java.io.IOException
java.io.IOExceptionpublic void requestX11(Channel c, boolean singleConnection, java.lang.String x11AuthenticationProtocol, java.lang.String x11AuthenticationCookie, int x11ScreenNumber) throws java.io.IOException
java.io.IOExceptionpublic void requestSubSystem(Channel c, java.lang.String subSystemName) throws java.io.IOException
java.io.IOExceptionpublic void requestExecCommand(Channel c, java.lang.String cmd) throws java.io.IOException
java.io.IOExceptionpublic void requestShell(Channel c) throws java.io.IOException
java.io.IOExceptionpublic void msgChannelExtendedData(byte[] msg,
int msglen)
throws java.io.IOException
java.io.IOExceptionpublic int waitForCondition(Channel c, long timeout, int condition_mask) throws java.lang.InterruptedException
c - Channeltimeout - in ms, 0 means no timeout.condition_mask - minimum event maskjava.lang.InterruptedExceptionpublic int getAvailable(Channel c, boolean extended) throws java.io.IOException
java.io.IOExceptionpublic int getChannelData(Channel c, boolean extended, byte[] target, int off, int len) throws java.io.IOException
java.io.IOExceptionpublic void msgChannelData(byte[] msg,
int msglen)
throws java.io.IOException
java.io.IOExceptionpublic void msgChannelWindowAdjust(byte[] msg,
int msglen)
throws java.io.IOException
java.io.IOExceptionpublic void msgChannelOpen(byte[] msg,
int msglen)
throws java.io.IOException
java.io.IOExceptionpublic void msgChannelRequest(byte[] msg,
int msglen)
throws java.io.IOException
java.io.IOExceptionpublic void msgChannelEOF(byte[] msg,
int msglen)
throws java.io.IOException
java.io.IOExceptionpublic void msgChannelClose(byte[] msg,
int msglen)
throws java.io.IOException
java.io.IOExceptionpublic void msgChannelSuccess(byte[] msg,
int msglen)
throws java.io.IOException
java.io.IOExceptionpublic void msgChannelFailure(byte[] msg,
int msglen)
throws java.io.IOException
java.io.IOExceptionpublic void msgChannelOpenConfirmation(byte[] msg,
int msglen)
throws java.io.IOException
java.io.IOExceptionpublic void msgChannelOpenFailure(byte[] msg,
int msglen)
throws java.io.IOException
java.io.IOExceptionpublic void msgGlobalRequest(byte[] msg,
int msglen)
throws java.io.IOException
java.io.IOExceptionpublic void msgGlobalSuccess()
throws java.io.IOException
java.io.IOExceptionpublic void msgGlobalFailure()
throws java.io.IOException
java.io.IOExceptionpublic void handleMessage(byte[] msg,
int msglen)
throws java.io.IOException
handleMessage in interface MessageHandlerjava.io.IOExceptionpublic void handleEndMessage(java.lang.Throwable cause)
throws java.io.IOException
MessageHandlerhandleEndMessage in interface MessageHandlercause - For diagnosis, the reason that caused the transport to close down.java.io.IOExceptionprivate java.io.IOException ioException(java.lang.String msg,
Channel c)