Package com.trilead.ssh2.channel
Class ChannelManager
- java.lang.Object
-
- com.trilead.ssh2.channel.ChannelManager
-
- All Implemented Interfaces:
MessageHandler
public class ChannelManager extends Object implements MessageHandler
ChannelManager. Please read the comments in Channel.java.Besides the crypto part, this is the core of the library.
- Version:
- $Id: ChannelManager.java,v 1.2 2008/03/03 07:01:36 cplattne Exp $
- Author:
- Christian Plattner, plattner@trilead.com
-
-
Constructor Summary
Constructors Constructor Description ChannelManager(TransportManager tm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description X11ServerDatacheckX11Cookie(String hexFakeCookie)voidcloseAllChannels()voidcloseChannel(Channel c, String reason, boolean force)intgetAvailable(Channel c, boolean extended)intgetChannelData(Channel c, boolean extended, byte[] target, int off, int len)voidhandleEndMessage(Throwable cause)Called to inform that no more messages will be delivered.voidhandleMessage(byte[] msg, int msglen)Handle message.voidmsgChannelClose(byte[] msg, int msglen)voidmsgChannelData(byte[] msg, int msglen)voidmsgChannelEOF(byte[] msg, int msglen)voidmsgChannelExtendedData(byte[] msg, int msglen)voidmsgChannelFailure(byte[] msg, int msglen)voidmsgChannelOpen(byte[] msg, int msglen)voidmsgChannelOpenConfirmation(byte[] msg, int msglen)voidmsgChannelOpenFailure(byte[] msg, int msglen)voidmsgChannelRequest(byte[] msg, int msglen)voidmsgChannelSuccess(byte[] msg, int msglen)voidmsgChannelWindowAdjust(byte[] msg, int msglen)voidmsgGlobalFailure()voidmsgGlobalRequest(byte[] msg, int msglen)voidmsgGlobalSuccess()ChannelopenDirectTCPIPChannel(String host_to_connect, int port_to_connect, String originator_IP_address, int originator_port)ChannelopenSessionChannel()voidregisterThread(com.trilead.ssh2.channel.IChannelWorkerThread thr)voidregisterX11Cookie(String hexFakeCookie, X11ServerData data)voidrequestCancelGlobalForward(int bindPort)voidrequestChannelTrileadPing(Channel c)voidrequestExecCommand(Channel c, String cmd)intrequestGlobalForward(String bindAddress, int bindPort, String targetAddress, int targetPort)voidrequestGlobalTrileadPing()voidrequestPTY(Channel c, String term, int term_width_characters, int term_height_characters, int term_width_pixels, int term_height_pixels, byte[] terminal_modes)voidrequestShell(Channel c)voidrequestSubSystem(Channel c, String subSystemName)voidrequestX11(Channel c, boolean singleConnection, String x11AuthenticationProtocol, String x11AuthenticationCookie, int x11ScreenNumber)voidsendData(Channel c, byte[] buffer, int pos, int len)voidsendEOF(Channel c)voidsendOpenConfirmation(Channel c)voidunRegisterX11Cookie(String hexFakeCookie, boolean killChannels)intwaitForCondition(Channel c, long timeout, int condition_mask)Wait until for a condition.
-
-
-
Constructor Detail
-
ChannelManager
public ChannelManager(TransportManager tm)
-
-
Method Detail
-
registerX11Cookie
public void registerX11Cookie(String hexFakeCookie, X11ServerData data)
-
unRegisterX11Cookie
public void unRegisterX11Cookie(String hexFakeCookie, boolean killChannels)
-
checkX11Cookie
public X11ServerData checkX11Cookie(String hexFakeCookie)
-
closeAllChannels
public void closeAllChannels()
-
closeChannel
public void closeChannel(Channel c, String reason, boolean force) throws IOException
- Throws:
IOException
-
sendEOF
public void sendEOF(Channel c) throws IOException
- Throws:
IOException
-
sendOpenConfirmation
public void sendOpenConfirmation(Channel c) throws IOException
- Throws:
IOException
-
sendData
public void sendData(Channel c, byte[] buffer, int pos, int len) throws IOException
- Throws:
IOException
-
requestGlobalForward
public int requestGlobalForward(String bindAddress, int bindPort, String targetAddress, int targetPort) throws IOException
- Throws:
IOException
-
requestCancelGlobalForward
public void requestCancelGlobalForward(int bindPort) throws IOException- Throws:
IOException
-
registerThread
public void registerThread(com.trilead.ssh2.channel.IChannelWorkerThread thr) throws IOException- Throws:
IOException
-
openDirectTCPIPChannel
public Channel openDirectTCPIPChannel(String host_to_connect, int port_to_connect, String originator_IP_address, int originator_port) throws IOException
- Throws:
IOException
-
openSessionChannel
public Channel openSessionChannel() throws IOException
- Throws:
IOException
-
requestGlobalTrileadPing
public void requestGlobalTrileadPing() throws IOException- Throws:
IOException
-
requestChannelTrileadPing
public void requestChannelTrileadPing(Channel c) throws IOException
- Throws:
IOException
-
requestPTY
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) throws IOException
- Throws:
IOException
-
requestX11
public void requestX11(Channel c, boolean singleConnection, String x11AuthenticationProtocol, String x11AuthenticationCookie, int x11ScreenNumber) throws IOException
- Throws:
IOException
-
requestSubSystem
public void requestSubSystem(Channel c, String subSystemName) throws IOException
- Throws:
IOException
-
requestExecCommand
public void requestExecCommand(Channel c, String cmd) throws IOException
- Throws:
IOException
-
requestShell
public void requestShell(Channel c) throws IOException
- Throws:
IOException
-
msgChannelExtendedData
public void msgChannelExtendedData(byte[] msg, int msglen) throws IOException- Throws:
IOException
-
waitForCondition
public int waitForCondition(Channel c, long timeout, int condition_mask) throws InterruptedException
Wait until for a condition.- Parameters:
c- Channeltimeout- in ms, 0 means no timeout.condition_mask- minimum event mask- Returns:
- all current events
- Throws:
InterruptedException- the interrupted exception
-
getAvailable
public int getAvailable(Channel c, boolean extended) throws IOException
- Throws:
IOException
-
getChannelData
public int getChannelData(Channel c, boolean extended, byte[] target, int off, int len) throws IOException
- Throws:
IOException
-
msgChannelData
public void msgChannelData(byte[] msg, int msglen) throws IOException- Throws:
IOException
-
msgChannelWindowAdjust
public void msgChannelWindowAdjust(byte[] msg, int msglen) throws IOException- Throws:
IOException
-
msgChannelOpen
public void msgChannelOpen(byte[] msg, int msglen) throws IOException- Throws:
IOException
-
msgChannelRequest
public void msgChannelRequest(byte[] msg, int msglen) throws IOException- Throws:
IOException
-
msgChannelEOF
public void msgChannelEOF(byte[] msg, int msglen) throws IOException- Throws:
IOException
-
msgChannelClose
public void msgChannelClose(byte[] msg, int msglen) throws IOException- Throws:
IOException
-
msgChannelSuccess
public void msgChannelSuccess(byte[] msg, int msglen) throws IOException- Throws:
IOException
-
msgChannelFailure
public void msgChannelFailure(byte[] msg, int msglen) throws IOException- Throws:
IOException
-
msgChannelOpenConfirmation
public void msgChannelOpenConfirmation(byte[] msg, int msglen) throws IOException- Throws:
IOException
-
msgChannelOpenFailure
public void msgChannelOpenFailure(byte[] msg, int msglen) throws IOException- Throws:
IOException
-
msgGlobalRequest
public void msgGlobalRequest(byte[] msg, int msglen) throws IOException- Throws:
IOException
-
msgGlobalSuccess
public void msgGlobalSuccess() throws IOException- Throws:
IOException
-
msgGlobalFailure
public void msgGlobalFailure() throws IOException- Throws:
IOException
-
handleMessage
public void handleMessage(byte[] msg, int msglen) throws IOExceptionDescription copied from interface:MessageHandlerHandle message.- Specified by:
handleMessagein interfaceMessageHandler- Parameters:
msg- the msgmsglen- the msglen- Throws:
IOException- the io exception
-
handleEndMessage
public void handleEndMessage(Throwable cause) throws IOException
Description copied from interface:MessageHandlerCalled to inform that no more messages will be delivered.- Specified by:
handleEndMessagein interfaceMessageHandler- Parameters:
cause- For diagnosis, the reason that caused the transport to close down.- Throws:
IOException- the io exception
-
-