MFClient  1.3.0
 All Classes Functions Variables Enumerations
Public Types | Public Member Functions | List of all members
SessionState Class Reference

#include <SessionState.h>

Public Types

enum  State {
  NEW, LOGGING_ON, LOGGED_ON, LOGGING_OUT_USER_INITIATED,
  LOGGING_OUT_SERVER_INITIATED, LOGGED_OUT_POSSIBLE_AUTO_RELOGON, LOGGED_OUT_NO_AUTO_RELOGON
}
 The enumeration of valid Session States.
 

Public Member Functions

 SessionState ()
 Default constructor that sets the state to NEW.
 
State getState ()
 Get the current state enum.
 
void setState (State state)
 Bluntly set the new state.
 
bool logon ()
 
bool logout ()
 
const char * getCurrentStateName ()
 Get a self-documenting text version of the current state.
 
bool isLoggedOn ()
 Is the session logged on?
 
bool isLoggingOn ()
 Is the session currently logging on?
 
State getCurrentState ()
 Get the current state enum value.
 
void logonResponseReceived ()
 
void logoutFromServerReceived ()
 
void logoutResponseFromServerReceived ()
 
bool relogon ()
 If we are logged out and set for autorelogon, do it More...
 
void autoRelogonFailed ()
 Auto relogon failed. Set the state to logged out and possible auto relogon.
 
bool isWaitingForLogoutResponseFromServer ()
 Is the session waiting for a logout response from the server?
 
void disconnected (bool reconnectionPossible)
 
void connectionFailed ()
 Connection attempt failed. Don't try to auto login again.
 
bool isUserInitiatedLogout ()
 Has the user initiated a logout?
 

Detailed Description

SessionState is a simple flyweight class that is used to track the client session status.

Member Function Documentation

void SessionState::disconnected ( bool  reconnectionPossible)
inline

If state is currently logging out due to a client request, we might get disconnected due to an error (stream closed, failure to write etc) these should not cause a reconnect even if they normally would.

Parameters
reconnectionPossible
bool SessionState::logon ( )
inline

Set the state to logging on, if manual logon is possible. Returns true or false depending on whether the state changed to logging on.

void SessionState::logonResponseReceived ( )
inline

Update the state to 'logged on' when the handshake you initiated completes.

bool SessionState::logout ( )
inline

Always want to allow the state to transition to LOGGING_OUT_USER_INITIATED as the user requested it (i.e. we should never disallow that). However it is possible that we should not allow the logout request to be performed if we are not in a state that would allow it (ie. we're LOGGED_OUT_POSSIBLE_AUTO_RELOGON).

Returns
true if logout even can be processed in this state
void SessionState::logoutFromServerReceived ( )
inline

A logout has been received from the server. Set the state to logging out which was initiated by the server.

void SessionState::logoutResponseFromServerReceived ( )
inline

The server has sent a logout response back. The resulting state is LOGGED_OUT_NO_AUTO_RELOGON.

bool SessionState::relogon ( )
inline

If we are logged out and set for autorelogon, do it


The documentation for this class was generated from the following files: