C++ UA Server SDK  1.5.0.318
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
UaSession Class Reference

Class used to manage a OPC UA client session in the server. More...

#include <uasession.h>

Inherits Session.

Public Member Functions

 UaSession (OpcUa_Int32 sessionId, const UaNodeId &authenticationToken)
 construction More...
 
virtual UaStatus close (OpcUa_Boolean deleteSubscriptions)
 Close the session This method is called if the Client closes the UaSession with the service CloseSession or if the internal clean up routine is closing the UaSession after a UaSession timeout. More...
 
virtual OpcUa_Boolean matchUser (UaSession *pOtherSession)
 Check if the user in both sessions is the same. More...
 
virtual UaStatus queuePublishRequest (UaPublishContext *pUaPublishContext, UaSubscription **ppSubscription)
 Queue a Publish context for the session. More...
 
virtual UaPublishContextgetPublishRequest ()
 Returns a Publish context if one is available for the session. More...
 
virtual void setSecureChannelInvalid ()
 Invalidate the secure channel assigned to the session. More...
 
virtual void checkResponseLock ()
 Lock if a response is processed. More...
 
virtual UaStatus queueSubscriptionForPublish (UaSubscription *pSubscription)
 Queue a subscriptions that is waiting for a publish. More...
 
virtual void queueSubscriptionStatusChangeNotification (OpcUa_UInt32 subscriptionId, const UaStatus &status)
 Queue a StatusChangeNotification for a subscription. More...
 
virtual UaStatus subscriptionCreated (UaSubscription *pSubscription)
 A new subscription in the session context was created. More...
 
virtual UaStatus subscriptionInvalidated (UaSubscription *pSubscription)
 A subscription in the session context was invalidated. More...
 
virtual void sendSubscriptionStatusChangeNotification (UaPublishContext *pUaPublishContext, OpcUa_UInt32 subscriptionId, const UaStatus &status)
 Send a StatusChangeNotification. More...
 
virtual RegisteredNodegetRegisteredNode (OpcUa_UInt32 handle) const
 Returns the registered node for a handle. More...
 
virtual OpcUa_UInt32 addRegisteredNode (RegisteredNode *pRegisteredNode)
 Adds a registered node and returns a handle. More...
 
virtual UaStatusCode removeRegisteredNode (OpcUa_UInt32 handle)
 Removes a registered node. More...
 
void lockSendResponse ()
 Lock access to UA Stack EndSendResponse method. More...
 
void unlockSendResponse ()
 Unlock access to UA Stack EndSendResponse method. More...
 
void startingServiceProcessing ()
 Called to increment the active service counter.
 
void finishedServiceProcessing ()
 Called to decrement the active service counter.
 
OpcUa_UInt32 activeServiceCount () const
 Get count of Service currently processed by the server. More...
 
void setServerNonce (const OpcUa_ByteString *pServerNonce)
 Set the last created server nonce The server nonce gets created during CreateSession or ActiveSession. More...
 
const OpcUa_ByteStringgetServerNonce () const
 Returns the last created server nonce The server nonce gets created during CreateSession or ActiveSession. More...
 
virtual void setEndpoint (UaEndpoint *pEndpoint)
 Set the endpoint data object containing information about the endpoint used by the client for this session.
 
virtual UaEndpointpEndpoint () const
 Get the endpoint data object containing information about the endpoint used by the client for this session.
 
virtual OpcUa_UInt64 getSecureChannelKey () const
 Returns an unique key to identify the secure channel in the session manager. More...
 
- Public Member Functions inherited from Session
 Session (OpcUa_Int32 sessionId, const UaNodeId &authenticationToken)
 construction More...
 
virtual UaStatus open (const UaString &sessionName, const UaByteString clientCertificate, OpcUa_UInt32 sessionTimeout)
 Open the session. More...
 
virtual UaStatus activate (OpcUa_UInt32 uSecureChannelId, UaUserIdentityToken *pUserIdentityToken, const UaStringArray &localeIDs)
 Activate the session. More...
 
virtual OpcUa_Boolean hasExpired () const
 Checks if the session timeout expired. More...
 
virtual UaStatus isValid (OpcUa_UInt32 uSecureChannelId)
 Checks if the session is valid. More...
 
virtual void setInvalid ()
 Set the state of the session to invalid.
 
OpcUa_Boolean isActivated ()
 Get flag indicating if session was activated. More...
 
UaDateTime lastTimeoutReset ()
 Get time the session timeout was reset. More...
 
virtual OpcUa_Boolean mustDelete ()
 Checks if the session must be deleted. More...
 
virtual OpcUa_Boolean isSecureChannelValid ()
 Check if the secure channel assigned to the session is valid. More...
 
virtual void setSecureChannelValid ()
 Validate the secure channel assigned to the session. More...
 
