Server

Server entry point, endpoint configuration, services, and authentication/authorization hooks.

ua::ConditionAlarmMetrics

class

Aggregate alarm metrics summarising a collection of condition instances.

Each metric (active count, unacknowledged count, highest severity, ...) is computed once at construction by snapshotting every supplied ConditionInstance, and is thereafter returned from the cached value by the corresponding accessor. The object is an immutable value snapshot: it does not track later changes to the source conditions, and a fresh instance must be constructed to observe updated metrics.

Construction reads each condition's state snapshot, which is itself mutex-protected; the resulting accessors are plain reads of cached values and are safe to call from any thread. ConditionInstance

Functions

ConditionAlarmMetrics(const std::vector< std::shared_ptr< ConditionInstance > > &conditions)

Computes the alarm metrics from the given condition instances.

  • conditions (const std::vector< std::shared_ptr< ConditionInstance > > &) - Condition instances to aggregate. Borrowed for the duration of the call only; no ownership is retained and the metrics do not reference the conditions afterwards.
uint32_t active_count() const

Returns the number of enabled conditions that were in the active state.

Returns: The count of enabled, active conditions in the snapshot.

uint32_t unacknowledged_count() const

Returns the number of enabled conditions that were unacknowledged.

Returns: The count of enabled, unacknowledged conditions in the snapshot.

uint32_t unconfirmed_count() const

Returns the number of enabled conditions that were unconfirmed.

Returns: The count of enabled, unconfirmed conditions in the snapshot.

uint16_t highest_active_severity() const

Returns the highest severity among the active conditions.

Returns: The highest severity among active conditions, or 0 if none were active.

uint16_t highest_unack_severity() const

Returns the highest severity among the unacknowledged conditions.

Returns: The highest severity among unacknowledged conditions, or 0 if none were unacknowledged.

ua::ConditionInstance

class

A strand-serialized OPC UA condition/alarm instance wrapping a ConditionLogic machine.

Owns a ConditionLogic and serializes every state transition, event emission, and address-space interaction through a private strand. The public API is callback-canonical: each operation exposes an *_async core plus sync and try_sync convenience wrappers. The instance is reference-counted via enable_shared_from_this; construct it only through create and hold it by std::shared_ptr.

Initialization is two-phase: call create, then initialize_async to integrate with the address space (instantiate nodes, wire variables, register method handlers). When no AddressSpace is supplied to create, the instance runs in logic-only mode: it drives the state machine and emits events but creates no address-space nodes, method handlers, or variable wiring.

Member types

std::function< void(VoidResult)> CompleteCallback

Callback signalling completion of an *_async operation; the VoidResult carries an ErrorDetail on failure.

std::function< void(NodeId conditionId, NodeId inputNode, StatusCode status)> InputCommunicationObserver

Observer invoked when a bound input enters or leaves a communication-failure state.

std::function< void(std::vector< std::unique_ptr< BaseEvent > >)> BuildEventsCallback

Callback receiving the events built by build_refresh_events_async; ownership of the returned BaseEvent objects transfers to the callee.

Static functions

std::shared_ptr< ConditionInstance > create(boost::asio::any_io_executor executor, std::unique_ptr< ConditionLogic > logic, NodeId conditionId, NodeId sourceNode, String sourceName, std::weak_ptr< EventSink > eventSink, std::optional< AddressSpace > addressSpace=std::nullopt, NodeId typeDefinition=NodeId{}, InputCommunicationObserver inputCommunicationObserver={})

Creates a condition instance and returns a shared owner; the canonical construction path.

  • executor (boost::asio::any_io_executor) - Executor whose strand serializes all state access and async work.
  • logic (std::unique_ptr< ConditionLogic >) - The condition/alarm state machine this instance drives. Ownership is transferred; must not be null.
  • conditionId (NodeId) - NodeId of the condition node this instance represents.
  • sourceNode (NodeId) - NodeId of the source that owns the condition (the event SourceNode).
  • sourceName (String) - Human-readable source name reported on emitted events.
  • eventSink (std::weak_ptr< EventSink >) - Sink that receives emitted condition/branch/audit events; held weakly, so the sink may outlive or predecease this instance safely.
  • addressSpace (std::optional< AddressSpace >) - Address space to integrate with, or std::nullopt for logic-only mode.
  • typeDefinition (NodeId) - NodeId of the condition type to instantiate; defaults to an empty NodeId.
  • inputCommunicationObserver (InputCommunicationObserver) - Invoked when the bound input enters or leaves a communication-failure state, with this condition's id, the input node, and the status: a bad status reports the failure and retains its ErrorDetail, Good reports recovery. Reached only once an input node has been bound - a condition with no input never notifies - and defaults to empty, in which case the state is tracked but not reported.

Returns: A shared owner of the new instance.

Functions

~ConditionInstance()=default
void initialize_async(CompleteCallback callback)

Integrates the condition into the address space, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void initialize_sync()

Integrates the condition into the address space, blocking until complete.

VoidResult try_initialize_sync() noexcept

Integrates the condition into the address space, blocking until complete.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void attach_async(CompleteCallback callback)

Attaches to a pre-existing condition node in the address space, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void attach_sync()

Attaches to a pre-existing condition node, blocking until complete.

VoidResult try_attach_sync() noexcept

Attaches to a pre-existing condition node, blocking until complete.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void enable_async(CompleteCallback callback)

Enables the condition, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void enable_sync()

Enables the condition, blocking until complete.

VoidResult try_enable_sync() noexcept

Enables the condition, blocking until complete.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void disable_async(CompleteCallback callback)

Disables the condition, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void disable_sync()

Disables the condition, blocking until complete.

VoidResult try_disable_sync() noexcept

Disables the condition, blocking until complete.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void activate_async(uint16_t severity, CompleteCallback callback)

Activates the alarm at the given severity, completing asynchronously.

  • severity (uint16_t) - Alarm severity to report (OPC UA severity scale, 1-1000).
  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void activate_sync(uint16_t severity)

Activates the alarm at the given severity, blocking until complete.

  • severity (uint16_t) - Alarm severity to report (OPC UA severity scale, 1-1000).
VoidResult try_activate_sync(uint16_t severity) noexcept

Activates the alarm at the given severity, blocking until complete.

  • severity (uint16_t) - Alarm severity to report (OPC UA severity scale, 1-1000).

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void deactivate_async(CompleteCallback callback)

Deactivates the alarm, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void deactivate_sync()

Deactivates the alarm, blocking until complete.

VoidResult try_deactivate_sync() noexcept

Deactivates the alarm, blocking until complete.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void acknowledge_async(ByteString eventId, LocalizedText comment, CompleteCallback callback)

Acknowledges the condition (or branch) identified by eventId, completing asynchronously.

  • eventId (ByteString) - EventId identifying the trunk or branch state to acknowledge.
  • comment (LocalizedText) - Operator comment recorded with the acknowledgement.
  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void acknowledge_sync(ByteString eventId, LocalizedText comment)

Acknowledges the condition (or branch) identified by eventId, blocking until complete.

  • eventId (ByteString) - EventId identifying the trunk or branch state to acknowledge.
  • comment (LocalizedText) - Operator comment recorded with the acknowledgement.
VoidResult try_acknowledge_sync(ByteString eventId, LocalizedText comment) noexcept

Acknowledges the condition (or branch) identified by eventId, blocking until complete.

  • eventId (ByteString) - EventId identifying the trunk or branch state to acknowledge.
  • comment (LocalizedText) - Operator comment recorded with the acknowledgement.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void confirm_async(ByteString eventId, LocalizedText comment, CompleteCallback callback)

Confirms the condition (or branch) identified by eventId, completing asynchronously.

  • eventId (ByteString) - EventId identifying the trunk or branch state to confirm.
  • comment (LocalizedText) - Operator comment recorded with the confirmation.
  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void confirm_sync(ByteString eventId, LocalizedText comment)

Confirms the condition (or branch) identified by eventId, blocking until complete.

  • eventId (ByteString) - EventId identifying the trunk or branch state to confirm.
  • comment (LocalizedText) - Operator comment recorded with the confirmation.
VoidResult try_confirm_sync(ByteString eventId, LocalizedText comment) noexcept

Confirms the condition (or branch) identified by eventId, blocking until complete.

  • eventId (ByteString) - EventId identifying the trunk or branch state to confirm.
  • comment (LocalizedText) - Operator comment recorded with the confirmation.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void add_comment_async(ByteString eventId, LocalizedText comment, CompleteCallback callback)

Adds an operator comment to the condition or branch by eventId, completing asynchronously.

  • eventId (ByteString) - EventId identifying the trunk or branch state to annotate.
  • comment (LocalizedText) - Operator comment to record.
  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void add_comment_sync(ByteString eventId, LocalizedText comment)

Adds an operator comment to the condition (or branch) identified by eventId, blocking.

  • eventId (ByteString) - EventId identifying the trunk or branch state to annotate.
  • comment (LocalizedText) - Operator comment to record.
VoidResult try_add_comment_sync(ByteString eventId, LocalizedText comment) noexcept

Adds an operator comment to the condition (or branch) identified by eventId, blocking.

  • eventId (ByteString) - EventId identifying the trunk or branch state to annotate.
  • comment (LocalizedText) - Operator comment to record.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void call_enable_async(String userId, Node::CallMethodCompleteCallback complete)

Enables the condition (client Enable method) and emits an audit event.

void call_disable_async(String userId, Node::CallMethodCompleteCallback complete)

Disables the condition (client Disable method) and emits an audit event.

void call_add_comment_async(ByteString eventId, LocalizedText comment, String userId, Node::CallMethodCompleteCallback complete)

