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, CallMethodCompleteCallback complete)

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

  • userId (String) - ClientUserId attributed to the call (may be empty).
  • complete (CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_disable_async(String userId, CallMethodCompleteCallback complete)

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

  • userId (String) - ClientUserId attributed to the call (may be empty).
  • complete (CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_add_comment_async(ByteString eventId, LocalizedText comment, String userId, 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 (CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_acknowledge_async(ByteString eventId, LocalizedText comment, String userId, 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 (CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_confirm_async(ByteString eventId, LocalizedText comment, String userId, 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 (CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_one_shot_shelve_async(String userId, CallMethodCompleteCallback complete)

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

  • userId (String) - ClientUserId attributed to the call (may be empty).
  • complete (CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_timed_shelve_async(double durationMs, String userId, 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 (CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_unshelve_async(String userId, CallMethodCompleteCallback complete)

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

  • userId (String) - ClientUserId attributed to the call (may be empty).
  • complete (CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_suppress_async(String userId, CallMethodCompleteCallback complete)

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

  • userId (String) - ClientUserId attributed to the call (may be empty).
  • complete (CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_unsuppress_async(String userId, CallMethodCompleteCallback complete)

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

  • userId (String) - ClientUserId attributed to the call (may be empty).
  • complete (CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_silence_async(String userId, CallMethodCompleteCallback complete)

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

  • userId (String) - ClientUserId attributed to the call (may be empty).
  • complete (CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_remove_from_service_async(String userId, CallMethodCompleteCallback complete)

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

  • userId (String) - ClientUserId attributed to the call (may be empty).
  • complete (CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_place_in_service_async(String userId, CallMethodCompleteCallback complete)

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

  • userId (String) - ClientUserId attributed to the call (may be empty).
  • complete (CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
void call_reset_async(String userId, CallMethodCompleteCallback complete)

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

  • userId (String) - ClientUserId attributed to the call (may be empty).
  • complete (CallMethodCompleteCallback) - Receives the CallResult exactly once. Never throws.
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).

ShelveTransition last_shelve_transition() const

Returns the last shelving transition (all fields empty until the first transition).

Returns: The last shelving transition.

UnshelveClock unshelve_clock() const

The clock ShelvingState.UnshelveTime is evaluated from at read time.

Returns: The alarm's UnshelveClock as of its last change.

void set_unshelve_clock(UnshelveClock clock)

Records the alarm's UnshelveClock.

  • clock (UnshelveClock) - The alarm logic's current clock.
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::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, the References read but not yet returned, and the resume token of the namespace's last answer. It is identified by a server-generated Guid that is handed to the client and matched on the subsequent BrowseNext request.

The point owns the resume token: a token that is not taken back for a BrowseNext is released once, through the namespace that issued it, when the point is destroyed or assigned over - released by the Client, freed for a new request, expired, or discarded with its Session.

Move-only: copying would duplicate ownership of the resume token. 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)

Constructs a continuation point holding no resume token and no References, so a BrowseNext with it has nothing left to read.

  • 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.
BrowseContinuationPoint(ViewDescription viewDescription, Counter maxRefsPerNode, const BrowseDescription &browseDescription, ua::detail::ResumeToken &&resumeToken, References bufferedReferences)

Constructs a continuation point holding the resume token of a namespace's answer, and the References of that answer not yet returned.

  • 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 (ua::detail::ResumeToken &&) - The namespace's token and its issuer; moved in.
  • bufferedReferences (References) - References read but not yet returned, replayed by BrowseNext before the token is passed back.
BrowseContinuationPoint(ViewDescription viewDescription, Counter maxRefsPerNode, const BrowseDescription &browseDescription, shared_ptr< PausedOperation > paused)

Constructs a continuation point for a Browse operation that was still running when its request reached the partial-result deadline.

  • viewDescription (ViewDescription) - View used by the original Browse request.
  • maxRefsPerNode (Counter) - Negotiated per-node reference limit.
  • browseDescription (const BrowseDescription &) - Node and reference filter of the paused Browse.
  • paused (shared_ptr< PausedOperation >) - Shared ownership of the operation continued by this point.

Releases the resume token through the namespace that issued it, if one is still held, and the paused operation, if one is still held.

BrowseContinuationPoint(BrowseContinuationPoint &&other) noexcept

Move-constructs, transferring the resume token and the paused operation.

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

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

  • other (BrowseContinuationPoint &&) - Source; left holding neither, and must not be reused except to assign or destroy.

Returns: Reference to this object.

shared_ptr< PausedOperation > take_paused()

Takes the paused operation this point continues, if any.

Returns: The paused operation, or null for a point that pages an ordinary Browse.

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.

bool has_resume_token() const noexcept

Whether the point holds a resume token: the namespace has References left to return after the buffered ones.

Returns: True when a namespace resume token is still owned.

ua::detail::ResumeToken take_resume_token() noexcept

Takes the resume token, to pass back to the namespace that issued it; the point no longer releases it.

Returns: The transferred token and issuer, or an empty token when none is held.

const References & buffered_references() const

The References read from the namespace but not yet returned.

Returns: The buffered References to replay before the namespace token resumes.

void set_buffered_references(References references)

Stores the References to replay before the namespace token resumes, replacing any buffer already held.

  • references (References) - The References not yet returned; moved in.

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.
HistoryContinuationPoint(uint16_t namespaceIndex, TimestampsToReturn timestampsToReturn, NamespaceHistoryDelegate::DetailKind detailKind, shared_ptr< PausedOperation > paused)

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

  • namespaceIndex (uint16_t) - Namespace owning the history request.
  • timestampsToReturn (TimestampsToReturn) - Timestamp selection from the original request.
  • detailKind (NamespaceHistoryDelegate::DetailKind) - History detail kind continued by this point.
  • paused (shared_ptr< PausedOperation >) - Shared ownership of the operation continued by this point.

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.

shared_ptr< PausedOperation > take_paused()

Takes the paused operation this point continues, if any.

Returns: The paused operation, or null for a point that pages an ordinary HistoryRead.

bool is_paused() const

Whether this point continues a paused operation rather than a delegate's cursor.

Returns: True when this point owns a paused operation.

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 interface 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.

Every operation is called on a thread of the Server's executor, which must not block: a namespace may answer an address-space operation by posting to that same executor. Use the *_async address-space operations here; the blocking AddressSpace::try_find_node_sync, try_create_node_sync and try_delete_node_sync refuse on this thread with Bad_WouldBlock. A delegate written with blocking calls must first move the work to a thread the application owns, and complete the callback from there.

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::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::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::ShutdownOptions

struct

Options for one graceful server shutdown.

grace and reason have the names and types of the same two values on ShutdownPolicy, which the runtime hands to an attached server.

Public attributes

std::optional< std::chrono::seconds > grace

How long sessions are given before they are closed; advertised to clients as ServerStatus.SecondsTillShutdown.

LocalizedText reason

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.

Result< Server > CreateResult

The created Server on success, or an ErrorDetail on failure.

Static functions

Server create(boost::asio::any_io_executor executor, ::ua::server::CreateConfig config, ServerComponents components)

Creates a server from its configuration and the components the application supplies.

  • 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 settings).
  • components (ServerComponents) - The crypto provider (required), certificate stores, authenticator, Role configuration and log sink. See ServerComponents.

Returns: A new server handle.

CreateResult try_create(boost::asio::any_io_executor executor, ::ua::server::CreateConfig config, ServerComponents components) noexcept

Creates a server, returning a bad CreateResult instead of throwing on failure.

  • 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 settings).
  • components (ServerComponents) - The crypto provider (required), certificate stores, authenticator, Role configuration and log sink. See ServerComponents.

Returns: The created Server, or an ErrorDetail on failure (including BadWouldBlock when called on a thread of executor). Never throws.

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. With a null callback the server still starts and a failure is logged.
void start_sync()

Starts the server, opening configured listeners and activating endpoints.

VoidResult try_start_sync() 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. A Good subcode on the answer is not returned; try_listen_sync() returns it.

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. A Good subcode on the answer is not returned; try_listen_sync() returns it.

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, ServerEndpointConfig endpoint)

Adds an endpoint configuration to a listener.

void remove_endpoint(ListenerHandle listener, ServerEndpointConfig endpoint)

Removes an endpoint configuration from a listener.

std::vector< ServerEndpointConfig > 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_sync.

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 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. A Good subcode on the answer is not returned; try_import_nodeset_sync() returns it.

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. A Good subcode on the answer is not returned; try_import_nodeset_sync() returns it.

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. A Good subcode on the answer is not returned; try_register_address_space_types_sync() returns it.

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(ServerConfig::ReverseConnectTarget target, std::function< void(ReverseConnectHandleResult)> callback) noexcept

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

  • target (ServerConfig::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(ServerConfig::ReverseConnectTarget target)

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

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

Returns: A handle identifying the started reverse connection. A Good subcode on the answer is not returned; try_start_reverse_connect_sync() returns it.

ReverseConnectHandleResult try_start_reverse_connect_sync(ServerConfig::ReverseConnectTarget target) noexcept

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

  • target (ServerConfig::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(ShutdownOptions params, CompleteCallback callback) noexcept

Asynchronously initiates a graceful server shutdown.

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

Initiates a graceful server shutdown, blocking until complete.

VoidResult try_shutdown_sync(ShutdownOptions params={}) noexcept

Initiates a graceful server shutdown, blocking until complete.

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

ua::server::ServerComponents

struct

The objects the application supplies to Server::create and Server::try_create.

Settings live in CreateConfig; this struct holds the live objects the server uses. Only crypto is required. Every other member is optional and says what the server does without it. The server takes shared ownership of everything installed here.

Public attributes

std::shared_ptr< const ::ua::Crypto > crypto

The cryptographic provider.

std::shared_ptr<::ua::CertificateStore > applicationGroupCertificateStore

The certificate store for the DefaultApplicationGroup.

std::shared_ptr<::ua::CertificateStore > userTokenCertificateStore

Certificate store holding the trusted issuers for X.509 user identity tokens.

std::shared_ptr< UserAuthenticator > authenticator

Authenticator that validates user identity tokens during session activation.

std::shared_ptr< RoleConfiguration > roleConfiguration

Optional Part-18 RoleSet configuration wired into NS0 at server bring-up.

std::shared_ptr<::ua::LogSink > logSink

Structured-log sink installed at construction, or null to disable logging.

::ua::LogLevel logLevel

Minimum level to emit (only meaningful when logSink is set).

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 identity

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

::ua::ApplicationConfig application

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

::ua::server::ServerConfig server

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::ApplicationConfig, and the server-only ua::server::ServerConfig. 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 identity

Static identity the server advertises about itself.

std::shared_ptr< const ::ua::ApplicationConfig > application

Shared, immutable deployment configuration.

::ua::server::ServerConfig server

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

ua::server::ServerConfig

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

Per-service caps on the number of nodes/items accepted in a single service request.

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< ListenerConfig > & listeners() const

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

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

std::vector< ListenerConfig > & listeners()

Returns the configured network listeners for mutation before startup.

Returns: Mutable reference to the configured ListenerConfig list.

void validate() const

Validates the configuration, throwing on the first inconsistency found.

Public attributes

optional< uint32_t > maxConnections

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

optional< uint32_t > maxSecureChannels

Maximum number of concurrent secure channels across all transports.

optional< uint32_t > maxRequestsPerSession

Maximum number of concurrent in-flight requests per session.

optional< uint32_t > maxInFlightRequests

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

optional< uint32_t > maxInFlightRequestsPerConnection

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

ConnectionThrottling connectionThrottling

Active per-IP connection throttling settings.

IdentityThrottling identityThrottling

Active identity-token attack-protection settings.

uint32_t maxAccessIdentities

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

std::chrono::milliseconds authzTimeout

One-operation deadline for asynchronous namespace permission resolution.

std::chrono::milliseconds authnTimeout

Deadline for one authentication check (the UserAuthenticator's answer to an ActivateSession) before it is abandoned and the activation refused.

DiscoveryThrottling discoveryThrottling

Active discovery-service throttling settings.

bool discoveryEndpointEnabled

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

bool acceptInvalidPadding

Accepts non-zero padding bytes in encrypted UserIdentityToken secrets.

ResourceLimits resourceLimits

Active server-internal queue/store caps.

std::chrono::seconds monitoredItemAccessRecheckInterval

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 subscriptionLimits

Active subscription/publish-flow tuning knobs.

optional< std::chrono::milliseconds > browseContinuationPointTimeout

Lifetime of an idle Browse continuation point.

optional< std::chrono::milliseconds > historyContinuationPointTimeout

Lifetime of an idle HistoryRead continuation point.

double partialResultDeadlineFraction

Fraction of a request's timeoutHint after which Browse, BrowseNext and HistoryRead stop waiting and answer with what they have.

optional< uint32_t > maxReferencesPerNode

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

optional< uint32_t > maxReferencesPerBrowseRequest

Budget on the number of references one Browse request may return across all of its operations.

optional< uint32_t > maxBrowsePathWalkReferences

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

bool auditingEnabled

Whether the server emits audit events and advertises auditing support.

std::optional< DataAccessOutOfRangePolicy > dataAccessWritePolicy

What the Write service does with a client's Value write to a Variable of a Data Access type (OPC 10000-8 5.3) that the type's Properties bound.

bool roleManagementEnabled

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

bool enableClaimToRoleMapping

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

std::optional< std::vector< WellKnownRole > > wellKnownRoles

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

uint32_t defaultShutdownGracePeriodSeconds

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

bool pushCertificateManagementEnabled

Whether the server offers Part 12 push certificate management.

DiagnosticPolicy diagnosticPolicy

Active DiagnosticInfo return policy.

HistoryConfig historyConfiguration

Active history-access capability limits.

std::vector< ReverseConnectTarget > reverseConnectTargets

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

LocalDiscoveryServer localDiscoveryServer

Active Local-Discovery-Server settings.

ua::server::ServerEndpointConfig

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 ServerEndpointConfig &obj) const =default

Compares two configurations field by field for equality.

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

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

Public attributes

std::string name

Stable endpoint identifier, unique within its listener.

MessageSecurityMode messageSecurityMode

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

SecurityPolicyId securityPolicyId

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

TransportProfileId transportProfile

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

std::vector< UserTokenPolicy > userIdentityTokens

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.

ServiceLatency latency

Request latency per service, by name (SDK extension).

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::CertificateEventInfo

struct

What a server observer is told about one certificate event: a certificate refused, or a validation error suppressed by the configured trust-list options (decision 27).

Carries the certificate itself because the AuditCertificateEventType's Certificate property is Mandatory (OPC 10000-5 section 6.4.12), and the host name or URI that failed to match because AuditCertificateDataMismatchEventType reports them (section 6.4.13).

Public attributes

std::string remoteAddress

Peer transport address (host:port); empty when not known.

std::shared_ptr< const ua::X509Certificate > certificate

The certificate the event concerns (the leaf the peer presented); null when it could not be decoded.

StatusCode status

The refusal, or the suppressed error, as an OPC UA certificate status (Table 106).

std::optional< std::string > invalidHostname

The host name the certificate failed to match, for Bad_CertificateHostNameInvalid.

std::optional< std::string > invalidUri

The application URI the certificate failed to match, for Bad_CertificateUriInvalid.

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 secureChannelId

Server-assigned secure channel identifier.

std::string securityPolicyUri

Negotiated security policy URI.

MessageSecurityMode messageSecurityMode

Negotiated message security mode.

std::string remoteAddress

Peer transport address (host:port).

std::string auditEntryId

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

ByteString clientCertificate

DER-encoded client certificate from the OPN request.

std::string clientCertificateThumbprint

SHA-1 thumbprint of the client certificate.

uint32_t requestedLifetime

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 sessionId

Server-assigned session identifier.

std::string sessionName

Human-readable session name from CreateSession.

uint32_t secureChannelId

Identifier of the secure channel carrying the session.

std::string remoteAddress

Peer transport address (host:port).

std::string auditEntryId

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

std::string clientUserId

Authenticated user identity; empty before authentication.

ByteString clientCertificate

DER-encoded client certificate from CreateSession.

std::string clientCertificateThumbprint

SHA-1 thumbprint of the client certificate.

double revisedSessionTimeout

Session timeout granted by the server, in ms.

std::string endpointUrl

EndpointUrl supplied to CreateSession; empty for other events.

bool endpointUrlMismatch

The URL HostName was outside the Server certificate HostNames.

std::shared_ptr< const Structure > userIdentityToken

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 eventType lets the host detect an audit event (an AuditEventType subtype) and persist the record out-of-band if audit integrity matters.

Public attributes

NodeId eventType

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

NodeId sourceNode

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

std::string sourceName

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

uint16_t severity

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 CertificateEventInfo &info)

Called when a client certificate has been rejected during validation.

  • info (const CertificateEventInfo &) - The peer address, the refused certificate and the refusal status (with the mismatched host name or URI where that was the refusal).
void on_certificate_error_suppressed(const CertificateEventInfo &info)

Called when a certificate was accepted although validation found an error, because the configured trust-list options suppress that error.

  • info (const CertificateEventInfo &) - The peer address, the accepted certificate and the suppressed error.
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::clientUserId 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::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.

The fields are written on the owning session's strand and read by the diagnostics Variables' value sources on whichever thread serves the Read, so both sides hold mutex. update_on_activate takes it itself.

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

std::mutex mutex

Guards every field below.

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.

Static attributes

constexpr std::size_t maxClientUserIdHistory

The most entries clientUserIdHistory holds; the oldest is dropped when another is appended.

Enumerations

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.

Type aliases

ua::server::DataAccessOutOfRangePolicy

type alias

The server name of ua::DataAccessOutOfRangePolicy, kept for existing callers.

Was this page helpful?