Interface ConnectionService
- All Superinterfaces:
AutoCloseable, Channel, Closeable, org.apache.sshd.common.Closeable, PortForwardingEventListenerManager, PortForwardingEventListenerManagerHolder, org.apache.sshd.common.PropertyResolver, Service, org.apache.sshd.common.session.SessionContextHolder, org.apache.sshd.common.session.SessionHeartbeatController, SessionHolder<Session>, UnknownChannelReferenceHandlerManager
- All Known Implementing Classes:
AbstractConnectionService, ClientConnectionService, ServerConnectionService
public interface ConnectionService
extends Service, org.apache.sshd.common.session.SessionHeartbeatController, UnknownChannelReferenceHandlerManager, PortForwardingEventListenerManager, PortForwardingEventListenerManagerHolder
Interface implementing ssh-connection service.
- Author:
- Apache MINA SSHD Project
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
org.apache.sshd.common.session.SessionHeartbeatController.HeartbeatType -
Field Summary
Fields inherited from interface org.apache.sshd.common.PropertyResolver
EMPTY -
Method Summary
Modifier and TypeMethodDescriptionRetrieve the forwarder instancebooleanlongregisterChannel(Channel channel) Register a newly created channel with a new unique identifierorg.apache.sshd.common.util.buffer.BufferSend a global request and wait for the response, if the request is sent withwant-reply = true.default org.apache.sshd.common.util.buffer.Bufferrequest(String request, org.apache.sshd.common.util.buffer.Buffer buffer, long timeout, TimeUnit unit) Send a global request and wait for the response, if the request is sent withwant-reply = true.default org.apache.sshd.common.util.buffer.BufferSend a global request and wait for the response, if the request is sent withwant-reply = true.request(org.apache.sshd.common.util.buffer.Buffer buffer, String request, GlobalRequestFuture.ReplyHandler replyHandler) Send a global request and handle the reply asynchronously.voidsetAllowMoreSessions(boolean allow) voidunregisterChannel(Channel channel) Remove this channel from the list of managed channelsMethods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListenerMethods inherited from interface PortForwardingEventListenerManager
addPortForwardingEventListener, getPortForwardingEventListenerProxy, removePortForwardingEventListenerMethods inherited from interface PortForwardingEventListenerManagerHolder
addPortForwardingEventListenerManager, getRegisteredManagers, removePortForwardingEventListenerManagerMethods inherited from interface org.apache.sshd.common.PropertyResolver
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getProperties, getString, getStringProperty, isEmptyMethods inherited from interface Service
getParentPropertyResolver, process, startMethods inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
disableSessionHeartbeat, getSessionHeartbeatInterval, getSessionHeartbeatType, setSessionHeartbeat, setSessionHeartbeatMethods inherited from interface SessionHolder
getSession, getSessionContextMethods inherited from interface UnknownChannelReferenceHandlerManager
getUnknownChannelReferenceHandler, resolveUnknownChannelReferenceHandler, setUnknownChannelReferenceHandler
-
Method Details
-
registerChannel
Register a newly created channel with a new unique identifier- Parameters:
channel- TheChannelto register- Returns:
- The assigned id of this channel - a UINT32 represented as a
long - Throws:
IOException- If failed to initialize and register the channel
-
unregisterChannel
-
getForwarder
-
request
default org.apache.sshd.common.util.buffer.Buffer request(String request, org.apache.sshd.common.util.buffer.Buffer buffer, long timeout, TimeUnit unit) throws IOException Send a global request and wait for the response, if the request is sent withwant-reply = true.- Parameters:
request- the request name - used mainly for logging and debuggingbuffer- the buffer containing the global requesttimeout- The number of time units to wait - must be positiveunit- TheTimeUnitto wait for the response- Returns:
- the return buffer if the request was successful,
nullotherwise. - Throws:
IOException- if an error occurred when encoding or sending the packetSocketTimeoutException- If no response received within specified timeout
-
request
default org.apache.sshd.common.util.buffer.Buffer request(String request, org.apache.sshd.common.util.buffer.Buffer buffer, Duration timeout) throws IOException Send a global request and wait for the response, if the request is sent withwant-reply = true.- Parameters:
request- the request name - used mainly for logging and debuggingbuffer- the buffer containing the global requesttimeout- The (nevernull) timeout to wait - its milliseconds value is used- Returns:
- the return buffer if the request was successful,
nullotherwise. - Throws:
IOException- if an error occurred when encoding or sending the packetSocketTimeoutException- If no response received within specified timeout
-
request
org.apache.sshd.common.util.buffer.Buffer request(String request, org.apache.sshd.common.util.buffer.Buffer buffer, long maxWaitMillis) throws IOException Send a global request and wait for the response, if the request is sent withwant-reply = true.- Parameters:
request- the request name - used mainly for logging and debuggingbuffer- the buffer containing the global requestmaxWaitMillis- maximum time in milliseconds to wait for the request to finish - must be positive- Returns:
- the return buffer if the request was successful,
nullotherwise. - Throws:
IOException- if an error occurred when encoding or sending the packetSocketTimeoutException- If no response received within specified timeout
-
request
GlobalRequestFuture request(org.apache.sshd.common.util.buffer.Buffer buffer, String request, GlobalRequestFuture.ReplyHandler replyHandler) throws IOException Send a global request and handle the reply asynchronously. Ifwant-reply = true, pass the receivedBufferto the givenGlobalRequestFuture.ReplyHandler, which may execute in a different thread.- want-reply == true && replyHandler != null
- The returned future is fulfilled with
nullwhen the request was sent, or with an exception if the request could not be sent. ThereplyHandleris invoked once the reply is received, with the SSH reply code and the data received. - want-reply == true && replyHandler == null
- The returned future is fulfilled with an exception if the request could not be sent, or a failure reply was received. If a success reply was received, the future is fulfilled with the received data buffer.
- want-reply == false
- The returned future is fulfilled with an empty
Bufferwhen the request was sent, or with an exception if the request could not be sent. If a reply handler is given, it is invoked with that empty buffer. The handler is not invoked if sending the request failed.
- Parameters:
buffer- theBuffercontaining the global request, with thewant-replyflag set as appropriaterequest- the request namereplyHandler-GlobalRequestFuture.ReplyHandlerfor handling the reply; may benull- Returns:
- Created
GlobalRequestFuture - Throws:
IOException- if an error occurred while encoding or sending the packet
-
getAgentForwardSupport
AgentForwardSupport getAgentForwardSupport() -
getX11ForwardSupport
X11ForwardSupport getX11ForwardSupport() -
isAllowMoreSessions
boolean isAllowMoreSessions() -
setAllowMoreSessions
void setAllowMoreSessions(boolean allow)
-