Class definition of the SessionManager. Manages the Sessions and creates Secure Channels. It is not possible to create plane copies of this Class. More...

#include <sessionmanager.h>

Collaboration diagram for SessionManager:

List of all members.

Public Member Functions

 SessionManager ()
virtual ~SessionManager ()
UaStatus startUp (ServerConfig *pServerConfig, NodeManagerRoot *pNodeManagerRoot)
UaStatus shutDown ()
UaStatus closeAllUaSessions ()
UaStatus createSession (const UaString &sessionName, const UaByteString &clientCertificate, OpcUa_Double requestedSessionTimeout, OpcUa_Double &revisedSessionTimeout, Session **session)
UaStatus activateSession (const OpcUa_NodeId *authenticationToken, OpcUa_UInt32 uSecureChannelId, const UaStringArray &localeIDs, UaUserIdentityToken *pUserIdentityToken)
SessiongetSession (const OpcUa_NodeId *authenticationToken, OpcUa_Boolean updateSession)
UaStatus closeSession (const OpcUa_NodeId *authenticationToken, OpcUa_Boolean deleteSubscriptions)
void secureChannelCreated (OpcUa_UInt32 uSecureChannelId, const UaString &sSecurityPolicy, OpcUa_UInt16 uSecurityMode)
void secureChannelDeleted (OpcUa_UInt32 uSecureChannelId)
OpcUa_UInt32 startServerShutDown ()
UaStatus purge ()

Static Public Member Functions

static UaDateTime getLastSystemTimeChange ()

Protected Member Functions

virtual void sessionOpened (Session *)
virtual void sessionActivated (Session *)
virtual void sessionClosed (Session *, OpcUa_Boolean)
virtual OpcUa_Int32 getNewSessionId ()

Protected Attributes

UaMutex m_mutex
std::map< OpcUa_Int32, Session * > m_mapSessions
std::map< OpcUa_UInt32,
std::list< Session * > > 
m_mapSecureChannels
OpcUa_Int32 m_lastSessionID
OpcUa_Boolean m_isStarted
ServerConfigm_pServerConfig
NodeManagerRootm_pNodeManagerRoot
OpcUa_UInt16 m_SessionIdNamespaceIndex
OpcUa_Boolean m_isShutdownStarted

Static Protected Attributes

static OpcUa_DateTime s_lastPurge
static OpcUa_DateTime s_timeOfLastSystemTimeChangeDetected

Detailed Description

Class definition of the SessionManager. Manages the Sessions and creates Secure Channels. It is not possible to create plane copies of this Class.

SessionManager


Constructor & Destructor Documentation

SessionManager::SessionManager (  )

construction

SessionManager::~SessionManager (  ) [virtual]

destruction


Member Function Documentation

UaStatus SessionManager::activateSession ( const OpcUa_NodeId *  authenticationToken,
OpcUa_UInt32  uSecureChannelId,
const UaStringArray &  localeIDs,
UaUserIdentityToken pUserIdentityToken 
)

Acivate a session.

Parameters:
localeIDsList of locale ids in priority order for localized strings.
authenticationTokenSecret session Id created by the server application.
uSecureChannelIdthe SecureChannelId to be deleted.
pUserIdentityTokenUser identity token contained in an ExtensionObject used to handle different types of user identity tokens like user/password or an X509 certificate. It provides the credentials of the user associated with the Client application. The implementation of this method must use these credentials to determine whether the Client should be allowed to activate a Session and what resources the Client has access to during this Session. If the method is not able to validate the user or if the user has no right to access the server, the method must return the status code OpcUa_BadUserAccessDenied.
Returns:
Error code
UaStatus SessionManager::closeAllUaSessions (  )

Close all sessions created via the UA communication channel

Returns:
Error code
UaStatus SessionManager::closeSession ( const OpcUa_NodeId *  authenticationToken,
OpcUa_Boolean  deleteSubscriptions 
)

Close a session identified by session ID

Parameters:
authenticationTokenSecret session Id created by the server application.
deleteSubscriptionsIndicates if the subscriptions should be deleted by the server
Returns:
Error code.
UaStatus SessionManager::createSession ( const UaString sessionName,
const UaByteString clientCertificate,
OpcUa_Double  requestedSessionTimeout,
OpcUa_Double &  revisedSessionTimeout,
Session **  session 
)