virtual UaStatus queueBrowseContext (BrowseContext *pBCP, OpcUa_ByteString *pCP)
 Queue a browse continuation point. More...
 
virtual BrowseContextgetBrowseContext (OpcUa_ByteString *pCP)
 Get a browse continuation point. More...
 
virtual OpcUa_UInt16 getMaxBrowseCPs ()
 Get the maximum number of browse continuation points. More...
 
virtual UaStatus queueQueryContext (QueryContext *pBCP, OpcUa_ByteString *pCP)
 Queue a query continuation point. More...
 
virtual QueryContextgetQueryContext (OpcUa_ByteString *pCP)
 Get a query continuation point. More...
 
virtual UaStatus queueHistoryReadCP (HistoryReadCPUserDataBase *pHistoryReadCP, OpcUa_ByteString *pCP)
 Queue a history read continuation point. More...
 
virtual HistoryReadCPUserDataBasegetHistoryReadCP (OpcUa_ByteString *pCP)
 Get a history read continuation point. More...
 
void registerSessionCallback (SessionCallback *pCallback)
 Register callback interface of object interested in the session status.
 
void unregisterSessionCallback (SessionCallback *pCallback)
 Unregister callback interface of object not longer interested in the session status.
 
void resetTimeout ()
 Reset session timeout. More...
 
void getSessionNodeId (OpcUa_NodeId &sessionId) const
 Returns the NodeId of the session. More...
 
OpcUa_Int32 getIntegerSessionId () const
 Returns the integer ID of the session. More...
 
void getAuthenticationToken (OpcUa_NodeId &authenticationToken) const
 Returns the private ID of the session This ID is private to the client and server application and must be kept private inside the management of the session in the client and server code. More...
 
OpcUa_UInt32 getSessionTimeout () const
 Returns the timeout of the session. More...
 
UaString getSessionName () const
 Returns the name of the session. More...
 
OpcUa_UInt32 getSecureChannelId () const
 Returns the ID of the SecureChannel assigned to the session. More...
 
void setSecureChannelSecurityPolicy (const UaString &sSecurityPolicy)
 Sets the security policy of the secure channel active for this session.
 
UaString getSecureChannelSecurityPolicy () const
 Returns the security policy of the secure channel active for this session.
 
void setSecureChannelMessageSecurityMode (OpcUa_MessageSecurityMode messageSecurityMode)
 Sets the message security mode of the secure channel active for this session.
 
OpcUa_MessageSecurityMode getSecureChannelMessageSecurityMode () const
 Returns the message security mode of the secure channel active for this session.
 
void setSecureChannelEndpointConfiguration (const UaEndpoint *pEndpoint)
 Sets the server endpoint configuration used by the secure channel active for this session.
 
const UaEndpointgetSecureChannelEndpointConfiguration () const
 Returns the server endpoint configuration used by the secure channel active for this session.
 
const OpcUa_ByteStringgetClientCertificate () const
 Returns the client certificate of the client created the session. More...
 
void setClientApplicationDescription (const UaApplicationDescription &clientApplicationDescription)
 Sets the client application description that contains ApplicationUri, ProductUri, ApplicationName and ApplicationType.
 
UaApplicationDescription getClientApplicationDescription () const
 Returns the client application description that contains ApplicationUri, ProductUri, ApplicationName and ApplicationType.
 
void setClientNetworkAddress (const UaString &clientNetworkAddress)
 Sets the client network address used to communicate with the server through this session.
 
UaString getClientNetworkAddress () const
 Returns the client network address used to communicate with the server through this session.
 
UaString getLocalId () const
 Get the first local Id used for the session. More...
 
const UaStringArraygetLocalIds () const
 Get a pointer to the list of all local Ids used for the session. More...
 
UaStringArray getLocalIdArray () const
 Get the list of all localIds used for the session. More...
 
void setClientUserId (const UaString &sClientUserId)
 Sets the client user id for the session. More...
 
UaString getClientUserId () const
 Returns the client user id for the session. More...
 
- Public Member Functions inherited from ReferenceCounter
 ReferenceCounter ()
 construction
 
virtual ~ReferenceCounter ()
 destruction
 

Protected Member Functions

virtual ~UaSession ()
 Prohibit use of default destructor.
 
- Protected Member Functions inherited from Session
 Session ()
 Prohibit use of default constructor.
 
virtual ~Session ()
 Prohibit use of destructor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Session
static OpcUa_UInt64 getSecureChannelKey (UaEndpoint *pEndpoint, OpcUa_UInt32 uSecureChannelId)
 Returns an unique key to identify the secure channel in the session manager. More...
 

Detailed Description

Class used to manage a OPC UA client session in the server.

It manages all OPC UA session relevant settings. All general session settings including the lifetime of the session are managed by the Session class which this class is derived from. The object is reference counted and can not be deleted directly.

