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 classRepresents a particular forwarding.static classAforwarded-tcpipchannel. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<RemotePortForwarder.Forward, ConnectListener> protected static final Stringprotected static final StringFields inherited from class 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.voidcancel(RemotePortForwarder.Forward forward) Request cancellation of some forwarding.voidhandleOpen(SSHPacket buf) Internal API.protected SSHPacketreq(String reqName, RemotePortForwarder.Forward forward) Methods inherited from class 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. Ifforwardspecifies as 0, the returned forward will have the correct port number as informed by remote host.- Parameters:
forward- theRemotePortForwarder.Forwardto put in place on remote hostlistener- the listener which will next forwarded connection- Returns:
- the
RemotePortForwarder.Forwardwhich 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.ForwardedTCPIPChannelfrom theCHANNEL_OPENrequest and calls associatedConnectListenerfor that forward in a separate thread.- Parameters:
buf-SSHPacketcontaining the request except for the message identifier and channel type field- Throws:
ConnectionExceptionTransportException
-