/* ======================================================================== * Copyright (c) 2005-2026 The OPC Foundation, Inc. All rights reserved. * * OPC Foundation MIT License 1.00 * ======================================================================*/ using System; using System.Text.Json.Serialization; using Microsoft.Extensions.Logging; using Opc.Ua; namespace ConsoleDataChannelStreaming { /// /// Machine-readable observations emitted only after a finite real-socket run and successful cleanup. /// internal sealed record SampleResult { /// /// Gets the actual selected carrier. /// public string Carrier { get; init; } = string.Empty; /// /// Gets the configured or Session authorization route. /// public string Authorization { get; init; } = string.Empty; /// /// Gets the application's payload sender. /// public string Publisher { get; init; } = string.Empty; /// /// Gets whether that sender also initiated the transport. /// public bool PublisherIsTransportInitiator { get; init; } /// /// Gets the actual sender's opener role. /// public bool SourceIsOpener { get; init; } /// /// Gets the authenticated association identity. /// public Guid ContextId { get; init; } /// /// Gets the flow identifier, not a payload identifier. /// public uint ChannelId { get; init; } /// /// Gets the actual bound TCP or UDP port. /// public int Port { get; init; } /// /// Gets received complete messages, excluding any control records. /// public int Messages { get; init; } /// /// Gets received application payload bytes. /// public long Bytes { get; init; } /// /// Gets the digest of complete successfully sent messages. /// public string SourceSha256 { get; init; } = string.Empty; /// /// Gets the digest of complete received messages. /// public string ReceivedSha256 { get; init; } = string.Empty; /// /// Gets the actual final committed revision. /// public uint Revision { get; init; } /// /// Gets the data connection's UASC identifier, zero for native-only carriers. /// public uint SecureChannelId { get; init; } /// /// Gets the ordinary Service connection's UASC identifier, zero when absent. /// public uint ServiceSecureChannelId { get; init; } /// /// Gets reference identity evidence of one shared physical transport. /// public bool SameServiceTransport { get; init; } /// /// Gets the actual server Session creation count. /// public int Sessions { get; init; } /// /// Gets whether the optional manager model was actually installed. /// public bool ModelEnabled { get; init; } /// /// Gets server-recorded ordinary Read requests. /// public int Reads { get; init; } /// /// Gets server-recorded ordinary Publish requests. /// public int Publishes { get; init; } /// /// Gets server-recorded generated-proxy control Calls. /// public int Calls { get; init; } /// /// Gets Read responses received within the measured payload interval. /// public int ReadResponsesDuringStreaming { get; init; } /// /// Gets Publish responses received within the measured payload interval. /// public int PublishResponsesDuringStreaming { get; init; } /// /// Gets decoded notifications received within the measured payload interval. /// public int NotificationsDuringStreaming { get; init; } /// /// Gets the server-revised publishing interval. /// public double RevisedPublishingInterval { get; init; } /// /// Gets first-send to observed directional-EOF elapsed time. /// public double ElapsedMilliseconds { get; init; } /// /// Gets measured received payload throughput, not enqueue speed or a conformance promise. /// public double MegabitsPerSecond { get; init; } /// /// Gets whether all flow budgets and native ownership counters returned to zero after disposal. /// public bool ResourcesReleased { get; init; } /// /// Gets the explicitly requested WAV path, empty for streaming or playback. /// public string WaveFile { get; init; } = string.Empty; } /// /// Uses source-generated serialization rather than reflection-based payload serialization. /// [JsonSerializable(typeof(SampleResult))] internal sealed partial class SampleResultJsonContext : JsonSerializerContext; /// /// Borrows the host's logging factory for existing library telemetry. /// internal sealed class SampleTelemetry(ILoggerFactory loggerFactory) : TelemetryContextBase(loggerFactory); }