zerodds-cli-common

Tools — shared helpers. Helper functions shared by the ZeroDDS command-line tools.

zerodds-cli-common collects code that several command-line tools need in the same form:

  • parse_duration: parses 5, 5s, 2m, 1h into a Duration; error type DurationParseError.
  • install_signal_handler(stop): sets an AtomicBool on SIGINT or SIGTERM; no-op outside Unix.
  • stable_prefix(marker): an RTPS GuidPrefix in the ZeroDDS layout: vendor ID in bytes 0–1, host identifier in bytes 2–5, process ID in bytes 6–9, tool marker in byte 10, low byte of the sub-second nanoseconds in byte 11. The host identifier makes the tool a same-host peer of the participants on its host.
  • participant_guid(prefix): 16-byte participant GUID with entity ID 00 00 00 C1 (ENTITYID_PARTICIPANT).
  • unix_ns_now(): current Unix time in nanoseconds as i64.
  • raw_reader_config(topic) and raw_reader_config_typed(topic, type_name): UserReaderConfig for payloads that are not decoded, with the type name zerodds::RawBytes (RAW_BYTES_TYPE_NAME) or the type name of the writer being followed. No TypeIdentifier is announced, so matching uses the type name only.
  • reliable_raw_writer_config(topic, type_name): UserWriterConfig for raw samples, RELIABLE and VOLATILE.
  • TypeFollower: returns the (topic, type_name) pairs among the discovered publications that were not seen before, with an optional topic allow-list, so a tool attaches one reader per newly discovered writer type.

According to the README the crate is published on crates.io so that the dependent tool crates resolve there; it is not intended as a general-purpose library.

Consumers

Status

  • std. No forbid(unsafe_code): on Unix, install_signal_handler calls libc::signal in an unsafe block. Safety classification in the crate docs: COMFORT.
  • Library only, no binary, no cargo features.
  • 13 test functions in src/lib.rs.

zerodds-cli-common

Werkzeuge — gemeinsame Hilfsfunktionen. Hilfsfunktionen, die die ZeroDDS-Kommandozeilenwerkzeuge gemeinsam nutzen.

zerodds-cli-common sammelt Code, den mehrere Kommandozeilenwerkzeuge in gleicher Form brauchen:

  • parse_duration: wandelt 5, 5s, 2m, 1h in eine Duration; Fehlertyp DurationParseError.
  • install_signal_handler(stop): setzt bei SIGINT oder SIGTERM ein AtomicBool; außerhalb von Unix ohne Wirkung.
  • stable_prefix(marker): ein RTPS-GuidPrefix im ZeroDDS-Aufbau: Hersteller-ID in Byte 0–1, Host-Kennung in Byte 2–5, Prozess-ID in Byte 6–9, Werkzeugkennung in Byte 10, niederwertiges Byte der Nanosekunden innerhalb der Sekunde in Byte 11. Durch die Host-Kennung gilt das Werkzeug für die Participants auf seinem Host als Gegenstelle auf demselben Host.
  • participant_guid(prefix): GUID des Participants mit 16 Byte und Entity-ID 00 00 00 C1 (ENTITYID_PARTICIPANT).
  • unix_ns_now(): aktuelle Unix-Zeit in Nanosekunden als i64.
  • raw_reader_config(topic) und raw_reader_config_typed(topic, type_name): UserReaderConfig für Nutzdaten, die nicht dekodiert werden, mit dem Typnamen zerodds::RawBytes (RAW_BYTES_TYPE_NAME) oder dem Typnamen des verfolgten Writers. Ein TypeIdentifier wird nicht angekündigt; das Matching verwendet daher nur den Typnamen.
  • reliable_raw_writer_config(topic, type_name): UserWriterConfig für Rohdaten, RELIABLE und VOLATILE.
  • TypeFollower: liefert unter den entdeckten Publikationen die Paare (topic, type_name), die vorher nicht gesehen wurden, mit optionaler Positivliste für Topics; ein Werkzeug hängt damit einen Reader pro neu entdecktem Writer-Typ an.

Laut README ist die Crate auf crates.io veröffentlicht, damit die abhängigen Werkzeug-Crates dort auflösbar sind; als allgemeine Bibliothek ist sie nicht gedacht.

Konsumenten

Status

  • std. Kein forbid(unsafe_code): Unter Unix ruft install_signal_handler libc::signal in einem unsafe-Block auf. Einstufung in der Crate-Dokumentation (safety classification): COMFORT.
  • Nur Bibliothek, kein Binary, keine Cargo-Features.
  • 13 Testfunktionen in src/lib.rs.