Files
dohertj2 c95824a65d 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>
2026-05-04 06:31:48 -04:00

44 lines
1.6 KiB
C#

using System.Runtime.Versioning;
using AVEVA.Historian.Client.Wcf;
namespace AVEVA.Historian.Client.Tests;
[SupportedOSPlatform("windows")]
public sealed class HistorianSspiClientTests
{
[Fact]
public void NativeFlagsRound0_MatchesDocumentedNativeWrapperValue()
{
Assert.Equal(0x2081C, HistorianSspiClient.NativeFlagsRound0);
}
[Fact]
public void NativeFlagsRoundSubsequent_MatchesDocumentedNativeWrapperValue()
{
Assert.Equal(0x81C, HistorianSspiClient.NativeFlagsRoundSubsequent);
}
[Fact]
public void Round0FlagsIncludeIdentify_LaterRoundsDoNot()
{
Assert.Equal(HistorianSspiClient.IscReqIdentify, HistorianSspiClient.NativeFlagsRound0 & HistorianSspiClient.IscReqIdentify);
Assert.Equal(0, HistorianSspiClient.NativeFlagsRoundSubsequent & HistorianSspiClient.IscReqIdentify);
}
[Fact]
public void AllRoundsRequestReplayAndSequenceDetection()
{
const int both = HistorianSspiClient.IscReqReplayDetect | HistorianSspiClient.IscReqSequenceDetect;
Assert.Equal(both, HistorianSspiClient.NativeFlagsRound0 & both);
Assert.Equal(both, HistorianSspiClient.NativeFlagsRoundSubsequent & both);
}
[Fact]
public void SelectRequestFlags_DispatchesByRoundIndex()
{
Assert.Equal(HistorianSspiClient.NativeFlagsRound0, HistorianSspiClient.SelectRequestFlags(0));
Assert.Equal(HistorianSspiClient.NativeFlagsRoundSubsequent, HistorianSspiClient.SelectRequestFlags(1));
Assert.Equal(HistorianSspiClient.NativeFlagsRoundSubsequent, HistorianSspiClient.SelectRequestFlags(7));
}
}