Skip to content

feat: add fallible MRT message trace iterators #304

Description

@digizeph
  • Add opt-in record/element trace iterators for outer-to-inner MRT/BGP4MP/BGP inspection.
  • Preserve wire metadata needed to diagnose malformed messages: BGP marker, declared length, byte offsets, and framing issues.
  • Provide fallible variants that retain decoded outer layers and raw record bytes when semantic parsing fails.
  • Keep existing parsed models and iterator behavior unchanged.

Proposed solution

  • Add into_trace_record_iter() and into_fallible_trace_record_iter().
  • Add element equivalents that attach each BgpElem to its source trace.
  • Return structured layers suitable for text output, JSON serialization, and application traversal.

Expected output

MRT [0+76] timestamp=1710000000 type=BGP4MP subtype=MESSAGE_AS4 length=64
  BGP4MP [12+64] peer=192.0.2.1 AS64496 local=192.0.2.2 AS64497 afi=IPv4
    BGP [36+36] marker=ffffffffffffffffffffffffffffffff length=36 type=UPDATE

For malformed messages, the fallible iterator should still expose decoded outer layers and the parse error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions