Top Description Methods
org.apache.sshd.common.session

public Interface ReservedSessionMessagesHandler

extends SshdEventListener
Known Direct Implementers
org.apache.sshd.common.session.helpers.ReservedSessionMessagesHandlerAdapter
Imports
java.util.List, .Map, org.apache.sshd.common.io.IoWriteFuture, org.apache.sshd.common.kex.KexProposalOption, org.apache.sshd.common.util.SshdEventListener, org.apache.sshd.common.util.buffer.Buffer

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.
Author
Apache MINA SSHD Project

Method Summary

Modifier and TypeMethod and Description
public default void
handleDebugMessage(Session
The Session through which the message was received
session
,
Buffer
The Buffer containing the data
buffer
)

Invoked when an SSH_MSG_DEBUG packet is received

public default void
handleIgnoreMessage(Session
The Session through which the message was received
session
,
Buffer
The Buffer containing the data
buffer
)

Invoked when an SSH_MSG_IGNORE packet is received

public default boolean

Returns:

true if message handled internally, false if should return a SSH_MSG_UNIMPLEMENTED reply (default behavior)
handleUnimplementedMessage
(Session
The Session through which the message was received
session
,
int
The received (un-implemented) command
cmd
,
Buffer
The Buffer containing the data - positioned just beyond the command
buffer
)

Invoked when a packet with an un-implemented message is received - including SSH_MSG_UNIMPLEMENTED itself

public default IoWriteFuture

Returns:

A IoWriteFuture that can be used to wait for the data to be sent successfully. If null then the session will send the identification, otherwise it is assumed that the handler has sent it.
sendIdentification
(Session
The Session through which the version is exchange is being managed
session
,
String
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.
version
,
List<String>
Extra lines to be sent - valid only for server sessions. Note:/B> the handler may modify these lines and return null thus signaling the session to proceed with sending the identification
extraLines
)

Send the initial version exchange identification in and independent manner

public default IoWriteFuture

Returns:

A non-null IoWriteFuture to signal that handler took care of the KEX packet delivery.
sendKexInitRequest
(Session
The Session through which the key exchange is being managed
session
,
Map<KexProposalOption, String>
The KEX proposal that was used to build the packet
proposal
,
Buffer
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.
packet
)

Invoked before sending the SSH_MSG_KEXINIT packet

public default boolean

Returns:

true whether heartbeat actually sent - Note: used mainly for debugging purposes.
sendReservedHeartbeat
(ConnectionService
The ConnectionService through which the heartbeat is being executed.
service
)

Invoked if the user configured usage of a proprietary heartbeat mechanism

Note

by default throws UnsupportedOperationException so users who configure a proprietary heartbeat mechanism option must provide an implementation for this method.

Inherited from org.apache.sshd.common.util.SshdEventListener:
validateListener

Method Detail

handleDebugMessageback to summary
public default void handleDebugMessage(Session session, Buffer buffer) throws Exception

Invoked when an SSH_MSG_DEBUG packet is received

Parameters
session:Session

The Session through which the message was received

buffer:Buffer

The Buffer containing the data

Exceptions
Exception:
If failed to handle the message
See Also
RFC 4253 - section 11.3
handleIgnoreMessageback to summary
public default void handleIgnoreMessage(Session session, Buffer buffer) throws Exception

Invoked when an SSH_MSG_IGNORE packet is received

Parameters
session:Session

The Session through which the message was received

buffer:Buffer

The Buffer containing the data

Exceptions
Exception:
If failed to handle the message
See Also
RFC 4253 - section 11.2
handleUnimplementedMessageback to summary
public default boolean handleUnimplementedMessage(Session session, int cmd, Buffer buffer) throws Exception

Invoked when a packet with an un-implemented message is received - including SSH_MSG_UNIMPLEMENTED itself

Parameters
session:Session

The Session through which the message was received

cmd:int

The received (un-implemented) command

buffer:Buffer

The Buffer containing the data - positioned just beyond the command

Returns:boolean

true if message handled internally, false if should return a SSH_MSG_UNIMPLEMENTED reply (default behavior)

Exceptions
Exception:
If failed to handle the message
See Also
RFC 4253 - section 11.4
sendIdentificationback to summary
public default IoWriteFuture sendIdentification(Session session, String version, List<String> extraLines) throws Exception

Send the initial version exchange identification in and independent manner

Parameters
session:Session

The Session through which the version is exchange is being managed

version:String

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:List<String>

Extra lines to be sent - valid only for server sessions. Note:/B> the handler may modify these lines and return null thus signaling the session to proceed with sending the identification

Returns:IoWriteFuture

A IoWriteFuture that can be used to wait for the data to be sent successfully. If null then the session will send the identification, otherwise it is assumed that the handler has sent it.

Exceptions
Exception:
if failed to handle the callback
See Also
RFC 4253 - section 4.2 - Protocol Version Exchange
sendKexInitRequestback to summary
public default IoWriteFuture sendKexInitRequest(Session session, Map<KexProposalOption, String> proposal, Buffer packet) throws Exception

Invoked before sending the SSH_MSG_KEXINIT packet

Parameters
session:Session

The Session through which the key exchange is being managed

proposal:Map<KexProposalOption, String>

The KEX proposal that was used to build the packet

packet:Buffer

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:IoWriteFuture

A non-null IoWriteFuture to signal that handler took care of the KEX packet delivery.

Exceptions
Exception:
if failed to handle the callback
sendReservedHeartbeatback to summary
public default boolean sendReservedHeartbeat(ConnectionService service) throws Exception

Invoked if the user configured usage of a proprietary heartbeat mechanism

Note

by default throws UnsupportedOperationException so users who configure a proprietary heartbeat mechanism option must provide an implementation for this method.

Parameters
service:ConnectionService

The ConnectionService through which the heartbeat is being executed.

Returns:boolean

true whether heartbeat actually sent - Note: used mainly for debugging purposes.

Exceptions
Exception:
If failed to send the heartbeat - Note: causes associated session termination.