net.schmizz.sshj.connection.channel.forwarded
Class RemotePortForwarder
java.lang.Object
net.schmizz.sshj.connection.channel.forwarded.AbstractForwardedChannelOpener
net.schmizz.sshj.connection.channel.forwarded.RemotePortForwarder
- All Implemented Interfaces:
- ForwardedChannelOpener
public class RemotePortForwarder
- extends AbstractForwardedChannelOpener
Handles remote port forwarding.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PF_REQ
protected static final String PF_REQ
- See Also:
- Constant Field Values
PF_CANCEL
protected static final String PF_CANCEL
- See Also:
- Constant Field Values
listeners
protected final Map<RemotePortForwarder.Forward,ConnectListener> listeners
RemotePortForwarder
public RemotePortForwarder(Connection conn)
bind
public RemotePortForwarder.Forward bind(RemotePortForwarder.Forward forward,
ConnectListener listener)
throws ConnectionException,
TransportException
- Request forwarding from the remote host on the specified
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.
- Parameters:
forward - the RemotePortForwarder.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 forwarding
TransportException
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 request
TransportException
req
protected SSHPacket req(String reqName,
RemotePortForwarder.Forward forward)
throws ConnectionException,
TransportException
- Throws:
ConnectionException
TransportException
getActiveForwards
public Set<RemotePortForwarder.Forward> getActiveForwards()
- Returns:
- the active forwards.
handleOpen
public void handleOpen(SSHPacket buf)
throws ConnectionException,
TransportException
- Internal API. Creates a
RemotePortForwarder.ForwardedTCPIPChannel from the CHANNEL_OPEN request and calls associated
ConnectListener for that forward in a separate thread.
- Parameters:
buf - SSHPacket containg the request except for the message identifier and channel type field
- Throws:
ConnectionException
TransportException
Copyright © 2009-2012. All Rights Reserved.