Class RemotePortForwarder
java.lang.Object
net.schmizz.sshj.connection.channel.forwarded.AbstractForwardedChannelOpener
net.schmizz.sshj.connection.channel.forwarded.RemotePortForwarder
- All Implemented Interfaces:
ForwardedChannelOpener
Handles remote port forwarding.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Represents a particular forwarding.static class
Aforwarded-tcpip
channel. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map
<RemotePortForwarder.Forward, ConnectListener> protected static final String
protected static final String
Fields inherited from class net.schmizz.sshj.connection.channel.forwarded.AbstractForwardedChannelOpener
chanType, conn, log
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbind
(RemotePortForwarder.Forward forward, ConnectListener listener) Request forwarding from the remote host on the specifiedRemotePortForwarder.Forward
.void
cancel
(RemotePortForwarder.Forward forward) Request cancellation of some forwarding.void
handleOpen
(SSHPacket buf) Internal API.protected SSHPacket
req
(String reqName, RemotePortForwarder.Forward forward) Methods inherited from class net.schmizz.sshj.connection.channel.forwarded.AbstractForwardedChannelOpener
callListener, getChannelType
-
Field Details
-
PF_REQ
- See Also:
-
PF_CANCEL
- See Also:
-
listeners
-
-
Constructor Details
-
RemotePortForwarder
-
-
Method Details
-
bind
public RemotePortForwarder.Forward bind(RemotePortForwarder.Forward forward, ConnectListener listener) throws ConnectionException, TransportException Request forwarding from the remote host on the specifiedRemotePortForwarder.Forward
. Forwarded connections will be handled by suppliedlistener
. Ifforward
specifies as 0, the returned forward will have the correct port number as informed by remote host.- Parameters:
forward
- theRemotePortForwarder.Forward
to put in place on remote hostlistener
- the listener which will next forwarded connection- Returns:
- the
RemotePortForwarder.Forward
which was put into place on the remote host - Throws:
ConnectionException
- if there is an error requesting the forwardingTransportException
-
cancel
public void cancel(RemotePortForwarder.Forward forward) throws ConnectionException, TransportException Request cancellation of some forwarding.- Parameters:
forward
- the forward which is being cancelled- Throws:
ConnectionException
- if there is an error with the cancellation requestTransportException
-
req
protected SSHPacket req(String reqName, RemotePortForwarder.Forward forward) throws ConnectionException, TransportException -
getActiveForwards
- Returns:
- the active forwards.
-
handleOpen
Internal API. Creates aRemotePortForwarder.ForwardedTCPIPChannel
from theCHANNEL_OPEN
request and calls associatedConnectListener
for that forward in a separate thread.- Parameters:
buf
-SSHPacket
containing the request except for the message identifier and channel type field- Throws:
ConnectionException
TransportException
-