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")]]
219 [[deprecated(
"use sessions() instead")]]
228 [[deprecated(
"use namespaceArray() instead")]]
241#ifdef UA_ENABLE_SUBSCRIPTIONS
244 [[deprecated(
"use Subscription constructor")]]
248#ifdef UA_ENABLE_SUBSCRIPTIONS_EVENTS
250 [[deprecated(
"use Event constructor")]]
274 detail::ServerContext& context() noexcept;
275 const detail::ServerContext& context() const noexcept;
280 void operator()(
UA_Server* server)
noexcept;
283 std::unique_ptr<detail::ServerContext> context_;
284 std::unique_ptr<UA_Server, Deleter> server_;
294 return (lhs.handle() == rhs.handle());
299 return !(lhs == rhs);
Access control base class.
UA_ByteString wrapper class.
Data source base class for variable nodes.
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.
bool operator==(const Server &lhs, const Server &rhs) noexcept
Server(uint16_t port, const ByteString &certificate={})
Create server config with minimal configuration.
std::vector< Session > getSessions()
Node< Server > getNode(NodeId id)
Node< Server > getObjectsNode()
void setApplicationName(std::string_view name)
void setProductUri(std::string_view uri)
std::vector< std::string > namespaceArray()
Get all defined namespaces.
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.
void setVariableNodeDataSource(const NodeId &id, DataSourceBase &source)
Set data source for variable node.
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)
void setVariableNodeValueCallback(const NodeId &id, ValueCallbackBase &callback)
Set value callbacks to execute before every read and after every write operation.
std::vector< Session > sessions()
Get active sessions.
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)
Server & operator=(Server &&other) noexcept
Server(ServerConfig &&config)
Create server with given configuration (move ownership to server).
bool operator!=(const Server &lhs, const Server &rhs) noexcept
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.
Server * asWrapper(UA_Server *server) noexcept
Convert native UA_Server pointer to its wrapper instance.
bool isRunning() const noexcept
Check if the server is running.
Server(const Server &)=delete
std::vector< std::string > getNamespaceArray()
UA_Server * handle() noexcept
View to a contiguous sequence of objects, similar to std::span in C++20.
High-level subscription class.
Value callback base class for variable nodes.
Template base class to wrap native objects.
constexpr const UA_ServerConfig & native() const noexcept
UA_BuildInfo wrapper class.
std::function< void(LogLevel, LogCategory, std::string_view msg)> LogFunction
Log function.
uint16_t NamespaceIndex
Namespace index.