Files
mxaccess/src/MxNativeCodec/MxStatus.cs
T
Joseph Doherty fe2a6db786
rust / build / test / clippy / fmt (push) Has been cancelled
Initial project state: .NET reference, design, Rust port (M0+M1), evidence
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>
2026-05-05 06:21:00 -04:00

127 lines
4.2 KiB
C#

namespace MxNativeCodec;
public enum MxStatusCategory : short
{
Unknown = -1,
Ok = 0,
Pending = 1,
Warning = 2,
CommunicationError = 3,
ConfigurationError = 4,
OperationalError = 5,
SecurityError = 6,
SoftwareError = 7,
OtherError = 8,
}
public enum MxStatusSource : short
{
Unknown = -1,
RequestingLmx = 0,
RespondingLmx = 1,
RequestingNmx = 2,
RespondingNmx = 3,
RequestingAutomationObject = 4,
RespondingAutomationObject = 5,
}
public sealed record MxStatus(
short Success,
MxStatusCategory Category,
MxStatusSource DetectedBy,
short Detail)
{
public string? DetailText => MxStatusDetails.GetKnownText(Detail);
public static MxStatus DataChangeOk { get; } = new(
Success: -1,
Category: MxStatusCategory.Ok,
DetectedBy: MxStatusSource.RequestingLmx,
Detail: 0);
public static MxStatus WriteCompleteOk { get; } = new(
Success: -1,
Category: MxStatusCategory.Ok,
DetectedBy: MxStatusSource.RespondingAutomationObject,
Detail: 0);
public static MxStatus SuspendPending { get; } = new(
Success: -1,
Category: MxStatusCategory.Pending,
DetectedBy: MxStatusSource.RequestingLmx,
Detail: 0);
public static MxStatus ActivateOk { get; } = new(
Success: -1,
Category: MxStatusCategory.Ok,
DetectedBy: MxStatusSource.RequestingLmx,
Detail: 0);
public static MxStatus InvalidReferenceConfiguration { get; } = new(
Success: 0,
Category: MxStatusCategory.ConfigurationError,
DetectedBy: MxStatusSource.RequestingLmx,
Detail: 6);
}
public static class MxStatusDetails
{
private static readonly IReadOnlyDictionary<short, string> KnownDetails = new Dictionary<short, string>
{
[16] = "Request timed out",
[17] = "Platform communication error",
[18] = "Invalid platform ID",
[19] = "Invalid engine ID",
[20] = "Engine communication error",
[21] = "Invalid reference",
[22] = "No Galaxy Repository",
[23] = "Invalid object ID",
[24] = "Object signature mismatch",
[25] = "Invalid primitive ID",
[26] = "Invalid attribute ID",
[27] = "Invalid property ID",
[28] = "Index out of range",
[29] = "Data out of range",
[30] = "Incorrect data type",
[31] = "Attribute not readable",
[32] = "Attribute not writeable",
[33] = "Write access denied",
[34] = "Unknown error",
[35] = "detected by",
[36] = "Wrong data type",
[37] = "Wrong number of dimensions",
[38] = "Invalid index",
[39] = "Index out of order",
[40] = "Dimension does not exist",
[41] = "Conversion not supported",
[42] = "Unable to convert string",
[43] = "Overflow",
[44] = "Attribute signature mismatch",
[45] = "Resolving local portion of reference",
[46] = "Resolving global portion of reference",
[47] = "Nmx version mismatch",
[48] = "Nmx command not valid",
[49] = "Lmx version mismatch",
[50] = "Lmx command not valid",
[51] = "However, the object could not be put On Scan - Permission to modify \"Operate\" attributes is required",
[52] = "Unable to resolve reference for 'set' request because Galaxy Repository is busy performing a 'Deploy/Undeploy' operation",
[53] = "Too many outstanding pending requests to engine",
[54] = "Object Initializing",
[55] = "Engine Initializing",
[56] = "Secured Write",
[57] = "Verified Write",
[58] = "No Alarm Ack Privilege",
[59] = "Alarm Acked Already",
[60] = "User did not have the necessary permissions to write",
[61] = "Verifier did not have the necessary permissions to verify",
[541] = "Conversion to intended data type is not supported",
[542] = "Unable to convert the input string to intended data type",
[8017] = "Object must be offscan to modify attributes that have an MxSecurityConfigure security classification",
};
public static string? GetKnownText(short detail)
{
return KnownDetails.TryGetValue(detail, out string? text) ? text : null;
}
}