11#include "open62541pp/config.hpp"
62#ifdef UA_ENABLE_ENCRYPTION
181 const NodeId&
id, std::unique_ptr<ValueCallbackBase>&& callback
188#ifdef UA_ENABLE_SUBSCRIPTIONS
191 [[deprecated(
"use Subscription constructor")]]
209 detail::ServerContext& context() noexcept;
210 const detail::ServerContext& context() const noexcept;
212 friend detail::ServerContext& detail::getContext(
Server& server) noexcept;
215 void operator()(
UA_Server* server)
noexcept;
218 std::unique_ptr<detail::ServerContext> context_;
219 std::unique_ptr<UA_Server, Deleter> server_;
229 return (lhs.handle() == rhs.handle());
234 return !(lhs == rhs);
239#if UAPP_HAS_ASYNC_OPERATIONS
Access control base class.
UA_ByteString wrapper class.
Data source base class for variable nodes.
UA_DataType wrapper class.
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)
ServerConfig(ServerConfig &&) noexcept=default
void setAccessControl(AccessControlBase &accessControl)
Set custom access control.
ServerConfig(const ServerConfig &)=delete
void addCustomDataTypes(Span< const DataType > types)
Add custom data types.
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).
bool operator==(const Server &lhs, const Server &rhs) noexcept
Server(UA_Server *native)
Create server from native instance (move ownership to server).
NamespaceIndex registerNamespace(std::string_view uri)
Register namespace. The new namespace index will be returned.
void stop()
Stop the server's main loop.
void setVariableNodeDataSource(const NodeId &id, DataSourceBase &source)
Set data source for variable node.
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.
Subscription< Server > createSubscription() noexcept
Create a (pseudo) subscription to monitor local data changes and events.
Server & operator=(const Server &)=delete
ServerConfig & config() noexcept
void setVariableNodeValueCallback(const NodeId &id, ValueCallbackBase &callback)
Set value callback for variable node.
std::vector< Session > sessions()
Get active sessions.
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
Server()
Create server with default configuration.
std::optional< AsyncOperation > getAsyncOperation(Server &server) noexcept
Get the next queued async operation if available.
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
void setVariableNodeDataSource(const NodeId &id, std::unique_ptr< DataSourceBase > &&source)
Set data source for variable node (move ownership to server).
void runAsyncOperation(Server &server, const AsyncOperation &operation)
Run the provided async operation.
void setVariableNodeValueCallback(const NodeId &id, std::unique_ptr< ValueCallbackBase > &&callback)
Set value callback for variable node (move ownership to server).
void useAsyncOperation(Server &server, const NodeId &id, bool enabled)
Enable or disable async operations for the specified node.
std::vector< String > namespaceArray()
Get all defined namespaces.
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 UA_ServerConfig * handle() noexcept
Return pointer to native object.
constexpr const UA_ServerConfig & native() const noexcept
UA_BuildInfo wrapper class.
uint16_t NamespaceIndex
Namespace index.
std::function< void(LogLevel, LogCategory, std::string_view msg)> LogFunction
Log function.
Wraps an async operation request.
const UA_AsyncOperationRequest * request
UA_AsyncOperationType type
static UA_ServerConfig copy(const UA_ServerConfig &config)
static UA_ServerConfig move(UA_ServerConfig &&config) noexcept
static void clear(UA_ServerConfig &config) noexcept
Default type handler providing standard copy and move operations.