Package org.apache.sshd.common.session
Interface ReservedSessionMessagesHandler
- All Superinterfaces:
EventListener,SshdEventListener
- All Known Implementing Classes:
ReservedSessionMessagesHandlerAdapter
Provides a way to listen and handle the
SSH_MSG_IGNORE and SSH_MSG_DEBUG messages that are received
by a session, as well as proprietary and/or extension messages and behavior.-
Method Summary
Modifier and TypeMethodDescriptiondefault voidhandleDebugMessage(Session session, Buffer buffer) Invoked when anSSH_MSG_DEBUGpacket is receiveddefault voidhandleIgnoreMessage(Session session, Buffer buffer) Invoked when anSSH_MSG_IGNOREpacket is receiveddefault booleanhandleUnimplementedMessage(Session session, int cmd, Buffer buffer) Invoked when a packet with an un-implemented message is received - includingSSH_MSG_UNIMPLEMENTEDitselfdefault IoWriteFuturesendIdentification(Session session, String version, List<String> extraLines) Send the initial version exchange identification in and independent mannerdefault IoWriteFuturesendKexInitRequest(Session session, Map<KexProposalOption, String> proposal, Buffer packet) Invoked before sending theSSH_MSG_KEXINITpacketdefault booleansendReservedHeartbeat(ConnectionService service) Invoked if the user configured usage of a proprietary heartbeat mechanism.
-
Method Details
-
sendIdentification
default IoWriteFuture sendIdentification(Session session, String version, List<String> extraLines) throws Exception Send the initial version exchange identification in and independent manner- Parameters:
session- TheSessionthrough which the version is exchange is being managedversion- The version line that was resolved - Note: since this string is part of the KEX and is cached in the calling session, any changes to it require updating the session's cached value.extraLines- Extra lines to be sent - valid only for server sessions. Note:/B> the handler may modify these lines and returnnullthus signaling the session to proceed with sending the identification- Returns:
- A
IoWriteFuturethat can be used to wait for the data to be sent successfully. Ifnullthen the session will send the identification, otherwise it is assumed that the handler has sent it. - Throws:
Exception- if failed to handle the callback- See Also:
-
sendKexInitRequest
default IoWriteFuture sendKexInitRequest(Session session, Map<KexProposalOption, String> proposal, Buffer packet) throws ExceptionInvoked before sending theSSH_MSG_KEXINITpacket- Parameters:
session- TheSessionthrough which the key exchange is being managedproposal- The KEX proposal that was used to build the packetpacket- The packet containing the fully encoded message - Caveat: this packet later serves as part of the key generation, so care must be taken if manipulating it.- Returns:
- A non-
nullIoWriteFutureto signal that handler took care of the KEX packet delivery. - Throws:
Exception- if failed to handle the callback
-
handleIgnoreMessage
Invoked when anSSH_MSG_IGNOREpacket is received- Parameters:
session- TheSessionthrough which the message was receivedbuffer- TheBuffercontaining the data- Throws:
Exception- If failed to handle the message- See Also:
-
handleDebugMessage
Invoked when anSSH_MSG_DEBUGpacket is received- Parameters:
session- TheSessionthrough which the message was receivedbuffer- TheBuffercontaining the data- Throws:
Exception- If failed to handle the message- See Also:
-
handleUnimplementedMessage
default boolean handleUnimplementedMessage(Session session, int cmd, Buffer buffer) throws Exception Invoked when a packet with an un-implemented message is received - includingSSH_MSG_UNIMPLEMENTEDitself- Parameters:
session- TheSessionthrough which the message was receivedcmd- The received (un-implemented) commandbuffer- TheBuffercontaining the data - positioned just beyond the command- Returns:
trueif message handled internally,falseif should return aSSH_MSG_UNIMPLEMENTEDreply (default behavior)- Throws:
Exception- If failed to handle the message- See Also:
-
sendReservedHeartbeat
Invoked if the user configured usage of a proprietary heartbeat mechanism. Note: by default throwsUnsupportedOperationExceptionso users who configure a proprietary heartbeat mechanism option must provide an implementation for this method.- Parameters:
service- TheConnectionServicethrough which the heartbeat is being executed.- Returns:
truewhether heartbeat actually sent - Note: used mainly for debugging purposes.- Throws:
Exception- If failed to send the heartbeat - Note: causes associated session termination.
-