- 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.
Proposed solution
into_trace_record_iter()andinto_fallible_trace_record_iter().BgpElemto its source trace.Expected output
For malformed messages, the fallible iterator should still expose decoded outer layers and the parse error.