public interface SessionListener extends SshdEventListener
Modifier and Type | Interface and Description |
---|---|
static class |
SessionListener.Event |
Modifier and Type | Method and Description |
---|---|
default void |
sessionClosed(Session session)
A session has been closed
|
default void |
sessionCreated(Session session)
A new session just been created
|
default void |
sessionDisconnect(Session session,
int reason,
String msg,
String language,
boolean initiator)
Invoked when
SSH_MSG_DISCONNECT message was sent/received |
default void |
sessionEstablished(Session session)
An initial session connection has been established - Caveat emptor: the main difference between this
callback and
sessionCreated(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 void |
sessionEvent(Session session,
SessionListener.Event event)
An event has been triggered
|
default void |
sessionException(Session session,
Throwable t)
An exception was caught and the session will be closed (if not already so).
|
default void |
sessionNegotiationEnd(Session session,
Map<KexProposalOption,String> clientProposal,
Map<KexProposalOption,String> serverProposal,
Map<KexProposalOption,String> negotiatedOptions,
Throwable reason)
Signals the end of the negotiation options handling
|
default void |
sessionNegotiationOptionsCreated(Session session,
Map<KexProposalOption,String> proposal) |
default void |
sessionNegotiationStart(Session session,
Map<KexProposalOption,String> clientProposal,
Map<KexProposalOption,String> serverProposal)
Signals the start of the negotiation options handling
|
default void |
sessionPeerIdentificationLine(Session session,
String line,
List<String> extraLines)
Successfully read a line as part of the initial peer identification
|
default void |
sessionPeerIdentificationReceived(Session session,
String version,
List<String> extraLines)
The peer's identification version was received
|
default void |
sessionPeerIdentificationSend(Session session,
String version,
List<String> extraLines)
About to send identification to peer
|
static <L extends SessionListener> |
validateListener(L listener) |
validateListener
default void sessionEstablished(Session session)
sessionCreated(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.session
- The established Session
default void sessionCreated(Session session)
session
- The created Session
default void sessionPeerIdentificationSend(Session session, String version, List<String> extraLines)
session
- The Session
instanceversion
- The resolved identification versionextraLines
- Extra data preceding the identification to be sent. Note: the list is modifiable only if
this is a server session. The user may modify it based on the peer.default void sessionPeerIdentificationLine(Session session, String line, List<String> extraLines)
session
- The Session
instanceline
- The data that was read so far - Note: might not be a full line if more packets are
required for full identification data. Furthermore, it may be repeated data due to
packets segmentation and re-assembly mechanismextraLines
- Previous lines that were before this one - Note: it may be repeated data due to
packets segmentation and re-assembly mechanismdefault void sessionPeerIdentificationReceived(Session session, String version, List<String> extraLines)
session
- The Session
instanceversion
- The retrieved identification versionextraLines
- Extra data preceding the identificationdefault void sessionNegotiationOptionsCreated(Session session, Map<KexProposalOption,String> proposal)
session
- The referenced Session
proposal
- The proposals that will be sent to the peer - Caveat emptor: the proposal is
modifiable i.e., the handler can modify it before being sentdefault void sessionNegotiationStart(Session session, Map<KexProposalOption,String> clientProposal, Map<KexProposalOption,String> serverProposal)
session
- The referenced Session
clientProposal
- The client proposal options (un-modifiable)serverProposal
- The server proposal options (un-modifiable)default void sessionNegotiationEnd(Session session, Map<KexProposalOption,String> clientProposal, Map<KexProposalOption,String> serverProposal, Map<KexProposalOption,String> negotiatedOptions, Throwable reason)
session
- The referenced Session
clientProposal
- 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 - null
if successfuldefault void sessionEvent(Session session, SessionListener.Event event)
session
- The referenced Session
event
- The generated SessionListener.Event
default void sessionException(Session session, Throwable t)
sessionClosed(Session)
will be called or perhaps has already been calledsession
- The referenced Session
t
- The caught exceptiondefault void sessionDisconnect(Session session, int reason, String msg, String language, boolean initiator)
SSH_MSG_DISCONNECT
message was sent/receivedsession
- The referenced Session
reason
- 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 messagedefault void sessionClosed(Session session)
session
- The closed Session
static <L extends SessionListener> L validateListener(L listener)
Copyright © 2008–2024 The Apache Software Foundation. All rights reserved.