org.apache.sshd.server.session
Class ServerSession

java.lang.Object
  extended by org.apache.sshd.common.session.AbstractSession
      extended by org.apache.sshd.server.session.ServerSession
All Implemented Interfaces:
Session

public class ServerSession
extends AbstractSession

TODO: handle key re-exchange key re-exchange should be performed after each gigabyte of transferred data or one hour time connection (see RFC4253, section 9) TODO: better use of SSH_MSG_DISCONNECT and disconnect error codes TODO Add javadoc

Author:
Apache MINA SSHD Project

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.sshd.common.Session
Session.AttributeKey<T>
 
Field Summary
 
Fields inherited from class org.apache.sshd.common.session.AbstractSession
attributes, authed, channels, clientProposal, clientVersion, closeFuture, closing, decodeLock, decoderBuffer, decoderLength, decoderState, encodeLock, factoryManager, I_C, I_S, inCipher, inCipherSize, inCompression, inMac, inMacResult, ioSession, kex, listeners, lock, log, negociated, nextChannelId, outCipher, outCipherSize, outCompression, outMac, random, seqi, seqo, serverProposal, serverVersion, SESSION, sessionId, uncompressBuffer, username
 
Constructor Summary
ServerSession(FactoryManager server, org.apache.mina.core.session.IoSession ioSession)
           
 
Method Summary
 CloseFuture close(boolean immediately)
          Close this session.
 String createX11Display(boolean singleConnection, String authenticationProtocol, String authenticationCookie, int screen)
           
protected  int getActiveSessionCountForUser(String userName)
          Retrieve the current number of sessions active for a given username.
 KeyPair getHostKey()
           
 KeyExchange getKex()
           
 String getNegociated(int index)
           
protected  ScheduledExecutorService getScheduledExecutorService()
           
 ServerFactoryManager getServerFactoryManager()
           
 byte[] getSessionId()
           
protected  void handleMessage(Buffer buffer)
          Abstract method for processing incoming decoded packets.
 String initAgentForward()
           
protected  boolean readIdentification(Buffer buffer)
          Read the other side identification.
 
Methods inherited from class org.apache.sshd.common.session.AbstractSession
addListener, attachSession, channelClose, channelData, channelEof, channelExtendedData, channelFailure, channelOpenConfirmation, channelOpenFailure, channelRequest, channelWindowAdjust, createBuffer, createProposal, decode, disconnect, doReadIdentification, exceptionCaught, getAttribute, getChannel, getFactoryManager, getIntProperty, getIoSession, getNextChannelId, getSession, getSession, getUsername, messageReceived, negociate, notImplemented, receiveKexInit, receiveNewKeys, registerChannel, removeListener, sendIdentification, sendKexInit, sendNewKeys, setAttribute, unregisterChannel, writePacket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerSession

public ServerSession(FactoryManager server,
                     org.apache.mina.core.session.IoSession ioSession)
              throws Exception
Throws:
Exception
Method Detail

close

public CloseFuture close(boolean immediately)
Description copied from class: AbstractSession
Close this session. This method will close all channels, then close the underlying MINA session. The call will not block until the mina session is actually closed.

Overrides:
close in class AbstractSession

getNegociated

public String getNegociated(int index)

getKex

public KeyExchange getKex()

getSessionId

public byte[] getSessionId()

getServerFactoryManager

public ServerFactoryManager getServerFactoryManager()

getScheduledExecutorService

protected ScheduledExecutorService getScheduledExecutorService()

handleMessage

protected void handleMessage(Buffer buffer)
                      throws Exception
Description copied from class: AbstractSession
Abstract method for processing incoming decoded packets. The given buffer will hold the decoded packet, starting from the command byte at the read position. Packets must be processed within this call or be copied because the given buffer is meant to be changed and updated when this method returns.

Specified by:
handleMessage in class AbstractSession
Parameters:
buffer - the buffer containing the packet
Throws:
Exception - if an exeption occurs while handling this packet.

readIdentification

protected boolean readIdentification(Buffer buffer)
                              throws IOException
Description copied from class: AbstractSession
Read the other side identification. This method is specific to the client or server side, but both should call AbstractSession.doReadIdentification(org.apache.sshd.common.util.Buffer) and store the result in the needed property.

Specified by:
readIdentification in class AbstractSession
Parameters:
buffer - the buffer containing the remote identification
Returns:
true if the identification has been fully read or false if more data is needed
Throws:
IOException - if an error occurs such as a bad protocol version

getHostKey

public KeyPair getHostKey()

getActiveSessionCountForUser

protected int getActiveSessionCountForUser(String userName)
Retrieve the current number of sessions active for a given username.

Parameters:
userName - The name of the user
Returns:
The current number of live SshSession objects associated with the user

initAgentForward

public String initAgentForward()
                        throws IOException
Throws:
IOException

createX11Display

public String createX11Display(boolean singleConnection,
                               String authenticationProtocol,
                               String authenticationCookie,
                               int screen)
                        throws IOException
Throws:
IOException


Copyright © 2008-2012 Apache Software Foundation. All Rights Reserved.