public class RemotePortForwarder extends AbstractForwardedChannelOpener
Modifier and Type | Class and Description |
---|---|
static class |
RemotePortForwarder.Forward
Represents a particular forwarding.
|
static class |
RemotePortForwarder.ForwardedTCPIPChannel
A
forwarded-tcpip channel. |
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<RemotePortForwarder.Forward,ConnectListener> |
listeners |
protected static java.lang.String |
PF_CANCEL |
protected static java.lang.String |
PF_REQ |
chanType, conn, log
Constructor and Description |
---|
RemotePortForwarder(Connection conn) |
Modifier and Type | Method and Description |
---|---|
RemotePortForwarder.Forward |
bind(RemotePortForwarder.Forward forward,
ConnectListener listener)
Request forwarding from the remote host on the specified
RemotePortForwarder.Forward . |
void |
cancel(RemotePortForwarder.Forward forward)
Request cancellation of some forwarding.
|
java.util.Set<RemotePortForwarder.Forward> |
getActiveForwards() |
void |
handleOpen(SSHPacket buf)
Internal API.
|
protected SSHPacket |
req(java.lang.String reqName,
RemotePortForwarder.Forward forward) |
callListener, getChannelType
protected static final java.lang.String PF_REQ
protected static final java.lang.String PF_CANCEL
protected final java.util.Map<RemotePortForwarder.Forward,ConnectListener> listeners
public RemotePortForwarder(Connection conn)
public RemotePortForwarder.Forward bind(RemotePortForwarder.Forward forward, ConnectListener listener) throws ConnectionException, TransportException
RemotePortForwarder.Forward
. Forwarded connections will be handled
by supplied listener
.
If forward
specifies as 0, the returned forward will have the correct port number as informed by remote
host.forward
- the RemotePortForwarder.Forward
to put in place on remote hostlistener
- the listener which will next forwarded connectionRemotePortForwarder.Forward
which was put into place on the remote hostConnectionException
- if there is an error requesting the forwardingTransportException
public void cancel(RemotePortForwarder.Forward forward) throws ConnectionException, TransportException
forward
- the forward which is being cancelledConnectionException
- if there is an error with the cancellation requestTransportException
protected SSHPacket req(java.lang.String reqName, RemotePortForwarder.Forward forward) throws ConnectionException, TransportException
public java.util.Set<RemotePortForwarder.Forward> getActiveForwards()
public void handleOpen(SSHPacket buf) throws ConnectionException, TransportException
RemotePortForwarder.ForwardedTCPIPChannel
from the CHANNEL_OPEN
request and calls associated
ConnectListener
for that forward in a separate thread.buf
- SSHPacket
containg the request except for the message identifier and channel type fieldConnectionException
TransportException