FOCAS Tier-C PR B � Driver.FOCAS.Host net48 x86 skeleton #170

Merged
dohertj2 merged 1 commits from focas-tier-c-pr-b-host into v2 2026-04-20 14:02:58 -04:00
Owner

Second of 5 PRs splitting #220.

What lands

  • Driver.FOCAS.Host (net48 x86 console app) � entry point + pipe server + ACL + stub handler
  • References Driver.FOCAS.Shared from PR A
  • Reads pipe/SID/secret from env vars like Galaxy.Host
  • StubFrameHandler handles Heartbeat fully (keeps supervisor happy in PR D) + returns ErrorResponse{not-implemented} for data-plane
  • 3 new integration tests (handshake success, wrong-secret rejection, stub data-plane returns not-implemented)

Why x86 net48

Fwlib32.dll is 32-bit only. Same bitness constraint as Galaxy.Host.

Not yet wired

  • Real Fwlib32 calls � PR C moves FwlibFocasClient + STA thread from driver into Host
  • Supervisor/respawn lives in PR D; MMF + NSSM scripts in PR E

Test baseline

165/165 existing FOCAS unit tests + 24/24 Shared tests + 3/3 new Host tests, no regressions.

Second of 5 PRs splitting #220. ## What lands - `Driver.FOCAS.Host` (net48 x86 console app) � entry point + pipe server + ACL + stub handler - References `Driver.FOCAS.Shared` from PR A - Reads pipe/SID/secret from env vars like Galaxy.Host - `StubFrameHandler` handles Heartbeat fully (keeps supervisor happy in PR D) + returns `ErrorResponse{not-implemented}` for data-plane - 3 new integration tests (handshake success, wrong-secret rejection, stub data-plane returns not-implemented) ## Why x86 net48 Fwlib32.dll is 32-bit only. Same bitness constraint as Galaxy.Host. ## Not yet wired - Real Fwlib32 calls � PR C moves `FwlibFocasClient` + STA thread from driver into Host - Supervisor/respawn lives in PR D; MMF + NSSM scripts in PR E ## Test baseline 165/165 existing FOCAS unit tests + 24/24 Shared tests + 3/3 new Host tests, no regressions.
dohertj2 added 1 commit 2026-04-20 14:02:49 -04:00
FOCAS Tier-C PR B — Driver.FOCAS.Host net48 x86 skeleton + pipe server. Second PR of the 5-PR #220 split. Stands up the Windows Service entry point + named-pipe scaffolding so PR C has a place to move the Fwlib32 calls into. New net48 x86 project (Fwlib32.dll is 32-bit-only, same bitness constraint as Galaxy.Host/MXAccess); references Driver.FOCAS.Shared for framing + DTOs so the wire format Proxy<->Host stays a single type system. Ships four files: PipeAcl creates a PipeSecurity where only the configured server principal SID gets ReadWrite+Synchronize + LocalSystem/BuiltinAdministrators are explicitly denied (so a compromised service account on the same host can't escalate via the pipe); IFrameHandler abstracts the dispatch surface with HandleAsync + AttachConnection for server-push event sinks; PipeServer accepts one connection at a time, verifies the peer SID via RunAsClient, reads the first Hello frame + matches the shared-secret and protocol major version, sends HelloAck, then hands off to the handler until EOF or cancel; StubFrameHandler fully handles Heartbeat/HeartbeatAck so a future supervisor's liveness detector stays happy, and returns ErrorResponse{Code=not-implemented,Message="Kind X is stubbed - Fwlib32 lift lands in PR C"} for every data-plane request. Program.cs mirrors the Galaxy.Host startup exactly: reads OTOPCUA_FOCAS_PIPE / OTOPCUA_ALLOWED_SID / OTOPCUA_FOCAS_SECRET from the env (supervisor passes these at spawn time), builds Serilog rolling-file logger into %ProgramData%\OtOpcUa\focas-host-*.log, constructs the pipe server with StubFrameHandler, loops on RunAsync until SIGINT. Log messages mark the backend as "stub" so it's visible in logs that Fwlib32 isn't actually connected yet. Driver.FOCAS.Host.Tests (net48 x86) ships three integration tests mirroring IpcHandshakeIntegrationTests from Galaxy.Host: correct-secret handshake + heartbeat round-trip, wrong-secret rejection with UnauthorizedAccessException, and a new test that sends a ReadRequest and asserts the StubFrameHandler returns ErrorResponse{not-implemented} mentioning PR C in the message so the wiring between frame dispatch + kind → error mapping is locked. Tests follow the same is-Administrator skip guard as Galaxy because PipeAcl denies BuiltinAdministrators. No changes to existing driver code; FOCAS unit tests still at 165/165 + Shared tests at 24/24. PR C wires the real Fwlib32 backend. a6f53e5b22
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dohertj2 merged commit 3609a5c676 into v2 2026-04-20 14:02:58 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dohertj2/lmxopcua#170