public interface Channel extends ChannelListenerManager, PropertyResolver, AttributeStore, PacketWriter, ChannelStreamPacketWriterResolverManager, Closeable
AttributeRepository.AttributeKey<T>
Modifier and Type | Field and Description |
---|---|
static String |
CHANNEL_EXEC |
static String |
CHANNEL_SHELL |
static 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(Collection<? extends RequestHandler<Channel>> handlers) |
int |
getId() |
Window |
getLocalWindow() |
int |
getRecipient() |
Window |
getRemoteWindow() |
List<RequestHandler<Channel>> |
getRequestHandlers() |
Session |
getSession() |
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(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
|
addChannelListener, getChannelListenerProxy, removeChannelListener
getBoolean, getBooleanProperty, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringProperty
clearAttributes, computeAttributeIfAbsent, removeAttribute, setAttribute
attributeKeys, getAttribute, getAttributesCount, ofAttributesMap, ofKeyValuePair
writePacket
getChannelStreamPacketWriterResolver, resolveChannelStreamPacketWriter, resolveChannelStreamPacketWriterResolver, setChannelStreamPacketWriterResolver
addCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListener
static final String CHANNEL_EXEC
static final String CHANNEL_SHELL
static final String CHANNEL_SUBSYSTEM
int getId()
int getRecipient()
Window getLocalWindow()
Window getRemoteWindow()
List<RequestHandler<Channel>> getRequestHandlers()
void addRequestHandler(RequestHandler<Channel> handler)
default void addRequestHandlers(Collection<? extends RequestHandler<Channel>> handlers)
void removeRequestHandler(RequestHandler<Channel> handler)
default void removeRequestHandlers(Collection<? extends RequestHandler<Channel>> handlers)
void handleClose() throws IOException
SSH_MSG_CHANNEL_CLOSE
receivedIOException
- If failed to handle the messagevoid handleWindowAdjust(Buffer buffer) throws IOException
SSH_MSG_CHANNEL_WINDOW_ADJUST
receivedbuffer
- The rest of the message data Buffer
after
decoding the channel identifiersIOException
- If failed to handle the messagevoid handleRequest(Buffer buffer) throws IOException
SSH_MSG_CHANNEL_REQUEST
receivedbuffer
- The rest of the message data Buffer
after
decoding the channel identifiersIOException
- If failed to handle the messagevoid handleData(Buffer buffer) throws IOException
SSH_MSG_CHANNEL_DATA
receivedbuffer
- The rest of the message data Buffer
after
decoding the channel identifiersIOException
- If failed to handle the messagevoid handleExtendedData(Buffer buffer) throws IOException
SSH_MSG_CHANNEL_EXTENDED_DATA
receivedbuffer
- The rest of the message data Buffer
after
decoding the channel identifiersIOException
- If failed to handle the messagevoid handleEof() throws IOException
SSH_MSG_CHANNEL_EOF
receivedIOException
- If failed to handle the messagevoid handleSuccess() throws IOException
SSH_MSG_CHANNEL_SUCCESS
receivedIOException
- If failed to handle the messagevoid handleFailure() throws IOException
SSH_MSG_CHANNEL_FAILURE
receivedIOException
- If failed to handle the messagevoid init(ConnectionService service, Session session, int id) throws IOException
service
- The ConnectionService
through which the channel is initializedsession
- The Session
associated with the channelid
- The locally assigned channel identifierIOException
- 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 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 decodedIOException
- If failed to handle the successvoid handleOpenFailure(Buffer buffer) throws 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 decodedIOException
- 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 foundgetSession()
,
Session.resolveAttribute(Session, AttributeRepository.AttributeKey)
Copyright © 2008–2022 The Apache Software Foundation. All rights reserved.