Package org.apache.sshd.common.session
Interface SessionListener
-
- All Superinterfaces:
java.util.EventListener,SshdEventListener
- All Known Implementing Classes:
SessionTimeoutListener
public interface SessionListener extends SshdEventListener
Represents an interface receiving session events.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSessionListener.Event
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default voidsessionClosed(Session session)A session has been closeddefault voidsessionCreated(Session session)A new session just been createddefault voidsessionDisconnect(Session session, int reason, java.lang.String msg, java.lang.String language, boolean initiator)Invoked whenSSH_MSG_DISCONNECTmessage was sent/receiveddefault voidsessionEstablished(Session session)An initial session connection has been established - Caveat emptor: the main difference between this callback andsessionCreated(Session)is that when this callback is called, the session is not yet fully initialized so not all API(s) will respond as expected.default voidsessionEvent(Session session, SessionListener.Event event)An event has been triggereddefault voidsessionException(Session session, java.lang.Throwable t)An exception was caught and the session will be closed (if not already so).default voidsessionNegotiationEnd(Session session, java.util.Map<KexProposalOption,java.lang.String> clientProposal, java.util.Map<KexProposalOption,java.lang.String> serverProposal, java.util.Map<KexProposalOption,java.lang.String> negotiatedOptions, java.lang.Throwable reason)Signals the end of the negotiation options handlingdefault voidsessionNegotiationStart(Session session, java.util.Map<KexProposalOption,java.lang.String> clientProposal, java.util.Map<KexProposalOption,java.lang.String> serverProposal)Signals the start of the negotiation options handlingdefault voidsessionPeerIdentificationReceived(Session session, java.lang.String version, java.util.List<java.lang.String> extraLines)The peer's identification version was receivedstatic <L extends SessionListener>
LvalidateListener(L listener)
-
-
-
Method Detail
-
sessionEstablished
default void sessionEstablished(Session session)
An initial session connection has been established - Caveat emptor: the main difference between this callback andsessionCreated(Session)is that when this callback is called, the session is not yet fully initialized so not all API(s) will respond as expected. The main purpose of this callback is to allow the user to customize some session properties based on the peer's address and/or any provided connection context.- Parameters:
session- The establishedSession
-
sessionCreated
default void sessionCreated(Session session)
A new session just been created- Parameters:
session- The createdSession
-
sessionPeerIdentificationReceived
default void sessionPeerIdentificationReceived(Session session, java.lang.String version, java.util.List<java.lang.String> extraLines)
The peer's identification version was received- Parameters:
session- TheSessioninstanceversion- The retrieved identification versionextraLines- Extra data preceding the identification- See Also:
- RFC 4253 - section 4.2 - Protocol Version Exchange
-
sessionNegotiationStart
default void sessionNegotiationStart(Session session, java.util.Map<KexProposalOption,java.lang.String> clientProposal, java.util.Map<KexProposalOption,java.lang.String> serverProposal)
Signals the start of the negotiation options handling- Parameters:
session- The referencedSessionclientProposal- The client proposal options (un-modifiable)serverProposal- The server proposal options (un-modifiable)
-
sessionNegotiationEnd
default void sessionNegotiationEnd(Session session, java.util.Map<KexProposalOption,java.lang.String> clientProposal, java.util.Map<KexProposalOption,java.lang.String> serverProposal, java.util.Map<KexProposalOption,java.lang.String> negotiatedOptions, java.lang.Throwable reason)
Signals the end of the negotiation options handling- Parameters:
session- The referencedSessionclientProposal- The client proposal options (un-modifiable)serverProposal- The server proposal options (un-modifiable)negotiatedOptions- The successfully negotiated options so far - even if exception occurred (un-modifiable)reason- Negotiation end reason -nullif successful
-
sessionEvent
default void sessionEvent(Session session, SessionListener.Event event)
An event has been triggered- Parameters:
session- The referencedSessionevent- The generatedSessionListener.Event
-
sessionException
default void sessionException(Session session, java.lang.Throwable t)
An exception was caught and the session will be closed (if not already so). Note: the code makes no guarantee that at this stagesessionClosed(Session)will be called or perhaps has already been called- Parameters:
session- The referencedSessiont- The caught exception
-
sessionDisconnect
default void sessionDisconnect(Session session, int reason, java.lang.String msg, java.lang.String language, boolean initiator)
Invoked whenSSH_MSG_DISCONNECTmessage was sent/received- Parameters:
session- The referencedSessionreason- The signaled reason codemsg- The provided description message (may be empty)language- The language tag indicator (may be empty)initiator- Whether the session is the sender or recipient of the message- See Also:
- RFC 4253 - section 11.1
-
sessionClosed
default void sessionClosed(Session session)
A session has been closed- Parameters:
session- The closedSession
-
validateListener
static <L extends SessionListener> L validateListener(L listener)
-
-