Initial commit: managed .NET 10 AVEVA Historian SDK + reverse-engineering toolkit
Full read-only SDK (src/AVEVA.Historian.Client) implementing the CLAUDE.md required
surface against AVEVA Historian's binary WCF protocol — no native AVEVA runtime
dependency. All operations live-verified against a local Historian:
- ProbeAsync, ReadRawAsync, ReadAggregateAsync, ReadAtTimeAsync, ReadEventsAsync
- BrowseTagNamesAsync, GetTagMetadataAsync (17 native data-type codes mapped)
- GetConnectionStatusAsync, GetStoreForwardStatusAsync, GetSystemParameterAsync
- 108/108 unit + integration tests pass
Includes the reverse-engineering toolkit (tools/AVEVA.Historian.ReverseEngineering)
used to decode the protocol: WCF probes, IL inspection via dnlib, and IL-rewrite
instrumentation (instrument-wcf-{write,read}message etc.) plus the .NET Framework
trace harness (tools/AVEVA.Historian.NativeTraceHarness) for parity testing.
Sanitized handoff evidence under docs/reverse-engineering/. Native AVEVA binaries
(current/, aveva-install-x64/, aveva-install-x86/) are gitignored — fetch separately
from the AVEVA installer.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
namespace AVEVA.Historian.Client.Transport;
|
||||
|
||||
internal interface IHistorianTransport : IAsyncDisposable
|
||||
{
|
||||
ValueTask ConnectAsync(HistorianClientOptions options, CancellationToken cancellationToken);
|
||||
|
||||
ValueTask SendAsync(ReadOnlyMemory<byte> payload, CancellationToken cancellationToken);
|
||||
|
||||
ValueTask<int> ReceiveAsync(Memory<byte> buffer, CancellationToken cancellationToken);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace AVEVA.Historian.Client.Transport;
|
||||
|
||||
internal interface IHistorianTransportFactory
|
||||
{
|
||||
IHistorianTransport Create();
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace AVEVA.Historian.Client.Transport;
|
||||
|
||||
internal sealed class TcpHistorianTransport : IHistorianTransport
|
||||
{
|
||||
public static readonly IHistorianTransportFactory Factory = new FactoryImpl();
|
||||
|
||||
private TcpClient? _client;
|
||||
private NetworkStream? _stream;
|
||||
|
||||
public async ValueTask ConnectAsync(HistorianClientOptions options, CancellationToken cancellationToken)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(options);
|
||||
|
||||
_client = new TcpClient();
|
||||
await _client.ConnectAsync(options.Host, options.Port, cancellationToken).ConfigureAwait(false);
|
||||
_stream = _client.GetStream();
|
||||
}
|
||||
|
||||
public async ValueTask SendAsync(ReadOnlyMemory<byte> payload, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_stream is null)
|
||||
{
|
||||
throw new InvalidOperationException("Transport is not connected.");
|
||||
}
|
||||
|
||||
await _stream.WriteAsync(payload, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async ValueTask<int> ReceiveAsync(Memory<byte> buffer, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_stream is null)
|
||||
{
|
||||
throw new InvalidOperationException("Transport is not connected.");
|
||||
}
|
||||
|
||||
return await _stream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
_stream?.Dispose();
|
||||
_client?.Dispose();
|
||||
return ValueTask.CompletedTask;
|
||||
}
|
||||
|
||||
private sealed class FactoryImpl : IHistorianTransportFactory
|
||||
{
|
||||
public IHistorianTransport Create()
|
||||
{
|
||||
return new TcpHistorianTransport();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user