Create a session.

Parameters:
sessionNamethe name of the Session to be build.
clientCertificatethe certificate the Client sends to the Server.
requestedSessionTimeoutRequested number of milliseconds that the session should remain open without activity.
revisedSessionTimeoutReturned number of milliseconds that the session remains open without activity.
sessionInterface to the Session context for the method call
Returns:
Error code
UaDateTime SessionManager::getLastSystemTimeChange (  ) [static]

Returns the time when a system time change was detected

OpcUa_Int32 SessionManager::getNewSessionId (  ) [protected, virtual]

Returns a new unique session id The method can be overwritten by a derived class

Session * SessionManager::getSession ( const OpcUa_NodeId *  authenticationToken,
OpcUa_Boolean  updateSession 
)

Get a session by authenticationToken

Parameters:
authenticationTokenServer unique node id that identifies the session.
updateSessionIndicates if the timeout of the returned session should be updated.
Returns:
Corresponding session for passed session ID
UaStatus SessionManager::purge (  )

Purge all sessions which are marked to delete

Returns:
Error code
void SessionManager::secureChannelCreated ( OpcUa_UInt32  uSecureChannelId,
const UaString sSecurityPolicy,
OpcUa_UInt16  uSecurityMode 
)

Event to inform session manager about creation of a secure channel

Parameters:
uSecureChannelIdthe SecureChannelId to be deleted.
sSecurityPolicythe policies needed for the secure channel.
uSecurityModethe security mode, if the event type refers to a secure channel.
void SessionManager::secureChannelDeleted ( OpcUa_UInt32  uSecureChannelId )

Event to inform session manager about deletion of a secure channel

Parameters:
uSecureChannelIdthe SecureChannelId to be deleted.
virtual void SessionManager::sessionActivated ( Session  ) [inline, protected, virtual]

Event for derived classes indicating that a session was activated.

Parameters:
sessionInterface pointer of the activated Session.
virtual void SessionManager::sessionClosed ( Session ,
OpcUa_Boolean   
) [inline, protected, virtual]

Event for derived classes indicating that a session was closed.

Parameters:
sessionInterface pointer of the closed Session.
deleteSubscriptionsFlag indicating if subscriptions are also deleted.
virtual void SessionManager::sessionOpened ( Session  ) [inline, protected, virtual]

Event for derived classes indicating that a new session was opened.

Parameters:
sessionInterface pointer of the new Session.
UaStatus SessionManager::shutDown (  )

Shut down session manager. Shut down method for session manager.

Returns:
Error code
OpcUa_UInt32 SessionManager::startServerShutDown (  )

Inform the session manager about the shutdown of the server.

Returns:
Number of active client connections.
UaStatus SessionManager::startUp ( ServerConfig pServerConfig,
NodeManagerRoot pNodeManagerRoot 
)

Initialize method for session manager.

Parameters:
pServerConfigServer configuration object.
pNodeManagerRoota pointer to the root NodeManager.
Returns:
Error code

Member Data Documentation

OpcUa_Boolean SessionManager::m_isShutdownStarted [protected]

Flag that indicates that the shutdown of the server was started

OpcUa_Boolean SessionManager::m_isStarted [protected]

Flag that indicates the status of the manager

OpcUa_Int32 SessionManager::m_lastSessionID [protected]

Last used session ID. Session ID must be unique in the server instance

std::map<OpcUa_UInt32, std::list<Session*> > SessionManager::m_mapSecureChannels [protected]

Map of session objects based on secure channel Id

std::map< OpcUa_Int32, Session* > SessionManager::m_mapSessions [protected]

Map of session objects based on session Id

Mutex to control access to the SessionManager object

Root node manager

Server configuration object

Namespace index used for the session node ids

OpcUa_DateTime SessionManager::s_lastPurge [static, protected]

Time of the last purge call

OpcUa_DateTime SessionManager::s_timeOfLastSystemTimeChangeDetected [static, protected]

The time when a system time change was detected


The documentation for this class was generated from the following files:
  • /home/buildbot/work/uasdkcpp/src/uaserver/uaservercpp/coremodule/sessionmanager.h
  • /home/buildbot/work/uasdkcpp/src/uaserver/uaservercpp/coremodule/sessionmanager.cpp