fe2a6db786
rust / build / test / clippy / fmt (push) Has been cancelled
Layout:
- src/ .NET 10 x64 reference: MxNativeCodec, MxNativeClient,
MxAsbClient, probes, tests, harnesses. Executable spec.
- design/ Architectural plan for the Rust port (M0–M6), error
model, protocol invariants, risks (R1–R16), adversarial
review log (review.md).
- rust/ Rust workspace. M0 skeleton + M1 codec parity.
mxaccess-codec: 215 unit tests + 2 cross-implementation
parity tests (byte-identical against .NET reference).
Other crates are M0 stubs awaiting M2+.
- captures/ Frida + netsh + pcap evidence per CLAUDE.md
("captures are evidence, not throwaway logs").
- analysis/ Decompiled C# (frida/proxy/decompiled-*),
Ghidra exports for native DLLs (`exports/` only —
working state at `projects/` and AVEVA's input
binaries at `input/` are gitignored).
- docs/ Reverse-engineering reference docs.
- tools/ Setup-LiveProbeEnv.ps1 (Infisical credential fetcher),
Compute-Crc.ps1 (.NET parity helper).
- .github/workflows/ Rust CI: fmt + build + test + clippy on Windows.
- LICENSE MIT (Joseph Doherty, 2026).
Verified:
- cargo test --workspace → 217 passed (215 unit + 2 .NET parity), 0 failed
- cargo clippy --workspace -- -D warnings → clean
- cargo fmt --all -- --check → clean
- cargo publish --dry-run -p mxaccess-codec → packages cleanly
Excluded from history (see .gitignore):
- **/bin, **/obj, **/target — build artifacts
- analysis/ghidra/projects/ — Ghidra working state (regenerable)
- analysis/ghidra/input/ — AVEVA proprietary DLLs (vendor IP)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
131 lines
3.2 KiB
C#
131 lines
3.2 KiB
C#
using System;
|
|
using System.Xml.Serialization;
|
|
|
|
namespace Asb.Base.V2;
|
|
|
|
[Serializable]
|
|
[XmlType(Namespace = "urn:data.asb.se:2")]
|
|
public class ArchestrAResult
|
|
{
|
|
[XmlElement(ElementName = "Success", Order = 0)]
|
|
public bool Success { get; set; }
|
|
|
|
[XmlElement(ElementName = "ResultCode", Order = 1)]
|
|
public int ResultCode { get; set; }
|
|
|
|
[XmlElement(ElementName = "SpecificErrorCode", Order = 2)]
|
|
public uint SpecificErrorCode { get; set; }
|
|
|
|
[XmlElement(ElementName = "Status", Order = 3)]
|
|
public uint Status { get; set; }
|
|
|
|
[XmlElement(ElementName = "Location", Order = 4)]
|
|
public string Location { get; set; }
|
|
|
|
[XmlElement(ElementName = "SuccessMessages", Order = 5)]
|
|
public string[] SuccessMessages { get; set; }
|
|
|
|
[XmlElement(ElementName = "InformationMessages", Order = 6)]
|
|
public string[] InformationMessages { get; set; }
|
|
|
|
[XmlElement(ElementName = "ErrorMessages", Order = 7)]
|
|
public string[] ErrorMessages { get; set; }
|
|
|
|
[XmlElement(ElementName = "Extensions", Order = 8)]
|
|
public NamedValue[] Extensions { get; set; }
|
|
|
|
[XmlIgnore]
|
|
public static bool CollectStackTraceInExceptions { get; set; }
|
|
|
|
[XmlIgnore]
|
|
public ArchestrAError ResultCodeAsError
|
|
{
|
|
get
|
|
{
|
|
if (ResultCode < 65535)
|
|
{
|
|
return (ArchestrAError)ResultCode;
|
|
}
|
|
return ArchestrAError.Unknown;
|
|
}
|
|
set
|
|
{
|
|
ResultCode = (int)value;
|
|
}
|
|
}
|
|
|
|
public static ArchestrAResult Create(ArchestrAResult archestraResult)
|
|
{
|
|
ArchestrAResult archestrAResult = archestraResult;
|
|
if (archestrAResult == null)
|
|
{
|
|
archestrAResult = new ArchestrAResult
|
|
{
|
|
Success = true,
|
|
ErrorMessages = new string[0],
|
|
InformationMessages = new string[0],
|
|
SuccessMessages = new string[0],
|
|
Extensions = new NamedValue[0],
|
|
ResultCode = 0
|
|
};
|
|
}
|
|
return archestrAResult;
|
|
}
|
|
|
|
public static ArchestrAResult MakeGoodResult()
|
|
{
|
|
return new ArchestrAResult
|
|
{
|
|
ResultCodeAsError = ArchestrAError.Success,
|
|
Status = 0u,
|
|
SpecificErrorCode = 0u,
|
|
Success = true
|
|
};
|
|
}
|
|
|
|
public static ArchestrAResult MakeResult(ArchestrAError error, ushort status)
|
|
{
|
|
return new ArchestrAResult
|
|
{
|
|
ResultCodeAsError = error,
|
|
Status = status,
|
|
Success = (error == ArchestrAError.Success)
|
|
};
|
|
}
|
|
|
|
public static ArchestrAResult MakeResult(ArchestrAError error, ushort status, uint specificError)
|
|
{
|
|
return new ArchestrAResult
|
|
{
|
|
ResultCodeAsError = error,
|
|
Status = status,
|
|
SpecificErrorCode = specificError,
|
|
Success = (error == ArchestrAError.Success)
|
|
};
|
|
}
|
|
|
|
public static ArchestrAResult MakeErrorResult(string message)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(message))
|
|
{
|
|
throw new ArgumentNullException("message");
|
|
}
|
|
return MakeResult(ArchestrAError.Unknown, 0, 0u).AddErrorMessage(message);
|
|
}
|
|
|
|
public static ArchestrAResult MakeErrorResult(ArchestrAError error, string message)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(message))
|
|
{
|
|
throw new ArgumentNullException("message");
|
|
}
|
|
return MakeResult(ArchestrAError.Unknown, 0, 0u).AddErrorMessage(message);
|
|
}
|
|
|
|
public static ArchestrAResult MakeNotLicensedResult(string message)
|
|
{
|
|
string message2 = (string.IsNullOrWhiteSpace(message) ? "The requested connection is not licensed for the operation and will be terminated" : message);
|
|
return MakeResult(ArchestrAError.NotLicensedError, 0, 0u).AddErrorMessage(message2);
|
|
}
|
|
}
|