open62541pp 0.16.0
C++ wrapper of open62541
|
#include <server.hpp>
High-level server class.
A server is usually created in two steps:
The server expects that the configuration is not modified during runtime.
Use the handle() method to get access the underlying UA_Server instance and use the full power of open62541.
Don't overwrite the UA_ServerConfig::context pointer! The context pointer is used to store a pointer to the Server instance (for asWrapper(UA_Server*)) and to get access to the underlying server context.
Definition at line 132 of file server.hpp.
Public Member Functions | |
Server () | |
Server (ServerConfig &&config) | |
Server (uint16_t port, const ByteString &certificate={}) | |
Server (uint16_t port, const ByteString &certificate, const ByteString &privateKey, Span< const ByteString > trustList, Span< const ByteString > issuerList, Span< const ByteString > revocationList={}) | |
~Server () | |
Server (const Server &)=delete | |
Server (Server &&other) noexcept | |
Server & | operator= (const Server &)=delete |
Server & | operator= (Server &&other) noexcept |
ServerConfig & | config () noexcept |
const ServerConfig & | config () const noexcept |
void | setLogger (LogFunction logger) |
void | setApplicationUri (std::string_view uri) |
void | setProductUri (std::string_view uri) |
void | setApplicationName (std::string_view name) |
void | setCustomHostname (std::string_view hostname) |
void | setAccessControl (AccessControlBase &accessControl) |
void | setAccessControl (std::unique_ptr< AccessControlBase > &&accessControl) |
void | setCustomDataTypes (Span< const DataType > dataTypes) |
std::vector< Session > | getSessions () |
std::vector< std::string > | getNamespaceArray () |
NamespaceIndex | registerNamespace (std::string_view uri) |
void | setVariableNodeValueCallback (const NodeId &id, ValueCallback callback) |
void | setVariableNodeValueBackend (const NodeId &id, ValueBackendDataSource backend) |
Subscription< Server > | createSubscription () noexcept |
Event | createEvent (const NodeId &eventType=ObjectTypeId::BaseEventType) |
uint16_t | runIterate () |
void | run () |
void | stop () |
bool | isRunning () const noexcept |
Node< Server > | getNode (NodeId id) |
Node< Server > | getRootNode () |
Node< Server > | getObjectsNode () |
Node< Server > | getTypesNode () |
Node< Server > | getViewsNode () |
UA_Server * | handle () noexcept |
const UA_Server * | handle () const noexcept |
Friends | |
detail::ServerContext & | detail::getContext (Server &server) noexcept |
opcua::Server::Server | ( | ) |
Create server with default configuration.
|
explicit |
Create server with given configuration (move ownership to server).
|
inlineexplicit |
Create server config with minimal configuration.
Security policies:
port | Port number |
certificate | Optional X.509 v3 certificate in DER encoded format |
Definition at line 142 of file server.hpp.
|
inline |
Create server config with encryption enabled (PKI).
Security policies:
port | Port number |
certificate | X.509 v3 certificate in DER encoded format |
privateKey | Private key in PEM encoded format |
trustList | List of trusted certificates in DER encoded format |
issuerList | List of issuer certificates (i.e. CAs) in DER encoded format |
revocationList | Certificate revocation lists (CRL) in DER encoded format |
Definition at line 155 of file server.hpp.
opcua::Server::~Server | ( | ) |
|
delete |
|
noexcept |
|
noexcept |
Referenced by setAccessControl(), setAccessControl(), setApplicationName(), setApplicationUri(), setLogger(), and setProductUri().
|
noexcept |
|
inline |
Definition at line 178 of file server.hpp.
|
inline |
Definition at line 183 of file server.hpp.
|
inline |
Definition at line 188 of file server.hpp.
|
inline |
Definition at line 193 of file server.hpp.
void opcua::Server::setCustomHostname | ( | std::string_view | hostname | ) |
Set custom hostname, default: system's host name.
|
inline |
Definition at line 202 of file server.hpp.
|
inline |
Definition at line 207 of file server.hpp.
Set custom data types.
All data types provided are automatically considered for decoding of received messages.
std::vector< Session > opcua::Server::getSessions | ( | ) |
Get active server session.
std::vector< std::string > opcua::Server::getNamespaceArray | ( | ) |
Get all defined namespaces.
|
nodiscard |
Register namespace. The new namespace index will be returned.
void opcua::Server::setVariableNodeValueCallback | ( | const NodeId & | id, |
ValueCallback | callback ) |
Set value callbacks to execute before every read and after every write operation.
void opcua::Server::setVariableNodeValueBackend | ( | const NodeId & | id, |
ValueBackendDataSource | backend ) |
Set data source backend for variable node.
|
noexcept |
Create a (pseudo) subscription to monitor local data changes and events.
Event opcua::Server::createEvent | ( | const NodeId & | eventType = ObjectTypeId::BaseEventType | ) |
Create an event object to generate and trigger events.
uint16_t opcua::Server::runIterate | ( | ) |
Run a single iteration of the server's main loop.
void opcua::Server::run | ( | ) |
Run the server's main loop. This method will block until Server::stop is called.
void opcua::Server::stop | ( | ) |
Stop the server's main loop.
|
noexcept |
Check if the server is running.
|
noexcept |
|
noexcept |
|
friend |