open62541pp 0.18.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 136 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 (UA_Server *native) | |
~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 > | sessions () |
std::vector< Session > | getSessions () |
std::vector< std::string > | namespaceArray () |
std::vector< std::string > | getNamespaceArray () |
NamespaceIndex | registerNamespace (std::string_view uri) |
void | setVariableNodeValueCallback (const NodeId &id, ValueCallbackBase &callback) |
void | setVariableNodeValueCallback (const NodeId &id, std::unique_ptr< ValueCallbackBase > &&callback) |
void | setVariableNodeDataSource (const NodeId &id, DataSourceBase &source) |
void | setVariableNodeDataSource (const NodeId &id, std::unique_ptr< DataSourceBase > &&source) |
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 |
Related Symbols | |
(Note that these are not member symbols.) | |
Server * | asWrapper (UA_Server *server) noexcept |
bool | operator== (const Server &lhs, const Server &rhs) noexcept |
bool | operator!= (const Server &lhs, const Server &rhs) 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 146 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 159 of file server.hpp.
|
explicit |
Create server from native instance (move ownership to server).
opcua::Server::~Server | ( | ) |
|
delete |
|
noexcept |
|
noexcept |
|
noexcept |
|
inline |
Definition at line 185 of file server.hpp.
|
inline |
Definition at line 190 of file server.hpp.
|
inline |
Definition at line 195 of file server.hpp.
|
inline |
Definition at line 200 of file server.hpp.
void opcua::Server::setCustomHostname | ( | std::string_view | hostname | ) |
Set custom hostname, default: system's host name.
|
inline |
Definition at line 209 of file server.hpp.
|
inline |
Definition at line 214 of file server.hpp.
Definition at line 219 of file server.hpp.
std::vector< Session > opcua::Server::sessions | ( | ) |
Get active sessions.
Referenced by getSessions().
|
inline |
Definition at line 228 of file server.hpp.
std::vector< std::string > opcua::Server::namespaceArray | ( | ) |
Get all defined namespaces.
Referenced by getNamespaceArray().
|
inline |
Definition at line 237 of file server.hpp.
NamespaceIndex opcua::Server::registerNamespace | ( | std::string_view | uri | ) |
Register namespace. The new namespace index will be returned.
void opcua::Server::setVariableNodeValueCallback | ( | const NodeId & | id, |
ValueCallbackBase & | callback | ||
) |
Set value callback for variable node.
void opcua::Server::setVariableNodeValueCallback | ( | const NodeId & | id, |
std::unique_ptr< ValueCallbackBase > && | callback | ||
) |
Set value callback for variable node (move ownership to server).
void opcua::Server::setVariableNodeDataSource | ( | const NodeId & | id, |
DataSourceBase & | source | ||
) |
Set data source for variable node.
void opcua::Server::setVariableNodeDataSource | ( | const NodeId & | id, |
std::unique_ptr< DataSourceBase > && | source | ||
) |
Set data source for variable node (move ownership to server).
|
noexcept |
Create a (pseudo) subscription to monitor local data changes and events.
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 |
Definition at line 305 of file server.hpp.
Definition at line 310 of file server.hpp.