Constructor & Destructor Documentation

UaSession::UaSession ( OpcUa_Int32  sessionId,
const UaNodeId authenticationToken 
)

construction

Parameters
sessionIdthe id of the current UaSession.
authenticationTokenSecret session Id created by the server application.

Member Function Documentation

OpcUa_UInt32 UaSession::activeServiceCount ( ) const

Get count of Service currently processed by the server.

Returns
the number of actual available Services.
OpcUa_UInt32 UaSession::addRegisteredNode ( RegisteredNode pRegisteredNode)
virtual

Adds a registered node and returns a handle.

Parameters
pRegisteredNodethe actual registered Node to add.
Returns
Handle for the node
void UaSession::checkResponseLock ( )
virtual

Lock if a response is processed.

Reimplemented from Session.

UaStatus UaSession::close ( OpcUa_Boolean  deleteSubscriptions)
virtual

Close the session This method is called if the Client closes the UaSession with the service CloseSession or if the internal clean up routine is closing the UaSession after a UaSession timeout.

Parameters
deleteSubscriptionsIndicates if the subscriptions should be deleted by the server
Returns
Error code

Reimplemented from Session.

UaPublishContext * UaSession::getPublishRequest ( )
virtual

Returns a Publish context if one is available for the session.

Returns
a Publish context for the session.
RegisteredNode * UaSession::getRegisteredNode ( OpcUa_UInt32  handle) const
virtual

Returns the registered node for a handle.

Parameters
handleHandle for the node.
Returns
Registered Node Information
OpcUa_UInt64 UaSession::getSecureChannelKey ( ) const
virtual

Returns an unique key to identify the secure channel in the session manager.

Returns
The key built out of the secureChannelId and the endpoint index.

Reimplemented from Session.

const OpcUa_ByteString * UaSession::getServerNonce ( ) const

Returns the last created server nonce The server nonce gets created during CreateSession or ActiveSession.

Returns
a pointer to the ServerNonce information.
void UaSession::lockSendResponse ( )

Lock access to UA Stack EndSendResponse method.

OpcUa_Boolean UaSession::matchUser ( UaSession pOtherSession)
virtual

Check if the user in both sessions is the same.

This method is used to check if the user in both sessions is identical. This is used in transfer subscription. The method can be overwritten in a derived class if a special user handling is implemented.

Parameters
pOtherSessionThe other session to compare with.
Returns
True if the users of both sessions are identical, False if they are different.
UaStatus UaSession::queuePublishRequest ( UaPublishContext pUaPublishContext,
UaSubscription **  ppSubscription 
)
virtual

Queue a Publish context for the session.

Parameters
pUaPublishContexta pointer to the information of the PublishContext.
ppSubscriptiona pointer to the information of the Subscription.
Returns
Error code
UaStatus UaSession::queueSubscriptionForPublish ( UaSubscription pSubscription)
virtual

Queue a subscriptions that is waiting for a publish.

Parameters
pSubscriptiona pointer to the information of the Subscription.
Returns
Error code
void UaSession::queueSubscriptionStatusChangeNotification ( OpcUa_UInt32  subscriptionId,
const UaStatus status 
)
virtual

Queue a StatusChangeNotification for a subscription.

Parameters
subscriptionIdIdentifier for the Subscription.
statusStatus code for the StatusChangeNotification.
Returns
Error code
UaStatusCode UaSession::removeRegisteredNode ( OpcUa_UInt32  handle)
virtual

Removes a registered node.

Parameters
handleHandle for the node.
void UaSession::sendSubscriptionStatusChangeNotification ( UaPublishContext pUaPublishContext,
OpcUa_UInt32  subscriptionId,
const UaStatus status 
)
virtual

Send a StatusChangeNotification.

Parameters
pUaPublishContexta pointer to the information of the PublishContext.
subscriptionIdIdentifier for the Subscription.
statusStatus code for the StatusChangeNotification.
Returns
Error code
void UaSession::setSecureChannelInvalid ( )
virtual

Invalidate the secure channel assigned to the session.

Reimplemented from Session.

void UaSession::setServerNonce ( const OpcUa_ByteString pServerNonce)

Set the last created server nonce The server nonce gets created during CreateSession or ActiveSession.

Parameters
pServerNoncea pointer to the ServerNonce information.
UaStatus UaSession::subscriptionCreated ( UaSubscription pSubscription)
virtual

A new subscription in the session context was created.

Parameters
pSubscriptiona pointer to the information of the Subscription.
Returns
Error code.
UaStatus UaSession::subscriptionInvalidated ( UaSubscription pSubscription)
virtual

A subscription in the session context was invalidated.

Parameters
pSubscriptiona pointer to the information of the Subscription.
Returns
Error code
void UaSession::unlockSendResponse ( )

Unlock access to UA Stack EndSendResponse method.


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