Skip to content

Add MMS association and report subscription runtime - #12

Closed
masarray wants to merge 2 commits into
agent/offline-reporting-foundationfrom
agent/mms-association-subscriptions
Closed

masarray wants to merge 2 commits into
agent/offline-reporting-foundationfrom
agent/mms-association-subscriptions

Conversation

@masarray

@masarray masarray commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Scope

Phase 4B adds an application-injected MMS association lifecycle and IEC 61850 report subscription runtime above the Phase 4A offline reporting layer.

Association lifecycle

  • Add an MmsByteTransport abstraction with connection, send, receive, close, deadline, and cancellation semantics.
  • Establish TPKT/COTP CR/CC, negotiate TPDU size, then establish ISO Session, Presentation, ACSE, and MMS Initiate.
  • Track explicit disconnected, transport, COTP, ACSE, associated, closing, and faulted states with bounded event history.
  • Segment outgoing COTP data and perform bounded TPKT/COTP receive and reassembly.
  • Allocate monotonic invoke IDs and route confirmed responses/errors through the existing invoke router.
  • Preserve interleaved unconfirmed InformationReports while a confirmed request is pending.
  • Distinguish timeout and cancellation; timeout faults the association while cancellation remains caller-controlled.
  • Support explicit reconnect after disconnect or failure and best-effort lifecycle cleanup.

Report subscription runtime

  • Re-probe the target RCB immediately before any write.
  • Reject takeover when an RCB is enabled, reserved, caller-incompatible, or otherwise in use.
  • Reserve URCBs with Resv=true when required.
  • Optionally configure DatSet, TrgOps, and OptFlds before enabling.
  • Enable with RptEna=true and optionally issue GI.
  • Poll or run persistently with std::stop_token, feeding report bytes through the Phase 4A decoder and bounded monitor.
  • Stop by disabling RptEna and releasing only reservations acquired by this runtime.
  • Record cleanup_required when the association disappears before cleanup and support retry after reconnect.

Validation

  • Add a deterministic MMS runtime CTest; repository total becomes 16 CTest entries.
  • Cover association establishment, negotiated limits, cancellation, timeout, explicit reconnect, confirmed-response routing, and report interleaving.
  • Cover RCB probe, reservation, optional configuration, enable, GI, report delivery, stop, takeover protection, and cleanup-required recovery.
  • Local GNU C++ 14.2 warnings-as-errors validation passed: 16/16.
  • Local Clang 17 warnings-as-errors validation passed: 16/16.
  • Local Clang ASan/UBSan validation passed: 16/16.

Safety boundary

The core library does not provide or automatically create a TCP socket backend. Live network and IED access is possible only when an application deliberately supplies an MmsByteTransport implementation. This phase does not implement IEC 61850 control services. BRCB EntryID resume, purge, replay, and overflow recovery remain outside Phase 4B.

Phase 4A: add bounded DataSet/RCB inventory, InformationReport parsing, RCB state interpretation, and offline report continuity monitoring.
@masarray
masarray force-pushed the agent/mms-association-subscriptions branch from 9905a74 to c99cb81 Compare August 6, 2026 09:56
@masarray masarray self-assigned this Aug 6, 2026

masarray commented Aug 6, 2026

Copy link
Copy Markdown
Owner Author

Superseded after Phase 4A was squash-merged to main. The Phase 4B branch was rebuilt as a single clean commit directly on top of the new main; a replacement PR targets main so the final history does not retain the old stacked base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant