11#include "open62541pp/config.hpp"
29template <
typename Connection>
57#ifdef UA_ENABLE_ENCRYPTION
141 [[deprecated(
"use ServerConfig constructor and construct Server with ServerConfig")]]
145#ifdef UA_ENABLE_ENCRYPTION
154 [[deprecated(
"use ServerConfig constructor and construct Server with ServerConfig")]]
163 :
Server(
ServerConfig(port, certificate, privateKey, trustList, issuerList, revocationList)
182 [[deprecated(
"use ServerConfig::setApplicationUri via config() or pass config to Server")]]
187 [[deprecated(
"use ServerConfig::setProductUri via config() or pass config to Server")]]
192 [[deprecated(
"use ServerConfig::setApplicationName via config() or pass config to Server")]]
198 [[deprecated(
"not supported since open62541 v1.4")]]
201 [[deprecated(
"use ServerConfig::setAccessControl via config() or pass config to Server")]]
206 [[deprecated(
"use ServerConfig::setAccessControl via config() or pass config to Server")]]
228#ifdef UA_ENABLE_SUBSCRIPTIONS
233#ifdef UA_ENABLE_SUBSCRIPTIONS_EVENTS
235 [[deprecated(
"use Event constructor")]]
259 detail::ServerContext& context() noexcept;
260 const detail::ServerContext& context() const noexcept;
265 void operator()(
UA_Server* server)
noexcept;
268 std::unique_ptr<detail::ServerContext> context_;
269 std::unique_ptr<UA_Server, Deleter> server_;
277 return (lhs.handle() == rhs.handle());
281 return !(lhs == rhs);
Access control base class.
UA_BuildInfo wrapper class.
UA_ByteString wrapper class.
Create and trigger events.
High-level node class to access node attribute, browse and populate address space.
void setAccessControl(std::unique_ptr< AccessControlBase > &&accessControl)
Set custom access control (transfer ownership to Server).
ServerConfig(uint16_t port, const ByteString &certificate={})
Create server config with minimal configuration.
void setApplicationName(std::string_view name)
Set application name, default: open62541-based OPC UA Application.
ServerConfig()
Create server config with default configuration.
void setLogger(LogFunction func)
void setAccessControl(AccessControlBase &accessControl)
Set custom access control.
ServerConfig & operator=(ServerConfig &&other) noexcept
ServerConfig(ServerConfig &&other) noexcept
ServerConfig(const ServerConfig &)=delete
ServerConfig & operator=(const ServerConfig &)=delete
ServerConfig(UA_ServerConfig &&native)
void setProductUri(std::string_view uri)
Set product URI, default: http://open62541.org.
void setBuildInfo(BuildInfo buildInfo)
void setApplicationUri(std::string_view uri)
Set application URI, default: urn:open62541.server.application.
ServerConfig(uint16_t port, const ByteString &certificate, const ByteString &privateKey, Span< const ByteString > trustList, Span< const ByteString > issuerList, Span< const ByteString > revocationList={})
Create server config with encryption enabled (PKI).
void setCustomDataTypes(Span< const DataType > dataTypes)
Set custom data types.
void setVariableNodeValueBackend(const NodeId &id, ValueBackendDataSource backend)
Set data source backend for variable node.
Server(uint16_t port, const ByteString &certificate={})
Create server config with minimal configuration.
std::vector< Session > getSessions()
Get active server session.
Node< Server > getNode(NodeId id)
Node< Server > getObjectsNode()
void setApplicationName(std::string_view name)
void setProductUri(std::string_view uri)
NamespaceIndex registerNamespace(std::string_view uri)
Register namespace. The new namespace index will be returned.
void setCustomHostname(std::string_view hostname)
Set custom hostname, default: system's host name.
void stop()
Stop the server's main loop.
Server(uint16_t port, const ByteString &certificate, const ByteString &privateKey, Span< const ByteString > trustList, Span< const ByteString > issuerList, Span< const ByteString > revocationList={})
Create server config with encryption enabled (PKI).
Server(Server &&other) noexcept
void run()
Run the server's main loop. This method will block until Server::stop is called.
uint16_t runIterate()
Run a single iteration of the server's main loop.
Node< Server > getRootNode()
Subscription< Server > createSubscription() noexcept
Create a (pseudo) subscription to monitor local data changes and events.
Node< Server > getViewsNode()
Server & operator=(const Server &)=delete
ServerConfig & config() noexcept
void setAccessControl(AccessControlBase &accessControl)
Event createEvent(const NodeId &eventType=ObjectTypeId::BaseEventType)
Create an event object to generate and trigger events.
Node< Server > getTypesNode()
void setApplicationUri(std::string_view uri)
void setVariableNodeValueCallback(const NodeId &id, ValueCallback callback)
Set value callbacks to execute before every read and after every write operation.
Server & operator=(Server &&other) noexcept
Server(ServerConfig &&config)
Create server with given configuration (move ownership to server).
void setLogger(LogFunction logger)
void setAccessControl(std::unique_ptr< AccessControlBase > &&accessControl)
friend detail::ServerContext & detail::getContext(Server &server) noexcept
Server()
Create server with default configuration.
bool isRunning() const noexcept
Check if the server is running.
Server(const Server &)=delete
std::vector< std::string > getNamespaceArray()
Get all defined namespaces.
UA_Server * handle() noexcept
View to a contiguous sequence of objects, similar to std::span in C++20.
High-level subscription class.
Template base class to wrap native objects.
constexpr const UA_ServerConfig & native() const noexcept
Client * asWrapper(UA_Client *client) noexcept
Convert native UA_Client pointer to its wrapper instance.
std::function< void(LogLevel, LogCategory, std::string_view msg)> LogFunction
Log function.
uint16_t NamespaceIndex
Namespace index.
bool operator!=(const Client &lhs, const Client &rhs) noexcept
bool operator==(const Client &lhs, const Client &rhs) noexcept
Data source backend for variable nodes.
Value callbacks for variable nodes.