Adds an operator comment (client AddComment method) and emits an audit event.

  • eventId (ByteString) - EventId identifying the trunk or branch state to annotate.
  • comment (LocalizedText) - Operator comment to record.
  • userId (String) - ClientUserId attributed to the call (may be empty).
  • complete (Node::CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_acknowledge_async(ByteString eventId, LocalizedText comment, String userId, Node::CallMethodCompleteCallback complete)

Acknowledges the condition (client Acknowledge method) and emits an audit event.

  • eventId (ByteString) - EventId identifying the trunk or branch state to acknowledge.
  • comment (LocalizedText) - Operator comment recorded with the acknowledgement.
  • userId (String) - ClientUserId attributed to the call (may be empty).
  • complete (Node::CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_confirm_async(ByteString eventId, LocalizedText comment, String userId, Node::CallMethodCompleteCallback complete)

Confirms the condition (client Confirm method) and emits an audit event.

  • eventId (ByteString) - EventId identifying the trunk or branch state to confirm.
  • comment (LocalizedText) - Operator comment recorded with the confirmation.
  • userId (String) - ClientUserId attributed to the call (may be empty).
  • complete (Node::CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_one_shot_shelve_async(String userId, Node::CallMethodCompleteCallback complete)

Shelves the alarm until it is explicitly unshelved (client OneShotShelve method) and emits an audit event.

void call_timed_shelve_async(double durationMs, String userId, Node::CallMethodCompleteCallback complete)

Shelves the alarm for durationMs (client TimedShelve method) and emits an audit event.

  • durationMs (double) - Shelving duration in milliseconds.
  • userId (String) - ClientUserId attributed to the call (may be empty).
  • complete (Node::CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_unshelve_async(String userId, Node::CallMethodCompleteCallback complete)

Returns the alarm to the Unshelved state (client Unshelve method) and emits an audit event.

void call_suppress_async(String userId, Node::CallMethodCompleteCallback complete)

Suppresses the alarm (client Suppress method) and emits an audit event.

void call_unsuppress_async(String userId, Node::CallMethodCompleteCallback complete)

Clears suppression (client Unsuppress method) and emits an audit event.

void call_silence_async(String userId, Node::CallMethodCompleteCallback complete)

Silences the alarm (client Silence method) and emits an audit event.

void call_remove_from_service_async(String userId, Node::CallMethodCompleteCallback complete)

Takes the alarm out of service (client RemoveFromService method) and emits an audit event.

void call_place_in_service_async(String userId, Node::CallMethodCompleteCallback complete)

Returns the alarm to service (client PlaceInService method) and emits an audit event.

void call_reset_async(String userId, Node::CallMethodCompleteCallback complete)

Resets a latched alarm (client Reset method) and emits an audit event.

void timed_shelve_async(double durationMs, CompleteCallback callback)

Shelves the alarm for a fixed duration, completing asynchronously.

  • durationMs (double) - Shelving duration in milliseconds.
  • callback (CompleteCallback) - Receives a VoidResult that is good or carries an ErrorDetail on failure. Never throws.
void timed_shelve_sync(double durationMs)

Shelves the alarm for a fixed duration, blocking until complete.

  • durationMs (double) - Shelving duration in milliseconds.
VoidResult try_timed_shelve_sync(double durationMs) noexcept

Shelves the alarm for a fixed duration, blocking until complete.

  • durationMs (double) - Shelving duration in milliseconds.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void one_shot_shelve_async(CompleteCallback callback)

One-shot-shelves the alarm until its next state change, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void one_shot_shelve_sync()

One-shot-shelves the alarm until its next state change, blocking until complete.

VoidResult try_one_shot_shelve_sync() noexcept

One-shot-shelves the alarm until its next state change, blocking until complete.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void unshelve_async(CompleteCallback callback)

Unshelves the alarm, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void unshelve_sync()

Unshelves the alarm, blocking until complete.

VoidResult try_unshelve_sync() noexcept

Unshelves the alarm, blocking until complete.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void suppress_async(CompleteCallback callback)

Suppresses the alarm, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void suppress_sync()

Suppresses the alarm, blocking until complete.

VoidResult try_suppress_sync() noexcept

Suppresses the alarm, blocking until complete.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void unsuppress_async(CompleteCallback callback)

Removes suppression from the alarm, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void unsuppress_sync()

Removes suppression from the alarm, blocking until complete.

VoidResult try_unsuppress_sync() noexcept

Removes suppression from the alarm, blocking until complete.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void remove_from_service_async(CompleteCallback callback)

Marks the alarm out of service, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void remove_from_service_sync()

Marks the alarm out of service, blocking until complete.

VoidResult try_remove_from_service_sync() noexcept

Marks the alarm out of service, blocking until complete.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void place_in_service_async(CompleteCallback callback)

Returns the alarm to service, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void place_in_service_sync()

Returns the alarm to service, blocking until complete.

VoidResult try_place_in_service_sync() noexcept

Returns the alarm to service, blocking until complete.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void silence_async(CompleteCallback callback)

Silences the alarm's audible/visible annunciation, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void silence_sync()

Silences the alarm's annunciation, blocking until complete.

VoidResult try_silence_sync() noexcept

Silences the alarm's annunciation, blocking until complete.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void reset_async(CompleteCallback callback)

Resets a latched alarm, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void reset_sync()

Resets a latched alarm, blocking until complete.

VoidResult try_reset_sync() noexcept

Resets a latched alarm, blocking until complete.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void respond_async(int32_t selectedResponse, CompleteCallback callback)

Responds to a dialog condition with the selected option, completing asynchronously.

  • selectedResponse (int32_t) - Zero-based index of the chosen response option.
  • callback (CompleteCallback) - Receives a VoidResult that is good or carries an ErrorDetail on failure. Never throws.
void respond_sync(int32_t selectedResponse)

Responds to a dialog condition with the selected option, blocking until complete.

  • selectedResponse (int32_t) - Zero-based index of the chosen response option.
VoidResult try_respond_sync(int32_t selectedResponse) noexcept

Responds to a dialog condition with the selected option, blocking until complete.

  • selectedResponse (int32_t) - Zero-based index of the chosen response option.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void bind_input_async(NodeId inputNode, double samplingIntervalMs, CompleteCallback callback)

Binds the alarm to an input variable for automatic evaluation, completing asynchronously.

  • inputNode (NodeId) - NodeId of the variable to sample.
  • samplingIntervalMs (double) - Sampling period in milliseconds.
  • callback (CompleteCallback) - Receives a VoidResult that is good or carries an ErrorDetail on failure. Never throws.
void bind_input_sync(NodeId inputNode, double samplingIntervalMs)

Binds the alarm to an input variable for automatic evaluation, blocking until complete.

  • inputNode (NodeId) - NodeId of the variable to sample.
  • samplingIntervalMs (double) - Sampling period in milliseconds.
VoidResult try_bind_input_sync(NodeId inputNode, double samplingIntervalMs) noexcept

Binds the alarm to an input variable for automatic evaluation, blocking until complete.

  • inputNode (NodeId) - NodeId of the variable to sample.
  • samplingIntervalMs (double) - Sampling period in milliseconds.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

void unbind_input_async(CompleteCallback callback)

Unbinds the input variable and cancels its sampling timer, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void build_refresh_events_async(BuildEventsCallback callback)

Builds refresh events for the current condition state, completing asynchronously.

  • callback (BuildEventsCallback) - Receives the built events; ownership transfers to the callee.
void close_async(CompleteCallback callback)

Closes the condition, completing asynchronously.

  • callback (CompleteCallback) - Receives a VoidResult - good, or an ErrorDetail on failure. Never throws.
void close_sync()

Closes the condition, blocking until complete.

VoidResult try_close_sync() noexcept

Closes the condition, blocking until complete.

Returns: A VoidResult holding an ErrorDetail on failure. Never throws.

std::shared_ptr< const ConditionStateSnapshot > snapshot() const

Returns a thread-safe immutable snapshot of the current condition state.

Returns: Shared owner of the immutable state snapshot.

const NodeId & condition_id() const

Returns the NodeId of the condition node.

Returns: The NodeId of the condition node.

const NodeId & source_node() const

Returns the NodeId of the condition's source node.

Returns: The NodeId of the condition's source node.

ua::ConditionStateSnapshot

class

Thread-safe snapshot of a condition's current state, readable from any thread.

A condition's authoritative state lives on its ConditionInstance strand. This snapshot mirrors the subset of that state that must be read outside the strand - for example by an ExternalValueSource handler servicing an attribute read on an unrelated thread. The ConditionInstance writes the snapshot from its strand via the update_from overloads; readers call the getters from any thread. Every read and write is serialized by an internal mutex, so no external synchronization is required.

Getters return values by copy. For the optional alarm sub-states (suppression, out-of-service, silencing, latching) the std::optional<bool> accessor is empty when the condition does not model that capability, while the paired current-state/transition-time accessors return default-constructed values in that case.

Functions

ByteString event_id() const

Returns the EventId of the most recently emitted event for this condition.

Returns: EventId of the most recently emitted event for this condition.

NodeId event_type() const

Returns the concrete EventType of the condition (its type-definition NodeId).

Returns: The condition's concrete EventType (its type-definition NodeId).

NodeId source_node() const

Returns the NodeId of the condition's source node.

Returns: NodeId of the condition's source node.

String source_name() const

Returns the human-readable name of the condition's source.

Returns: Human-readable name of the condition's source.

DateTime time() const

Returns the time the condition's most recent event was generated.

Returns: Time the condition's most recent event was generated.

DateTime receive_time() const

Returns the time the condition's most recent event was received for processing.

Returns: Time the condition's most recent event was received for processing.

LocalizedText message() const

Returns the condition's current message.

Returns: The condition's current message.

NodeId condition_class_id() const

Returns the ConditionClassId (the well-known condition-class type, Part 9).

Returns: ConditionClassId (the well-known condition-class type, Part 9).

LocalizedText condition_class_name() const

Returns the ConditionClassName (display name of the condition class).

Returns: ConditionClassName (display name of the condition class).

String condition_name() const

Returns the ConditionName (the application-assigned name of this condition).

Returns: ConditionName (the application-assigned name of this condition).

NodeId branch_id() const

Returns the BranchId of the condition (null NodeId for the main/current branch).

Returns: BranchId of the condition (null NodeId for the main/current branch).

String client_user_id() const

Returns the ClientUserId - the identity of the client that last drove a state change.

Returns: ClientUserId - the identity of the client that last drove a state change.

std::optional< TwoStateVariableState > high_high_state() const

Returns the NonExclusiveLimitAlarm HighHighState, or empty if not a non-exclusive limit alarm.

Returns: NonExclusiveLimitAlarm HighHighState, or an empty optional if not a non-exclusive limit alarm.

std::optional< TwoStateVariableState > high_state() const

Returns the NonExclusiveLimitAlarm HighState, or empty if not a non-exclusive limit alarm.

Returns: NonExclusiveLimitAlarm HighState, or an empty optional if not a non-exclusive limit alarm.

std::optional< TwoStateVariableState > low_state() const

Returns the NonExclusiveLimitAlarm LowState, or empty if not a non-exclusive limit alarm.

Returns: NonExclusiveLimitAlarm LowState, or an empty optional if not a non-exclusive limit alarm.

std::optional< TwoStateVariableState > low_low_state() const

Returns the NonExclusiveLimitAlarm LowLowState, or empty if not a non-exclusive limit alarm.

Returns: NonExclusiveLimitAlarm LowLowState, or an empty optional if not a non-exclusive limit alarm.

LocalizedText limit_state_name() const

Returns the ExclusiveLimitAlarm LimitState.CurrentState display name (empty when no limit active).

Returns: ExclusiveLimitAlarm LimitState.CurrentState display name (empty when no limit is active).

NodeId limit_state_id() const

Returns the ExclusiveLimitAlarm LimitState.CurrentState.Id (the state NodeId; null when inactive).

Returns: ExclusiveLimitAlarm LimitState.CurrentState.Id (the state NodeId; null when inactive).

LocalizedText shelve_state_name() const

Returns the AlarmCondition ShelvingState.CurrentState display name (e.g.

Returns: AlarmCondition ShelvingState.CurrentState display name (e.g. "Unshelved").

NodeId shelve_state_id() const

Returns the AlarmCondition ShelvingState.CurrentState.Id (the ShelvedStateMachineType state NodeId).

Returns: AlarmCondition ShelvingState.CurrentState.Id (the ShelvedStateMachineType state NodeId).

bool enabled() const

Returns whether the condition is enabled.

Returns: True if the condition is enabled.

bool retained() const

Returns whether the condition is retained (currently of interest to a client).

Returns: True if the condition is retained (currently of interest to a client).

uint16_t severity() const

Returns the current severity, on the OPC UA 1..1000 scale.

Returns: Current severity, on the OPC UA 1..1000 scale.

StatusCode quality() const

Returns the quality of the condition's underlying value.

Returns: Quality of the condition's underlying value.

DateTime quality_source_timestamp() const

Returns the source timestamp of the current quality.

Returns: Source timestamp of the current quality.

LocalizedText comment() const

Returns the most recent comment associated with the condition.

Returns: Most recent comment associated with the condition.

DateTime comment_source_timestamp() const

Returns the source timestamp of the current comment.

Returns: Source timestamp of the current comment.

uint16_t last_severity() const

Returns the previous severity, recorded when severity last changed.

Returns: Previous severity, recorded when severity last changed.

DateTime last_severity_source_timestamp() const

Returns the source timestamp at which last_severity was recorded.

Returns: Source timestamp at which last_severity was recorded.

bool acked() const

Returns whether the condition has been acknowledged.

Returns: True if the condition has been acknowledged.

DateTime acked_transition_time() const

Returns the time of the last transition of the AckedState two-state variable.

Returns: Time of the last transition of the AckedState two-state variable.

LocalizedText acked_current_state() const

Returns the localized name of the current AckedState.

Returns: Localized name of the current AckedState.

bool confirmed() const

Returns whether the condition has been confirmed.

Returns: True if the condition has been confirmed.

DateTime confirmed_transition_time() const

Returns the time of the last transition of the ConfirmedState two-state variable.

Returns: Time of the last transition of the ConfirmedState two-state variable.

LocalizedText confirmed_current_state() const

Returns the localized name of the current ConfirmedState.

Returns: Localized name of the current ConfirmedState.

bool active() const

Returns whether the alarm is active.

Returns: True if the alarm is active.

DateTime active_transition_time() const

Returns the time of the last transition of the ActiveState two-state variable.

Returns: Time of the last transition of the ActiveState two-state variable.

LocalizedText active_current_state() const

Returns the localized name of the current ActiveState.

Returns: Localized name of the current ActiveState.

LocalizedText enabled_current_state() const

Returns the localized name of the current EnabledState.

Returns: Localized name of the current EnabledState.

DateTime enabled_transition_time() const

Returns the time of the last transition of the EnabledState two-state variable.

Returns: Time of the last transition of the EnabledState two-state variable.

bool suppressed_or_shelved() const

Returns whether the alarm is currently suppressed or shelved.

Returns: True if the alarm is currently suppressed or shelved.

NodeId input_node() const

Returns the node whose value drives this alarm's input.

Returns: NodeId of the node whose value drives this alarm's input.

std::optional< bool > suppressed() const

Returns the suppression state, or an empty optional if the condition does not model suppression.

Returns: Suppression state, or an empty optional if the condition does not model suppression.

LocalizedText suppressed_current_state() const

Returns the localized name of the current SuppressedState, or an empty value if not modelled.

Returns: Localized name of the current SuppressedState, or an empty value if not modelled.

DateTime suppressed_transition_time() const

Returns the time of the last SuppressedState transition, or a default value if not modelled.

Returns: Time of the last SuppressedState transition, or a default value if not modelled.

std::optional< bool > out_of_service() const

Returns the out-of-service state, or an empty optional if the condition does not model it.

Returns: Out-of-service state, or an empty optional if the condition does not model it.

LocalizedText out_of_service_current_state() const

Returns the localized name of the current OutOfServiceState, or an empty value if not modelled.

Returns: Localized name of the current OutOfServiceState, or an empty value if not modelled.

DateTime out_of_service_transition_time() const

Returns the time of the last OutOfServiceState transition, or a default value if not modelled.

Returns: Time of the last OutOfServiceState transition, or a default value if not modelled.

std::optional< bool > silenced() const

Returns the silencing state, or an empty optional if the condition does not model silencing.

Returns: Silencing state, or an empty optional if the condition does not model silencing.

LocalizedText silenced_current_state() const

Returns the localized name of the current SilenceState, or an empty value if not modelled.

Returns: Localized name of the current SilenceState, or an empty value if not modelled.

DateTime silenced_transition_time() const

Returns the time of the last SilenceState transition, or a default value if not modelled.

Returns: Time of the last SilenceState transition, or a default value if not modelled.

std::optional< bool > latched() const

Returns the latching state, or an empty optional if the condition does not model latching.

Returns: Latching state, or an empty optional if the condition does not model latching.

LocalizedText latched_current_state() const

Returns the localized name of the current LatchedState, or an empty value if not modelled.

Returns: Localized name of the current LatchedState, or an empty value if not modelled.

DateTime latched_transition_time() const

Returns the time of the last LatchedState transition, or a default value if not modelled.

Returns: Time of the last LatchedState transition, or a default value if not modelled.

void update_from(const ConditionPayload &event)

Updates the snapshot's base condition fields from a condition event payload.

  • event (const ConditionPayload &) - Source payload supplying the base condition fields.
void update_from(const AcknowledgeableConditionPayload &event)

Updates the snapshot's acknowledgement-related fields from an acknowledgeable condition payload.

  • event (const AcknowledgeableConditionPayload &) - Source payload supplying the acknowledge/confirm fields.
void update_from(const AlarmConditionPayload &event)

Updates the snapshot's alarm-related fields from an alarm condition payload.

  • event (const AlarmConditionPayload &) - Source payload supplying the alarm fields.
void set_non_exclusive_limit_states(std::optional< TwoStateVariableState > highHigh, std::optional< TwoStateVariableState > high, std::optional< TwoStateVariableState > low, std::optional< TwoStateVariableState > lowLow)

Sets the NonExclusiveLimitAlarm per-limit sub-states (empty for non-limit / exclusive alarms).

void set_exclusive_limit_state(LocalizedText currentStateName, NodeId currentStateId)

Sets the ExclusiveLimitAlarm LimitState.CurrentState name + state NodeId.

  • currentStateName (LocalizedText) - Display name of the LimitState.CurrentState.
  • currentStateId (NodeId) - NodeId of the LimitState.CurrentState.
void set_shelve_state(LocalizedText currentStateName, NodeId currentStateId)

Sets the AlarmCondition ShelvingState.CurrentState name + ShelvedStateMachineType state NodeId.

  • currentStateName (LocalizedText) - Display name of the ShelvingState.CurrentState.
  • currentStateId (NodeId) - NodeId of the ShelvingState.CurrentState (a ShelvedStateMachineType state).

ua::Conditions

class

Server-level registry of all live condition instances and their factories.

Owns the set of ConditionInstance objects the server exposes, the per-type ConditionFactory map, and the ConditionRefresh / HasEffect machinery that drives alarm-and-condition behaviour (OPC UA Part 9).

This is a strand-serialized component: all mutable state (the condition registry, the factory map, the in-progress refresh and discover guards, and the shutting-down flag) is owned by an internal strand. Every public *_async method posts entry onto that strand internally, so callers may invoke from any thread. The component holds the registry by shared_ptr (enable_shared_from_this) and captures itself weakly across async hops, so it is safe to destroy concurrently with in-flight work.

The public surface follows the canonical async trio: *_async - callback-canonical; the callback receives a Result (or VoidResult) carrying any ErrorDetail on failure. Never throws. sync - blocks and returns the bare value (or void); throws UaException on a bad status. External convenience only. try_sync - blocks and returns a Result (or VoidResult); never throws. External convenience only.

Lookup methods (find_condition_, find_factory_) treat a missing key as success: the Result is Good with a null payload. Only a real failure (the component is shutting down) yields a Bad status.

sync and try_sync block the calling thread; never call them from inside the SDK. Internal callers use the *_async variants. ConditionInstance, ConditionFactory, server::EventBus

Member types

std::function< void(ConditionInstanceResult)> CreateConditionCallback

Receives the outcome of a condition-creation request.

std::function< void(BaseEvent &)> EmitFunction

Sink invoked once per event to deliver it during a refresh.

std::function< void(VoidResult)> DiscoverExistingConditionsCallback

Receives the outcome of a discover-existing-conditions scan.

std::function< bool(uint32_t subscriptionId, const NodeId &callerSessionId)> SubscriptionValidator

Predicate that tests whether a subscription belongs to a given session.

std::function< void(uint32_t subscriptionId, uint32_t monitoredItemId, std::function< void(std::optional< NodeId >)> callback)> MonitoredItemNodeResolver

Resolves the monitored NodeId of an event MonitoredItem.

std::function< void(VoidResult)> ProcessHasEffectReferencesCallback

Receives the outcome of HasEffect reference processing.

Functions

Conditions(ConstructionKey, boost::asio::any_io_executor executor, std::weak_ptr< EventSink > eventSink)

Constructs a registry without address space integration.

  • executor (boost::asio::any_io_executor) - Executor whose strand serializes all registry state. The component does not take ownership of the underlying io_context; it must outlive the registry.
  • eventSink (std::weak_ptr< EventSink >) - Sink that retained condition events are emitted through. Held weakly; may expire without invalidating the registry.
Conditions(ConstructionKey, boost::asio::any_io_executor executor, std::weak_ptr< EventSink > eventSink, AddressSpace addressSpace)

Constructs an address-space-integrated registry and installs the default factories.

  • executor (boost::asio::any_io_executor) - Executor whose strand serializes all registry state; it must outlive the registry.
  • eventSink (std::weak_ptr< EventSink >) - Sink that retained condition events are emitted through. Held weakly.
  • addressSpace (AddressSpace) - Address space the condition objects are instantiated in.
void create_condition_async(NodeId conditionId, NodeId sourceNode, String sourceName, std::unique_ptr< ConditionLogic > logic, NodeId typeDefinition, CreateConditionCallback callback)

Creates a condition instance and integrates it into the address space.

  • conditionId (NodeId) - NodeId the condition object is created under.
  • sourceNode (NodeId) - Node the condition reports about (its source).
  • sourceName (String) - Human-readable name of the source node.
  • logic (std::unique_ptr< ConditionLogic >) - Behaviour for the condition; ownership transfers in.
  • typeDefinition (NodeId) - ObjectType the condition is instantiated from.
  • callback (CreateConditionCallback) - Receives the created ConditionInstance on success, or an ErrorDetail on failure. This overload never throws.
std::shared_ptr< ConditionInstance > create_condition_sync(NodeId conditionId, NodeId sourceNode, String sourceName, std::unique_ptr< ConditionLogic > logic, NodeId typeDefinition)

Creates an address-space-integrated condition, blocking until complete.

  • conditionId (NodeId) - NodeId the condition object is created under.
  • sourceNode (NodeId) - Node the condition reports about (its source).
  • sourceName (String) - Human-readable name of the source node.
  • logic (std::unique_ptr< ConditionLogic >) - Behaviour for the condition; ownership transfers in.
  • typeDefinition (NodeId) - ObjectType the condition is instantiated from.

Returns: The created condition instance.

ConditionInstanceResult try_create_condition_sync(NodeId conditionId, NodeId sourceNode, String sourceName, std::unique_ptr< ConditionLogic > logic, NodeId typeDefinition) noexcept

Creates an address-space-integrated condition, blocking until complete.

  • conditionId (NodeId) - NodeId the condition object is created under.
  • sourceNode (NodeId) - Node the condition reports about (its source).
  • sourceName (String) - Human-readable name of the source node.
  • logic (std::unique_ptr< ConditionLogic >) - Behaviour for the condition; ownership transfers in.
  • typeDefinition (NodeId) - ObjectType the condition is instantiated from.

Returns: The created condition instance, or an ErrorDetail on failure. Never throws.

void create_condition_async(NodeId conditionId, NodeId sourceNode, String sourceName, std::unique_ptr< ConditionLogic > logic, CreateConditionCallback callback)

Creates a condition instance without address space integration.

  • conditionId (NodeId) - NodeId the condition is registered under.
  • sourceNode (NodeId) - Node the condition reports about.
  • sourceName (String) - Human-readable name of the source node.
  • logic (std::unique_ptr< ConditionLogic >) - Behaviour for the condition; ownership transfers in.
  • callback (CreateConditionCallback) - Receives the created ConditionInstance on success, or an ErrorDetail on failure. This overload never throws.
std::shared_ptr< ConditionInstance > create_condition_sync(NodeId conditionId, NodeId sourceNode, String sourceName, std::unique_ptr< ConditionLogic > logic)

Creates a logic-only condition, blocking until complete.

  • conditionId (NodeId) - NodeId the condition is registered under.
  • sourceNode (NodeId) - Node the condition reports about.
  • sourceName (String) - Human-readable name of the source node.
  • logic (std::unique_ptr< ConditionLogic >) - Behaviour for the condition; ownership transfers in.

Returns: The created condition instance.

ConditionInstanceResult try_create_condition_sync(NodeId conditionId, NodeId sourceNode, String sourceName, std::unique_ptr< ConditionLogic > logic) noexcept

Creates a logic-only condition, blocking until complete.

  • conditionId (NodeId) - NodeId the condition is registered under.
  • sourceNode (NodeId) - Node the condition reports about.
  • sourceName (String) - Human-readable name of the source node.
  • logic (std::unique_ptr< ConditionLogic >) - Behaviour for the condition; ownership transfers in.

Returns: The created condition instance, or an ErrorDetail on failure. Never throws.

void register_condition_async(std::shared_ptr< ConditionInstance > instance, std::function< void(VoidResult)> callback)

Registers a pre-created condition instance.

void register_condition_sync(std::shared_ptr< ConditionInstance > instance)

Registers a pre-created condition instance, blocking until complete.

VoidResult try_register_condition_sync(std::shared_ptr< ConditionInstance > instance) noexcept

Registers a pre-created condition instance, blocking until complete.

Returns: Success, or an ErrorDetail on failure. Never throws.

void deregister_condition_async(NodeId conditionId, std::function< void(VoidResult)> callback)

Removes a condition from the registry by its conditionId.

void deregister_condition_sync(NodeId conditionId)

Removes a condition by its conditionId, blocking until complete.

  • conditionId (NodeId) - Key of the condition to remove.
VoidResult try_deregister_condition_sync(NodeId conditionId) noexcept

Removes a condition by its conditionId, blocking until complete.

  • conditionId (NodeId) - Key of the condition to remove.

Returns: Success, or an ErrorDetail on failure. Never throws.

void find_condition_async(NodeId conditionId, std::function< void(Result< std::shared_ptr< ConditionInstance > >)> callback)

Looks up a registered condition by its conditionId.

std::shared_ptr< ConditionInstance > find_condition_sync(NodeId conditionId)

Looks up a registered condition by its conditionId, blocking until complete.

  • conditionId (NodeId) - Key to look up.

Returns: The condition instance, or null if not registered.

Result< std::shared_ptr< ConditionInstance > > try_find_condition_sync(NodeId conditionId) noexcept

Looks up a registered condition by its conditionId, blocking until complete.

  • conditionId (NodeId) - Key to look up.

Returns: The condition instance (null if not registered), or an ErrorDetail on failure. Never throws.

void condition_refresh_async(EmitFunction emitter, std::function< void(VoidResult)> callback)

Performs a ConditionRefresh: replays all retained condition events.

  • emitter (EmitFunction) - Invoked once per event in refresh order.
  • callback (std::function< void(VoidResult)>) - Receives success, or an ErrorDetail on failure. Never throws.
void condition_refresh_async(EventSink &sink, std::function< void(VoidResult)> callback)

Performs a ConditionRefresh, delivering events to an EventSink.

  • sink (EventSink &) - Sink the refresh events are emitted through.
  • callback (std::function< void(VoidResult)>) - Receives success, or an ErrorDetail on failure. Never throws.
void condition_refresh_sync(EmitFunction emitter)

Performs a ConditionRefresh via an emit function, blocking until complete.

  • emitter (EmitFunction) - Invoked once per event in refresh order.
void condition_refresh_sync(EventSink &sink)

Performs a ConditionRefresh via an EventSink, blocking until complete.

  • sink (EventSink &) - Sink the refresh events are emitted through.
VoidResult try_condition_refresh_sync(EmitFunction emitter) noexcept

Performs a ConditionRefresh via an emit function, blocking until complete.

  • emitter (EmitFunction) - Invoked once per event in refresh order.

Returns: Success, or an ErrorDetail on failure. Never throws.

VoidResult try_condition_refresh_sync(EventSink &sink) noexcept

Performs a ConditionRefresh via an EventSink, blocking until complete.

  • sink (EventSink &) - Sink the refresh events are emitted through.

Returns: Success, or an ErrorDetail on failure. Never throws.

void condition_refresh2_async(EmitFunction emitter, NodeId monitoredNode, std::function< void(VoidResult)> callback)

Performs a ConditionRefresh2: refresh scoped to a single monitored node.

  • emitter (EmitFunction) - Invoked once per event in refresh order.
  • monitoredNode (NodeId) - Source node the refresh is scoped to.
  • callback (std::function< void(VoidResult)>) - Receives success, or an ErrorDetail on failure. Never throws.
void condition_refresh2_async(EventSink &sink, NodeId monitoredNode, std::function< void(VoidResult)> callback)

Performs a ConditionRefresh2, delivering events to an EventSink.

  • sink (EventSink &) - Sink the refresh events are emitted through.
  • monitoredNode (NodeId) - Source node the refresh is scoped to.
  • callback (std::function< void(VoidResult)>) - Receives success, or an ErrorDetail on failure. Never throws.
void condition_refresh2_sync(EmitFunction emitter, NodeId monitoredNode)

Performs a ConditionRefresh2 via an emit function, blocking until complete.

  • emitter (EmitFunction) - Invoked once per event in refresh order.
  • monitoredNode (NodeId) - Source node the refresh is scoped to.
void condition_refresh2_sync(EventSink &sink, NodeId monitoredNode)

Performs a ConditionRefresh2 via an EventSink, blocking until complete.

  • sink (EventSink &) - Sink the refresh events are emitted through.
  • monitoredNode (NodeId) - Source node the refresh is scoped to.
VoidResult try_condition_refresh2_sync(EmitFunction emitter, NodeId monitoredNode) noexcept

Performs a ConditionRefresh2 via an emit function, blocking until complete.

  • emitter (EmitFunction) - Invoked once per event in refresh order.
  • monitoredNode (NodeId) - Source node the refresh is scoped to.

Returns: Success, or an ErrorDetail on failure. Never throws.

VoidResult try_condition_refresh2_sync(EventSink &sink, NodeId monitoredNode) noexcept

Performs a ConditionRefresh2 via an EventSink, blocking until complete.

  • sink (EventSink &) - Sink the refresh events are emitted through.
  • monitoredNode (NodeId) - Source node the refresh is scoped to.

Returns: Success, or an ErrorDetail on failure. Never throws.

void register_factory_async(NodeId objectTypeId, ConditionFactory factory, std::function< void(VoidResult)> callback)

Registers a ConditionFactory for an ObjectType.

  • objectTypeId (NodeId) - ObjectType NodeId the factory is keyed by.
  • factory (ConditionFactory) - Factory invoked to build logic for that type.
  • callback (std::function< void(VoidResult)>) - Receives success, or an ErrorDetail on failure. Never throws.
void register_factory_sync(NodeId objectTypeId, ConditionFactory factory)

Registers a factory for an ObjectType, blocking until complete.

  • objectTypeId (NodeId) - ObjectType NodeId the factory is keyed by.
  • factory (ConditionFactory) - Factory invoked to build logic for that type.
void set_max_branches_per_condition(size_t maxBranches)

Sets the per-condition ConditionBranch retention cap applied to factory-created acknowledgeable condition logic (memory fail-safe).

  • maxBranches (size_t) - Maximum number of ConditionBranches retained per condition; clamped to >= 1.
VoidResult try_register_factory_sync(NodeId objectTypeId, ConditionFactory factory) noexcept

Registers a factory for an ObjectType, blocking until complete.

  • objectTypeId (NodeId) - ObjectType NodeId the factory is keyed by.
  • factory (ConditionFactory) - Factory invoked to build logic for that type.

Returns: Success, or an ErrorDetail on failure. Never throws.

void find_factory_async(NodeId objectTypeId, std::function< void(Result< ConditionFactory >)> callback)

Looks up a registered factory by ObjectType NodeId.

  • objectTypeId (NodeId) - ObjectType NodeId to look up.
  • callback (std::function< void(Result< ConditionFactory >)>) - Receives the ConditionFactory, a Good result with an empty factory if objectTypeId is not registered, or a Bad status (Shutdown) if the component is shutting down. Never throws.
ConditionFactory find_factory_sync(NodeId objectTypeId)

Looks up a registered factory, blocking until complete.

  • objectTypeId (NodeId) - ObjectType NodeId to look up.

Returns: The factory, or an empty factory if not registered.

Result< ConditionFactory > try_find_factory_sync(NodeId objectTypeId) noexcept

Looks up a registered factory, blocking until complete.

  • objectTypeId (NodeId) - ObjectType NodeId to look up.

Returns: The factory (empty if not registered), or an ErrorDetail on failure. Never throws.

void retained_conditions_async(std::function< void(Result< std::vector< std::shared_ptr< ConditionInstance > > >)> callback)

Snapshots all currently retained conditions.

std::vector< std::shared_ptr< ConditionInstance > > retained_conditions_sync()

Snapshots all currently retained conditions, blocking until complete.

Returns: The retained conditions.

Result< std::vector< std::shared_ptr< ConditionInstance > > > try_retained_conditions_sync() noexcept

Snapshots all currently retained conditions, blocking until complete.

Returns: The retained conditions, or an ErrorDetail on failure. Never throws.

void compute_alarm_metrics_async(std::function< void(Result< ConditionAlarmMetrics >)> callback)

Computes aggregate alarm metrics across all registered conditions.

ConditionAlarmMetrics compute_alarm_metrics_sync()

Computes aggregate alarm metrics, blocking until complete.

Returns: The computed metrics.

Result< ConditionAlarmMetrics > try_compute_alarm_metrics_sync() noexcept

Computes aggregate alarm metrics, blocking until complete.

Returns: The computed metrics, or an ErrorDetail on failure. Never throws.

void discover_existing_conditions_async(DiscoverExistingConditionsCallback callback)

Scans the address space for condition-typed objects and attaches them.

  • callback (DiscoverExistingConditionsCallback) - Receives success, or an ErrorDetail on failure. Never throws.
void discover_existing_conditions_sync()

Scans for and attaches existing conditions, blocking until complete.

VoidResult try_discover_existing_conditions_sync() noexcept

Scans for and attaches existing conditions, blocking until complete.

Returns: Success, or an ErrorDetail on failure. Never throws.

void register_refresh_methods(std::weak_ptr< server::EventBus > eventBus, SubscriptionValidator validator, MonitoredItemNodeResolver itemNodeResolver)

Installs the ConditionRefresh and ConditionRefresh2 method handlers.

  • eventBus (std::weak_ptr< server::EventBus >) - Weak handle to the server EventBus the refresh handlers emit refreshed Condition events through. Weak (not a raw reference) because the emit runs across async hops on a pool thread and the bus can be torn down (~ServerImpl) while a refresh is in flight; each emit locks it and is skipped if the bus is gone.
  • validator (SubscriptionValidator) - Confirms the caller owns the target subscription.
  • itemNodeResolver (MonitoredItemNodeResolver) - Resolves a ConditionRefresh2 MonitoredItemId to its monitored NodeId so the refresh is scoped to that one MonitoredItem (Part 9 5.5.8). When null, ConditionRefresh2 cannot resolve any MonitoredItem and reports BadMonitoredItemIdInvalid.
void register_condition_methods()

Installs the standard Condition method handlers on the NS0 type method nodes.

void process_has_effect_references_async(NodeId transitionNodeId, ProcessHasEffectReferencesCallback callback)

Applies HasEffect references emanating from a transition node.

  • transitionNodeId (NodeId) - Transition node whose HasEffect references are processed.
  • callback (ProcessHasEffectReferencesCallback) - Receives success, or an ErrorDetail on failure. Never throws.
void process_has_effect_references_sync(NodeId transitionNodeId)

Applies a transition node's HasEffect references, blocking until complete.

  • transitionNodeId (NodeId) - Transition node whose HasEffect references are processed.
VoidResult try_process_has_effect_references_sync(NodeId transitionNodeId) noexcept

Applies a transition node's HasEffect references, blocking until complete.

  • transitionNodeId (NodeId) - Transition node whose HasEffect references are processed.

Returns: Success, or an ErrorDetail on failure. Never throws.

ua::server::SessionDiagnosticsHelper

class

Convenience class that backs a session's SessionDiagnosticsObjectType node with live counters.

Instantiates a SessionDiagnosticsObjectType instance under a parent node and wires read handlers for all diagnostic child Variables so that each read reports the current value from the shared SessionCounters / SessionSecurityState the helper was given. The counters and security state are held by shared_ptr and updated by the owning session; the read handlers observe them live.

A helper created via create_async/create_sync owns the instantiated subtree and removes it on destruction (RAII); call release to detach that ownership.

Member types

std::function< void(SessionDiagnosticsHelperResult)> CreateCompleteCallback

Callback type reporting the outcome of create_async.

Static functions

void create_async(AddressSpace addressSpace, const NodeId &parent, const QualifiedName &browseName, std::shared_ptr< SessionCounters > counters, std::shared_ptr< SessionSecurityState > securityState, std::shared_ptr< SessionDescriptiveState > descriptiveState, const InstantiationOptions &options, CreateCompleteCallback complete) noexcept

Creates a new SessionDiagnosticsObjectType instance under parent and wires its read handlers.

  • addressSpace (AddressSpace) - Address space in which the node is created.
  • parent (const NodeId &) - Node under which the new instance is created.
  • browseName (const QualifiedName &) - Browse name of the new node.
  • counters (std::shared_ptr< SessionCounters >) - Shared per-session counters the read handlers observe live; must outlive the helper.
  • securityState (std::shared_ptr< SessionSecurityState >) - Shared per-session security state the read handlers observe live; must outlive the helper.
  • descriptiveState (std::shared_ptr< SessionDescriptiveState >) - Shared per-session descriptive state (session name, client description, connection timestamps) the read handlers observe live; must outlive the helper.
  • options (const InstantiationOptions &) - Instantiation options for the new subtree.
  • complete (CreateCompleteCallback) - Receives the outcome: on success the Result holds the owning SessionDiagnosticsHelper; on failure it carries an ErrorDetail. This overload never throws.
SessionDiagnosticsHelperResult try_create_sync(AddressSpace addressSpace, const NodeId &parent, const QualifiedName &browseName, std::shared_ptr< SessionCounters > counters, std::shared_ptr< SessionSecurityState > securityState, std::shared_ptr< SessionDescriptiveState > descriptiveState, const InstantiationOptions &options) noexcept

Creates a new SessionDiagnosticsObjectType instance under parent, blocking until complete.

  • addressSpace (AddressSpace) - Address space in which the node is created.
  • parent (const NodeId &) - Node under which the new instance is created.
  • browseName (const QualifiedName &) - Browse name of the new node.
  • counters (std::shared_ptr< SessionCounters >) - Shared per-session counters the read handlers observe live; must outlive the helper.
  • securityState (std::shared_ptr< SessionSecurityState >) - Shared per-session security state the read handlers observe live; must outlive the helper.
  • descriptiveState (std::shared_ptr< SessionDescriptiveState >) - Shared per-session descriptive state (session name, client description, connection timestamps) the read handlers observe live; must outlive the helper.
  • options (const InstantiationOptions &) - Instantiation options for the new subtree.

Returns: The owning SessionDiagnosticsHelper, or an ErrorDetail on failure. Never throws.

SessionDiagnosticsHelper create_sync(AddressSpace addressSpace, const NodeId &parent, const QualifiedName &browseName, std::shared_ptr< SessionCounters > counters, std::shared_ptr< SessionSecurityState > securityState, std::shared_ptr< SessionDescriptiveState > descriptiveState, const InstantiationOptions &options)

Creates a new SessionDiagnosticsObjectType instance under parent, blocking until complete.

  • addressSpace (AddressSpace) - Address space in which the node is created.
  • parent (const NodeId &) - Node under which the new instance is created.
  • browseName (const QualifiedName &) - Browse name of the new node.
  • counters (std::shared_ptr< SessionCounters >) - Shared per-session counters the read handlers observe live; must outlive the helper.
  • securityState (std::shared_ptr< SessionSecurityState >) - Shared per-session security state the read handlers observe live; must outlive the helper.
  • descriptiveState (std::shared_ptr< SessionDescriptiveState >) - Shared per-session descriptive state (session name, client description, connection timestamps) the read handlers observe live; must outlive the helper.
  • options (const InstantiationOptions &) - Instantiation options for the new subtree.

Returns: The owning SessionDiagnosticsHelper.

Functions

SessionDiagnosticsHelper()=default

Constructs an empty helper that backs no node.

const std::vector< NodeId > & security_diagnostic_node_ids() const

Returns the node ids of the security-diagnostic child Variables.

Returns: The node ids of the security-diagnostic child Variables, valid for the helper's lifetime.

const NodeId & node_id() const

Returns the node id of the backed SessionDiagnosticsObjectType instance.

Returns: The NodeId of the backed SessionDiagnosticsObjectType instance.

void release()

Detaches RAII ownership of the created subtree so it persists beyond this handle's lifetime.

ua::server::BrowseContinuationPoint

class

Captured state that lets a truncated Browse be continued by BrowseNext.

When a Browse produces more references than the client requested (or more than max_refs_per_node permits), the server returns a slice plus an opaque continuation point. This object holds everything needed to resume: the originating ViewDescription and BrowseDescription, the per-node reference cap, and the resume token for the producing namespace. It is identified by a server-generated Guid that is handed to the client and matched on the subsequent BrowseNext request.

When the references come from a NamespaceBrowseDelegate, the stored namespace_continuation_token is the delegate's own opaque token. The continuation point owns that token's lifetime: on destruction (and on the destination side of a move-assignment) a non-empty token is handed back to the delegate via release_resume_token, so the delegate can free any state it pinned for the paged browse.

Move-only: copying would duplicate ownership of the resume token. The moved-from instance has its delegate cleared so the token is released exactly once. Instances are not internally synchronized; serialize access externally (the server confines each continuation point to its session).

Functions

BrowseContinuationPoint(ViewDescription viewDescription, Counter maxRefsPerNode, const BrowseDescription &browseDescription, ByteString namespaceContinuationToken)

Constructs a continuation point for a built-in (non-delegated) Browse.

  • viewDescription (ViewDescription) - View the Browse was issued against.
  • maxRefsPerNode (Counter) - Maximum references returned per node, as negotiated for the originating request.
  • browseDescription (const BrowseDescription &) - The node and reference filter being browsed.
  • namespaceContinuationToken (ByteString) - Opaque token marking the resume position; ownership is taken by this object.
BrowseContinuationPoint(ViewDescription viewDescription, Counter maxRefsPerNode, const BrowseDescription &browseDescription, ByteString resumeToken, shared_ptr< NamespaceBrowseDelegate > delegate)

Constructs a continuation point backed by a NamespaceBrowseDelegate.

  • viewDescription (ViewDescription) - View the Browse was issued against.
  • maxRefsPerNode (Counter) - Maximum references returned per node.
  • browseDescription (const BrowseDescription &) - The node and reference filter being browsed.
  • resumeToken (ByteString) - Delegate-owned opaque resume token; ownership is taken by this object and released to delegate.
  • delegate (shared_ptr< NamespaceBrowseDelegate >) - Delegate that produced the references and that owns the resume token's backing state.

Releases the resume token back to the delegate, if one is held.

BrowseContinuationPoint(BrowseContinuationPoint &&other) noexcept

Move-constructs, transferring resume-token ownership.

  • other (BrowseContinuationPoint &&) - Source; left without a delegate and must not be reused except to assign or destroy.
BrowseContinuationPoint & operator=(BrowseContinuationPoint &&other) noexcept

Move-assigns, releasing this object's token before taking other 's.

  • other (BrowseContinuationPoint &&) - Source; left without a delegate and must not be reused except to assign or destroy.

Returns: Reference to this object.

const Guid & identifier() const

Server-generated identifier matched against incoming BrowseNext requests.

Returns: The server-generated Guid identifying this continuation point.

const ViewDescription & view_description() const

View the originating Browse was issued against.

Returns: The ViewDescription the originating Browse targeted.

Counter max_refs_per_node() const

Maximum number of references to return per node, as negotiated for the originating Browse request.

Returns: The per-node reference cap negotiated for the originating Browse.

const BrowseDescription & browse_description() const

Node and reference filter being browsed.

Returns: The BrowseDescription (node plus reference filter) being browsed.

const ByteString & namespace_continuation_token() const

Opaque token marking the resume position within the producing namespace.

Returns: The opaque resume token; empty once the browse is fully consumed.

ByteString & namespace_continuation_token()

Mutable access to the resume token so it can be advanced on BrowseNext.

Returns: Mutable reference to the resume token, for advancing it on BrowseNext.

const shared_ptr< NamespaceBrowseDelegate > & delegate() const

Delegate that produced the references, or null for a built-in Browse.

Returns: The producing NamespaceBrowseDelegate, or null for a built-in Browse.

const References & buffered_references() const

Unprocessed references from the namespace page that was open when this continuation point was emitted.

Returns: The buffered mid-page references to replay before the namespace token resumes.

void set_buffered_references(References references)

Stores the mid-page references to replay before the namespace token resumes.

  • references (References) - The unprocessed references from the open page; moved in, replacing any buffer already held.

ua::server::HistoryContinuationPoint

class

Server-side state that lets a HistoryRead be resumed across service calls.

When a HistoryRead cannot return all values in one response, the SDK creates one HistoryContinuationPoint per unfinished operation and hands the client an opaque identifier. On the follow-up request the client returns that identifier and the SDK replays the stored NamespaceHistoryDelegate::Cursor back to the delegate to fetch the next page.

The handle owns the delegate cursor: its destructor (and move-assignment overwrite) calls NamespaceHistoryDelegate::release_cursor exactly once on the last owning instance, so the delegate can reclaim any per-cursor resources. It is move-only to keep that ownership single, and is not thread-safe - it is created, accessed, and destroyed on the session's serialized service path.

Functions

HistoryContinuationPoint(uint16_t namespaceIndex, NamespaceHistoryDelegate::Cursor cursor, shared_ptr< NamespaceHistoryDelegate > delegate, TimestampsToReturn timestampsToReturn, NamespaceHistoryDelegate::DetailKind detailKind)

Constructs a continuation point and assigns it a fresh random identifier.

  • namespaceIndex (uint16_t) - Namespace whose history delegate owns the cursor.
  • cursor (NamespaceHistoryDelegate::Cursor) - Opaque pagination state produced by the delegate; moved in.
  • delegate (shared_ptr< NamespaceHistoryDelegate >) - History delegate that produced and will reclaim the cursor. Must outlive this handle.
  • timestampsToReturn (TimestampsToReturn) - Timestamps the original request asked for, replayed on resume.
  • detailKind (NamespaceHistoryDelegate::DetailKind) - Which HistoryRead operation this point continues.

Releases the owned cursor back to the delegate, if one is still held.

Move-constructs from other, transferring cursor ownership and leaving other inert.

  • other (HistoryContinuationPoint &&) - Source handle; left holding no delegate so it releases no cursor.
HistoryContinuationPoint & operator=(HistoryContinuationPoint &&other) noexcept

Move-assigns from other, releasing any cursor this handle currently owns first.

  • other (HistoryContinuationPoint &&) - Source handle; left holding no delegate so it releases no cursor.

Returns: Reference to this handle.

const Guid & identifier() const

Returns the random identifier the client uses to resume this read.

Returns: The Guid the client presents to resume this HistoryRead.

uint16_t namespace_index() const

Returns the namespace index whose history delegate owns the cursor.

Returns: The namespace index whose history delegate owns the cursor.

NamespaceHistoryDelegate::Cursor & cursor()

Returns a mutable reference to the owned delegate cursor.

Returns: Mutable reference to the owned delegate cursor.

const NamespaceHistoryDelegate::Cursor & cursor() const

Returns a read-only reference to the owned delegate cursor.

Returns: Read-only reference to the owned delegate cursor.

const shared_ptr< NamespaceHistoryDelegate > & delegate() const

Returns the history delegate that produced and will reclaim the cursor.

Returns: The NamespaceHistoryDelegate that produced and will reclaim the cursor.

TimestampsToReturn timestamps_to_return() const

Returns the timestamps the originating request asked for, replayed on resume.

Returns: The TimestampsToReturn the originating HistoryRead requested.

NamespaceHistoryDelegate::DetailKind detail_kind() const

Returns which HistoryRead operation this continuation point continues.

Returns: The NamespaceHistoryDelegate::DetailKind this continuation point continues.

ua::server::NodeManagementDelegate

class

Extension seam through which a server applies the OPC UA NodeManagement service.

A delegate implements the AddNodes, AddReferences, DeleteNodes, and DeleteReferences operations on behalf of a namespace. The SDK validates and authorizes the request, then dispatches each batch to the delegate; the delegate effects the mutation against the supplied AddressSpace and reports a per-item outcome.

All operations are callback-canonical (*_async). A delegate may complete its callback inline or after deferred work; per the SDK post discipline the caller is responsible for unwinding the stack, so the delegate need not post.

Member types

Result< AddNodeDestination > PrepareAddNodesItemResult

Per-item outcome of side-effect-free AddNodes destination preparation.

std::function< void(BatchResult< PrepareAddNodesItemResult >)> PrepareAddNodesCallback

Completion callback for prepare_add_nodes_async.

Result< AddNodesResult > AddNodesItemResult

Per-item outcome of an AddNodes operation.

std::function< void(BatchResult< AddNodesItemResult >)> AddNodesCompleteCallback

Completion callback for add_nodes_async.

std::function< void(BatchResult< VoidResult >)> NodeMgmtCompleteCallback

Completion callback shared by AddReferences, DeleteNodes, and DeleteReferences.

Functions

~NodeManagementDelegate()=default
void prepare_add_nodes_async(std::shared_ptr< const Context > context, AddressSpace addressSpace, std::vector< AddNodesItem > items, PrepareAddNodesCallback callback) noexcept

Selects the destination namespace for each AddNodes item without mutation.

void add_nodes_async(std::shared_ptr< const Context > context, AddressSpace addressSpace, std::vector< AuthorizedAddNode > items, AddNodesCompleteCallback callback)=0

Adds authorized nodes to the address space.

  • context (std::shared_ptr< const Context >) - Request context (identity, endpoint security, cancellation); the delegate may extend its lifetime.
  • addressSpace (AddressSpace) - Address space the nodes are added to.
  • items (std::vector< AuthorizedAddNode >) - Nodes paired with their authorized destinations, in request order.
  • callback (AddNodesCompleteCallback) - Receives the per-item outcomes as a BatchResult of AddNodesItemResult.
void add_references_async(std::shared_ptr< const Context > context, AddressSpace addressSpace, std::vector< AddReferencesItem > items, NodeMgmtCompleteCallback callback)=0

Adds references to the address space.

  • context (std::shared_ptr< const Context >) - Request context (identity, endpoint security, cancellation); the delegate may extend its lifetime.
  • addressSpace (AddressSpace) - Address space the references are added to.
  • items (std::vector< AddReferencesItem >) - References to add, in request order.
  • callback (NodeMgmtCompleteCallback) - Receives the per-item outcomes as a BatchResult of VoidResult.
void delete_nodes_async(std::shared_ptr< const Context > context, AddressSpace addressSpace, std::vector< DeleteNodesItem > items, NodeMgmtCompleteCallback callback)=0

Deletes nodes from the address space.

  • context (std::shared_ptr< const Context >) - Request context (identity, endpoint security, cancellation); the delegate may extend its lifetime.
  • addressSpace (AddressSpace) - Address space the nodes are removed from.
  • items (std::vector< DeleteNodesItem >) - Nodes to delete, in request order.
  • callback (NodeMgmtCompleteCallback) - Receives the per-item outcomes as a BatchResult of VoidResult.
void delete_references_async(std::shared_ptr< const Context > context, AddressSpace addressSpace, std::vector< DeleteReferencesItem > items, NodeMgmtCompleteCallback callback)=0

Deletes references from the address space.

  • context (std::shared_ptr< const Context >) - Request context (identity, endpoint security, cancellation); the delegate may extend its lifetime.
  • addressSpace (AddressSpace) - Address space the references are removed from.
  • items (std::vector< DeleteReferencesItem >) - References to delete, in request order.
  • callback (NodeMgmtCompleteCallback) - Receives the per-item outcomes as a BatchResult of VoidResult.

ua::server::WriteInterceptionContext

struct

Everything an interceptor needs to judge (and optionally transform) one attribute write.

Passed to WriteInterceptor::intercept_write_async for a single write, after built-in type checks and before the namespace stores the value. value is the value as it currently stands in the chain - a replacement returned by an earlier interceptor is visible to later ones.

WriteInterceptor

Public attributes

::ua::NodeId nodeId

Node whose attribute is being written.

::ua::AttributeId attributeId

Attribute targeted by the write.

::ua::DataValue value

Value as it currently stands in the chain (may be a prior replacement).

::ua::String indexRange

Raw index range for slice writes; empty for whole-value writes.

::ua::AddressSpace addressSpace

Handle for async-reading the node's TypeDefinition / properties; observe only, never mutate.

std::shared_ptr< const UserIdentity > userIdentity

Authenticated caller identity, or null when no session security context is present.

std::shared_ptr< const EndpointSecurityContext > endpointSecurity

Endpoint security context for the caller's session, or null when none is present.

ua::server::WriteDecision

struct

Outcome of intercepting one write.

A default-constructed value ({}) approves the write unchanged and is the conventional result for an interceptor that does not apply.

WriteInterceptor

Public attributes

::ua::VoidResult outcome

Verdict for the write: a Good result raises no objection; a Bad result rejects the write with that status (and carries the ErrorDetail) and short-circuits the remaining interceptors.

std::optional<::ua::DataValue > replacement

Replacement value to store in place of the incoming one, honoured only on a Good outcome.

ua::server::WriteInterceptor

class

Pluggable, asynchronous write interceptor for server attribute writes.

The server runs every registered interceptor for each attribute write, in registration order, after built-in type checks and before the value reaches the namespace. Each interceptor may approve (Good, no replacement), transform (Good + replacement), or reject (Bad) the write; the first rejection short-circuits the chain. An interceptor that does not apply to a write returns {} (Good, no replacement).

Interceptors observe and decide only - they must not mutate the address space.

WriteInterceptionContext, WriteDecision

Member types

std::function< void(WriteDecision)> CompleteCallback

Callback that delivers the interceptor's WriteDecision to the server.

Functions

~WriteInterceptor()=default
void intercept_write_async(WriteInterceptionContext context, CompleteCallback complete)=0

Intercepts a single attribute write and reports the decision asynchronously.

  • context (WriteInterceptionContext) - Subject of the write and the caller's identity; see WriteInterceptionContext. Taken by value so the interceptor may retain it across async work.
  • complete (CompleteCallback) - Invoked exactly once with the WriteDecision - approve, transform, or reject.

ua::server::ListenOptions

struct

Options controlling how a server starts listening on an endpoint.

Passed by value to the Server listen family (listen_async, listen_sync, try_listen_sync); a default-constructed instance selects the conventional behaviour. The struct owns no external resources and may be copied freely.

Public attributes

std::optional< std::chrono::seconds > timeout

Upper bound on how long the listen operation may take, in seconds.

bool failIfAlreadyListening

Whether listening on an already-active endpoint is treated as an error.

ua::server::RequestLatencyTracker

struct

Lightweight per-service request latency tracker using an exponential moving average.

Holds one independent statistics Entry per service kind. Latencies are recorded at service completion with relaxed atomics, so reads and writes are lock-free and may race freely across threads; the published averages are eventually-consistent observability figures, not exact measurements. Service kinds are mapped to slot indices by the caller (the Session shell); the tracker itself ascribes no meaning to an index.

Functions

void record(size_t serviceIndex, std::chrono::microseconds duration)

Records a latency sample for the service kind at serviceIndex.

  • serviceIndex (size_t) - Caller-assigned slot identifying the service kind; samples with an index at or beyond sMaxServiceKinds are dropped.
  • duration (std::chrono::microseconds) - Measured request latency.
void reset()

Resets the statistics of every service-kind slot to zero.

Public attributes

Entry byService[sMaxServiceKinds]

Per-service statistics, indexed by the caller-assigned service-kind slot.

Static attributes

constexpr size_t sMaxServiceKinds

Maximum number of tracked service kinds, i.e. the slot count of byService.

ua::server::ReverseConnectHandle

struct

Opaque handle identifying an active reverse connect target.

Returned by ua::server::Server::start_reverse_connect_async (and its sync variants) and passed back to stop a specific target. The handle is a small value type that may be freely copied, stored, and compared; it owns no resources and remains valid until the corresponding target is stopped. A default-constructed handle (value == 0) refers to no target.

Public attributes

std::uint64_t value

Opaque target identifier; 0 denotes no target.

ua::server::ListenerHandle

struct

Opaque handle identifying a single bound listener.

Returned by the listen operations and passed back to per-listener queries (endpoints, bound address, advertised URLs). Value-comparable; the wrapped integer is an opaque token, not a stable address or index.

Public attributes

std::uint64_t value

Opaque listener token. Do not interpret.

ua::server::ShutdownParams

struct

Parameters controlling a graceful server shutdown.

Public attributes

std::optional< uint32_t > secondsTillShutdown

Grace period, in seconds, before sessions are forcibly terminated.

LocalizedText shutdownReason

Reason for shutdown, exposed to clients via ServerStatus.ShutdownReason.

ua::server::Server

class

The main entry point for the OPC UA Server SDK.

Configures, starts, and manages an OPC UA server: listeners and endpoints, address-space access, cryptographic configuration, event emission, and lifecycle. This is a move-only handle that shares ownership of the underlying server implementation; the server runs while at least one handle is alive.

Member types

std::function< void(VoidResult)> CompleteCallback

Callback signaling completion of an asynchronous operation.

std::function< void(ListenerHandleResult)> ListenCompleteOneCallback

Callback for a listen operation that produces a single listener handle.

std::function< void(ListenerHandleListResult)> ListenCompleteManyCallback

Callback for a listen operation that may produce several listener handles.

Static functions

Server create(boost::asio::any_io_executor executor, ::ua::server::CreateConfig config, shared_ptr< const Crypto > crypto, shared_ptr< CertificateStore > applicationGroupCertificateStore, ::ua::server::ServerSecurityHooks securityHooks={}, std::shared_ptr< LogSink > logSink=nullptr, LogLevel logLevel=LogLevel::Info)

Creates a production server with full dependency injection.

  • executor (boost::asio::any_io_executor) - The executor that runs the server's asynchronous work.
  • config (::ua::server::CreateConfig) - The server creation configuration (identity and parameters).
  • crypto (shared_ptr< const Crypto >) - The cryptographic provider.
  • applicationGroupCertificateStore (shared_ptr< CertificateStore >) - The application group certificate store.
  • securityHooks (::ua::server::ServerSecurityHooks) - Optional security policy hooks.
  • logSink (std::shared_ptr< LogSink >) - Structured-log sink installed at construction, or nullptr to disable logging. Installed BEFORE any subsystem captures a logger, so the address space, namespaces, sampling engine, conditions, etc. all log to it from birth. The sink is fixed for the server's lifetime (there is no runtime sink setter); the level remains adjustable via set_log_level().
  • logLevel (LogLevel) - Minimum level to emit (only meaningful when logSink set).

Returns: A new server handle.

Functions

Server(Server &&) noexcept=default

Move-constructs, transferring the moved-from handle's share of the server.

Server & operator=(Server &&) noexcept=default

Move-assigns, releasing this handle's current share before taking other's.

Returns: A reference to this handle.

~Server()

Destroys this handle and releases its share of the server implementation.

AddressSpace address_space()

Returns a handle to the server's address space.

Returns: A handle to the server's address space.

const Crypto & crypto() const

Returns the server's cryptographic provider.

Returns: The server's cryptographic provider.

const ::ua::server::CombinedConfig & config() const

Returns the combined (effective) server configuration.

Returns: The combined (effective) server configuration.

void start_async(CompleteCallback callback) noexcept

Starts the server through the callback-canonical lifecycle.

  • callback (CompleteCallback) - Receives startup success or the exact metadata, lifecycle or network failure.
void start()

Starts the server, opening configured listeners and activating endpoints.

VoidResult try_start() noexcept

Starts the server, opening configured listeners and activating endpoints.

Returns: Success, or an ErrorDetail on failure. Never throws.

ListenerHandleListResult try_listen_sync(TransportProfileId transportProfileId, string_view hostname, uint16_t port, ListenOptions options={}) noexcept

Starts listening on a transport profile, host, and port.

  • transportProfileId (TransportProfileId) - Transport profile URI (e.g. TCP UA Binary).
  • hostname (string_view) - Hostname or IP address to bind to.
  • port (uint16_t) - TCP port number.
  • options (ListenOptions) - Additional listening options.

Returns: One handle per bound endpoint, or an ErrorDetail on failure. Never throws.

ListenerHandleList listen_sync(TransportProfileId transportProfileId, string_view hostname, uint16_t port, ListenOptions options={})

Starts listening on a transport profile, host, and port, blocking until done.

  • transportProfileId (TransportProfileId) - Transport profile URI (e.g. TCP UA Binary).
  • hostname (string_view) - Hostname or IP address to bind to.
  • port (uint16_t) - TCP port number.
  • options (ListenOptions) - Additional listening options.

Returns: One handle per bound endpoint.

ListenerHandleResult try_listen_sync(ua::transport::BindAddress bindAddress, ListenOptions options={}) noexcept

Starts listening on a transport-qualified bind address.

Returns: The listener handle, or an ErrorDetail on failure. Never throws.

ListenerHandle listen_sync(ua::transport::BindAddress bindAddress, ListenOptions options={})

Starts listening on a transport-qualified bind address, blocking until done.

Returns: The listener handle.

void listen_async(TransportProfileId transportProfileId, string_view hostname, uint16_t port, ListenOptions options, ListenCompleteManyCallback callback) noexcept

Asynchronously starts listening on a transport profile, host, and port.

  • transportProfileId (TransportProfileId) - Transport profile URI (e.g. TCP UA Binary).
  • hostname (string_view) - Hostname or IP address to bind to.
  • port (uint16_t) - TCP port number.
  • options (ListenOptions) - Additional listening options.
  • callback (ListenCompleteManyCallback) - Receives one handle per bound endpoint on success, or an ErrorDetail on failure. Never throws.
void listen_async(ua::transport::BindAddress bindAddress, ListenOptions options, ListenCompleteOneCallback callback) noexcept

Asynchronously starts listening on a transport-qualified bind address.

  • bindAddress (ua::transport::BindAddress) - Transport-qualified, transport-defined bind address.
  • options (ListenOptions) - Additional listening options.
  • callback (ListenCompleteOneCallback) - Receives the listener handle on success, or an ErrorDetail on failure. Never throws.
void add_endpoint(ListenerHandle listener, ServerEndpointConfiguration endpoint)

Adds an endpoint configuration to a listener.

void remove_endpoint(ListenerHandle listener, ServerEndpointConfiguration endpoint)

Removes an endpoint configuration from a listener.

std::vector< ServerEndpointConfiguration > endpoints(ListenerHandle listener) const

Returns the endpoint configurations currently attached to a listener.

Returns: The endpoint configurations currently attached to listener.

ua::transport::BindAddress requested_bind_address(ListenerHandle listener) const

Returns the bind address originally requested for a listener.

Returns: The bind address originally requested for listener.

ua::transport::BindAddress bound_bind_address(ListenerHandle listener) const

Returns the bind address a listener is actually bound to.

Returns: The bind address listener is actually bound to.

std::vector< ua::transport::EndpointUrl > advertised_urls(ListenerHandle listener) const

Returns the endpoint URLs advertised for a listener.

Returns: The endpoint URLs advertised for listener.

CertificateStore & default_application_group_certificate_store() const

Returns the certificate store for the default application group.

Returns: The certificate store for the default application group.

std::vector< std::string > discovery_urls() const

Returns the post-bind discovery URLs, one per bound listener endpoint.

Returns: The discovery URLs, one per bound listener endpoint; empty before start.

ApplicationDescription application_description() const

Returns the ApplicationDescription this server advertises.

Returns: The ApplicationDescription this server advertises.

std::shared_ptr< CertificateStore > application_certificate_store() const

Returns the certificate store the registration channel uses by default.

Returns: The registration channel's default certificate store; never null.

void set_observer(std::shared_ptr< ServerObserver > observer)

Sets the observer for server lifecycle notifications.

  • observer (std::shared_ptr< ServerObserver >) - The observer to install, or nullptr to unset (releasing the server's reference to any previously installed observer).
void set_log_level(LogLevel level)

Changes the minimum log level at runtime.

  • level (LogLevel) - The new minimum level to emit.
ServerHealthSnapshot health_snapshot() const

Returns a snapshot of server-wide health metrics.

Returns: A snapshot of server-wide health metrics.

std::vector< SessionHealthSnapshot > session_health_snapshots() const

Returns one health snapshot per active session.

Returns: One health snapshot per active session.

void set_node_management_delegate(std::shared_ptr< NodeManagementDelegate > delegate)

Sets the application delegate for the Node Management services.

void add_write_interceptor(std::shared_ptr< WriteInterceptor > interceptor)

Registers a write interceptor run before every attribute write is stored.

void set_event_listener(std::function< void(const BaseEvent &)> listener)

Sets a local listener that receives every emitted event synchronously.

void emit_event(BaseEvent &event)

Emits an OPC UA event into the server's event pipeline.

  • event (BaseEvent &) - The event to emit; modified in place to populate the auto-filled fields.
Conditions & conditions()

Returns the server-level registry of live condition instances.

Returns: The server-level registry of live condition instances.

EventSink & event_sink()

Returns the server's event sink for event emission.

Returns: The server's event sink for event emission.

shared_ptr< const UaBinaryDataValueCodec > ua_binary_data_value_codec()

Creates a UA Binary codec for encoding and decoding DataValues.

Returns: A shared pointer to an immutable codec instance.

void register_structure_type(const NodeId &encodingId, StructureFactory::CreateMethod factory)

Registers a custom structure type with the server's UA Binary decoder.

  • encodingId (const NodeId &) - The binary encoding NodeId for the type.
  • factory (StructureFactory::CreateMethod) - A callable producing a new default-constructed instance.
Result< NodeSetImportSummary > try_import_nodeset_sync(shared_ptr< const NodeSetDocument > document, NodeSetImportOptions options={})

Imports a parsed NodeSet document into the address space, blocking until done.

  • document (shared_ptr< const NodeSetDocument >) - The parsed, immutable NodeSet document to import.
  • options (NodeSetImportOptions) - Import options; the structure resolver defaults to the server's structure factory.

Returns: The import summary, or an ErrorDetail on failure. Never throws.

Result< NodeSetImportSummary > try_import_nodeset_sync(const Stream &nodeset, NodeSetImportOptions options={})

Parses and imports a NodeSet2 XML stream into the address space, blocking until done.

  • nodeset (const Stream &) - The NodeSet2 XML stream to parse and import.
  • options (NodeSetImportOptions) - Import options; the structure resolver defaults to the server's structure factory.

Returns: The import summary, or an ErrorDetail on failure. Never throws.

NodeSetImportSummary import_nodeset_sync(shared_ptr< const NodeSetDocument > document, NodeSetImportOptions options={})

Imports a parsed NodeSet document into the address space, blocking until done.

  • document (shared_ptr< const NodeSetDocument >) - The parsed, immutable NodeSet document to import.
  • options (NodeSetImportOptions) - Import options; the structure resolver defaults to the server's structure factory.

Returns: The import summary.

NodeSetImportSummary import_nodeset_sync(const Stream &nodeset, NodeSetImportOptions options={})

Parses and imports a NodeSet2 XML stream into the address space, blocking until done.

  • nodeset (const Stream &) - The NodeSet2 XML stream to parse and import.
  • options (NodeSetImportOptions) - Import options; the structure resolver defaults to the server's structure factory.

Returns: The import summary.

void import_nodeset_async(shared_ptr< const NodeSetDocument > document, NodeSetImportOptions options, std::function< void(Result< NodeSetImportSummary >)> completion)

Asynchronously imports a parsed NodeSet document into the address space.

  • document (shared_ptr< const NodeSetDocument >) - The parsed, immutable NodeSet document to import.
  • options (NodeSetImportOptions) - Import options; the structure resolver defaults to the server's structure factory.
  • completion (std::function< void(Result< NodeSetImportSummary >)>) - Invoked on the server's executor with the import summary on success, or an ErrorDetail on failure. Never throws.
Result< dynamic_types::LoaderRegistrationStats > try_register_address_space_types_sync(dynamic_types::TypeFilter filter={})

Discovers and registers the address space's custom DataTypes, blocking until complete.

  • filter (dynamic_types::TypeFilter) - Selects which discovered DataTypes to register; an empty filter selects all. Field dependencies of a selected type are always registered.

Returns: The registration statistics, or an ErrorDetail on a top-level failure. Never throws.

dynamic_types::LoaderRegistrationStats register_address_space_types_sync(dynamic_types::TypeFilter filter={})

Discovers and registers the address space's custom DataTypes, blocking until complete.

  • filter (dynamic_types::TypeFilter) - Selects which discovered DataTypes to register; an empty filter selects all.

Returns: The registration statistics.

void register_address_space_types_async(dynamic_types::TypeFilter filter, std::function< void(Result< dynamic_types::LoaderRegistrationStats >)> completion)

Asynchronously discovers and registers the address space's custom DataTypes.

void start_reverse_connect_async(ServerConfiguration::ReverseConnectTarget target, std::function< void(ReverseConnectHandleResult)> callback) noexcept

Asynchronously starts a reverse connection to a client-side listener.

  • target (ServerConfiguration::ReverseConnectTarget) - The reverse-connect target to dial.
  • callback (std::function< void(ReverseConnectHandleResult)>) - Receives the handle for the started reverse connection on success, or an ErrorDetail on failure. Never throws.
ReverseConnectHandle start_reverse_connect_sync(ServerConfiguration::ReverseConnectTarget target)

Starts a reverse connection to a client-side listener, blocking until started.

  • target (ServerConfiguration::ReverseConnectTarget) - The reverse-connect target to dial.

Returns: A handle identifying the started reverse connection.

ReverseConnectHandleResult try_start_reverse_connect_sync(ServerConfiguration::ReverseConnectTarget target) noexcept

Starts a reverse connection to a client-side listener, blocking until started.

  • target (ServerConfiguration::ReverseConnectTarget) - The reverse-connect target to dial.

Returns: A handle for the started reverse connection, or an ErrorDetail on failure. Never throws.

void stop_reverse_connect_async(ReverseConnectHandle handle, std::function< void(VoidResult)> callback) noexcept

Asynchronously stops a reverse connection.

void stop_reverse_connect_sync(ReverseConnectHandle handle)

Stops a reverse connection, blocking until stopped.

VoidResult try_stop_reverse_connect_sync(ReverseConnectHandle handle) noexcept

Stops a reverse connection, blocking until stopped.

Returns: Success, or an ErrorDetail on failure. Never throws.

void stop_all_reverse_connects_async(std::function< void(VoidResult)> callback) noexcept

Asynchronously stops all active reverse connections.

void stop_all_reverse_connects_sync()

Stops all active reverse connections, blocking until stopped.

VoidResult try_stop_all_reverse_connects_sync() noexcept

Stops all active reverse connections, blocking until stopped.

Returns: Success, or an ErrorDetail on failure. Never throws.

void shutdown_async(ShutdownParams params, CompleteCallback callback) noexcept

Asynchronously initiates a graceful server shutdown.

  • params (ShutdownParams) - Shutdown parameters (grace period, reason).
  • callback (CompleteCallback) - Invoked when shutdown is complete, with success or an ErrorDetail. Never throws.
void shutdown_sync(ShutdownParams params={})

Initiates a graceful server shutdown, blocking until complete.

  • params (ShutdownParams) - Shutdown parameters (grace period, reason).
VoidResult try_shutdown_sync(ShutdownParams params={}) noexcept

Initiates a graceful server shutdown, blocking until complete.

  • params (ShutdownParams) - Shutdown parameters (grace period, reason).

Returns: Success, or an ErrorDetail on failure. Never throws.

ua::server::CreateConfig

struct

Value-based configuration bundle supplied when creating a Server.

Aggregates the three configuration objects a server needs at construction: the application identity, the deployment configuration, and the server-only settings. Every field is held by value so the caller can populate and edit the bundle freely before handing it to Server::create. The factory freezes the contents internally into an immutable shared configuration, so later mutation of this struct has no effect on a server already created.

Server::create

Public attributes

::ua::ApplicationIdentity mIdentity

Application identity advertised to peers (product URI, name, type, build info).

::ua::ApplicationConfiguration mApplication

Deployment configuration (protocol timeouts, lifetimes, limits, trust-list locations, security policy).

::ua::server::ServerConfiguration mServer

Server-only settings (limits, throttling, capabilities, listeners, roles).

ua::server::CombinedConfig

struct

The complete configuration needed to construct a server instance.

Bundles the three configuration layers a server is built from: the static application identity, the shared deployment-wide ua::ApplicationConfiguration, and the server-only ua::server::ServerConfiguration. The application configuration is held by shared, const-qualified pointer because it is immutable once loaded and may be shared with other components (for example a co-hosted client); the identity and server settings are owned by value.

Public attributes

::ua::ApplicationIdentity mIdentity

Static identity the server advertises about itself.

std::shared_ptr< const ::ua::ApplicationConfiguration > mApplication

Shared, immutable deployment configuration.

::ua::server::ServerConfiguration mServer

Server-only settings (connection/channel limits, endpoints, roles).

ua::server::ServerConfiguration

struct

Server-only configuration: limits, throttling, capabilities, listeners, and roles.

A plain value type passed to the server at construction. Members are read during startup; mutate them before start(), not after. Counts are absolute concurrency caps, durations carry their std::chrono units, and optional limits left as nullopt mean "unbounded / OS-limited" unless noted otherwise.

Member types

std::chrono::milliseconds milliseconds

Convenience alias for std::chrono::milliseconds.

Static functions

constexpr std::string_view diagnostic_level_name(DiagnosticPolicy::Level level)

Names a diagnostic level for error context.

  • level (DiagnosticPolicy::Level) - The level to name.

Returns: The level's name as it appears in error context - None, Summary or Full - and Unknown for a value outside the enumeration.

Functions

const ServerCapabilities & server_capabilities() const

Returns the server capability limits (read-only view).

Returns: Read-only reference to the advertised ServerCapabilities.

ServerCapabilities & server_capabilities()

Returns the server capability limits for mutation before startup.

Returns: Mutable reference to the advertised ServerCapabilities.

const std::vector< ListenerConfiguration > & listeners() const

Returns the configured network listeners (read-only view).

Returns: Read-only reference to the configured ListenerConfiguration list.

std::vector< ListenerConfiguration > & listeners()

Returns the configured network listeners for mutation before startup.

Returns: Mutable reference to the configured ListenerConfiguration list.

void validate() const

Validates the configuration, throwing on the first inconsistency found.

Public attributes

optional< uint32_t > mMaxConnections

Maximum number of concurrent transport connections, including those still in the HEL/ACK handshake.

optional< uint32_t > mMaxSecureChannels

Maximum number of concurrent secure channels across all transports.

optional< uint32_t > mMaxRequestsPerSession

Maximum number of concurrent in-flight requests per session.

optional< uint32_t > mMaxInFlightRequests

Maximum number of concurrent in-flight requests across the whole server.

optional< uint32_t > mMaxInFlightRequestsPerConnection

Maximum number of concurrent in-flight requests per transport connection (secure channel).

ConnectionThrottling mConnectionThrottling

Active per-IP connection throttling settings.

IdentityThrottling mIdentityThrottling

Active identity-token attack-protection settings.

uint32_t mMaxAccessIdentities

Maximum number of distinct live access identities retained by the server.

milliseconds mAuthzTimeout

One-operation deadline for asynchronous namespace permission resolution.

DiscoveryThrottling mDiscoveryThrottling

Active discovery-service throttling settings.

bool mDiscoveryEndpointEnabled

Enables the unsecured discovery-only endpoint used when no configured endpoint accepts SecurityPolicy None.

bool mAcceptInvalidPadding

Accepts non-zero padding bytes in encrypted UserIdentityToken secrets.

ResourceLimits mResourceLimits

Active server-internal queue/store caps.

std::chrono::seconds mMonitoredItemAccessRecheckInterval

Period on which each active MonitoredItem's read/receive-events authorization is re-evaluated, honoring access-rights changes after CreateMonitoredItems (OPC 10000-4 sec.

SubscriptionLimits mSubscriptionLimits

Active subscription/publish-flow tuning knobs.

optional< milliseconds > mBrowseContinuationPointTimeout

Lifetime of an idle Browse continuation point.

optional< milliseconds > mHistoryContinuationPointTimeout

Lifetime of an idle HistoryRead continuation point.

optional< uint32_t > mMaxReferencesPerNode

Server ceiling on the number of references returned per node in a single Browse page.

optional< uint32_t > mMaxBrowsePathWalkReferences

Per-operation budget on the number of references examined during a single TranslateBrowsePaths walk.

bool mAuditingEnabled

Whether the server emits audit events and advertises auditing support.

bool mRoleManagementEnabled

Whether the OPC 10000-18 RoleType Method handlers permit runtime Role mutation.

bool mEnableClaimToRoleMapping

Whether an authenticator's published Role claim is mapped to the SecurityAdmin Role.

std::optional< std::vector< WellKnownRole > > mWellKnownRoles

Subset of well-known Roles to materialise in the address space.

uint32_t mDefaultShutdownGracePeriodSeconds

Default grace period, in seconds, for shutdown while clients are connected.

DiagnosticPolicy mDiagnosticPolicy

Active DiagnosticInfo return policy.

HistoryConfiguration mHistoryConfiguration

Active history-access capability limits.

std::vector< ReverseConnectTarget > mReverseConnectTargets

Reverse-connect targets, activated by start() alongside listeners.

LocalDiscoveryServer mLocalDiscoveryServer

Active Local-Discovery-Server settings.

ua::server::ServiceCounter

struct

Per-service request counter pair holding a total and an error subtotal.

Both fields are lock-free atomics updated from any thread on the request path; error_count counts the subset of total_count that completed with a bad status, so error_count <= total_count holds eventually but not necessarily at any single observation. Counts are approximate by design (see ServerSummaryCounters for the ordering rationale).

Public attributes

std::atomic< uint32_t > totalCount

Total requests of this service counted so far.

std::atomic< uint32_t > errorCount

Subset of total_count that completed with an error.

ua::server::ServerSummaryCounters

struct

Server-wide diagnostic summary counters mirroring the OPC UA summary node.

Maps 1:1 to ServerDiagnosticsSummaryDataType (one atomic per field). Every field uses relaxed memory ordering, so reads of distinct fields are not mutually consistent and totals are approximate by design - they are intended for diagnostics, not for exact accounting or synchronisation. Gauge fields rise and fall with live resources; the remaining fields are monotonic and increment only (until reset). All fields are updated from any thread.

Functions

void reset()

Resets every counter to zero using relaxed stores.

Public attributes

std::atomic< uint32_t > currentSessionCount

Sessions currently open.

std::atomic< uint32_t > currentSubscriptionCount

Subscriptions currently active.

std::atomic< uint32_t > serverViewCount

Views currently present in the server.

std::atomic< uint32_t > publishingIntervalCount

Distinct publishing intervals in use.

std::atomic< uint32_t > currentMonitoredItemCount

Monitored items currently active, summed across all subscriptions.

std::atomic< uint32_t > cumulatedSessionCount

Sessions opened since startup (cumulative).

std::atomic< uint32_t > securityRejectedSessionCount

Sessions rejected for a security reason since startup.

std::atomic< uint32_t > rejectedSessionCount

Sessions rejected for any reason since startup.

std::atomic< uint32_t > sessionTimeoutCount

Sessions closed by timeout since startup.

std::atomic< uint32_t > sessionAbortCount

Sessions aborted abnormally since startup.

std::atomic< uint32_t > cumulatedSubscriptionCount

Subscriptions created since startup (cumulative).

std::atomic< uint32_t > securityRejectedRequestsCount

Requests rejected for a security reason since startup.

std::atomic< uint32_t > rejectedRequestsCount

Requests rejected for any reason since startup.

ua::server::SecureChannelCounters

struct

Secure channel counters aggregated across the whole server.

Relaxed atomics updated from any thread; counts are approximate by design.

Functions

void reset()

Resets every counter to zero using relaxed stores.

Public attributes

std::atomic< uint32_t > currentCount

Secure channels currently open (gauge).

std::atomic< uint32_t > cumulatedCount

Secure channels opened since startup (cumulative).

std::atomic< uint32_t > rejectedCount

Secure channel opens rejected since startup.

ua::server::ConnectionCounters

struct

TCP connection counters aggregated across the whole server.

Relaxed atomics updated from any thread; counts are approximate by design.

Functions

void reset()

Resets every counter to zero using relaxed stores.

Public attributes

std::atomic< uint32_t > currentCount

TCP connections currently open (gauge).

std::atomic< uint32_t > cumulatedCount

TCP connections accepted since startup (cumulative).

std::atomic< uint32_t > rejectedCount

TCP connections rejected since startup.

ua::server::SessionCounters

struct

Per-session diagnostic counters mirroring the OPC UA session diagnostics node.

Holds an aggregate request counter plus one ServiceCounter per service, matching the per-service fields of SessionDiagnosticsDataType. All fields are relaxed atomics updated from any thread; counts are approximate by design. One instance exists per live session.

Functions

void reset()

Resets the aggregate and every per-service counter to zero using relaxed stores.

Public attributes

ServiceCounter totalRequests

Aggregate total/error counts across all services on this session.

std::atomic< uint32_t > unauthorizedRequestCount

Requests on this session rejected because the user was not authorized.

ServiceCounter read

Read service requests on this session.

ServiceCounter historyRead

HistoryRead service requests on this session.

ServiceCounter write

Write service requests on this session.

ServiceCounter historyUpdate

HistoryUpdate service requests on this session.

ServiceCounter call

Call service requests on this session.

ServiceCounter createMonitoredItems

CreateMonitoredItems requests on this session.

ServiceCounter modifyMonitoredItems

ModifyMonitoredItems requests on this session.

ServiceCounter setMonitoringMode

SetMonitoringMode requests on this session.

ServiceCounter setTriggering

SetTriggering requests on this session.

ServiceCounter deleteMonitoredItems

DeleteMonitoredItems requests on this session.

ServiceCounter createSubscription

CreateSubscription requests on this session.

ServiceCounter modifySubscription

ModifySubscription requests on this session.

ServiceCounter setPublishingMode

SetPublishingMode requests on this session.

ServiceCounter publish

Publish service requests on this session.

ServiceCounter republish

Republish service requests on this session.

ServiceCounter transferSubscriptions

TransferSubscriptions requests on this session.

ServiceCounter deleteSubscriptions

DeleteSubscriptions requests on this session.

ServiceCounter addNodes

AddNodes service requests on this session.

ServiceCounter addReferences

AddReferences service requests on this session.

ServiceCounter deleteNodes

DeleteNodes service requests on this session.

ServiceCounter deleteReferences

DeleteReferences service requests on this session.

ServiceCounter browse

Browse service requests on this session.

ServiceCounter browseNext

BrowseNext service requests on this session.

ServiceCounter translateBrowsePaths

TranslateBrowsePathsToNodeIds requests on this session.

ServiceCounter queryFirst

QueryFirst service requests on this session.

ServiceCounter queryNext

QueryNext service requests on this session.

ServiceCounter registerNodes

RegisterNodes service requests on this session.

ServiceCounter unregisterNodes

UnregisterNodes service requests on this session.

ua::server::ServerEndpointConfiguration

struct

Security configuration for a single server endpoint exposed by a listener.

Describes one endpoint a client may connect to: its message security mode, security policy, transport profile, and the user identity tokens it accepts. A listener typically exposes several of these (e.g. one per security policy/mode pairing). The defaults select the most secure common combination (Sign-and-encrypt with SecurityPolicyId::Aes128Sha256RsaOaep over UA-TCP UA-SC UA-Binary).

Functions

bool operator==(const ServerEndpointConfiguration &obj) const =default

Compares two configurations field by field for equality.

  • obj (const ServerEndpointConfiguration &) - Configuration to compare against.

Returns: true when every field compares equal, otherwise false.

Public attributes

std::string mName

Stable endpoint identifier, unique within its listener.

MessageSecurityMode mMessageSecurityMode

Message security mode required on the secure channel (default Sign-and-encrypt).

SecurityPolicyId mSecurityPolicyId

Security policy applied to the secure channel (default Aes128Sha256RsaOaep).

TransportProfileId mTransportProfile

Transport profile for the endpoint (default UA-TCP UA-SC UA-Binary).

std::vector< UserTokenPolicy > mUserIdentityTokens

User identity tokens this endpoint accepts, in order of server preference.

ua::server::ServerHealthSnapshot

struct

A point-in-time snapshot of server-wide health and diagnostics metrics.

Each field is read independently from an atomic counter, so the snapshot is not a coherent cross-field capture: different fields may reflect slightly different instants. This is acceptable per the OPC UA "approximate" guidance for diagnostics. Counters named current_* are gauges (instantaneous occupancy), cumulated_* are monotonically increasing totals over the server's lifetime, and rejected_* count refused attempts.

Public attributes

uint32_t currentSessionCount

Sessions currently open.

uint32_t cumulatedSessionCount

Sessions opened since server start.

uint32_t securityRejectedSessionCount

Session creations refused for security reasons.

uint32_t rejectedSessionCount

Session creations refused for any reason.

uint32_t sessionTimeoutCount

Sessions closed because they timed out.

uint32_t sessionAbortCount

Sessions closed abnormally (aborted).

uint32_t currentSubscriptionCount

Subscriptions currently active across all sessions.

uint32_t cumulatedSubscriptionCount

Subscriptions created since server start.

uint32_t serverViewCount

Views present in the server's address space.

uint32_t publishingIntervalCount

Distinct publishing intervals currently in use.

uint32_t securityRejectedRequestsCount

Requests refused for security reasons.

uint32_t rejectedRequestsCount

Requests refused for any reason.

uint32_t currentSecureChannelCount

Secure channels currently open.

uint32_t cumulatedSecureChannelCount

Secure channels opened since server start.

uint32_t rejectedSecureChannelCount

Secure-channel open attempts that were refused.

uint32_t currentConnectionCount

Transport connections currently open.

uint32_t cumulatedConnectionCount

Transport connections accepted since server start.

uint32_t rejectedConnectionCount

Transport connection attempts that were refused.

LatencyEntry latencyByService[RequestLatencyTracker::sMaxServiceKinds]

Per-service latency statistics, indexed by service-kind slot.

ua::server::SessionHealthSnapshot

struct

A point-in-time snapshot of per-session health and diagnostics metrics.

Identifies one session and reports its request counters, authorization failures, and subscription/monitored-item occupancy. As with ServerHealthSnapshot, fields are sampled independently and are approximate rather than a coherent cross-field capture.

Public attributes

NodeId sessionId

Identifier of the session this snapshot describes.

std::string sessionName

Human-readable session name, as supplied by the client.

uint32_t unauthorizedRequestCount

Requests refused because the session lacked permission.

uint32_t currentSubscriptionCount

Subscriptions currently owned by the session.

uint32_t currentMonitoredItemsCount

Monitored items currently owned by the session.

ServiceCount totalRequests

All requests, summed across every service kind.

ServiceCount read

Read service requests.

ServiceCount browse

Browse service requests.

ServiceCount browseNext

BrowseNext service requests.

ServiceCount write

Write service requests.

ServiceCount call

Call (method) service requests.

ServiceCount historyRead

HistoryRead service requests.

ServiceCount historyUpdate

HistoryUpdate service requests.

ServiceCount createMonitoredItems

CreateMonitoredItems service requests.

ServiceCount modifyMonitoredItems

ModifyMonitoredItems service requests.

ServiceCount setMonitoringMode

SetMonitoringMode service requests.

ServiceCount setTriggering

SetTriggering service requests.

ServiceCount deleteMonitoredItems

DeleteMonitoredItems service requests.

ServiceCount createSubscription

CreateSubscription service requests.

ServiceCount modifySubscription

ModifySubscription service requests.

ServiceCount setPublishingMode

SetPublishingMode service requests.

ServiceCount publish

Publish service requests.

ServiceCount republish

Republish service requests.

ServiceCount transferSubscriptions

TransferSubscriptions service requests.

ServiceCount deleteSubscriptions

DeleteSubscriptions service requests.

ServiceCount addNodes

AddNodes service requests.

ServiceCount addReferences

AddReferences service requests.

ServiceCount deleteNodes

DeleteNodes service requests.

ServiceCount deleteReferences

DeleteReferences service requests.

ServiceCount translateBrowsePaths

TranslateBrowsePathsToNodeIds service requests.

ServiceCount queryFirst

QueryFirst service requests.

ServiceCount queryNext

QueryNext service requests.

ServiceCount registerNodes

RegisterNodes service requests.

ServiceCount unregisterNodes

UnregisterNodes service requests.

ua::server::SecureChannelEventInfo

struct

Context describing a secure channel for a channel-lifecycle event.

Snapshot of the channel state at the moment the event fired. Fields sourced from the OpenSecureChannel (OPN) request reflect the values seen on the wire at that time; later requests on the same channel do not retroactively update a previously delivered snapshot.

Public attributes

uint32_t mSecureChannelId

Server-assigned secure channel identifier.

std::string mSecurityPolicyUri

Negotiated security policy URI.

MessageSecurityMode mMessageSecurityMode

Negotiated message security mode.

std::string mRemoteAddress

Peer transport address (host:port).

std::string mAuditEntryId

Audit entry id from the request header (may be empty).

ByteString mClientCertificate

DER-encoded client certificate from the OPN request.

std::string mClientCertificateThumbprint

SHA-1 thumbprint of the client certificate.

uint32_t mRequestedLifetime

Channel lifetime requested in the OPN request, in ms.

ua::server::SessionEventInfo

struct

Context describing a session for a session-lifecycle or authentication event.

Snapshot of the session state at the moment the event fired. Some fields are only populated once the corresponding handshake step has run: identity-related fields are empty before authentication, and the ActivateSession fields are set only after activation.

Public attributes

NodeId mSessionId

Server-assigned session identifier.

std::string mSessionName

Human-readable session name from CreateSession.

uint32_t mSecureChannelId

Identifier of the secure channel carrying the session.

std::string mRemoteAddress

Peer transport address (host:port).

std::string mAuditEntryId

Audit entry id from the request header (may be empty).

std::string mClientUserId

Authenticated user identity; empty before authentication.

ByteString mClientCertificate

DER-encoded client certificate from CreateSession.

std::string mClientCertificateThumbprint

SHA-1 thumbprint of the client certificate.

double mRevisedSessionTimeout

Session timeout granted by the server, in ms.

std::string mEndpointUrl

EndpointUrl supplied to CreateSession; empty for other events.

bool mEndpointUrlMismatch

The URL HostName was outside the Server certificate HostNames.

std::shared_ptr< const Structure > mUserIdentityToken

User identity token (ExtensionObject body); null before activation.

ua::server::DroppedEventInfo

struct

Identity of an event the server dropped from its internal dispatch backlog.

Conveyed to ServerObserver::on_event_dispatch_dropped when the EventBus's pending-dispatch cap is exceeded under sustained overload and the oldest queued event is discarded before it reaches any MonitoredItem. Carries enough to identify and classify the lost event - in particular mEventType lets the host detect an audit event (an AuditEventType subtype) and persist the record out-of-band if audit integrity matters.

Public attributes

NodeId mEventType

EventType NodeId of the dropped event (used to classify, e.g. audit).

NodeId mSourceNode

NodeId of the node that was the source of the dropped event.

std::string mSourceName

Source name of the dropped event (may be empty).

uint16_t mSeverity

Severity of the dropped event.

ua::server::ServerObserver

class

Receives notifications of server lifecycle, security, and transport events.

Implement this interface and register it with the server to observe secure channel and session lifecycle, transport connections, security rejections, reverse-connect activity, shutdown, and internal errors. Every hook has an empty default, so a subclass overrides only the events it cares about.

Hooks are invoked by the server on an unspecified internal thread or strand; an override must not block and must not assume any particular calling context.

Lifetime: Server::set_observer takes a std::shared_ptr and retains it, so the server CO-OWNS the observer and it cannot be destroyed while registered. The hazard is the reverse cycle: an observer that captures the Server handle (or anything the server owns) keeps the server alive past its intended shutdown. Capture weakly, or capture only what a hook needs; set_observer(nullptr) releases the server's reference.

Functions

ServerObserver()=default
~ServerObserver()=default
void on_secure_channel_opened(const SecureChannelEventInfo &info)

Called when a secure channel has been successfully opened.

  • info (const SecureChannelEventInfo &) - Snapshot of the newly opened channel.
void on_secure_channel_closed(const SecureChannelEventInfo &info, StatusCode reason)

Called when a secure channel has been closed.

  • info (const SecureChannelEventInfo &) - Snapshot of the channel being closed.
  • reason (StatusCode) - Status code describing the close cause; good on an orderly close.
void on_secure_channel_renewed(const SecureChannelEventInfo &info)

Called when an existing secure channel's security token has been renewed.

  • info (const SecureChannelEventInfo &) - Snapshot of the renewed channel.
void on_secure_channel_open_failed(const SecureChannelEventInfo &info, StatusCode reason)

Called when an attempt to open a secure channel failed.

  • info (const SecureChannelEventInfo &) - Snapshot of the channel as far as it was established.
  • reason (StatusCode) - Status code describing the failure.
void on_secure_channel_renew_failed(const SecureChannelEventInfo &info, StatusCode reason)

Called when an attempt to renew a secure channel's token failed.

  • info (const SecureChannelEventInfo &) - Snapshot of the channel whose renewal failed.
  • reason (StatusCode) - Status code describing the failure.
void on_session_created(const SessionEventInfo &info)

Called when a session has been created (CreateSession completed).

  • info (const SessionEventInfo &) - Snapshot of the created session.
void on_session_create_failed(const SessionEventInfo &info, StatusCode reason)

Called when a CreateSession invocation has failed.

  • info (const SessionEventInfo &) - Snapshot of the attempted session as far as it was established.
  • reason (StatusCode) - Rich status describing the failure; any ErrorDetail is attached to this value.
void on_session_activated(const SessionEventInfo &info)

Called when a session has been activated (ActivateSession completed).

  • info (const SessionEventInfo &) - Snapshot of the activated session, including user identity.
void on_session_closed(const SessionEventInfo &info, StatusCode reason)

Called when a session has been closed.

  • info (const SessionEventInfo &) - Snapshot of the closed session.
  • reason (StatusCode) - Status code describing the close cause; good on an orderly close.
void on_session_timed_out(const SessionEventInfo &info)

Called when a session has been terminated for exceeding its timeout.

  • info (const SessionEventInfo &) - Snapshot of the timed-out session.
void on_connection_accepted(const std::string &remoteAddress)

Called when an inbound transport connection has been accepted.

  • remoteAddress (const std::string &) - Peer transport address (host:port).
void on_connection_closed(const std::string &remoteAddress, ConnectionCloseReason reason, StatusCode status)

Called when a transport connection has been closed.

  • remoteAddress (const std::string &) - Peer transport address (host:port).
  • reason (ConnectionCloseReason) - Categorised cause of the close.
  • status (StatusCode) - Wire status code associated with the close.
void on_certificate_rejected(const std::string &remoteAddress, StatusCode reason)

Called when a client certificate has been rejected during validation.

  • remoteAddress (const std::string &) - Peer transport address (host:port).
  • reason (StatusCode) - Status code describing why the certificate was rejected.
void on_authentication_failed(const SessionEventInfo &info, StatusCode reason)

Called when authentication of a session's user identity failed.

  • info (const SessionEventInfo &) - Snapshot of the session; SessionEventInfo::mClientUserId may be empty.
  • reason (StatusCode) - Status code describing the authentication failure.
void on_reverse_connect_opened(const std::string &targetName, const std::string &remoteAddress)

Called when an outbound reverse-connect connection has been opened.

  • targetName (const std::string &) - Configured name of the reverse-connect target.
  • remoteAddress (const std::string &) - Address of the client to which the server connected.
void on_reverse_connect_closed(const std::string &targetName, const std::string &remoteAddress, StatusCode reason)

Called when a reverse-connect connection has been closed.

  • targetName (const std::string &) - Configured name of the reverse-connect target.
  • remoteAddress (const std::string &) - Address of the client the connection was to.
  • reason (StatusCode) - Status code describing the close cause.
void on_reverse_connect_channel_established(const std::string &targetName, uint32_t secureChannelId)

Called when a secure channel has been established over a reverse-connect connection.

  • targetName (const std::string &) - Configured name of the reverse-connect target.
  • secureChannelId (uint32_t) - Server-assigned identifier of the established channel.
void on_shutdown_initiated(uint32_t secondsTillShutdown, const LocalizedText &reason)

Called when a server shutdown has been initiated.

  • secondsTillShutdown (uint32_t) - Time remaining until shutdown completes, in seconds.
  • reason (const LocalizedText &) - Localized reason for the shutdown.
void on_shutdown_complete()

Called when server shutdown has completed.

void on_internal_error(StatusCode status, const std::string &description)

Called when an internal error has occurred that is not tied to a specific channel or session.

  • status (StatusCode) - Status code categorising the error.
  • description (const std::string &) - Human-readable description of the error.
void on_event_dispatch_dropped(const DroppedEventInfo &info)

Called when the server drops an event from its internal dispatch backlog because the pending-dispatch cap was exceeded under sustained overload.

  • info (const DroppedEventInfo &) - Identity of the dropped event.

ua::server::SecureChannelInfo

class

Immutable snapshot of the security context of one server-side secure channel.

Captures the negotiated security parameters and connection metadata of the channel a session is bound to, taken at the moment the session is created or re-activated. It is handed to authentication and authorization hooks so they can make access decisions from the channel's actual security properties (policy, message mode, client certificate, transport endpoint) rather than re-deriving them.

This is a copyable value type and holds no ownership of the live channel: the channel is referenced via a weak_ptr (see secure_channel), while all other fields are owned copies that remain valid for the lifetime of the snapshot regardless of the channel's state. Accessors are plain reads with no thread or strand affinity and may be called from any thread.

Functions

SecureChannelInfo(weak_ptr< SecureChannel > secureChannel, shared_ptr< const SecurityPolicy > securityPolicy, MessageSecurityMode messageSecurityMode, std::string endpointPolicyId, std::vector< UserTokenPolicy > userIdentityTokens={}, shared_ptr< const X509Certificate > clientCertificate=nullptr, uint32_t channelId=0, std::string remoteAddress={}, std::string endpointUrl={}, std::string transportProfileUri={})

Constructs a snapshot from a channel's negotiated security parameters.

  • secureChannel (weak_ptr< SecureChannel >) - Weak reference to the live channel; may be expired or empty.
  • securityPolicy (shared_ptr< const SecurityPolicy >) - Negotiated security policy. Must not be null.
  • messageSecurityMode (MessageSecurityMode) - Negotiated message security mode (None / Sign / SignAndEncrypt).
  • endpointPolicyId (std::string) - Endpoint user-token policy identifier. Must not be empty.
  • userIdentityTokens (std::vector< UserTokenPolicy >) - User token policies advertised by the accepting endpoint.
  • clientCertificate (shared_ptr< const X509Certificate >) - Client's certificate, or null when none was supplied (e.g. a MessageSecurityMode::None channel).
  • channelId (uint32_t) - Secure channel identifier, or 0 when unknown.
  • remoteAddress (std::string) - Peer network address, or empty when unknown.
  • endpointUrl (std::string) - Server-side endpoint URL the channel terminates at; see endpoint_url.
  • transportProfileUri (std::string) - Transport profile URI; see transport_profile_uri.
weak_ptr< SecureChannel > secure_channel() const

Returns a weak reference to the live secure channel this snapshot describes.

Returns: Weak pointer to the channel; may be expired or empty.

shared_ptr< const SecurityPolicy > security_policy() const

Returns the negotiated security policy of the channel.

Returns: Non-null shared pointer to the security policy.

MessageSecurityMode message_security_mode() const

Returns the negotiated message security mode (None, Sign, or SignAndEncrypt).

Returns: The negotiated message security mode.

const std::string & endpoint_policy_id() const

Returns the endpoint user-token policy identifier the channel was accepted under.

Returns: Reference to the policy identifier; guaranteed non-empty.

shared_ptr< const X509Certificate > client_certificate() const

Returns the client's X.509 certificate, if one was presented.

Returns: Shared pointer to the client certificate, or null when none was supplied (e.g. a MessageSecurityMode::None channel).

uint32_t channel_id() const

Returns the secure channel identifier.

Returns: The channel id, or 0 when unknown.

const std::string & remote_address() const

Returns the peer network address of the channel.

Returns: Reference to the remote address; empty when unknown.

const std::vector< UserTokenPolicy > & user_identity_tokens() const

Returns the user token policies advertised by the endpoint that accepted the channel.

Returns: Reference to the advertised user token policies.

const std::string & endpoint_url() const

Returns the server-side stable endpoint URL the channel terminates at.

Returns: Reference to the endpoint URL; empty when the listener advertises no URLs.

const std::string & transport_profile_uri() const

Returns the transport profile URI of the negotiated channel.

Returns: Reference to the transport profile URI.

ua::server::SessionInfo

class

Read-only execution context that the server hands to a service for one session's requests.

Bundles the per-session dependencies a service implementation needs: the executor on which to schedule asynchronous work, the AddressSpace handle to read and mutate, the application and server configuration, the request's security posture, a logger, and the optional event-sink and write-interceptor extension points. Implemented by the Session/SecureChannel shell; a service holds the context only for the lifetime of the request and never owns the underlying server.

Functions

SessionInfo()=default
~SessionInfo()
AddressSpace address_space() const =0

Returns a handle to the server's address space for reading and mutating nodes.

Returns: A handle to the server's address space.

const ::ua::ApplicationConfiguration & configuration() const =0

Returns the application-wide configuration in effect for this session.

Returns: The application-wide configuration in effect for this session.

const ::ua::server::ServerConfiguration & server_configuration() const =0

Returns the server-specific configuration in effect for this session.

Returns: The server-specific configuration in effect for this session.

DiagnosticSecurityContext diagnostic_security_context() const =0

Returns the request's security posture used to gate diagnostic exposure.

Returns: The request's security posture for gating diagnostic exposure.

Logger logger() const =0

Returns the logger to use for this session's service work.

Returns: The logger for this session's service work.

EventSink * event_sink() const

Returns the server's event sink for inline audit-event emission, or null if unavailable.

Returns: The server's event sink, or null when unavailable.

std::vector< std::shared_ptr< WriteInterceptor > > write_interceptors() const

Returns the registered write interceptors, run for every attribute write before it is stored.

Returns: The registered write interceptors; empty when none are registered.

ua::server::SessionDescriptiveState

struct

The non-counter half of OPC 10000-5 SessionDiagnosticsDataType: who connected, how they addressed the server, and when.

Kept separate from SessionSecurityState because Part 5 treats the two differently - 12.12 restricts the security record to authorised users, while these fields carry no such restriction.

Not internally synchronized, matching SessionSecurityState - the descriptive fields are written on the owning session's strand at CreateSession and ActivateSession. lastActivityTicks is the exception and is atomic, because it is written on every request and read by the diagnostics node handler off-strand.

Functions

void note_activity(std::chrono::steady_clock::time_point at) noexcept

Records a request arriving.

  • at (std::chrono::steady_clock::time_point) - The steady-clock time the request arrived at.
std::chrono::steady_clock::time_point last_activity() const noexcept

The steady-clock tick of the last request.

Returns: The steady-clock time point of the most recent request on this session.

DateTime last_contact_time() const noexcept

ClientLastContactTime as wall-clock, derived from the monotonic tick.

Returns: The wall-clock time of the most recent request, converted from last_activity() against connectionSteadyOrigin.

Public attributes

std::string sessionName

Name from CreateSession, or the server-assigned substitute when the client sent none (OPC 10000-4 5.6.2.2: "If this parameter is null or empty the Server shall assign a value").

ApplicationDescription clientDescription

ApplicationDescription the client supplied in CreateSession.

std::string serverUri

CreateSession serverUri.

std::string endpointUrl

The network address the client used to reach this session's endpoint.

std::vector< std::string > localeIds

Locale preference from ActivateSession, in priority order. Re-activation may replace it.

std::chrono::milliseconds revisedSessionTimeout

The timeout the server GRANTED, not the one requested.

DateTime clientConnectionTime

Server wall-clock time at which the session was opened.

std::chrono::steady_clock::time_point connectionSteadyOrigin

Steady-clock origin paired with clientConnectionTime, so a monotonic activity tick can be converted to wall-clock without sampling the wall clock on the request path.

std::atomic< std::chrono::steady_clock::rep > lastActivityTicks

Steady-clock tick of the most recent request on this session.

ua::server::SessionSecurityState

struct

Per-session security facts exposed as SessionSecurityDiagnosticsDataType.

Mirrors the OPC UA SessionSecurityDiagnosticsDataType (Part 5) for one session: the bound user, the negotiated channel security, and the client certificate. Populated at activation and read back to service the session's diagnostics node.

Not internally synchronized: every field is read and mutated only on the owning session's strand, so no external locking is required.

Functions

void update_on_activate(const UserIdentity &user, const EndpointSecurityContext &endpoint)

Refreshes the user-identity and channel-security fields for a session activation.

  • user (const UserIdentity &) - Identity bound to the session by the completed authentication.
  • endpoint (const EndpointSecurityContext &) - Negotiated endpoint security context for the activating channel.

Public attributes

NodeId sessionId

NodeId of the session these diagnostics describe.

std::string clientUserId

User identifier currently bound to the session; empty before activation.

std::vector< std::string > clientUserIdHistory

Active user identifiers observed by the session, oldest first, with the current user last.

std::string authenticationMechanism

URI of the user-token policy / authentication mechanism used at activation.

std::string encoding

Message encoding negotiated for the session.

std::string transportProtocol

URL scheme of the session's transport.

MessageSecurityMode securityMode

Message security mode negotiated on the secure channel.

std::string securityPolicyUri

URI of the security policy negotiated on the secure channel.

ByteString clientCertificate

Client application instance certificate (DER); empty when none was provided.

Enumerations

ua::server::DataAccessOutOfRangePolicy

enum

How the Data Access write interceptor reacts to an AnalogItem value outside its range.

  • Reject - Reject the write with Bad_OutOfRange (OPC 10000-8 5.2 default).
  • Clamp - Accept the write but clamp the value into the range.

ua::server::WellKnownRole

enum

One of the nine OPC 10000-18 well-known Roles.

  • Anonymous - Granted to any Session, including unauthenticated ones.
  • AuthenticatedUser - Granted to any Session authenticated with a non-anonymous identity.
  • Observer - Read/browse access to the information model.
  • Operator - Observer plus the ability to operate the running system.
  • Engineer - Operator plus the ability to configure the system.
  • Supervisor - Elevated operational oversight of the running system.
  • ConfigureAdmin - Administrative configuration of the server's information model.
  • SecurityAdmin - Administration of security settings (the default admin Role).
  • TrustedApplication - Granted to Sessions presenting a trusted ApplicationInstanceCertificate.

Was this page helpful?