|
nros rmw-cffi
C vtable for plugging a third-party RMW backend into nros
|
#include <rmw_entity.h>
Data Fields | |
| const char * | key |
| const char * | value |
Publisher creation options — the home for publisher-side transport hints (upstream: rmw_publisher_options_t). Passed as a NULLable trailing param to create_publisher; NULL = all defaults. Session creation options — the home for init-time context that create_session's flat argument list cannot grow without another ABI break (issue 0808). Passed as a NULLable trailing param; NULL = all defaults.
The carrier question 0808 opened had two candidates: encode this behind the locator string, or take one options struct. The struct wins on precedent — rmw_publisher_options_t and rmw_subscription_options_t already solved exactly this problem for entities, with the same NULLable-trailing-param shape — and on cost: parsing config out of a locator means every backend reimplements a parser, which is code size on a target plus a new class of silent misparse. One break, then the struct grows.
Of Humble's eight rmw_init_options_t fields this carries the two that were GAPS (issue 0785). domain_id stays a named argument because every backend needs it; security_options remains declined on the target (a DDS-SROS2 keystore path, and there is neither a filesystem nor a security plugin where this ABI runs); allocator, instance_id, impl and implementation_identifier are answered elsewhere or declined ABI-wide. One backend-specific session configuration property.
The counterpart of RmwConfig::properties on the Rust side, which every backend already accepts and which — until phase-206 W3 — NO non-Rust caller could reach: the cffi adapter built properties: &[] and threw the options pointer away, so a C or C++ entry could state no transport configuration at all, on any platform.
Backend-specific by design. For zenoh this is zenoh-pico's run-time option set — zp_config_insert(config, Z_CONFIG_<X>_KEY, value), which upstream calls "the primary configuration method" and which has no file format for the pico client — with the accepted names derived from zenoh-pico's own config.h (zpico_config_keys.h). A backend that does not recognise a name MUST fail the session rather than drop it: a silently ignored configuration line is indistinguishable from one that took effect.
Both strings are NUL-terminated and BORROWED for the duration of the create_session call.
| const char* rmw_session_property_t::key |
Property name; never NULL.
| const char* rmw_session_property_t::value |
Property value; never NULL.