com.maverick.sshd.tunnel
Class RemoteForwardingChannel

java.lang.Object
  extended by com.maverick.sshd.Channel
      extended by com.maverick.sshd.tunnel.ForwardingChannel
          extended by com.maverick.sshd.tunnel.SocketForwardingChannel
              extended by com.maverick.sshd.tunnel.RemoteForwardingChannel
All Implemented Interfaces:
com.maverick.ssh.components.SshComponent

public class RemoteForwardingChannel
extends SocketForwardingChannel

Implements a Remote forwarding channel for use with forwarding sockets from the server machine through the client to some endpoint reachable from the client machine.

Author:
Lee David Painter

Nested Class Summary
 
Nested classes/interfaces inherited from class com.maverick.sshd.tunnel.SocketForwardingChannel
SocketForwardingChannel.QueuedData
 
Field Summary
static String CHANNEL_TYPE
           
 
Fields inherited from class com.maverick.sshd.tunnel.ForwardingChannel
hostToConnect, originatingHost, originatingPort, portToConnect
 
Fields inherited from class com.maverick.sshd.Channel
connection, localwindow, localWindowLock, state
 
Constructor Summary
RemoteForwardingChannel(RemoteForwardingListeningInterface rfi, org.apache.mina.core.session.IoSession session)
          Constructs a forwarding channel of the type "forwarded-tcpip"
 
Method Summary
protected  byte[] createChannel()
          Creates the end of the channelopenmessage string address that was connected uint32 port that was connected string originator IP address uint32 originator port
protected  void onChannelOpenFailure()
          Either nothing was listening on the clients end of the tunnel, or the connection was rejected.
protected  void onRegistrationComplete()
           
protected  void onRemoteEOF()
          Called when the remote side is EOF.
protected  byte[] openChannel(byte[] requestdata)
          Called when the channel is being opened.
 
Methods inherited from class com.maverick.sshd.tunnel.SocketForwardingChannel
canClose, evaluateClosure, evaluateWindowSpace, onChannelClosed, onChannelClosing, onChannelData, onChannelFree, onChannelOpen, onChannelOpenConfirmation, onChannelRequest, onExtendedData, onLocalEOF, onRemoteClose, sendChannelData
 
Methods inherited from class com.maverick.sshd.tunnel.ForwardingChannel
getHost, getInformation, getOriginatingHost, getOriginatingPort, getPort
 
Methods inherited from class com.maverick.sshd.Channel
addEventListener, addInputListener, addOutputListener, close, getConnection, getContext, getLocalId, getLocalPacket, getLocalWindow, getName, getQueueSize, getRemoteId, getRemotePacket, getRemoteWindow, getSessionIdentifier, hasQueuedData, idle, isClosed, isClosing, isEOF, isLocalEOF, isOpen, isRemoteEOF, onWindowAdjust, queueSize, registerExtendedData, removeEventListener, sendChannelData, sendChannelRequest, sendEOF, sendExtendedData, sendRequestResponse, sendWindowAdjust
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHANNEL_TYPE

public static final String CHANNEL_TYPE
See Also:
Constant Field Values
Constructor Detail

RemoteForwardingChannel

public RemoteForwardingChannel(RemoteForwardingListeningInterface rfi,
                               org.apache.mina.core.session.IoSession session)
Constructs a forwarding channel of the type "forwarded-tcpip"

Parameters:
hostToConnect - String
portToConnect - int
socketChannel - SocketChannel
Method Detail

createChannel

protected byte[] createChannel()
                        throws IOException,
                               com.maverick.ssh.common.ChannelOpenException
Creates the end of the channelopenmessage string address that was connected uint32 port that was connected string originator IP address uint32 originator port

Specified by:
createChannel in class SocketForwardingChannel
Returns:
byte[], the end of the channelopenmessage
Throws:
IOException
com.maverick.ssh.common.ChannelOpenException

onRemoteEOF

protected void onRemoteEOF()
Called when the remote side is EOF.

Overrides:
onRemoteEOF in class SocketForwardingChannel

onRegistrationComplete

protected void onRegistrationComplete()

openChannel

protected byte[] openChannel(byte[] requestdata)
                      throws WriteOperationRequest,
                             com.maverick.ssh.common.ChannelOpenException
Description copied from class: Channel
Called when the channel is being opened. You can retrun data to be sent in the channel open confirmation message, or null for none.

Specified by:
openChannel in class SocketForwardingChannel
Returns:
byte[]
Throws:
WriteOperationRequest
com.maverick.ssh.common.ChannelOpenException

onChannelOpenFailure

protected void onChannelOpenFailure()
Either nothing was listening on the clients end of the tunnel, or the connection was rejected. Now we close the connection from the server to the start of the tunnel.

Overrides:
onChannelOpenFailure in class Channel


Copyright © 2012. All Rights Reserved.