nros rmw-cffi
C vtable for plugging a third-party RMW backend into nros
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
rmw_transport.h File Reference

Runtime-pluggable custom transport vtable (Phase 115.A). More...

#include <stddef.h>
#include <stdint.h>
#include "nros/rmw_ret.h"
Include dependency graph for rmw_transport.h:

Go to the source code of this file.

Data Structures

struct  nros_transport_ops_t
 

Macros

#define NROS_TRANSPORT_OPS_ABI_VERSION_V1   ((uint32_t)1)
 

Functions

rmw_ret_t nros_rmw_cffi_set_custom_transport (const nros_transport_ops_t *ops)
 

Detailed Description

Runtime-pluggable custom transport vtable (Phase 115.A).

Lets a consumer plug a custom byte-pipe (USB-CDC, BLE, RS-485, semihosting bridge, ring-buffer loopback, etc.) at runtime — no board-crate, Cargo-feature, or rebuild required. The active RMW backend (zenoh-pico, XRCE, dust-DDS, …) consumes this vtable as the read/write surface for every wire frame.

Mirrors micro-ROS's rmw_uros_set_custom_transport(framing, params, open, close, write, read) and is the C-side view of the Rust-side nros_rmw::NrosTransportOps (single #[repr(C)] layout; no parallel definitions to drift).

Threading contract (v1)

Versioning

See also

Macro Definition Documentation

◆ NROS_TRANSPORT_OPS_ABI_VERSION_V1

#define NROS_TRANSPORT_OPS_ABI_VERSION_V1   ((uint32_t)1)

Current ABI version of nros_transport_ops_t. Consumers MUST fill this in before passing the struct to nros_set_custom_transport.

Function Documentation

◆ nros_rmw_cffi_set_custom_transport()

rmw_ret_t nros_rmw_cffi_set_custom_transport ( const nros_transport_ops_t ops)

Install a custom transport for subsequent session opens.

The struct's contents are copied internally; the caller may stack-allocate. To clear the slot, pass NULL.

The fn pointer is exported from the nano-ros C staticlib (packages/api/nros-c/), where it forwards to the nros-rmw-cffi registry. C++ consumers should include <nros/transport.hpp> (from nros-cpp) which calls this function under the hood.

Return values
NROS_RMW_RET_OKon success (transport installed or cleared).
NROS_RMW_RET_INCOMPATIBLE_ABIwhen ops is non-NULL but ops->abi_version does not match NROS_TRANSPORT_OPS_ABI_VERSION_V1. The previously installed transport (if any) is left untouched.