open62541pp 0.17.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
opcua::Session Class Reference

#include <session.hpp>

Detailed Description

High-level session class to manage client sessions.

Sessions are identified by a server-assigned session id (of type NodeId). A session carries attributes in a key-value list. Custom attributes/meta-data can be attached to a session as key-value pairs of QualifiedName and Variant.

See also
https://reference.opcfoundation.org/Core/Part4/v105/docs/5.7
Examples
server_accesscontrol.cpp, server_datasource.cpp, and server_valuecallback.cpp.

Definition at line 20 of file session.hpp.

Public Member Functions

 Session (Server &connection, NodeId sessionId, void *sessionContext) noexcept
 
Serverconnection () noexcept
 
const Serverconnection () const noexcept
 
const NodeIdid () const noexcept
 
void * context () noexcept
 
const void * context () const noexcept
 
Variant getSessionAttribute (const QualifiedName &key)
 
void setSessionAttribute (const QualifiedName &key, const Variant &value)
 
void deleteSessionAttribute (const QualifiedName &key)
 
void close ()
 

Related Symbols

(Note that these are not member symbols.)

bool operator== (const Session &lhs, const Session &rhs) noexcept
 
bool operator!= (const Session &lhs, const Session &rhs) noexcept
 

Constructor & Destructor Documentation

◆ Session()

opcua::Session::Session ( Server & connection,
NodeId sessionId,
void * sessionContext )
inlinenoexcept

Definition at line 22 of file session.hpp.

Member Function Documentation

◆ connection() [1/2]

Server & opcua::Session::connection ( )
inlinenoexcept

Get the server instance.

Examples
server_valuecallback.cpp.

Definition at line 28 of file session.hpp.

◆ connection() [2/2]

const Server & opcua::Session::connection ( ) const
inlinenoexcept

Get the server instance.

Definition at line 33 of file session.hpp.

◆ id()

const NodeId & opcua::Session::id ( ) const
inlinenoexcept

Get the session identifier.

Definition at line 38 of file session.hpp.

◆ context() [1/2]

void * opcua::Session::context ( )
inlinenoexcept

Get the session context.

Definition at line 43 of file session.hpp.

◆ context() [2/2]

const void * opcua::Session::context ( ) const
inlinenoexcept

Get the session context.

Definition at line 48 of file session.hpp.

◆ getSessionAttribute()

Variant opcua::Session::getSessionAttribute ( const QualifiedName & key)

Get a session attribute by its key.

Note
Supported since open62541 v1.3
Examples
server_accesscontrol.cpp.

◆ setSessionAttribute()

void opcua::Session::setSessionAttribute ( const QualifiedName & key,
const Variant & value )

Attach a session attribute as a key-value pair.

Note
Supported since open62541 v1.3
Examples
server_accesscontrol.cpp.

◆ deleteSessionAttribute()

void opcua::Session::deleteSessionAttribute ( const QualifiedName & key)

Delete a session attribute by its key.

Note
Supported since open62541 v1.3

◆ close()

void opcua::Session::close ( )

Manually close this session.

Note
Supported since open62541 v1.3

Friends And Related Symbol Documentation

◆ operator==()

bool operator== ( const Session & lhs,
const Session & rhs )
related

◆ operator!=()

bool operator!= ( const Session & lhs,
const Session & rhs )
related