11#include "open62541pp/config.hpp"
61#ifdef UA_ENABLE_ENCRYPTION
178 [[deprecated(
"use free function setVariableNodeValueCallback instead")]]
180 [[deprecated(
"use free function setVariableNodeValueCallback instead")]]
182 const NodeId&
id, std::unique_ptr<ValueCallbackBase>&& callback
184 [[deprecated(
"use free function setVariableNodeValueBackend instead")]]
186 [[deprecated(
"use free function setVariableNodeValueBackend instead")]]
203 detail::ServerContext& context() noexcept;
204 const detail::ServerContext& context() const noexcept;
206 friend detail::ServerContext& detail::getContext(
Server& server) noexcept;
209 void operator()(
UA_Server* server)
const noexcept;
212 std::unique_ptr<detail::ServerContext> context_;
213 std::unique_ptr<UA_Server, Deleter> server_;
223 return (lhs.handle() == rhs.handle());
228 return !(lhs == rhs);
234 return findDataType(
id, server.config()->customDataTypes);
243 Server& server,
const NodeId&
id, std::unique_ptr<ValueCallbackBase>&& callback
250 Server& server,
const NodeId&
id, std::unique_ptr<DataSourceBase>&& source
255#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).
std::optional< NamespaceIndex > namespaceIndex(std::string_view uri) noexcept
Get namespace index for given URI.
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)
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.
Server & operator=(const Server &)=delete
ServerConfig & config() noexcept
void setVariableNodeValueCallback(const NodeId &id, ValueCallbackBase &callback)
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)
void runAsyncOperation(Server &server, const AsyncOperation &operation)
Run the provided async operation.
void setVariableNodeValueCallback(const NodeId &id, std::unique_ptr< ValueCallbackBase > &&callback)
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.
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.
void setVariableNodeValueCallback(Server &server, const NodeId &id, ValueCallbackBase &callback)
Set value callback for variable node.
const UA_DataType * findDataType(Client &client, const NodeId &id) noexcept
void setVariableNodeValueBackend(Server &server, const NodeId &id, DataSourceBase &source)
Set data source value backend for variable node.
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.