com.mindbright.ssh2
public interface SSH2ConnectionEventHandler
SSH2Connection
to get info on the progress and status of all
forwards and resulting channels through the connection.
All callback methods which indicates channel open confirmation or channel
open failure uses the naming convention that when it begins with "local"
(e.g. localDirectConnect
) it is coupled to a channel originating
locally and conversly when it begins with "remote"
(e.g. remoteForwardedConnect
) it is coupled to a channel
originating remotely. The naming of the channel types in the connection
protocol specification is used to identify whether a channel is a local
forward or a remote forward. This means that local forwards are called
"direct" and remote forwards are called "forwarded". This naming can be
somewhat confusing for example the method localForwardedConnect
might be the one might expect to be called when a local forward channel is
confirmed to be open, instead the call is
localDirectConnect
. The reason for this is to have a symmetrical
naming for all callbacks which are valid on both client and server side,
hence check each callback and see if it applies to youe need (i.e. client or
server).
Modifier and Type | Method and Description |
---|---|
void |
channelAdded(SSH2Connection connection,
SSH2Channel channel)
Called when a new channel is added.
|
void |
channelClosed(SSH2Connection connection,
SSH2Channel channel)
Called when a channel is closed.
|
void |
channelConnect(java.lang.Object originator,
SSH2Channel channel,
java.net.Socket fwdSocket)
Called when a channel is connected to a
Socket . |
void |
channelDeleted(SSH2Connection connection,
SSH2Channel channel)
Called when a channel is deleted.
|
boolean |
listenerAccept(SSH2Listener listener,
java.net.Socket fwdSocket)
Called when a listener accepts a new connection.
|
void |
localChannelOpenFailure(SSH2Connection connection,
SSH2Channel channel,
int reasonCode,
java.lang.String reasonText,
java.lang.String languageTag)
Called on either side when a locally originating channel gets a channel
open failure indication from peer.
|
void |
localDirectConnect(SSH2Connection connection,
SSH2Listener listener,
SSH2Channel channel)
Called on the client side when a local forward channel is confirmed to
be open.
|
void |
localForwardedConnect(SSH2Connection connection,
SSH2Listener listener,
SSH2Channel channel)
Called on the server side when a remote forward channel is confirmed to
be open.
|
void |
localSessionConnect(SSH2Connection connection,
SSH2Channel channel)
Called on the client side when a session channel is confirmed to be open.
|
void |
localX11Connect(SSH2Connection connection,
SSH2Listener listener,
SSH2Channel channel)
Called on the server side when an X11 channel is confirmed to be open.
|
void |
remoteChannelOpenFailure(SSH2Connection connection,
java.lang.String channelType,
java.lang.String targetAddr,
int targetPort,
java.lang.String originAddr,
int originPort,
SSH2Exception cause)
Called on either side when there is a problem opening a remotely
originating channel resulting in a channel open failure indication beeing
sent back to peer.
|
void |
remoteDirectConnect(SSH2Connection connection,
SSH2Channel channel)
Called on the client side when a remote direct channel has been
confirmed to be open.
|
void |
remoteForwardedConnect(SSH2Connection connection,
java.lang.String remoteAddr,
int remotePort,
SSH2Channel channel)
Called on the client side when a remote forward channel has been
confirmed to be open.
|
void |
remoteSessionConnect(SSH2Connection connection,
java.lang.String remoteAddr,
int remotePort,
SSH2Channel channel)
Called on the client side when a remote session channel has been
confirmed to be open.
|
void |
remoteX11Connect(SSH2Connection connection,
SSH2Channel channel)
Called on the client side when a remote X11 channel has been
confirmed to be open.
|
void |
setSocketOptions(int channelType,
java.net.Socket s)
Called to set socket options on newly connected port forward channels
|
void channelAdded(SSH2Connection connection, SSH2Channel channel)
connection
- the connection layer responsiblechannel
- the channel which was addedvoid channelDeleted(SSH2Connection connection, SSH2Channel channel)
connection
- the connection layer responsiblechannel
- the channel which was deletedvoid channelConnect(java.lang.Object originator, SSH2Channel channel, java.net.Socket fwdSocket)
Socket
.originator
- the responsible listener/connectorchannel
- the created channelfwdSocket
- the socket which is connected tovoid channelClosed(SSH2Connection connection, SSH2Channel channel)
connection
- the connection layer responsiblechannel
- the channel which was deletedboolean listenerAccept(SSH2Listener listener, java.net.Socket fwdSocket)
true
or
false
.listener
- the responsible listenerfwdSocket
- the socket which resultedboolean
indicating wether to process connection or
not.void localForwardedConnect(SSH2Connection connection, SSH2Listener listener, SSH2Channel channel)
connection
- the connection layer responsiblelistener
- the responsible listenerchannel
- the channel which was openedvoid localDirectConnect(SSH2Connection connection, SSH2Listener listener, SSH2Channel channel)
connection
- the connection layer responsiblelistener
- the responsible listenerchannel
- the channel which was openedvoid localSessionConnect(SSH2Connection connection, SSH2Channel channel)
connection
- the connection layer responsiblechannel
- the channel which was openedvoid localX11Connect(SSH2Connection connection, SSH2Listener listener, SSH2Channel channel)
connection
- the connection layer responsiblelistener
- the responsible listenerchannel
- the channel which was openedvoid localChannelOpenFailure(SSH2Connection connection, SSH2Channel channel, int reasonCode, java.lang.String reasonText, java.lang.String languageTag)
SSH2
for
reason codes.connection
- the connection layer responsiblechannel
- the channel which was openedreasonCode
- the reason codereasonText
- languageTag
- SSH2
void remoteForwardedConnect(SSH2Connection connection, java.lang.String remoteAddr, int remotePort, SSH2Channel channel)
connection
- the connection layer responsibleremoteAddr
- remotePort
- channel
- the channel which was openedvoid remoteDirectConnect(SSH2Connection connection, SSH2Channel channel)
connection
- the connection layer responsiblechannel
- the channel which was openedvoid remoteSessionConnect(SSH2Connection connection, java.lang.String remoteAddr, int remotePort, SSH2Channel channel)
connection
- the connection layer responsibleremoteAddr
- remotePort
- channel
- the channel which was openedvoid remoteX11Connect(SSH2Connection connection, SSH2Channel channel)
connection
- the connection layer responsiblechannel
- the channel which was openedvoid remoteChannelOpenFailure(SSH2Connection connection, java.lang.String channelType, java.lang.String targetAddr, int targetPort, java.lang.String originAddr, int originPort, SSH2Exception cause)
connection
- the connection layer responsiblechannelType
- the type of channeltargetAddr
- the address which should have been connected totargetPort
- the port which should have been connected tooriginAddr
- the address where the channel originated (depends on type)originPort
- the port where the channel originated (depends on type)cause
- the exception which was the cause of the problemvoid setSocketOptions(int channelType, java.net.Socket s)
channelType
- the type of the channels
- socket to manipulate