public interface Session extends Closeable
| Modifier and Type | Interface and Description |
|---|---|
static class |
Session.AttributeKey<T>
Type safe key for storage within the user attributes of
AbstractSession. |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(SessionListener listener)
Add a session |listener|.
|
Buffer |
createBuffer(byte cmd)
Create a new buffer for the specified SSH packet and reserve the needed space
(5 bytes) for the packet header.
|
Buffer |
createBuffer(byte cmd,
int estimatedSize)
Create a new buffer for the specified SSH packet and reserve the needed space
(5 bytes) for the packet header.
|
void |
exceptionCaught(java.lang.Throwable t)
Handle any exceptions that occured on this session.
|
<T> T |
getAttribute(Session.AttributeKey<T> key)
Returns the value of the user-defined attribute of this session.
|
java.lang.String |
getClientVersion()
Retrieve the client version for this session.
|
FactoryManager |
getFactoryManager()
Retrieve the FactoryManager that has created this session
|
int |
getIntProperty(java.lang.String name,
int defaultValue)
Retrieve a configuration property as an integer
|
java.lang.String |
getServerVersion()
Retrieve the server version for this session.
|
java.lang.String |
getUsername()
Retrieve the name of the user authenticated on this session
or null if the session has not been authenticated yet.
|
SshFuture |
reExchangeKeys()
Initiate a new key exchange.
|
void |
removeListener(SessionListener listener)
Remove a session |listener|.
|
Buffer |
request(Buffer buffer)
Send a global request and wait for the response.
|
<T,E extends T> |
setAttribute(Session.AttributeKey<T> key,
E value)
Sets a user-defined attribute.
|
IoWriteFuture |
writePacket(Buffer buffer)
Encode and send the given buffer.
|
<T> T getAttribute(Session.AttributeKey<T> key)
key - the key of the attribute; must not be null.<T,E extends T> T setAttribute(Session.AttributeKey<T> key, E value)
key - the key of the attribute; must not be null.value - the value of the attribute; must not be null.java.lang.String getUsername()
java.lang.String getClientVersion()
java.lang.String getServerVersion()
FactoryManager getFactoryManager()
int getIntProperty(java.lang.String name,
int defaultValue)
name - the name of the propertydefaultValue - the default valueBuffer createBuffer(byte cmd)
cmd - the SSH commandBuffer createBuffer(byte cmd, int estimatedSize)
cmd - the SSH commandestimatedSize - estimated number of bytes the buffer will hold, 0 if unknown.IoWriteFuture writePacket(Buffer buffer) throws java.io.IOException
buffer - the buffer to encode and sendjava.io.IOException - if an error occured when encoding sending the packetBuffer request(Buffer buffer) throws java.io.IOException
buffer - the buffer containing the global requestnull otherwise.java.io.IOException - if an error occurred when encoding sending the packetvoid exceptionCaught(java.lang.Throwable t)
SshException.t - the exception to processvoid addListener(SessionListener listener)
listener - the session listener to addvoid removeListener(SessionListener listener)
listener - the session listener to removeSshFuture reExchangeKeys() throws java.io.IOException
java.io.IOExceptionCopyright © 2008-2014 The Apache Software Foundation. All Rights Reserved.