Cross-vendor dynamic XTypes

Decoding a foreign vendor's topic with no compile-time type: a runtime DynamicType built from out-of-band IDL, walked by the reflective XCDR codec.

What it shows

  • zerodds-spy learns each writer's type_name from discovery, builds a DynamicType from --type-file and prints decoded samples as JSON.
  • Four publishers decoded live: eProsima Fast DDS 3.x (XCDR1 and XCDR2), CycloneDDS (XCDR2), RTI Connext 7.7 (XCDR1), OpenDDS 3.34 (XCDR2).
  • Two IDL variants ship because the vendor compilers disagree: dyn.idl with a @mutable union (only fastddsgen accepts it) and dyn_app.idl with an @appendable union for Cyclone, OpenDDS and RTI.
  • The example's README catalogues four reflective-codec bugs it surfaced — a skipped union in the IDL→DynamicType loader, branch matching by member id instead of position, a missing PL_CDR2 DHEADER, and an XCDR2-only codec that mis-read XCDR1 wire.

Run it

# vendor side (example: CycloneDDS)
cc -I<cyclone>/include cyclone/pub.c dyn.c -L<cyclone>/lib -lddsc -o cyc_pub && ./cyc_pub 0

# ZeroDDS side — reflective decode, no compiled type
zerodds-spy -t TrackTopic --type-file dyn_app.idl --decode

Output

$ zerodds-spy -t TrackTopic --type-file dyn.idl --decode
zerodds-spy: attached topic=TrackTopic type=dyn::Track
[1] writer=… type=dyn::Track {"color":2,"command":{"speed":7006},"id":106,"name":"track-6","path":[6,12,18]}

Taken verbatim from the example's own README.

See also

Cross-Vendor — dynamische XTypes

Das Topic eines fremden Vendors ohne Compile-Zeit-Typ decodieren: ein zur Laufzeit aus Out-of-Band-IDL gebauter DynamicType, den der reflektive XCDR-Codec abläuft.

Was es zeigt

  • zerodds-spy lernt den type_name jedes Writers aus dem Discovery, baut aus --type-file einen DynamicType und gibt decodierte Samples als JSON aus.
  • Vier Publisher live decodiert: eProsima Fast DDS 3.x (XCDR1 und XCDR2), CycloneDDS (XCDR2), RTI Connext 7.7 (XCDR1), OpenDDS 3.34 (XCDR2).
  • Zwei IDL-Varianten, weil die Vendor-Compiler sich uneinig sind: dyn.idl mit @mutable-Union (nur fastddsgen nimmt sie) und dyn_app.idl mit @appendable-Union für Cyclone, OpenDDS und RTI.
  • Das README des Beispiels führt vier Fehler im reflektiven Codec auf, die dabei sichtbar wurden — eine im IDL→DynamicType-Loader übersprungene union, Branch-Auswahl über Member-Id statt Position, ein fehlender PL_CDR2-DHEADER und ein reiner XCDR2-Codec, der XCDR1-Wire falsch las.

Ausführen

# Vendor-Seite (Beispiel: CycloneDDS)
cc -I<cyclone>/include cyclone/pub.c dyn.c -L<cyclone>/lib -lddsc -o cyc_pub && ./cyc_pub 0

# ZeroDDS-Seite — reflektiver Decode, kein kompilierter Typ
zerodds-spy -t TrackTopic --type-file dyn_app.idl --decode

Ausgabe

$ zerodds-spy -t TrackTopic --type-file dyn.idl --decode
zerodds-spy: attached topic=TrackTopic type=dyn::Track
[1] writer=… type=dyn::Track {"color":2,"command":{"speed":7006},"id":106,"name":"track-6","path":[6,12,18]}

Wörtlich aus dem README des Beispiels übernommen.

Verwandt