Package org.apache.sshd.server.forward
Class TcpipServerChannel
- java.lang.Object
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.Channel,AttributeRepository,AttributeStore,Channel,ChannelIdentifier,ChannelListenerManager,ChannelStreamWriterResolver,ChannelStreamWriterResolverManager,Closeable,ForwardingTunnelEndpointsProvider,PropertyResolver,SessionContextHolder,SessionHolder<Session>,ExecutorServiceCarrier,ServerChannel,ServerSessionHolder
public class TcpipServerChannel extends AbstractServerChannel implements ForwardingTunnelEndpointsProvider
TODO Add javadoc
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classTcpipServerChannel.PortIoHandlerstatic classTcpipServerChannel.TcpipFactory-
Nested classes/interfaces inherited from class org.apache.sshd.common.channel.AbstractChannel
AbstractChannel.GracefulChannelCloseable, AbstractChannel.GracefulState, AbstractChannel.PacketValidator
-
Nested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
AbstractCloseable.State
-
Nested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
AttributeRepository.AttributeKey<T>
-
-
Field Summary
Fields Modifier and Type Field Description private IoConnectorconnectorprivate java.net.SocketAddresslocalAddressprivate SshdSocketAddressoriginatorAddressprivate ChannelAsyncOutputStreamoutprivate ChannelToPortHandlerportprivate SshdSocketAddresstunnelEntranceprivate SshdSocketAddresstunnelExitprivate TcpForwardingFilter.Typetype-
Fields inherited from class org.apache.sshd.server.channel.AbstractServerChannel
exitStatusSent
-
Fields inherited from class org.apache.sshd.common.channel.AbstractChannel
channelListenerProxy, channelListeners, closeSignaled, DEFAULT_PACKET_VALIDATOR, eofReceived, eofSent, gracefulFuture, gracefulState, initialized, RESPONSE_BUFFER_GROWTH_FACTOR, service, unregisterSignaled
-
Fields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, state
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.channel.Channel
CHANNEL_EXEC, CHANNEL_SHELL, CHANNEL_SUBSYSTEM
-
Fields inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamWriterResolver
NONE
-
Fields inherited from interface org.apache.sshd.common.PropertyResolver
EMPTY
-
-
Constructor Summary
Constructors Constructor Description TcpipServerChannel(TcpForwardingFilter.Type type, CloseableExecutorService executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ChannelToPortHandlercreateChannelToPortHandler(IoSession session)protected OpenFuturedoInit(Buffer buffer)protected voiddoWriteData(byte[] data, int off, long len)protected voiddoWriteExtendedData(byte[] data, int off, long len)protected CloseablegetInnerCloseable()java.net.SocketAddressgetLocalAddress()SshdSocketAddressgetOriginatorAddress()ChannelToPortHandlergetPort()Retrieves theChannelToPortHandler.TcpForwardingFilter.TypegetTcpipChannelType()SshdSocketAddressgetTunnelEntrance()SshdSocketAddressgetTunnelExit()protected voidhandleChannelConnectResult(OpenFuture f, IoConnectFuture future)protected voidhandleChannelOpenFailure(OpenFuture f, java.lang.Throwable problem)protected voidhandleChannelOpenSuccess(OpenFuture f, IoSession session)voidhandleEof()Invoked whenSSH_MSG_CHANNEL_EOFreceivedvoidhandleWindowAdjust(Buffer buffer)Invoked whenSSH_MSG_CHANNEL_WINDOW_ADJUSTreceivedprotected booleanmayWrite()voidsetLocalAddress(java.net.SocketAddress localAddress)-
Methods inherited from class org.apache.sshd.server.channel.AbstractServerChannel
handleOpenFailure, handleOpenSuccess, open, sendExitStatus
-
Methods inherited from class org.apache.sshd.common.channel.AbstractChannel
addChannelListener, addPendingRequest, addRequestHandler, attributeKeys, clearAttributes, computeAttributeIfAbsent, configureWindow, getAttribute, getAttributesCount, getChannelId, getChannelListenerProxy, getChannelStreamWriterResolver, getExecutorService, getLocalWindow, getPacketValidator, getParentPropertyResolver, getProperties, getRecipient, getRemoteWindow, getRequestHandlers, getSession, handleChannelRegistrationResult, handleChannelRequest, handleChannelUnregistration, handleClose, handleData, handleExtendedData, handleFailure, handleInternalRequest, handleRequest, handleSuccess, handleUnknownChannelRequest, init, invokeChannelSignaller, isEofSent, isEofSignalled, isInitialized, notifyStateChanged, notifyStateChanged, preClose, removeAttribute, removeChannelListener, removePendingRequest, removeRequestHandler, resolveChannelStreamWriterResolver, sendEof, sendResponse, sendWindowAdjust, setAttribute, setChannelStreamWriterResolver, setPacketValidator, setRecipient, signalChannelClosed, signalChannelClosed, signalChannelInitialized, signalChannelInitialized, signalChannelOpenFailure, signalChannelOpenFailure, signalChannelOpenSuccess, signalChannelOpenSuccess, toString, validateIncomingDataSize, writePacket
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractInnerCloseable
doCloseGracefully, doCloseImmediately
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, removeCloseFutureListener
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.AttributeRepository
attributeKeys, getAttribute, getAttributesCount
-
Methods inherited from interface org.apache.sshd.common.AttributeStore
clearAttributes, computeAttributeIfAbsent, removeAttribute, setAttribute
-
Methods inherited from interface org.apache.sshd.common.channel.Channel
addRequestHandler, addRequestHandlers, getLocalWindow, getRecipient, getRemoteWindow, getRequestHandlers, handleChannelRegistrationResult, handleChannelUnregistration, handleClose, handleData, handleExtendedData, handleFailure, handleRequest, handleSuccess, init, isEofSignalled, isInitialized, removeRequestHandler, removeRequestHandlers, resolveAttribute, writePacket
-
Methods inherited from interface org.apache.sshd.common.channel.ChannelIdentifier
getChannelId
-
Methods inherited from interface org.apache.sshd.common.channel.ChannelListenerManager
addChannelListener, getChannelListenerProxy, removeChannelListener
-
Methods inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamWriterResolverManager
getChannelStreamWriterResolver, resolveChannelStreamWriter, resolveChannelStreamWriterResolver, setChannelStreamWriterResolver
-
Methods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
Methods inherited from interface org.apache.sshd.common.PropertyResolver
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringProperty, isEmpty
-
Methods inherited from interface org.apache.sshd.server.channel.ServerChannel
getServerSession
-
Methods inherited from interface org.apache.sshd.common.session.SessionHolder
getSession, getSessionContext
-
-
-
-
Field Detail
-
type
private final TcpForwardingFilter.Type type
-
connector
private IoConnector connector
-
port
private volatile ChannelToPortHandler port
-
out
private ChannelAsyncOutputStream out
-
tunnelEntrance
private SshdSocketAddress tunnelEntrance
-
tunnelExit
private SshdSocketAddress tunnelExit
-
originatorAddress
private SshdSocketAddress originatorAddress
-
localAddress
private java.net.SocketAddress localAddress
-
-
Constructor Detail
-
TcpipServerChannel
public TcpipServerChannel(TcpForwardingFilter.Type type, CloseableExecutorService executor)
-
-
Method Detail
-
getTcpipChannelType
public TcpForwardingFilter.Type getTcpipChannelType()
-
getLocalAddress
public java.net.SocketAddress getLocalAddress()
-
setLocalAddress
public void setLocalAddress(java.net.SocketAddress localAddress)
-
getTunnelEntrance
public SshdSocketAddress getTunnelEntrance()
- Specified by:
getTunnelEntrancein interfaceForwardingTunnelEndpointsProvider
-
getTunnelExit
public SshdSocketAddress getTunnelExit()
- Specified by:
getTunnelExitin interfaceForwardingTunnelEndpointsProvider
-
getOriginatorAddress
public SshdSocketAddress getOriginatorAddress()
-
handleWindowAdjust
public void handleWindowAdjust(Buffer buffer) throws java.io.IOException
Description copied from interface:ChannelInvoked whenSSH_MSG_CHANNEL_WINDOW_ADJUSTreceived- Specified by:
handleWindowAdjustin interfaceChannel- Overrides:
handleWindowAdjustin classAbstractChannel- Parameters:
buffer- The rest of the message dataBufferafter decoding the channel identifiers- Throws:
java.io.IOException- If failed to handle the message
-
doInit
protected OpenFuture doInit(Buffer buffer)
- Overrides:
doInitin classAbstractServerChannel
-
getPort
public ChannelToPortHandler getPort()
Retrieves theChannelToPortHandler. This isnullwhen the forwarding connection is not open.- Returns:
- the port handler, if set, or
nullotherwise
-
mayWrite
protected boolean mayWrite()
- Overrides:
mayWritein classAbstractChannel
-
handleChannelConnectResult
protected void handleChannelConnectResult(OpenFuture f, IoConnectFuture future)
-
handleChannelOpenSuccess
protected void handleChannelOpenSuccess(OpenFuture f, IoSession session)
-
handleChannelOpenFailure
protected void handleChannelOpenFailure(OpenFuture f, java.lang.Throwable problem)
-
handleEof
public void handleEof() throws java.io.IOExceptionDescription copied from interface:ChannelInvoked whenSSH_MSG_CHANNEL_EOFreceived- Specified by:
handleEofin interfaceChannel- Overrides:
handleEofin classAbstractChannel- Throws:
java.io.IOException- If failed to handle the message
-
getInnerCloseable
protected Closeable getInnerCloseable()
- Overrides:
getInnerCloseablein classAbstractChannel
-
doWriteData
protected void doWriteData(byte[] data, int off, long len) throws java.io.IOException- Specified by:
doWriteDatain classAbstractChannel- Throws:
java.io.IOException
-
doWriteExtendedData
protected void doWriteExtendedData(byte[] data, int off, long len) throws java.io.IOException- Specified by:
doWriteExtendedDatain classAbstractChannel- Throws:
java.io.IOException
-
createChannelToPortHandler
protected ChannelToPortHandler createChannelToPortHandler(IoSession session)
-
-