open62541pp 0.16.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.6
Examples
server_accesscontrol.cpp.

Definition at line 20 of file session.hpp.

Public Member Functions

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

Constructor & Destructor Documentation

◆ Session()

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

Definition at line 22 of file session.hpp.

Member Function Documentation

◆ connection() [1/2]

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

Get the server instance.

Definition at line 27 of file session.hpp.

◆ connection() [2/2]

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

Get the server instance.

Definition at line 32 of file session.hpp.

◆ id()

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

Get the session identifier.

Definition at line 37 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