com.maverick.sshd
Class RemoteForwardingChannel

java.lang.Object
  extended by com.maverick.sshd.Channel
      extended by com.maverick.sshd.ForwardingChannel
          extended by com.maverick.sshd.SocketForwardingChannel
              extended by com.maverick.sshd.RemoteForwardingChannel
All Implemented Interfaces:
SelectorRegistrationListener, SocketHandler

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.Channel
Channel.QueuedData
 
Field Summary
 
Fields inherited from class com.maverick.sshd.ForwardingChannel
hostToConnect, originatingHost, originatingPort, portToConnect
 
Fields inherited from class com.maverick.sshd.Channel
connection, localwindow, localWindowLock
 
Constructor Summary
RemoteForwardingChannel(java.lang.String addressToBind, int portToBind, java.nio.channels.SocketChannel socketChannel)
          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 onChannelOpenConfirmation()
          Called when the channel has been confirmed as open by the remote side - this method is only called when the channel has been requested by this side of the connection
protected  void onChannelOpenFailure()
          Either nothing was listening on the clients end of the tunnel, or the connection was rejected.
protected  void onRegistrationComplete()
          Called by the subsystem when the selector registration has been completed.
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.SocketForwardingChannel
canClose, evaluateClosure, evaluateWindowSpace, getInterestedOps, initialize, onChannelClosed, onChannelClosing, onChannelData, onChannelFree, onChannelOpen, onChannelRequest, onExtendedData, onLocalEOF, onRemoteClose, processReadEvent, processWriteEvent, registrationCompleted, setThread, shutdownSocket
 
Methods inherited from class com.maverick.sshd.ForwardingChannel
getHost, getOriginatingHost, getOriginatingPort, getPort
 
Methods inherited from class com.maverick.sshd.Channel
addEventListener, addInputListener, addOutputListener, clearIdleState, close, getChannelType, getConnection, getContext, getLocalId, getLocalPacket, getLocalWindow, getQueueSize, getRemoteId, getRemotePacket, getRemoteWindow, getSessionIdentifier, hasQueuedData, isClosed, isClosing, isEOF, isOpen, onWindowAdjust, queueSize, registerExtendedData, resetIdleState, sendChannelData, sendChannelData, sendChannelData, sendChannelData, sendChannelDataWithBuffering, sendChannelDataWithBuffering, sendChannelRequest, sendEOF, sendExtendedData, sendExtendedData, sendRequestResponse, sendWindowAdjust
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteForwardingChannel

public RemoteForwardingChannel(java.lang.String addressToBind,
                               int portToBind,
                               java.nio.channels.SocketChannel socketChannel)
Constructs a forwarding channel of the type "forwarded-tcpip"

Parameters:
addressToBind - String
portToBind - int
socketChannel - SocketChannel
Method Detail

createChannel

protected byte[] createChannel()
                        throws java.io.IOException
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:
java.io.IOException

onRemoteEOF

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

Overrides:
onRemoteEOF in class SocketForwardingChannel

onRegistrationComplete

protected void onRegistrationComplete()
Description copied from class: SocketForwardingChannel
Called by the subsystem when the selector registration has been completed.

Specified by:
onRegistrationComplete in class SocketForwardingChannel

onChannelOpenConfirmation

protected void onChannelOpenConfirmation()
Description copied from class: Channel
Called when the channel has been confirmed as open by the remote side - this method is only called when the channel has been requested by this side of the connection

Specified by:
onChannelOpenConfirmation in class SocketForwardingChannel

openChannel

protected byte[] openChannel(byte[] requestdata)
                      throws WriteOperationRequest,
                             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
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 © 2003-2008 SSHTools LTD. All Rights Reserved.