public interface Channel extends SessionHolder<Session>, ChannelListenerManager, PropertyResolver, AttributeStore, PacketWriter, ChannelStreamPacketWriterResolverManager, Closeable
AttributeRepository.AttributeKey<T>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CHANNEL_EXEC |
static java.lang.String |
CHANNEL_SHELL |
static java.lang.String |
CHANNEL_SUBSYSTEM |
EMPTY
NONE
CLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT
Modifier and Type | Method and Description |
---|---|
void |
addRequestHandler(RequestHandler<Channel> handler) |
default void |
addRequestHandlers(java.util.Collection<? extends RequestHandler<Channel>> handlers) |
int |
getId() |
Window |
getLocalWindow() |
int |
getRecipient() |
Window |
getRemoteWindow() |
java.util.List<RequestHandler<Channel>> |
getRequestHandlers() |
void |
handleClose()
Invoked when
SSH_MSG_CHANNEL_CLOSE received |
void |
handleData(Buffer buffer)
Invoked when
SSH_MSG_CHANNEL_DATA received |
void |
handleEof()
Invoked when
SSH_MSG_CHANNEL_EOF received |
void |
handleExtendedData(Buffer buffer)
Invoked when
SSH_MSG_CHANNEL_EXTENDED_DATA received |
void |
handleFailure()
Invoked when
SSH_MSG_CHANNEL_FAILURE received |
void |
handleOpenFailure(Buffer buffer)
For a client channel, this method will be called internally by the session when the server has rejected this
channel opening.
|
void |
handleOpenSuccess(int recipient,
long rwSize,
long packetSize,
Buffer buffer)
For a client channel, this method will be called internally by the session when the confirmation has been
received.
|
void |
handleRequest(Buffer buffer)
Invoked when
SSH_MSG_CHANNEL_REQUEST received |
void |
handleSuccess()
Invoked when
SSH_MSG_CHANNEL_SUCCESS received |
void |
handleWindowAdjust(Buffer buffer)
Invoked when
SSH_MSG_CHANNEL_WINDOW_ADJUST received |
void |
init(ConnectionService service,
Session session,
int id)
Invoked when the local channel is initial created
|
boolean |
isEofSignalled() |
boolean |
isInitialized() |
OpenFuture |
open(int recipient,
long rwSize,
long packetSize,
Buffer buffer)
For a server channel, this method will actually open the channel
|
void |
removeRequestHandler(RequestHandler<Channel> handler) |
default void |
removeRequestHandlers(java.util.Collection<? extends RequestHandler<Channel>> handlers) |
default <T> T |
resolveAttribute(AttributeRepository.AttributeKey<T> key)
Attempts to resolve the associated value by going up the store's hierarchy (if any)
|
static <T> T |
resolveAttribute(Channel channel,
AttributeRepository.AttributeKey<T> key)
Attempts to use the channel attribute, if not found then tries the session
|
getSession, getSessionContext
addChannelListener, getChannelListenerProxy, removeChannelListener
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringProperty
clearAttributes, computeAttributeIfAbsent, removeAttribute, setAttribute
attributeKeys, getAttribute, getAttributesCount, ofAttributesMap, ofKeyValuePair
calculatePadLength, writePacket
getChannelStreamPacketWriterResolver, resolveChannelStreamPacketWriter, resolveChannelStreamPacketWriterResolver, setChannelStreamPacketWriterResolver
addCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListener
static final java.lang.String CHANNEL_EXEC
static final java.lang.String CHANNEL_SHELL
static final java.lang.String CHANNEL_SUBSYSTEM
int getId()
int getRecipient()
Window getLocalWindow()
Window getRemoteWindow()
java.util.List<RequestHandler<Channel>> getRequestHandlers()
void addRequestHandler(RequestHandler<Channel> handler)
default void addRequestHandlers(java.util.Collection<? extends RequestHandler<Channel>> handlers)
void removeRequestHandler(RequestHandler<Channel> handler)
default void removeRequestHandlers(java.util.Collection<? extends RequestHandler<Channel>> handlers)
void handleClose() throws java.io.IOException
SSH_MSG_CHANNEL_CLOSE
receivedjava.io.IOException
- If failed to handle the messagevoid handleWindowAdjust(Buffer buffer) throws java.io.IOException
SSH_MSG_CHANNEL_WINDOW_ADJUST
receivedbuffer
- The rest of the message data Buffer
after decoding the channel identifiersjava.io.IOException
- If failed to handle the messagevoid handleRequest(Buffer buffer) throws java.io.IOException
SSH_MSG_CHANNEL_REQUEST
receivedbuffer
- The rest of the message data Buffer
after decoding the channel identifiersjava.io.IOException
- If failed to handle the messagevoid handleData(Buffer buffer) throws java.io.IOException
SSH_MSG_CHANNEL_DATA
receivedbuffer
- The rest of the message data Buffer
after decoding the channel identifiersjava.io.IOException
- If failed to handle the messagevoid handleExtendedData(Buffer buffer) throws java.io.IOException
SSH_MSG_CHANNEL_EXTENDED_DATA
receivedbuffer
- The rest of the message data Buffer
after decoding the channel identifiersjava.io.IOException
- If failed to handle the messagevoid handleEof() throws java.io.IOException
SSH_MSG_CHANNEL_EOF
receivedjava.io.IOException
- If failed to handle the messagevoid handleSuccess() throws java.io.IOException
SSH_MSG_CHANNEL_SUCCESS
receivedjava.io.IOException
- If failed to handle the messagevoid handleFailure() throws java.io.IOException
SSH_MSG_CHANNEL_FAILURE
receivedjava.io.IOException
- If failed to handle the messagevoid init(ConnectionService service, Session session, int id) throws java.io.IOException
service
- The ConnectionService
through which the channel is initializedsession
- The Session
associated with the channelid
- The locally assigned channel identifierjava.io.IOException
- If failed to process the initializationboolean isInitialized()
true
if call to init(ConnectionService, Session, int)
was successfully completedboolean isEofSignalled()
true
if the peer signaled that it will not send any more dataOpenFuture open(int recipient, long rwSize, long packetSize, Buffer buffer)
recipient
- Recipient identifierrwSize
- Read/Write window size (uint32
)packetSize
- Preferred maximum packet size (uint32
)buffer
- Incoming Buffer
that triggered the call. Note: the buffer's read position is
exactly after the information that read to this call was decodedOpenFuture
for the channel open requestvoid handleOpenSuccess(int recipient, long rwSize, long packetSize, Buffer buffer) throws java.io.IOException
recipient
- Recipient identifierrwSize
- Read/Write window size (uint32
)packetSize
- Preferred maximum packet size (uint32
)buffer
- Incoming Buffer
that triggered the call. Note: the buffer's read position is
exactly after the information that read to this call was decodedjava.io.IOException
- If failed to handle the successvoid handleOpenFailure(Buffer buffer) throws java.io.IOException
buffer
- Incoming Buffer
that triggered the call. Note: the buffer's read position is
exactly after the information that read to this call was decodedjava.io.IOException
- If failed to handle the successdefault <T> T resolveAttribute(AttributeRepository.AttributeKey<T> key)
AttributeRepository
resolveAttribute
in interface AttributeRepository
T
- The generic attribute typekey
- The key of the attribute; must not be null
.null
if there is no value associated with the specified key either in this repository or any
of its ancestors (if any available)static <T> T resolveAttribute(Channel channel, AttributeRepository.AttributeKey<T> key)
T
- The generic attribute typechannel
- The Channel
- ignored if null
key
- The attribute key - never null
null
if not foundSessionHolder.getSession()
,
Session.resolveAttribute(Session, AttributeRepository.AttributeKey)